Skip to content

Tests: action ordering regression suite#338

Open
heifner wants to merge 1 commit into
masterfrom
feature/action-ordering-tests
Open

Tests: action ordering regression suite#338
heifner wants to merge 1 commit into
masterfrom
feature/action-ordering-tests

Conversation

@heifner
Copy link
Copy Markdown
Contributor

@heifner heifner commented May 14, 2026

Adds a focused regression suite covering EOSIO-style action_trace ordering rules: apply_context::exec phases (self -> notifications -> CFA inlines -> regular inlines) and the schedule-vs-execution divergence between action_ordinal and receipt.global_sequence.

What's new

  • unittests/test-contracts/action_order_test/ -- minimal test contract with six actions, one per trace shape: bare self, notification handler queues inline, inline-then-notification (headline divergence), natural contrast, nested apply_context with an inline that itself notifies, and CFA + regular inline + notification (triple divergence).
  • unittests/action_ordering_tests.cpp -- six BOOST_AUTO_TEST_CASE_TEMPLATE cases (instantiated over validating_testers) asserting both action_ordinal and receipt.global_sequence for every trace produced.
  • CMake glue: the new contract joins unittests/test-contracts/CMakeLists.txt and test_contracts.hpp.in.

Why

History APIs, indexers, and monitoring tooling that flatten action_traces and treat the vector as execution-ordered will misread any transaction that intermixes `require_recipient` and `send_inline` in a single body. The vaults.sx 2021 incident relied on exactly that misread.

The contract header documents all six cases in the EOSIO PR #6897 nested-arrow notation so contract authors and indexer authors share one reference. Existing coverage in `api_tests.cpp::action_ordinal_test` already exercises a complex multi-account scenario; this PR adds focused, individually documented cases (plus the CFA-inline case that the existing test does not cover).

Adds a focused regression suite that pins down the apply_context::exec
phase ordering (self -> notifications -> CFA inlines -> regular inlines)
and the schedule-vs-execution divergence between action_ordinal and
receipt.global_sequence.

The new action_order_test contract exposes six actions covering the
distinct trace shapes: bare self apply, notification handler queues an
inline, inline-then-notification (headline divergence), the natural
contrast, nested apply_context with an inline that itself notifies, and
CFA + regular inline + notification (triple divergence).

unittests/action_ordering_tests.cpp drives all six and asserts both the
action_ordinal sequence and the receipt.global_sequence values, so the
phase-order invariants stay regression-tested.

Documentation in the contract header captures all six cases in the
EOSIO PR #6897 trace-tree notation, giving history-API and indexer
authors a single reference for why they must sort by global_sequence
(or walk the creation tree) rather than iterate action_traces by index.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant