Cellular balance rules 6 (ADR-0132, schema v41)
Foundation / checks (checks) (push) Successful in 42m33s
Foundation / checks (deploy) (push) Successful in 4m11s
Foundation / checks (ecs) (push) Successful in 2m27s
Foundation / checks (network) (push) Successful in 19m23s
Foundation / checks (postgres) (push) Successful in 44m44s
Foundation / checks (tsan) (push) Successful in 9m53s
Foundation / checks (client) (push) Successful in 16m19s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 3m14s
Foundation / image (push) Successful in 3m16s
Foundation / checks (checks) (push) Successful in 42m33s
Foundation / checks (deploy) (push) Successful in 4m11s
Foundation / checks (ecs) (push) Successful in 2m27s
Foundation / checks (network) (push) Successful in 19m23s
Foundation / checks (postgres) (push) Successful in 44m44s
Foundation / checks (tsan) (push) Successful in 9m53s
Foundation / checks (client) (push) Successful in 16m19s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 3m14s
Foundation / image (push) Successful in 3m16s
The playtest found mutation offers the arena could never pay for. A mutation's matter cost is the real body difference (ADR-0118), so it cannot be discounted. Rules 6 cut it honestly: - genome schema 3 steps a third as far (1/300 of the range); - development version 3 charges a third of the construction energy (13 instead of 40 pJ per 1000 fg). Founder 2 uses both. The cellular-v5 opening creates rules-6 regions on bundle v7, which schema v41 admits. Existing lineages, regions and committed history are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -710,6 +710,99 @@ void cellular_host_admits_mutation_choices() {
|
||||
|
||||
// ADR-0125 (schema v36): a rules-4 region publishes a bud with its tick; the wildlife
|
||||
// descendant, its identity and the parent's debit recover after a restart.
|
||||
// 2026-10-15 balance (schema v41): a rules-6 region publishes a founder of genome schema 3
|
||||
// and development 3 on the v7 bundle, and a restarted host recovers it.
|
||||
void cellular_balance_region_founds_and_recovers() {
|
||||
using namespace evo::biology;
|
||||
constexpr RegionKey key{9771, 1};
|
||||
auto owner = connect_as(env("PGUSER"));
|
||||
auto runtime = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
const auto build = filled<32>(0xDC);
|
||||
CHECK(owner->query("INSERT INTO evolution.retained_builds(build_identity) VALUES "
|
||||
"(decode(repeat('dc',32),'hex')) ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
auto endowed = primitive_endowment(primitive_founder_v2);
|
||||
CHECK(endowed);
|
||||
auto funding = endowed->body;
|
||||
funding.energy.value = endowed->reserve.energy.value + endowed->construction.value;
|
||||
auto primitive = PrimitiveLives::create({key.world, key.region, 1, 17, funding, {{0, 0}}});
|
||||
CHECK(primitive);
|
||||
constexpr std::uint64_t stock = 10'000'000'000;
|
||||
auto habitat = CellularHabitat::create(
|
||||
{key.world,
|
||||
key.region,
|
||||
1,
|
||||
3'000,
|
||||
2'000,
|
||||
{{{0, 0}, 29, {{stock}, {{{stock}, {stock}, {stock}, {stock}}}}}}});
|
||||
CHECK(habitat);
|
||||
auto opening =
|
||||
CellularLives::create(**primitive, std::move(*habitat), {{3'000, 2'000}, 0, 293'150},
|
||||
CellularLivesProfile::balance);
|
||||
CHECK(opening);
|
||||
auto objects = FilesystemObjectStore::open(env("PGHOST"), key, max_cellular_lives_bytes);
|
||||
CHECK(objects);
|
||||
CHECK(provision_cellular_region(*owner, **objects, key, 1, **opening, distinct_commit(0xA7),
|
||||
build, 5s));
|
||||
CHECK(owner->query("INSERT INTO evolution.life_allocators VALUES(9771,1000) "
|
||||
"ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
|
||||
return Postgres::connect({env("PGHOST"),
|
||||
{},
|
||||
env("PGPORT"),
|
||||
env("PGDATABASE"),
|
||||
env("EVO_PG_RUNTIME_USER"),
|
||||
{},
|
||||
{}},
|
||||
5s);
|
||||
};
|
||||
// A fresh value per host: copying the config trips a GCC 14 -O3 array-bounds false positive.
|
||||
const auto config = [&] { return CellularHostConfig{key, 1, {}, build, {build}}; };
|
||||
auto made = CellularRegionHost::create(config(), connect, std::move(*objects));
|
||||
CHECK(made);
|
||||
auto host = std::move(*made);
|
||||
CHECK(host->step().ready && host->state()->rules_version() == cellular_lives_balance_rules);
|
||||
const auto account = filled<16>(0x85);
|
||||
const auto control = claim_account_control(*runtime, key, checked_value(host->authority()),
|
||||
account, 1, 1, 60'000ms, 5s);
|
||||
CHECK(control);
|
||||
CHECK(host->create_primitive_life(account, control->generation, 11).result ==
|
||||
evo::network::PrimitiveLifeResult::pending);
|
||||
const auto& committed = checked_value(host->committed());
|
||||
const auto digest = sha256(committed.manifest);
|
||||
CHECK(digest);
|
||||
CellularBatch birth;
|
||||
birth.header = {key.world,
|
||||
key.region,
|
||||
1,
|
||||
committed.head.commit,
|
||||
checked_value(digest),
|
||||
host->state()->tick(),
|
||||
host->state()->tick() + 1};
|
||||
birth.ticks.push_back({{}, {host->queued_births().front()}, {}});
|
||||
CHECK(host->publish(birth));
|
||||
const auto life = host->state()->lives().front();
|
||||
const auto genome = host->state()->archive().find(life.identity.genome);
|
||||
CHECK(genome && genome->schema_version() == genome_schema_v3 &&
|
||||
genome->development_version() == 3);
|
||||
const auto manifest = decode_manifest(checked_value(host->committed()).manifest);
|
||||
CHECK(manifest && manifest->cellular_versions == cellular_v7_versions);
|
||||
|
||||
// A restarted host recovers the rules-6 state from the v7 checkpoint.
|
||||
host->drain();
|
||||
host.reset();
|
||||
auto reopened = FilesystemObjectStore::open(env("PGHOST"), key, max_cellular_lives_bytes);
|
||||
CHECK(reopened);
|
||||
auto restarted = CellularRegionHost::create(config(), connect, std::move(*reopened));
|
||||
CHECK(restarted);
|
||||
host = std::move(*restarted);
|
||||
CHECK(host->step().ready && host->state()->rules_version() == cellular_lives_balance_rules &&
|
||||
host->state()->lives().size() == 1 &&
|
||||
host->state()->lives().front().identity == life.identity);
|
||||
host->drain();
|
||||
}
|
||||
|
||||
void cellular_bud_publishes_and_recovers() {
|
||||
using namespace evo::biology;
|
||||
constexpr RegionKey key{9767, 1};
|
||||
@@ -966,6 +1059,7 @@ void run_cellular_publication_tests() {
|
||||
cellular_mutation_publication_binds_results();
|
||||
cellular_host_admits_mutation_choices();
|
||||
cellular_bud_publishes_and_recovers();
|
||||
cellular_balance_region_founds_and_recovers();
|
||||
cellular_death_is_final_and_account_restarts();
|
||||
auto owner = connect_as(env("PGUSER"));
|
||||
const auto build = filled<32>(0xD9);
|
||||
|
||||
Reference in New Issue
Block a user