Represent cellular profile migration manifests
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (checks) (push) Failing after 11m27s
Foundation / checks (network) (push) Failing after 9m31s
Foundation / checks (client) (push) Successful in 13m14s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 1m57s
Foundation / checks (tsan) (push) Canceled after 1m49s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (checks) (push) Failing after 11m27s
Foundation / checks (network) (push) Failing after 9m31s
Foundation / checks (client) (push) Successful in 13m14s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 1m57s
Foundation / checks (tsan) (push) Canceled after 1m49s
This commit is contained in:
@@ -61,6 +61,9 @@ bool structural(const CheckpointManifest& m) noexcept {
|
||||
const auto& b = m.batch;
|
||||
const bool primitive = m.profile == CheckpointProfile::primitive_lives_v1;
|
||||
const bool cellular = m.profile == CheckpointProfile::cellular_lives_v1;
|
||||
const bool cellular_migration =
|
||||
cellular && m.sequence > 0 && m.cellular_versions == cellular_v2_versions &&
|
||||
m.begin_tick == m.end_tick && m.end_tick > 0 && b == BatchDigests{};
|
||||
if ((!cellular && m.cellular_versions != cellular_v1_versions) ||
|
||||
(cellular && m.cellular_versions != cellular_v1_versions &&
|
||||
m.cellular_versions != cellular_v2_versions) ||
|
||||
@@ -91,10 +94,12 @@ bool structural(const CheckpointManifest& m) noexcept {
|
||||
}
|
||||
const bool link = !zero(m.predecessor_commit) && m.predecessor_commit != m.commit &&
|
||||
!zero(m.predecessor_digest) && !zero(m.holder) && m.epoch != 0 &&
|
||||
m.end_tick > m.begin_tick &&
|
||||
(m.end_tick > m.begin_tick || cellular_migration) &&
|
||||
m.end_tick - m.begin_tick <= max_checkpoint_ticks;
|
||||
if (m.manifest_version == 1)
|
||||
return link && no_batch;
|
||||
if (cellular_migration)
|
||||
return link;
|
||||
const auto ticks = m.end_tick - m.begin_tick;
|
||||
const auto cellular_legacy_min =
|
||||
server::cellular_batch_header_bytes + ticks * sizeof(std::uint32_t);
|
||||
@@ -342,6 +347,37 @@ successor_manifest(const CheckpointManifest& p, const Sha256Digest& predecessor_
|
||||
return m;
|
||||
}
|
||||
|
||||
std::expected<CheckpointManifest, CheckpointError> cellular_profile_migration_manifest(
|
||||
const CheckpointManifest& p, const Sha256Digest& predecessor_digest, Uuid commit,
|
||||
const LeaseGrant& lease, const Sha256Digest& build, std::uint64_t payload_bytes,
|
||||
const Sha256Digest& payload_sha256) {
|
||||
if (!supported(p))
|
||||
return std::unexpected{CheckpointError::unsupported};
|
||||
if (!structural(p) || p.profile != CheckpointProfile::cellular_lives_v1 ||
|
||||
p.cellular_versions != cellular_v1_versions || p.sequence == 0 || p.sequence == maximum ||
|
||||
p.end_tick == 0 || lease.frame != p.frame || lease.holder == Uuid{} || lease.epoch == 0 ||
|
||||
predecessor_digest == Sha256Digest{} || commit == Uuid{} || commit == p.commit ||
|
||||
build == Sha256Digest{} || payload_bytes == 0 || payload_sha256 == Sha256Digest{})
|
||||
return std::unexpected{CheckpointError::chain};
|
||||
CheckpointManifest m = p;
|
||||
m.commit = commit;
|
||||
m.sequence = p.sequence + 1;
|
||||
m.predecessor_commit = p.commit;
|
||||
m.predecessor_digest = predecessor_digest;
|
||||
m.begin_tick = p.end_tick;
|
||||
m.end_tick = p.end_tick;
|
||||
m.holder = lease.holder;
|
||||
m.epoch = lease.epoch;
|
||||
m.build = build;
|
||||
m.payload_bytes = payload_bytes;
|
||||
m.payload_sha256 = payload_sha256;
|
||||
m.cellular_versions = cellular_v2_versions;
|
||||
m.batch = {};
|
||||
if (!structural(m))
|
||||
return std::unexpected{CheckpointError::format};
|
||||
return m;
|
||||
}
|
||||
|
||||
std::expected<std::unique_ptr<processes::EnvironmentalCommunity>, CheckpointError>
|
||||
restore_environmental_payload(std::span<const std::uint8_t> payload, const CheckpointManifest& m,
|
||||
std::size_t budget) {
|
||||
|
||||
@@ -880,9 +880,18 @@ CellularLives::restore(std::span<const std::uint8_t> bytes, std::uint64_t world,
|
||||
const auto genome = archive->find(life.identity.genome);
|
||||
if (!genome)
|
||||
return std::unexpected{CellularLivesError::archive};
|
||||
const auto generated =
|
||||
biology::mutation_candidates(*genome, life.mutation.offer->context);
|
||||
if (!generated || *generated != *life.mutation.offer)
|
||||
const auto& offer = *life.mutation.offer;
|
||||
if (life.mutation.event_index == 0 || life.mutation.offer_tick == 0 ||
|
||||
life.mutation.offer_tick > saved_tick || offer.parent != life.identity.genome ||
|
||||
offer.context.seed != mutation_seed(saved_world, saved_region, life.identity.life,
|
||||
life.mutation.event_index) ||
|
||||
offer.context.stream != cellular_mutation_stream ||
|
||||
offer.context.event_index != life.mutation.event_index ||
|
||||
offer.context.environment.temperature_millikelvin !=
|
||||
config.ambient_temperature_millikelvin)
|
||||
return std::unexpected{CellularLivesError::noncanonical};
|
||||
const auto generated = biology::mutation_candidates(*genome, offer.context);
|
||||
if (!generated || *generated != offer)
|
||||
return std::unexpected{CellularLivesError::noncanonical};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user