feat(persistence): admit durable funded maturation upgrades
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (network) (push) Successful in 20m40s
Foundation / checks (client) (push) Successful in 21m57s
Foundation / checks (tsan) (push) Successful in 26m32s
Foundation / checks (postgres) (push) Successful in 1h3m17s
Foundation / checks (checks) (push) Successful in 1h14m29s
Foundation / postgres-tools (push) Successful in 34s
Foundation / server-image (push) Successful in 4m6s
Foundation / image (push) Successful in 4m52s

This commit is contained in:
dingo
2026-10-19 06:23:51 -04:00
parent a5307c768b
commit 463b091056
25 changed files with 799 additions and 74 deletions
+76 -3
View File
@@ -194,10 +194,10 @@ void manifests() {
!restore_cellular_payload(maturation->state().snapshot(), rules8_raw),
"rules 9 bypassed durable raw admission");
auto unsupported_rules = rules8_population;
unsupported_rules.cellular_versions.rules = cellular_lives_maturation_rules;
unsupported_rules.cellular_versions.rules = cellular_lives_maturation_rules + 1;
require(!supported(unsupported_rules) && !encode_manifest(unsupported_rules) &&
population_envelope_version(unsupported_rules.cellular_versions) == 0,
"portable rules 9 silently entered a durable bundle");
"unknown rules silently entered a durable bundle");
auto back = checked(population_profile_transition_manifest(
next, filled<32>(11), filled<16>(12), lease, source.build,
state->snapshot().size(), filled<32>(13)),
@@ -271,6 +271,78 @@ void manifests() {
checked(decode_manifest(checked(encode_manifest(upgraded), "upgrade encode")),
"upgrade decode") == upgraded,
"boundary upgrade changed profile, clock, history or identity");
auto matured_payload =
checked(cellular_maturation_upgrade_payload(upgraded_payload, upgraded),
"maturation payload upgrade");
auto matured = checked(cellular_maturation_upgrade_manifest(
upgraded, filled<32>(19), filled<16>(20), lease, upgraded.build,
matured_payload.size(), filled<32>(21)),
"maturation manifest upgrade");
auto expected_matured = upgraded;
expected_matured.cellular_versions = cellular_v11_versions;
expected_matured.commit = filled<16>(20);
++expected_matured.sequence;
expected_matured.predecessor_commit = upgraded.commit;
expected_matured.predecessor_digest = filled<32>(19);
expected_matured.payload_bytes = matured_payload.size();
expected_matured.payload_sha256 = filled<32>(21);
require(matured == expected_matured && supported(matured) &&
checked(decode_manifest(checked(encode_manifest(matured), "maturation encode")),
"maturation decode") == matured,
"maturation upgrade changed profile, identity, stock metadata or time");
require(!cellular_maturation_upgrade_payload(payload, base) &&
!cellular_maturation_upgrade_payload(matured_payload, matured) &&
!cellular_boundary_upgrade_payload(matured_payload, matured),
"maturation skipped prerequisite, repeated or downgraded");
if (index == 0) {
auto old = checked(restore_cellular_payload(upgraded_payload, upgraded),
"maturation raw source");
auto target = checked(restore_cellular_payload(matured_payload, matured),
"maturation raw target");
require(target->snapshot() ==
checked(old->maturation_upgrade_candidate(), "raw maturation oracle")
->snapshot() &&
target->current_total() == old->current_total(),
"raw maturation changed stocks");
} else {
auto old = checked(restore_population_payload(upgraded_payload, upgraded),
"maturation cohort source");
auto target = checked(restore_population_payload(matured_payload, matured),
"maturation cohort target");
require(target->snapshot() ==
checked(old->maturation_upgrade_candidate(), "cohort maturation oracle")
->snapshot() &&
target->conversion_sequence() == old->conversion_sequence() &&
std::ranges::equal(target->members(), old->members()),
"maturation lost cohort history");
auto biology =
checked(unattended_population_inputs(target->state(), header(*target, 64)),
"matured intentions");
auto advanced =
checked(prepare_population_batch(*target, std::move(biology)), "matured interval");
const auto matured_trace =
checked(encode_population_batch(advanced.batch), "matured trace");
auto matured_next =
checked(population_successor_manifest(
matured, filled<32>(22), filled<16>(23), lease, matured.end_tick + 64,
matured.build, advanced.state->snapshot().size(), filled<32>(24),
{matured_trace.size(), filled<32>(25), 0, {}}),
"matured successor");
require(matured_next.cellular_versions == cellular_v11_versions &&
restore_population_payload(advanced.state->snapshot(), matured_next)
.has_value(),
"matured population cannot continue");
}
auto switched = checked(population_profile_transition_manifest(
matured, filled<32>(22), filled<16>(23), lease, matured.build,
matured.payload_bytes, matured.payload_sha256),
"matured profile switch");
require(switched.cellular_versions == cellular_v11_versions &&
switched.profile != matured.profile,
"representation switch changed maturation rules");
auto genesis_matured = matured;
genesis_matured.sequence = 0;
require(!encode_manifest(genesis_matured), "maturation bypassed retained opening history");
if (index == 0) {
auto restored = checked(restore_cellular_payload(upgraded_payload, upgraded),
"upgraded raw restore");
@@ -392,7 +464,8 @@ void manifests() {
}
require(population_envelope_version(cellular_v8_versions) == 0 &&
population_envelope_version(cellular_v9_versions) == 1 &&
population_envelope_version(cellular_v10_versions) == 2,
population_envelope_version(cellular_v10_versions) == 2 &&
population_envelope_version(cellular_v11_versions) == 2,
"population bundle to envelope mapping differs");
}
} // namespace