Schedule v7 cellular actions with exact retries
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 38s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (postgres) (push) Failing after 52s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m3s
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 3m59s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 38s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (postgres) (push) Failing after 52s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m3s
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 3m59s
This commit is contained in:
@@ -201,6 +201,11 @@ scoped change before starting the next segment.
|
||||
The C++ persistence and PostgresActionLedger adapters parse single and batched
|
||||
records, rejecting malformed cellular evidence. CI/PostgreSQL execution is
|
||||
pending; no cellular writer exists yet.
|
||||
- 11.3d-5f: `IntentAdmission` accepts v7 cellular actions, carries their
|
||||
canonical input bytes with the scheduled action and rejects changed bytes on
|
||||
a reused id while the action is pending or final in memory. Debug and
|
||||
Release/NDEBUG focused tests pass. RegionSessions still refuses v7 until
|
||||
publication and restart recovery are complete.
|
||||
|
||||
## Exit boundary
|
||||
|
||||
|
||||
@@ -6183,3 +6183,16 @@ unit, plus `git diff --check`. PostgreSQL is unavailable on this Windows
|
||||
environment, and the POSIX migration integration target cannot compile with
|
||||
MSVC because `poll.h` is missing; per the agreed workflow CI must run the
|
||||
migration and store tests. No publisher writes cellular rows yet.
|
||||
|
||||
## 2026-10-10 — M11.3d-5f cellular action admission scheduling (CI pending)
|
||||
|
||||
Extended `IntentAdmission` with v7 cellular action overloads. Scheduled
|
||||
`CarriedAction` values retain the canonical bytes, exact retries resolve to the
|
||||
same pending/final action, and reusing an id with changed bytes returns
|
||||
`invalid_action`. Cellular commit outcomes use the distinct v7 committed result.
|
||||
RegionSessions remains opt-in-off until the publisher/recovery gate is complete.
|
||||
|
||||
Executed locally: warning-as-error MSVC 19.44 direct Debug and Release/NDEBUG
|
||||
compile/run of `cellular_intent_admission_tests` (authority, scheduling,
|
||||
canonical bytes, pending/final exact retries and changed-input refusal passed),
|
||||
plus `git diff --check`. The full network suite and CI are pending.
|
||||
|
||||
@@ -45,11 +45,14 @@ struct CarriedAction {
|
||||
AccountId account;
|
||||
std::uint64_t action_id{}, tick{};
|
||||
ActionKind kind{};
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input;
|
||||
friend bool operator==(const CarriedAction&, const CarriedAction&) = default;
|
||||
};
|
||||
struct AccountOutcome {
|
||||
AccountId account;
|
||||
ActionOutcome outcome;
|
||||
ActionKind kind{ActionKind::probe};
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input;
|
||||
};
|
||||
struct ScheduledCellularIntention {
|
||||
AccountId account;
|
||||
@@ -123,11 +126,17 @@ class IntentAdmission {
|
||||
scheduled_cellular_intentions(std::uint64_t tick) const;
|
||||
[[nodiscard]] ActionReceipt action(std::uint64_t session, const SessionAction& m,
|
||||
const AdmissionFacts& facts);
|
||||
// v7 path retains canonical biological bytes through scheduling and refuses a reused
|
||||
// account/action id whose input differs, including a final action still in memory.
|
||||
[[nodiscard]] ActionReceipt action(std::uint64_t session, const CellularAction& m,
|
||||
const AdmissionFacts& facts);
|
||||
// The same admission with the durable uniqueness check deferred (M10.9d): nothing when the
|
||||
// action awaits `verify`, which confirms every waiting action with one ledger request and
|
||||
// returns their receipts by session. Without a ledger, `admit` always answers at once.
|
||||
[[nodiscard]] std::optional<ActionReceipt> admit(std::uint64_t session, const SessionAction& m,
|
||||
const AdmissionFacts& facts);
|
||||
[[nodiscard]] std::optional<ActionReceipt> admit(std::uint64_t session, const CellularAction& m,
|
||||
const AdmissionFacts& facts);
|
||||
[[nodiscard]] std::vector<std::pair<std::uint64_t, ActionReceipt>>
|
||||
verify(const AdmissionFacts& facts);
|
||||
// An action of the session's account: final, pending or unknown. With a ledger, an action
|
||||
@@ -188,19 +197,27 @@ class IntentAdmission {
|
||||
struct Found {
|
||||
Record state{Record::unavailable};
|
||||
ActionOutcome outcome;
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input;
|
||||
};
|
||||
[[nodiscard]] Found lookup(const AccountId& account, std::uint64_t action_id) const;
|
||||
// The in-memory checks of an action; `check` is set when only the ledger can still
|
||||
// refuse it.
|
||||
[[nodiscard]] ActionReceipt screen(Session& s, const SessionAction& m,
|
||||
const AdmissionFacts& facts, bool& check);
|
||||
[[nodiscard]] ActionReceipt screen(
|
||||
Session& s, const SessionAction& m, const AdmissionFacts& facts, bool& check,
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input =
|
||||
std::nullopt);
|
||||
// Applies a durable answer to a receipt that passed `screen`.
|
||||
void decide(const AccountId& account, ActionReceipt& r, const Found& found);
|
||||
void decide(const AccountId& account, ActionReceipt& r, const Found& found,
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input =
|
||||
std::nullopt);
|
||||
Session* find(std::uint64_t session);
|
||||
const Session* find(std::uint64_t session) const;
|
||||
void count_window(Session& s, std::uint64_t server_tick) const;
|
||||
[[nodiscard]] std::size_t unresolved_of(const Session& s) const;
|
||||
void remember(const AccountId& account, const ActionOutcome& outcome);
|
||||
void remember(const AccountId& account, const ActionOutcome& outcome,
|
||||
ActionKind kind = ActionKind::probe,
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>>
|
||||
cellular_input = std::nullopt);
|
||||
IntentLimits limits_;
|
||||
std::vector<Session> sessions_;
|
||||
std::vector<Action> actions_;
|
||||
|
||||
@@ -73,7 +73,8 @@ enum class AdmitStatus : std::uint8_t {
|
||||
};
|
||||
// Wire u16 (SessionAction::kind carries the raw value; admission validates it).
|
||||
enum class ActionKind : std::uint8_t {
|
||||
probe = 1 // No effect on biology: proves admission, scheduling and durability (M10.4).
|
||||
probe = 1, // No effect on biology: proves admission, scheduling and durability (M10.4).
|
||||
cellular = 2 // v7 biological input, committed with profile-4 state (ADR-0111/0112).
|
||||
};
|
||||
enum class ActionResult : std::uint8_t {
|
||||
committed_no_effect = 1, // Durable in commit `commit_sequence`; changed nothing.
|
||||
|
||||
@@ -145,7 +145,10 @@ IntentAdmission::scheduled_cellular_intentions(std::uint64_t tick) const {
|
||||
}
|
||||
|
||||
ActionReceipt IntentAdmission::screen(Session& s, const SessionAction& m,
|
||||
const AdmissionFacts& facts, bool& check) {
|
||||
const AdmissionFacts& facts, bool& check,
|
||||
std::optional<std::array<std::uint8_t,
|
||||
cellular_action_input_bytes>>
|
||||
cellular_input) {
|
||||
ActionReceipt r{m.action_id, AdmitStatus::admitted, facts.server_tick, m.tick};
|
||||
check = false;
|
||||
count_window(s, facts.server_tick);
|
||||
@@ -167,13 +170,30 @@ ActionReceipt IntentAdmission::screen(Session& s, const SessionAction& m,
|
||||
r.status = AdmitStatus::not_ready;
|
||||
else if (m.epoch != facts.epoch)
|
||||
r.status = AdmitStatus::stale_epoch;
|
||||
else if (m.kind != static_cast<std::uint16_t>(ActionKind::probe) || m.action_id == 0)
|
||||
else if ((m.kind != static_cast<std::uint16_t>(ActionKind::probe) &&
|
||||
m.kind != static_cast<std::uint16_t>(ActionKind::cellular)) ||
|
||||
(m.kind == static_cast<std::uint16_t>(ActionKind::cellular)) !=
|
||||
cellular_input.has_value() ||
|
||||
m.action_id == 0 ||
|
||||
(cellular_input && !decode_cellular_action_input(*cellular_input)))
|
||||
r.status = AdmitStatus::invalid_action;
|
||||
else if (known_action != actions_.end() || known_final != finals_.end()) {
|
||||
// Never admitted twice; the receipt names the tick it was scheduled for.
|
||||
r.status = AdmitStatus::duplicate;
|
||||
r.tick =
|
||||
known_action != actions_.end() ? known_action->carried.tick : known_final->outcome.tick;
|
||||
const auto same = [&](ActionKind kind,
|
||||
const std::optional<std::array<std::uint8_t,
|
||||
cellular_action_input_bytes>>& bytes) {
|
||||
return static_cast<std::uint16_t>(kind) == m.kind && bytes == cellular_input;
|
||||
};
|
||||
if (known_action != actions_.end()) {
|
||||
r.tick = known_action->carried.tick;
|
||||
r.status = same(known_action->carried.kind, known_action->carried.cellular_input)
|
||||
? AdmitStatus::duplicate
|
||||
: AdmitStatus::invalid_action;
|
||||
} else {
|
||||
r.tick = known_final->outcome.tick;
|
||||
r.status = same(known_final->kind, known_final->cellular_input)
|
||||
? AdmitStatus::duplicate
|
||||
: AdmitStatus::invalid_action;
|
||||
}
|
||||
} else if (!in_window(m.tick, facts.server_tick, limits_.intent_window))
|
||||
r.status = AdmitStatus::outside_window;
|
||||
else if (unresolved_of(s) >= limits_.max_unresolved)
|
||||
@@ -183,14 +203,21 @@ ActionReceipt IntentAdmission::screen(Session& s, const SessionAction& m,
|
||||
return r;
|
||||
}
|
||||
|
||||
void IntentAdmission::decide(const AccountId& account, ActionReceipt& r, const Found& found) {
|
||||
void IntentAdmission::decide(
|
||||
const AccountId& account, ActionReceipt& r, const Found& found,
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input) {
|
||||
// Committed earlier (another epoch, process or region): never admitted again.
|
||||
if (found.state == Record::unavailable) {
|
||||
r.status = AdmitStatus::not_ready; // Uniqueness cannot be confirmed now.
|
||||
} else if (found.state == Record::committed) {
|
||||
if (found.cellular_input != cellular_input) {
|
||||
r.status = AdmitStatus::invalid_action;
|
||||
return;
|
||||
}
|
||||
r.status = AdmitStatus::duplicate;
|
||||
r.tick = found.outcome.tick;
|
||||
remember(account, found.outcome);
|
||||
remember(account, found.outcome,
|
||||
cellular_input ? ActionKind::cellular : ActionKind::probe, cellular_input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,6 +236,25 @@ ActionReceipt IntentAdmission::action(std::uint64_t session, const SessionAction
|
||||
return r;
|
||||
}
|
||||
|
||||
ActionReceipt IntentAdmission::action(std::uint64_t session, const CellularAction& m,
|
||||
const AdmissionFacts& facts) {
|
||||
const SessionAction base{m.session, m.epoch, m.action_id,
|
||||
static_cast<std::uint16_t>(ActionKind::cellular), m.tick};
|
||||
const auto bytes = encode_cellular_action_input(
|
||||
{m.tick, m.move_x, m.move_y, m.has_intake_target, m.intake_x_um, m.intake_y_um});
|
||||
auto* s = find(session);
|
||||
if (!s)
|
||||
return {m.action_id, AdmitStatus::unknown_session, facts.server_tick, m.tick};
|
||||
bool check = false;
|
||||
auto r = screen(*s, base, facts, check, bytes);
|
||||
if (check)
|
||||
decide(s->account, r, lookup(s->account, m.action_id), bytes);
|
||||
if (r.status == AdmitStatus::admitted)
|
||||
actions_.push_back({{s->account, m.action_id, m.tick, ActionKind::cellular, bytes},
|
||||
Stage::scheduled});
|
||||
return r;
|
||||
}
|
||||
|
||||
std::optional<ActionReceipt> IntentAdmission::admit(std::uint64_t session, const SessionAction& m,
|
||||
const AdmissionFacts& facts) {
|
||||
auto* s = find(session);
|
||||
@@ -231,6 +277,31 @@ std::optional<ActionReceipt> IntentAdmission::admit(std::uint64_t session, const
|
||||
return r;
|
||||
}
|
||||
|
||||
std::optional<ActionReceipt> IntentAdmission::admit(std::uint64_t session,
|
||||
const CellularAction& m,
|
||||
const AdmissionFacts& facts) {
|
||||
const SessionAction base{m.session, m.epoch, m.action_id,
|
||||
static_cast<std::uint16_t>(ActionKind::cellular), m.tick};
|
||||
const auto bytes = encode_cellular_action_input(
|
||||
{m.tick, m.move_x, m.move_y, m.has_intake_target, m.intake_x_um, m.intake_y_um});
|
||||
auto* s = find(session);
|
||||
if (!s)
|
||||
return ActionReceipt{m.action_id, AdmitStatus::unknown_session, facts.server_tick, m.tick};
|
||||
bool check = false;
|
||||
const auto r = screen(*s, base, facts, check, bytes);
|
||||
if (r.status != AdmitStatus::admitted)
|
||||
return r;
|
||||
actions_.push_back({{s->account, m.action_id, m.tick, ActionKind::cellular, bytes},
|
||||
check ? Stage::verifying : Stage::scheduled,
|
||||
false,
|
||||
session,
|
||||
facts.epoch,
|
||||
facts.server_tick});
|
||||
if (check)
|
||||
return std::nullopt;
|
||||
return r;
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::uint64_t, ActionReceipt>>
|
||||
IntentAdmission::verify(const AdmissionFacts& facts) {
|
||||
std::vector<std::pair<std::uint64_t, ActionReceipt>> out;
|
||||
@@ -242,10 +313,10 @@ IntentAdmission::verify(const AdmissionFacts& facts) {
|
||||
return out;
|
||||
// Authority lost or moved on since admission: refused as admission would refuse it now.
|
||||
const bool current = facts.ready;
|
||||
std::expected<std::vector<std::optional<ActionOutcome>>, ActionLedgerError> answers =
|
||||
std::expected<std::vector<std::optional<DurableActionRecord>>, ActionLedgerError> answers =
|
||||
std::unexpected(ActionLedgerError::unavailable);
|
||||
if (current && ledger_ != nullptr)
|
||||
answers = ledger_->find_all(keys);
|
||||
answers = ledger_->find_all_records(keys);
|
||||
if (answers.has_value() && answers->size() != keys.size())
|
||||
answers = std::unexpected(ActionLedgerError::unavailable);
|
||||
std::size_t i = 0;
|
||||
@@ -263,10 +334,12 @@ IntentAdmission::verify(const AdmissionFacts& facts) {
|
||||
if (answers.has_value()) {
|
||||
const auto& record = (*answers)[index];
|
||||
found.state = record.has_value() ? Record::committed : Record::absent;
|
||||
if (record.has_value())
|
||||
found.outcome = *record;
|
||||
if (record.has_value()) {
|
||||
found.outcome = record->outcome;
|
||||
found.cellular_input = record->cellular_input;
|
||||
}
|
||||
}
|
||||
decide(a.carried.account, r, found);
|
||||
decide(a.carried.account, r, found, a.carried.cellular_input);
|
||||
}
|
||||
if (r.status == AdmitStatus::admitted)
|
||||
a.stage = Stage::scheduled;
|
||||
@@ -295,11 +368,13 @@ ActionOutcome IntentAdmission::query(std::uint64_t session, const ActionQuery& m
|
||||
if (pending->unknown && ledger_ && facts.ready)
|
||||
if (const auto found = lookup(account, m.action_id);
|
||||
found.state != Record::unavailable) {
|
||||
const auto kind = pending->carried.kind;
|
||||
const auto input = pending->carried.cellular_input;
|
||||
o = found.state == Record::committed
|
||||
? found.outcome
|
||||
: ActionOutcome{m.action_id, ActionResult::not_committed, 0, 0};
|
||||
actions_.erase(pending);
|
||||
remember(account, o);
|
||||
remember(account, o, kind, input);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
@@ -311,7 +386,9 @@ ActionOutcome IntentAdmission::query(std::uint64_t session, const ActionQuery& m
|
||||
// No longer in memory: a committed action is still on record.
|
||||
if (ledger_ && facts.ready)
|
||||
if (const auto found = lookup(account, m.action_id); found.state == Record::committed) {
|
||||
remember(account, found.outcome);
|
||||
remember(account, found.outcome,
|
||||
found.cellular_input ? ActionKind::cellular : ActionKind::probe,
|
||||
found.cellular_input);
|
||||
return found.outcome;
|
||||
}
|
||||
return o;
|
||||
@@ -348,8 +425,10 @@ std::vector<CarriedAction> IntentAdmission::carry(std::uint64_t tick) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void IntentAdmission::remember(const AccountId& account, const ActionOutcome& outcome) {
|
||||
finals_.push_back({account, outcome});
|
||||
void IntentAdmission::remember(
|
||||
const AccountId& account, const ActionOutcome& outcome, ActionKind kind,
|
||||
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input) {
|
||||
finals_.push_back({account, outcome, kind, cellular_input});
|
||||
while (finals_.size() > limits_.max_finals)
|
||||
finals_.pop_front();
|
||||
}
|
||||
@@ -360,28 +439,30 @@ std::vector<AccountOutcome> IntentAdmission::committed(std::span<const CarriedAc
|
||||
// The durable record is the authority: an id carried by two batches (an account that
|
||||
// moved regions with the action pending) keeps the record of the first commit. One
|
||||
// request for the whole commit; unanswered, the host's own report stands.
|
||||
std::expected<std::vector<std::optional<ActionOutcome>>, ActionLedgerError> records =
|
||||
std::expected<std::vector<std::optional<DurableActionRecord>>, ActionLedgerError> records =
|
||||
std::unexpected(ActionLedgerError::unavailable);
|
||||
if (ledger_ != nullptr && !actions.empty()) {
|
||||
std::vector<ActionKey> keys;
|
||||
keys.reserve(actions.size());
|
||||
for (const auto& c : actions)
|
||||
keys.push_back({c.account, c.action_id});
|
||||
records = ledger_->find_all(keys);
|
||||
records = ledger_->find_all_records(keys);
|
||||
if (records.has_value() && records->size() != actions.size())
|
||||
records = std::unexpected(ActionLedgerError::unavailable);
|
||||
}
|
||||
for (std::size_t i = 0; i < actions.size(); ++i) {
|
||||
const auto& c = actions[i];
|
||||
ActionOutcome o{c.action_id, ActionResult::committed_no_effect, c.tick, commit_sequence};
|
||||
const auto local_result = c.kind == ActionKind::cellular ? ActionResult::committed
|
||||
: ActionResult::committed_no_effect;
|
||||
ActionOutcome o{c.action_id, local_result, c.tick, commit_sequence};
|
||||
if (records.has_value())
|
||||
if (const auto& record = (*records)[i]; record.has_value())
|
||||
o = *record;
|
||||
o = record->outcome;
|
||||
std::erase_if(actions_, [&](const Action& a) {
|
||||
return a.carried.account == c.account && a.carried.action_id == c.action_id;
|
||||
});
|
||||
out.push_back({c.account, o});
|
||||
remember(c.account, o);
|
||||
out.push_back({c.account, o, c.kind, c.cellular_input});
|
||||
remember(c.account, o, c.kind, c.cellular_input);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -401,8 +482,8 @@ std::vector<AccountOutcome> IntentAdmission::dropped(std::span<const CarriedActi
|
||||
if (it != actions_.end())
|
||||
actions_.erase(it);
|
||||
const ActionOutcome o{c.action_id, ActionResult::not_committed, 0, 0};
|
||||
out.push_back({c.account, o});
|
||||
remember(c.account, o);
|
||||
out.push_back({c.account, o, c.kind, c.cellular_input});
|
||||
remember(c.account, o, c.kind, c.cellular_input);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -416,8 +497,8 @@ std::vector<AccountOutcome> IntentAdmission::abandon() {
|
||||
if (a.stage != Stage::scheduled)
|
||||
return false;
|
||||
const ActionOutcome o{a.carried.action_id, ActionResult::not_committed, 0, 0};
|
||||
out.push_back({a.carried.account, o});
|
||||
remember(a.carried.account, o);
|
||||
out.push_back({a.carried.account, o, a.carried.kind, a.carried.cellular_input});
|
||||
remember(a.carried.account, o, a.carried.kind, a.carried.cellular_input);
|
||||
return true;
|
||||
});
|
||||
for (auto& s : sessions_)
|
||||
@@ -451,13 +532,17 @@ ActionLedger::find_record(const AccountId& account, std::uint64_t action_id) {
|
||||
std::expected<std::vector<std::optional<DurableActionRecord>>, ActionLedgerError>
|
||||
ActionLedger::find_all_records(std::span<const ActionKey> keys) {
|
||||
std::vector<std::optional<DurableActionRecord>> out;
|
||||
out.reserve(keys.size());
|
||||
for (const auto& key : keys) {
|
||||
auto found = find_record(key.account, key.action_id);
|
||||
if (!found.has_value())
|
||||
return std::unexpected(found.error());
|
||||
out.push_back(*found);
|
||||
}
|
||||
auto found = find_all(keys);
|
||||
if (!found.has_value())
|
||||
return std::unexpected(found.error());
|
||||
if (found->size() != keys.size())
|
||||
return std::unexpected(ActionLedgerError::unavailable);
|
||||
out.reserve(found->size());
|
||||
for (const auto& record : *found)
|
||||
if (record)
|
||||
out.emplace_back(DurableActionRecord{*record, std::nullopt});
|
||||
else
|
||||
out.emplace_back();
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -466,13 +551,15 @@ IntentAdmission::Found IntentAdmission::lookup(const AccountId& account,
|
||||
Found f;
|
||||
if (!ledger_)
|
||||
return f;
|
||||
const auto answer = ledger_->find(account, action_id);
|
||||
const auto answer = ledger_->find_record(account, action_id);
|
||||
if (!answer.has_value())
|
||||
return f;
|
||||
const auto& record = answer.value();
|
||||
f.state = record.has_value() ? Record::committed : Record::absent;
|
||||
if (record.has_value())
|
||||
f.outcome = record.value();
|
||||
if (record.has_value()) {
|
||||
f.outcome = record->outcome;
|
||||
f.cellular_input = record->cellular_input;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,12 +76,45 @@ void scheduled_inputs_are_stable_until_simulated() {
|
||||
CHECK(marks.size() == 3);
|
||||
CHECK(queue.scheduled_cellular_intentions(12).empty());
|
||||
}
|
||||
|
||||
void cellular_actions_keep_exact_retry_identity() {
|
||||
IntentLimits limits;
|
||||
limits.max_actions_per_window = 8;
|
||||
auto made = IntentAdmission::create(limits);
|
||||
CHECK(made);
|
||||
auto queue = std::move(*made);
|
||||
CHECK(queue.open(22, account(2)));
|
||||
const AdmissionFacts facts{true, 7, 10};
|
||||
const CellularAction action{22, 7, 77, 11, 500, 0, true, 1'000, 2'000};
|
||||
CHECK(queue.admit(22, action, facts) ==
|
||||
std::optional<ActionReceipt>{ActionReceipt{77, AdmitStatus::admitted, 10, 11}});
|
||||
CHECK(queue.admit(22, action, facts) ==
|
||||
std::optional<ActionReceipt>{ActionReceipt{77, AdmitStatus::duplicate, 10, 11}});
|
||||
|
||||
auto changed = action;
|
||||
changed.move_x = 501;
|
||||
CHECK(queue.admit(22, changed, facts) ==
|
||||
std::optional<ActionReceipt>{ActionReceipt{77, AdmitStatus::invalid_action, 10, 11}});
|
||||
|
||||
const auto carried = queue.carry(11);
|
||||
CHECK(carried.size() == 1 && carried.front().kind == ActionKind::cellular);
|
||||
CHECK(carried.front().cellular_input == encode_cellular_action_input(
|
||||
{11, 500, 0, true, 1'000, 2'000}));
|
||||
const auto outcome = queue.committed(carried, 3);
|
||||
CHECK(outcome.size() == 1 && outcome.front().outcome ==
|
||||
ActionOutcome{77, ActionResult::committed, 11, 3});
|
||||
CHECK(queue.admit(22, action, facts) ==
|
||||
std::optional<ActionReceipt>{ActionReceipt{77, AdmitStatus::duplicate, 10, 11}});
|
||||
CHECK(queue.admit(22, changed, facts) ==
|
||||
std::optional<ActionReceipt>{ActionReceipt{77, AdmitStatus::invalid_action, 10, 11}});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
try {
|
||||
admission_and_rejections();
|
||||
scheduled_inputs_are_stable_until_simulated();
|
||||
cellular_actions_keep_exact_retry_identity();
|
||||
std::puts("PASS cellular intent admission: authority, ordering and retry-stable schedule");
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
|
||||
Reference in New Issue
Block a user