Add funded cellular mutation proposal
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 43s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (tsan) (push) Canceled after 0s
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 53s
Foundation / checks (client) (push) Canceled after 2m59s
Foundation / checks (network) (push) Canceled after 2m19s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 43s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (tsan) (push) Canceled after 0s
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 53s
Foundation / checks (client) (push) Canceled after 2m59s
Foundation / checks (network) (push) Canceled after 2m19s
This commit is contained in:
@@ -45,13 +45,27 @@ struct MutationOffer {
|
||||
std::vector<MutationCandidate> candidates;
|
||||
auto operator<=>(const MutationOffer&) const = default;
|
||||
};
|
||||
// A fully funded genome change, detached from the organism until its owner
|
||||
// commits it. Body matter is recomputed from the successor; reserve includes
|
||||
// channel-specific material releases and pays all deficits plus construction
|
||||
// energy. A refusal never spends anything.
|
||||
struct MutationTransition {
|
||||
Genome successor;
|
||||
accounting::Inventory body;
|
||||
accounting::Inventory reserve;
|
||||
accounting::Inventory intake;
|
||||
accounting::Inventory release;
|
||||
auto operator<=>(const MutationTransition&) const = default;
|
||||
};
|
||||
enum class MutationError : std::uint8_t {
|
||||
invalid_context,
|
||||
no_candidates,
|
||||
unknown_candidate,
|
||||
context_changed,
|
||||
altered_offer,
|
||||
invalid_successor
|
||||
invalid_successor,
|
||||
insufficient_funding,
|
||||
development
|
||||
};
|
||||
inline constexpr std::size_t max_candidates = 8;
|
||||
|
||||
@@ -66,4 +80,12 @@ mutation_candidates(const Genome& genome, const MutationContext& context);
|
||||
[[nodiscard]] std::expected<Genome, MutationError>
|
||||
select_mutation(const Genome& genome, const MutationContext& context, const MutationOffer& offered,
|
||||
std::uint16_t chosen, std::uint64_t successor_id, std::uint64_t origin_event);
|
||||
// Revalidates the offer, derives both bodies at the offer's recorded growth and
|
||||
// environment, and funds the exact channel transition from retained reserve.
|
||||
// Added matter in each channel incurs construction energy at that genome's
|
||||
// versioned construction rate. No state is changed by this proposal.
|
||||
[[nodiscard]] std::expected<MutationTransition, MutationError>
|
||||
fund_mutation(const Genome& genome, const MutationContext& context, const MutationOffer& offered,
|
||||
std::uint16_t chosen, std::uint64_t successor_id, std::uint64_t origin_event,
|
||||
const accounting::Inventory& reserve);
|
||||
} // namespace evo::biology
|
||||
|
||||
Reference in New Issue
Block a user