fix: STATICCALL bypasses oracle access detection in MiniRex#183
Merged
fix: STATICCALL bypasses oracle access detection in MiniRex#183
Conversation
In MiniRex, the oracle access detection in frame_init incorrectly triggered for STATICCALL because it only checked target_address (which equals the oracle address for STATICCALL). Rex intentionally adds STATICCALL to the detection path. Gate STATICCALL oracle detection on Rex+ via CallScheme check. Add tests for CALLCODE/DELEGATECALL/STATICCALL oracle detection in both MiniRex and Rex specs. Update MiniRex spec to match.
Contributor
|
LGTM Replay safety concern: This commit changes MiniRex semantics ( Verification result: safe. I checked the mainnet MiniRex window (chain 4326, block 1 to 2054928, ~8 hours from genesis to Rex activation at timestamp 1764851940):
The MiniRex window was the chain's initial bootstrap phase with minimal user activity and no oracle usage, so this fix is replay-safe. |
RealiCZ
approved these changes
Mar 9, 2026
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.
Summary
STATICCALL to the oracle contract incorrectly triggered oracle access detection in MiniRex. This PR fixes the spec gate so STATICCALL detection only activates in Rex+.
History
v1.0.1 (MiniRex): Oracle detection lived inside the
callinstruction handler (instructions.rs), so only the CALL opcode triggered it. CALLCODE, DELEGATECALL, and STATICCALL naturally bypassed detection since they had their own separate instruction handlers without oracle checks. This was the correct MiniRex behavior per spec.v1.1.0: Commit 723fed6 ("refactor: move oracle access tracking to frame level (#86)") moved oracle detection from the CALL instruction handler into
frame_init, which intercepts ALL call types (CALL, CALLCODE, DELEGATECALL, STATICCALL). The refactor checkedcall_inputs.target_addressagainst the oracle address — this works correctly for CALL (detected) and for CALLCODE/DELEGATECALL (not detected, sincetarget_addressis the caller's address for those schemes). However, STATICCALL setstarget_addressto the called address (oracle), so it became incorrectly detected in MiniRex without a spec gate. The intent was for Rex to add STATICCALL detection, but the refactor applied it to all specs.Fix
Gate oracle detection in
frame_initonCallScheme:Call→ always detected (MiniRex+)StaticCall→ detected only in Rex+ (fixes the missing spec gate)CallCode/DelegateCall→ never detected (they execute in the caller's state context, not the oracle's)Other changes
tests/mini_rex/oracle.rs): 3 tests — STATICCALL (not detected), DELEGATECALL (not detected), CALLCODE (not detected)tests/rex/oracle.rs): 3 tests — STATICCALL (detected), DELEGATECALL (not detected), CALLCODE (not detected)specs/MiniRex.md): Correct section 2.8.3 which listed all four call types as triggering oracle detection — now documents only CALL, with explanation of why the others are excludedTest plan
cargo test -p mega-evm --test mini_rex -- oracle— all 22 oracle tests passcargo test -p mega-evm --test rex -- oracle— all 3 new oracle tests passcargo test -p mega-evm— full suite passes