Add cellular checkpoint manifest profile
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m49s
Foundation / checks (postgres) (push) Failing after 51s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 3m42s
Foundation / checks (network) (push) Canceled after 3m4s

This commit is contained in:
dingo
2026-10-10 22:45:29 -04:00
parent 181b9aeec2
commit 3931fcfbe6
7 changed files with 163 additions and 19 deletions
+49
View File
@@ -399,6 +399,54 @@ void primitive_profile() {
CHECK(mismatched_ids && (*mismatched_ids)->spawn(r, {12, 13, 14, 15, {5}}));
CHECK(!restore_primitive_payload((*mismatched_ids)->snapshot(), *n));
}
void cellular_profile() {
using namespace evo::biology;
using namespace evo::server;
auto endowment = primitive_endowment();
CHECK(endowment);
auto funding = endowment->body;
funding.energy.value = endowment->reserve.energy.value + endowment->construction.value;
auto primitive = PrimitiveLives::create({7, 3, 9, 17, funding, {{0, 0}}});
CHECK(primitive);
auto habitat = CellularHabitat::create({7, 3, 9, 1'000, 1'000, {}});
CHECK(habitat);
auto owner = CellularLives::create(**primitive, std::move(*habitat), {{1'000, 1'000}, 0, 293'150});
CHECK(owner && (*owner)->lives().empty() && (*owner)->tick() == 0);
const auto payload = (*owner)->snapshot();
auto manifest = genesis_manifest(key, 9, filled<16>(0x02), 50000, build, payload.size(),
filled<32>(0xA2), CheckpointProfile::cellular_lives_v1);
CHECK(manifest && supported(*manifest) && manifest->history_profile == cellular_history_profile &&
manifest->cellular_versions == cellular_v1_versions &&
max_payload_bytes(CheckpointProfile::cellular_lives_v1) == max_cellular_lives_bytes);
const auto encoded = encode_manifest(*manifest);
CHECK(encoded && decode_manifest(*encoded) == *manifest);
const auto restored = restore_cellular_payload(payload, *manifest);
CHECK(restored && (*restored)->snapshot() == payload);
CHECK(!restore_primitive_payload(payload, *manifest));
const auto successor = successor_manifest(*manifest, filled<32>(0xA5), filled<16>(0x04),
lease(), 1, build, payload.size(),
filled<32>(0xA6), batch_for(1, 1));
CHECK(successor && supported(*successor) &&
successor->cellular_versions == cellular_v1_versions);
const auto clone = clone_manifest(*manifest, filled<32>(0xA3), {8, 3}, filled<16>(0x03),
payload.size(), filled<32>(0xA4), {});
CHECK(!clone && clone.error() == CheckpointError::unsupported);
auto bad_versions = *manifest;
++bad_versions.cellular_versions.archive;
CHECK(!supported(bad_versions));
CHECK(!restore_cellular_payload(payload, bad_versions));
auto bad_identity = *manifest;
bad_identity.key.region = 4;
const auto wrong_identity = restore_cellular_payload(payload, bad_identity);
CHECK(!wrong_identity && wrong_identity.error() == CheckpointError::payload);
auto wrong_length = *manifest;
++wrong_length.payload_bytes;
const auto length_result = restore_cellular_payload(payload, wrong_length);
CHECK(!length_result && length_result.error() == CheckpointError::payload);
}
} // namespace
int main() {
@@ -410,6 +458,7 @@ int main() {
lineage_profile();
clone_genesis();
primitive_profile();
cellular_profile();
std::puts("region checkpoint contracts passed");
return 0;
} catch (const std::exception& e) {