Declare portable primitive checkpoint profile (M11.2c-2b)
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Successful in 12m24s
Foundation / checks (network) (push) Successful in 13m51s
Foundation / checks (tsan) (push) Successful in 8m7s
Foundation / checks (checks) (push) Successful in 33m53s
Foundation / checks (postgres) (push) Successful in 46m23s
Foundation / server-image (push) Successful in 24s
Foundation / postgres-tools (push) Successful in 1m36s
Foundation / image (push) Successful in 2m45s

This commit is contained in:
dingo
2026-10-10 05:00:15 -04:00
parent 41237bd289
commit 7b6f722b1b
9 changed files with 215 additions and 22 deletions
+64
View File
@@ -336,6 +336,69 @@ void clone_genesis() {
half.predecessor_commit = {};
CHECK(encode_manifest(half).error() == CheckpointError::format);
}
void primitive_profile() {
using namespace evo::server;
const auto endowment = evo::biology::primitive_endowment();
CHECK(endowment);
auto funding = endowment->body;
funding.energy.value = endowment->reserve.energy.value + endowment->construction.value;
auto state = PrimitiveLives::create({7, 3, 9, 1, funding, {{0, 0}}});
CHECK(state);
const auto opening = (*state)->snapshot();
auto g = genesis_manifest(key, 9, filled<16>(1), 50000, build, opening.size(), filled<32>(2),
CheckpointProfile::primitive_lives_v1);
CHECK(g && supported(*g) && g->history_profile == primitive_history_profile &&
g->versions == primitive_v1_versions);
CHECK(restore_primitive_payload(opening, *g));
CHECK(decode_manifest(*encode_manifest(*g)) == *g);
CHECK(!restore_environmental_payload(opening, *g, 8000000));
CHECK(!restore_lineage_payload(opening, *g, 8000000));
CHECK(!clone_manifest(*g, filled<32>(1), {8, 3}, filled<16>(3), opening.size(), filled<32>(2),
{}));
LifeRequest r{filled<16>(4), 1};
CHECK((*state)->spawn(r, {12, 12, 12, 12, {5}}));
const auto born = (*state)->snapshot();
auto n = successor_manifest(
*g, filled<32>(3), filled<16>(2), lease(), 5, build, born.size(), filled<32>(4),
{primitive_batch_header_bytes + primitive_birth_bytes, filled<32>(5), 0, {}});
CHECK(n && supported(*n));
CHECK(restore_primitive_payload(born, *n));
const auto invalid = [&](auto mutate, CheckpointError error) {
auto changed = *n;
mutate(changed);
const auto result = restore_primitive_payload(born, changed);
CHECK(!result && result.error() == error);
};
invalid([](auto& m) { m.end_tick = 4; }, CheckpointError::payload);
invalid([](auto& m) { m.key.region = 99; }, CheckpointError::payload);
invalid([](auto& m) { m.frame = 99; }, CheckpointError::payload);
invalid([](auto& m) { --m.payload_bytes; }, CheckpointError::payload);
invalid([](auto& m) { ++m.versions.envelope; }, CheckpointError::unsupported);
invalid([](auto& m) { m.history_profile = 1; }, CheckpointError::unsupported);
invalid([](auto& m) { m.tick_microseconds = 100000; }, CheckpointError::format);
invalid([](auto& m) { ++m.batch.trace_bytes; }, CheckpointError::format);
invalid([](auto& m) { m.batch.trace_bytes = 0; }, CheckpointError::format);
invalid(
[](auto& m) { m.batch.trace_bytes = max_primitive_batch_bytes + primitive_birth_bytes; },
CheckpointError::format);
invalid(
[](auto& m) {
m.batch.decision_count = 1;
m.batch.decisions_sha256 = filled<32>(6);
},
CheckpointError::format);
auto forged_genesis = *g;
forged_genesis.payload_bytes = born.size();
CHECK(!restore_primitive_payload(born, forged_genesis));
// An idle checkpoint preserves biology while the manifest advances its clock.
auto idle =
successor_manifest(*n, filled<32>(6), filled<16>(3), lease(), 10, build, born.size(),
filled<32>(4), {primitive_batch_header_bytes, filled<32>(7), 0, {}});
CHECK(idle && restore_primitive_payload(born, *idle));
auto mismatched_ids = PrimitiveLives::create({7, 3, 9, 1, funding, {{0, 0}}});
CHECK(mismatched_ids && (*mismatched_ids)->spawn(r, {12, 13, 14, 15, {5}}));
CHECK(!restore_primitive_payload((*mismatched_ids)->snapshot(), *n));
}
} // namespace
int main() {
@@ -346,6 +409,7 @@ int main() {
payload_validation_and_restored_trajectory();
lineage_profile();
clone_genesis();
primitive_profile();
std::puts("region checkpoint contracts passed");
return 0;
} catch (const std::exception& e) {