feat(tests): RESERVE_BALANCE precompile with tests#14
Open
pdobacz wants to merge 9 commits intoforks/monad_ninefrom
Open
feat(tests): RESERVE_BALANCE precompile with tests#14pdobacz wants to merge 9 commits intoforks/monad_ninefrom
pdobacz wants to merge 9 commits intoforks/monad_ninefrom
Conversation
Co-Authored-By: Claude <claude-opus-4-5-20251101>
Co-Authored-By: Claude claude-opus-4-5-20251101 Squashed from: Gas-dependent error message for `method not supported` Tidy spec.py Fix check order to match post PR 2109 spec Appease mypy refactor _is_call in reserve_balance.py remove early version of test_check_order test Add check-order tests and refactor precompile test helpers Generic precompile tests aware of Monad precompiles Test essential usecase of containing reserve balance violation Enusre revert returns are independent of gas Spec update: add error messages to reserve balance precompile Appease mypy Add SHORT_CALLDATA to CallScenario Refactor and expand precompile call tests Spec update: precompile gas cost GAS_BASE -> GAS_WARM_ACCESS (100) Spec update: reject nonzero value in reserve balance precompile Add test_contract_unrestricted_with_selfdestruct wip claude 16: mip4 test_many_accounts_balance_change optimizations wip claude 14: MIP-4 spec update - strict calldata and CALL-only wip claude 13 (squashed): tests: 2step, uint256max, regression wip claude 10: simplify RefillFactory to return callable directly wip claude 08: convert CHECKRESERVEBALANCE opcode to precompile wip claude 03 (squashed): adding tests wip claude 03: add MIP-4 CHECKRESERVEBALANCE opcode tests (preliminary) wip claude 02: add CHECKRESERVEBALANCE opcode (MIP-4)
This reverts commit 1f901ab.
Co-Authored-By: Claude claude-opus
Greptile SummaryThis PR implements the Key changes:
Issues found:
Confidence Score: 3/5
Sequence DiagramsequenceDiagram
participant Caller as Caller Contract
participant Interp as process_message()
participant RB as reserve_balance()
participant Helper as is_reserve_balance_violated()
Caller->>Interp: CALL 0x1001 (normal path)
Note over Interp: code_address in PRE_COMPILED_CONTRACTS AND NOT disable_precompiles
Interp->>RB: reserve_balance(evm)
RB->>RB: _is_call() check (NOT_CALL → raise InvalidParameter)
RB->>RB: charge_gas(GAS_WARM_ACCESS)
RB->>RB: selector / value / size checks
RB->>Helper: is_reserve_balance_violated(state, tx_env)
Helper-->>RB: bool
RB-->>Interp: evm.output = U256(violation).to_be_bytes32()
Interp-->>Caller: return data (32 bytes)
Caller->>Interp: CALL delegating_EOA → points to 0x1001
Note over Interp: disable_precompiles = True, code_address in PRE_COMPILED_CONTRACTS
Interp->>Interp: elif code_address in MONAD_PRECOMPILE_ADDRESSES → True
Interp->>Interp: raise RevertInMonadPrecompile
Note over Interp: gas_left = 0, evm.output preserved
Interp-->>Caller: revert (0 return, all gas consumed)
Caller->>Interp: CALL delegating_EOA → points to 0x1000 (STAKING)
Note over Interp: disable_precompiles = True, code_address NOT in PRE_COMPILED_CONTRACTS
Note over Interp: ⚠ elif never reached — executes empty code instead
Interp-->>Caller: success (empty return)
Last reviewed commit: 2b9d255 |
good bot Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
No description provided.