Show what a mutation costs and why an engulf failed
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m7s
Foundation / checks (tsan) (push) Successful in 9m49s
Foundation / checks (client) (push) Successful in 17m12s
Foundation / checks (network) (push) Successful in 19m34s
Foundation / checks (checks) (push) Successful in 43m5s
Foundation / checks (postgres) (push) Successful in 44m57s
Foundation / server-image (push) Successful in 31s
Foundation / postgres-tools (push) Successful in 1m13s
Foundation / image (push) Successful in 3m24s
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m7s
Foundation / checks (tsan) (push) Successful in 9m49s
Foundation / checks (client) (push) Successful in 17m12s
Foundation / checks (network) (push) Successful in 19m34s
Foundation / checks (checks) (push) Successful in 43m5s
Foundation / checks (postgres) (push) Successful in 44m57s
Foundation / server-image (push) Successful in 31s
Foundation / postgres-tools (push) Successful in 1m13s
Foundation / image (push) Successful in 3m24s
After the first M11.9 playtest (ADR-0129 amendment): each offered candidate now carries its funded cost to the cell, construction energy and matter per channel, so the client can grey out what the reserve cannot pay; a candidate is affordable by that cost exactly when the owner would fund it. A failed engulf now reports no contact, prey too large, or membrane too thick. The v10 candidate record grows to 64 bytes, so v10 clients must be rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,9 @@ constexpr std::size_t cellular_action_bytes = (std::size_t{4} * 8) + 4 + 1 + 3 +
|
||||
constexpr std::size_t cellular_mutation_action_bytes = (std::size_t{7} * 8) + 2 + 6;
|
||||
constexpr std::size_t cellular_offer_prefix_bytes = (std::size_t{4} * 8) + 2 + 6;
|
||||
constexpr std::size_t cellular_life_ended_bytes = (std::size_t{2} * 8) + 1 + 7;
|
||||
constexpr std::size_t cellular_offered_candidate_bytes = 2 + 1 + 1 + 4 + 8 + 8;
|
||||
// A candidate: operator, capability, effect, parameter, maintenance, mass, then its cost to
|
||||
// this cell (energy and four matter channels, ADR-0129).
|
||||
constexpr std::size_t cellular_offered_candidate_bytes = 2 + 1 + 1 + 4 + 8 + 8 + 8 + (4 * 8);
|
||||
constexpr std::size_t cellular_perception_prefix_bytes = 8 + 8 + 2;
|
||||
constexpr std::size_t cellular_diagnostics_bytes = 64;
|
||||
constexpr std::size_t cellular_perception_v9_prefix_bytes =
|
||||
@@ -61,7 +63,7 @@ bool valid_diagnostics(const CellularLifeDiagnostics& diagnostics) {
|
||||
const auto intake = static_cast<std::uint8_t>(diagnostics.intake);
|
||||
if (movement > static_cast<std::uint8_t>(CellularMovementResult::insufficient_energy) ||
|
||||
intake > static_cast<std::uint8_t>(CellularIntakeResult::out_of_contact) ||
|
||||
diagnostics.engulf > CellularEngulfResult::unsupported ||
|
||||
diagnostics.engulf > CellularEngulfResult::membrane_too_thick ||
|
||||
diagnostics.bud > CellularBudOutcome::no_placement)
|
||||
return false;
|
||||
if (!diagnostics.has_tick_effects)
|
||||
@@ -325,6 +327,9 @@ std::vector<std::uint8_t> encode_session(const SessionMessage& message, std::uin
|
||||
put(out, candidate.parameter, 4);
|
||||
put(out, candidate.maintenance, 8);
|
||||
put(out, candidate.total_mass, 8);
|
||||
put(out, candidate.cost_energy_pj, 8);
|
||||
for (const auto matter : candidate.cost_matter_fg)
|
||||
put(out, matter, 8);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -666,10 +671,17 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
for (std::size_t i = 0; i < count; ++i) {
|
||||
const auto at = cellular_offer_prefix_bytes + i * cellular_offered_candidate_bytes;
|
||||
m.candidates.push_back({static_cast<std::uint16_t>(get(payload, at, 2)),
|
||||
payload[at + 2], payload[at + 3],
|
||||
static_cast<std::uint32_t>(get(payload, at + 4, 4)),
|
||||
get(payload, at + 8, 8), get(payload, at + 16, 8)});
|
||||
CellularOfferedCandidate candidate{static_cast<std::uint16_t>(get(payload, at, 2)),
|
||||
payload[at + 2],
|
||||
payload[at + 3],
|
||||
static_cast<std::uint32_t>(get(payload, at + 4, 4)),
|
||||
get(payload, at + 8, 8),
|
||||
get(payload, at + 16, 8),
|
||||
get(payload, at + 24, 8),
|
||||
{}};
|
||||
for (std::size_t channel = 0; channel < candidate.cost_matter_fg.size(); ++channel)
|
||||
candidate.cost_matter_fg[channel] = get(payload, at + 32 + channel * 8, 8);
|
||||
m.candidates.push_back(candidate);
|
||||
}
|
||||
if (!valid_offer(m))
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
@@ -708,7 +720,7 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
|
||||
std::ranges::any_of(payload.subspan(wire_version == session_protocol_v10 ? 79 : 77,
|
||||
wire_version == session_protocol_v10 ? 3 : 5),
|
||||
[](std::uint8_t value) { return value != 0; }) ||
|
||||
payload[77] > static_cast<std::uint8_t>(CellularEngulfResult::unsupported) ||
|
||||
payload[77] > static_cast<std::uint8_t>(CellularEngulfResult::membrane_too_thick) ||
|
||||
payload[78] > static_cast<std::uint8_t>(CellularBudOutcome::no_placement))
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
if (wire_version == session_protocol_v10) {
|
||||
|
||||
Reference in New Issue
Block a user