Show what a bud costs (ADR-0129 amendment)
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 4m4s
Foundation / checks (tsan) (push) Successful in 9m59s
Foundation / checks (client) (push) Successful in 19m19s
Foundation / checks (network) (push) Successful in 19m24s
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 32m13s
Foundation / checks (checks) (push) Canceled after 32m19s
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 4m4s
Foundation / checks (tsan) (push) Successful in 9m59s
Foundation / checks (client) (push) Successful in 19m19s
Foundation / checks (network) (push) Successful in 19m24s
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 32m13s
Foundation / checks (checks) (push) Canceled after 32m19s
The v10 cellular perception carries the bud cost after the diagnostics block: the energy (construction plus the bud's provision) and matter per channel one bud takes from a fully grown cell's reserve. biology::bud_cost reads it from fund_bud itself, so the shown cost is exactly the charge; the server caches it per genome. The client shows it and names the channels the reserve is short on. v10 clients must be rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,6 +316,39 @@ void v10_effects_and_life_end_are_owner_only() {
|
||||
idle.diagnostics->bud = CellularBudOutcome::budded; // Effects need tick effects.
|
||||
CHECK(encode_session(SessionMessage{idle}, session_protocol_v10).empty());
|
||||
|
||||
// ADR-0129 amendment: v10 appends the bud cost (payload 82..121), with or without
|
||||
// tick effects; v9 cannot carry it, and a cleared view carries none.
|
||||
auto costed = perception;
|
||||
costed.diagnostics->bud_cost_energy_pj = 0x0102030405060708;
|
||||
costed.diagnostics->bud_cost_matter_fg = {11, 22, 33, 44};
|
||||
const auto costed_bytes = encode_session(SessionMessage{costed}, session_protocol_v10);
|
||||
CHECK(costed_bytes.size() == bytes.size() && costed_bytes[session_header_bytes + 82] == 0x08 &&
|
||||
costed_bytes[session_header_bytes + 89] == 0x01 &&
|
||||
costed_bytes[session_header_bytes + 90] == 11 &&
|
||||
costed_bytes[session_header_bytes + 114] == 44);
|
||||
CHECK(std::get<CellularPerception>(*decode_session(costed_bytes)) == costed);
|
||||
CHECK(bytes.size() == session_header_bytes + 18 + 64 + 40);
|
||||
auto resting = costed;
|
||||
resting.diagnostics->has_tick_effects = false;
|
||||
resting.diagnostics->maintenance_cost_pj = 0;
|
||||
resting.diagnostics->movement = CellularMovementResult::not_reported;
|
||||
resting.diagnostics->intake = CellularIntakeResult::not_reported;
|
||||
resting.diagnostics->engulf = CellularEngulfResult::not_reported;
|
||||
resting.diagnostics->bud = CellularBudOutcome::not_reported;
|
||||
CHECK(std::get<CellularPerception>(*decode_session(
|
||||
encode_session(SessionMessage{resting}, session_protocol_v10))) == resting);
|
||||
auto v9_costed = resting;
|
||||
v9_costed.diagnostics->engulf = CellularEngulfResult::not_reported;
|
||||
CHECK(encode_session(SessionMessage{v9_costed}, session_protocol_v9).empty());
|
||||
v9_costed.diagnostics->bud_cost_energy_pj = 0;
|
||||
v9_costed.diagnostics->bud_cost_matter_fg = {};
|
||||
CHECK(!encode_session(SessionMessage{v9_costed}, session_protocol_v9).empty());
|
||||
auto cleared = encode_session(SessionMessage{CellularPerception{40, 0, {}, std::nullopt}},
|
||||
session_protocol_v10);
|
||||
CHECK(!cleared.empty() && decode_session(cleared));
|
||||
cleared[session_header_bytes + 90] = 1; // A cleared view with a bud cost.
|
||||
CHECK(!decode_session(cleared));
|
||||
|
||||
const CellularLifeEnded ended{41, 7, CellularDeathReason::engulfed};
|
||||
const auto ended_bytes = encode_session(SessionMessage{ended});
|
||||
std::uint16_t version{};
|
||||
|
||||
Reference in New Issue
Block a user