Record cellular births in replay traces
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 39s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (postgres) (push) Failing after 52s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / checks (network) (push) Failing after 3m4s
Foundation / checks (client) (push) Failing after 4m22s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 00:28:49 -04:00
parent 81866a6897
commit b4fe9e7628
13 changed files with 296 additions and 21 deletions
+32
View File
@@ -94,6 +94,38 @@ void reserved_birth_is_funded_and_detached() {
CHECK((*born)->advance_tick(next_tick) && (*born)->tick() == 2 &&
(*born)->lives().size() == 1);
auto trace_base = empty_cellular_owner(founder_price(1), {{0, 0}});
CellularBatch birth_batch;
birth_batch.header = {trace_base->world(), trace_base->region(), trace_base->frame(), {}, {},
trace_base->tick(), trace_base->tick() + 1};
birth_batch.header.predecessor.fill(3);
birth_batch.header.predecessor_digest.fill(4);
CellularTickIntents birth_tick;
birth_tick.births.push_back({request.account, request.action, 1, 801});
birth_batch.ticks.push_back(birth_tick);
const auto birth_bytes = encode_cellular_batch(birth_batch);
CHECK(birth_bytes);
const auto decoded_births = decode_cellular_batch(*birth_bytes);
CHECK(decoded_births && *decoded_births == birth_batch);
const auto replayed_birth = replay_cellular_batch(*trace_base, *decoded_births);
CHECK(replayed_birth && (*replayed_birth)->tick() == 1 &&
(*replayed_birth)->lives().size() == 1 &&
(*replayed_birth)->lives()[0].identity.life == 801 &&
(*replayed_birth)->lives()[0].account == request.account &&
(*replayed_birth)->archive().recorded() == 1 &&
(*replayed_birth)->current_total() == (*replayed_birth)->opening_total());
auto legacy_batch = birth_batch;
legacy_batch.ticks[0].births.clear();
auto legacy_bytes = encode_cellular_batch(legacy_batch);
CHECK(legacy_bytes);
(*legacy_bytes)[8] = static_cast<std::uint8_t>(cellular_batch_legacy_format);
legacy_bytes->erase(legacy_bytes->begin() + 116, legacy_bytes->begin() + 120);
const auto decoded_legacy = decode_cellular_batch(*legacy_bytes);
CHECK(decoded_legacy && decoded_legacy->ticks[0].births.empty());
auto invalid_birth_batch = birth_batch;
invalid_birth_batch.ticks[0].births[0].generation = 0;
CHECK(encode_cellular_batch(invalid_birth_batch).error() == CellularBatchError::format);
auto unfunded = empty_cellular_owner({}, {{0, 0}});
CHECK(unfunded->advance_tick(no_lives));
const auto unfunded_snapshot = unfunded->snapshot();