Queue births in cellular tick batches
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (postgres) (push) Canceled after 0s
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 (network) (push) Canceled after 1m9s
Foundation / checks (client) (push) Canceled after 1m53s
Foundation / checks (ecs) (push) Canceled after 1m48s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (postgres) (push) Canceled after 0s
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 (network) (push) Canceled after 1m9s
Foundation / checks (client) (push) Canceled after 1m53s
Foundation / checks (ecs) (push) Canceled after 1m48s
This commit is contained in:
@@ -107,11 +107,11 @@ void actions_bind_to_owned_life_and_preserve_other_inputs() {
|
||||
CHECK(builder->actions().size() == 1 && builder->actions()[0] == prepared->actions[0]);
|
||||
const auto replayed = replay_cellular_batch(**state, builder->batch());
|
||||
CHECK(replayed && (*replayed)->snapshot() == builder->candidate().snapshot());
|
||||
const auto repeated_input = network::encode_cellular_action_input({3, 0, 0, false, 0, 0});
|
||||
const network::CarriedAction repeated{network::AccountId{controlled.account}, 77, 3,
|
||||
const auto repeated_input = network::encode_cellular_action_input({4, 0, 0, false, 0, 0});
|
||||
const network::CarriedAction repeated{network::AccountId{controlled.account}, 77, 4,
|
||||
network::ActionKind::cellular, repeated_input};
|
||||
const std::array repeated_actions{repeated};
|
||||
CHECK(builder->append(3, next_baseline, repeated_actions).error() ==
|
||||
CHECK(builder->append(4, next_baseline, repeated_actions).error() ==
|
||||
CellularSessionBatchError::duplicate_action);
|
||||
CHECK(builder->append(5, next_baseline, {}).error() == CellularSessionBatchError::tick);
|
||||
|
||||
@@ -144,10 +144,45 @@ void actions_bind_to_owned_life_and_preserve_other_inputs() {
|
||||
CHECK(prepare_cellular_session_tick(**state, 2, baseline, malformed_actions).error() ==
|
||||
CellularSessionBatchError::action);
|
||||
}
|
||||
|
||||
void builder_batches_reserved_birth_after_empty_tick() {
|
||||
auto primitive = PrimitiveLives::create({93, 1, 1, 17, founder_price(1), {{0, 0}}});
|
||||
CHECK(primitive);
|
||||
auto habitat = biology::CellularHabitat::create({93, 1, 1, 1'000, 1'000, {}});
|
||||
CHECK(habitat);
|
||||
auto state = CellularLives::create(**primitive, std::move(*habitat),
|
||||
{{1'000, 1'000}, 0, 293'150});
|
||||
CHECK(state && (*state)->lives().empty());
|
||||
persistence::RegionHead head{};
|
||||
head.frame = 1;
|
||||
head.commit.fill(1);
|
||||
head.digest.fill(2);
|
||||
auto builder = CellularSessionBatchBuilder::create(**state, head);
|
||||
CHECK(builder);
|
||||
|
||||
CellularTickIntents::Birth birth{};
|
||||
birth.account.back() = 8;
|
||||
birth.request = 13;
|
||||
birth.generation = 4;
|
||||
birth.identity = 901;
|
||||
const std::array births{birth};
|
||||
const std::span<const CellularLifeIntent> no_lives{};
|
||||
CHECK(builder->append(1, no_lives, {}, births));
|
||||
CHECK(builder->candidate().tick() == 1 && builder->candidate().lives().size() == 1 &&
|
||||
builder->batch().ticks[0].births == std::vector{birth} && (*state)->lives().empty());
|
||||
const auto replayed = replay_cellular_batch(**state, builder->batch());
|
||||
CHECK(replayed && (*replayed)->snapshot() == builder->candidate().snapshot());
|
||||
const auto snapshot = builder->candidate().snapshot();
|
||||
const std::array next_lives{CellularLifeIntent{901, {}}};
|
||||
CHECK(builder->append(2, next_lives, {}, births).error() ==
|
||||
CellularSessionBatchError::duplicate_birth);
|
||||
CHECK(builder->candidate().snapshot() == snapshot && builder->batch().ticks.size() == 1);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() try {
|
||||
actions_bind_to_owned_life_and_preserve_other_inputs();
|
||||
builder_batches_reserved_birth_after_empty_tick();
|
||||
std::puts("cellular session batch: ok");
|
||||
} catch (const std::exception& e) {
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
|
||||
Reference in New Issue
Block a user