Tests: action ordering regression suite#338
Open
heifner wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-- sixBOOST_AUTO_TEST_CASE_TEMPLATEcases (instantiated overvalidating_testers) asserting bothaction_ordinalandreceipt.global_sequencefor every trace produced.unittests/test-contracts/CMakeLists.txtandtest_contracts.hpp.in.Why
History APIs, indexers, and monitoring tooling that flatten
action_tracesand 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).