Summary
filter_invalid_txs is called inside create_block_for_executor at lib.rs:615 with the original state view (Arc<Storage::StateView> from L948). However, system transactions have already been executed and their state changes are accumulated in accumulated_state_changes — which is not applied to the state view used for filtering.
TOCTOU window
The state used for balance/nonce validation is stale relative to post-system-txn state:
- System txns execute → mint precompile adds balance to user A, or a contract callback sends ETH to user A.
accumulated_state_changes holds these changes.
filter_invalid_txs reads original state → sees user A's old balance → marks A's transaction as invalid (insufficient balance).
- A's transaction is discarded even though post-system-txn state would make it valid.
The reverse is also possible: a system txn drains a contract, and a user txn that depends on that contract's balance passes validation but fails at execution time.
Impact
- Severity: High
- Valid user transactions may be silently discarded.
- Invalid user transactions may pass validation (caught by the parallel executor later, but with wasted gas accounting).
Suggested investigation
- Apply
accumulated_state_changes to the state view before calling filter_invalid_txs, or pass the changes as an overlay.
Files
crates/pipe-exec-layer-ext-v2/execute/src/lib.rs (L615, L948, L1207-1289)
Summary
filter_invalid_txsis called insidecreate_block_for_executoratlib.rs:615with the original state view (Arc<Storage::StateView>from L948). However, system transactions have already been executed and their state changes are accumulated inaccumulated_state_changes— which is not applied to the state view used for filtering.TOCTOU window
The state used for balance/nonce validation is stale relative to post-system-txn state:
accumulated_state_changesholds these changes.filter_invalid_txsreads original state → sees user A's old balance → marks A's transaction as invalid (insufficient balance).The reverse is also possible: a system txn drains a contract, and a user txn that depends on that contract's balance passes validation but fails at execution time.
Impact
Suggested investigation
accumulated_state_changesto the state view before callingfilter_invalid_txs, or pass the changes as an overlay.Files
crates/pipe-exec-layer-ext-v2/execute/src/lib.rs(L615, L948, L1207-1289)