File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed
monad_eight/vm/precompiled_contracts
monad_nine/vm/precompiled_contracts
tests/monad_eight/staking_precompile Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ def staking(evm: Evm) -> None:
357357 evm .output = b"value is nonzero"
358358 raise RevertInMonadPrecompile
359359
360- # Validate calldata size (addValidator does ABI validation instead )
360+ # Validate calldata size (addValidator defers to its handler )
361361 if selector != SELECTOR_ADD_VALIDATOR :
362362 if len (data ) < expected_size :
363363 evm .output = b"input too short"
@@ -394,5 +394,7 @@ def staking(evm: Evm) -> None:
394394 elif selector == SELECTOR_WITHDRAW :
395395 evm .output = b"unknown withdrawal id"
396396 raise RevertInMonadPrecompile
397+ else :
398+ raise AssertionError (f"unhandled setter: { selector .hex ()} " )
397399 else :
398400 raise InvalidParameter
Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ def staking(evm: Evm) -> None:
357357 evm .output = b"value is nonzero"
358358 raise RevertInMonadPrecompile
359359
360- # Validate calldata size (addValidator does ABI validation instead )
360+ # Validate calldata size (addValidator defers to its handler )
361361 if selector != SELECTOR_ADD_VALIDATOR :
362362 if len (data ) < expected_size :
363363 evm .output = b"input too short"
@@ -394,5 +394,7 @@ def staking(evm: Evm) -> None:
394394 elif selector == SELECTOR_WITHDRAW :
395395 evm .output = b"unknown withdrawal id"
396396 raise RevertInMonadPrecompile
397+ else :
398+ raise AssertionError (f"unhandled setter: { selector .hex ()} " )
397399 else :
398400 raise InvalidParameter
Original file line number Diff line number Diff line change 1818from execution_testing .forks .forks .forks import MONAD_EIGHT
1919from execution_testing .forks .helpers import Fork
2020
21- from .helpers import build_calldata , generous_gas
21+ from .helpers import CORRECT_SEL_ARGS_OFFSET , build_calldata , generous_gas
2222from .spec import (
2323 GAS_GET_PROPOSER_VAL_ID ,
2424 SELECTOR_GET_PROPOSER_VAL_ID ,
@@ -55,7 +55,7 @@ def test_fork_transition(
5555 + Op .CALL (
5656 gas = GAS_GET_PROPOSER_VAL_ID + 10000 ,
5757 address = STAKING_PRECOMPILE ,
58- args_offset = 60 ,
58+ args_offset = CORRECT_SEL_ARGS_OFFSET ,
5959 args_size = 4 ,
6060 ret_offset = 0 ,
6161 ret_size = 32 ,
Original file line number Diff line number Diff line change 3434
3535from .helpers import (
3636 CORRECT_SEL_ARGS_OFFSET ,
37+ CORRECT_SEL_MSTORE_OFFSET ,
3738 WRONG_SEL_ARGS_OFFSET ,
3839 WRONG_SEL_MSTORE_OFFSET ,
3940 build_calldata ,
@@ -532,7 +533,7 @@ def test_selector(
532533 args_size = func .calldata_size
533534 gas = func .gas_cost + 10000
534535 else :
535- calldata_setup = Op .MSTORE (32 , selector )
536+ calldata_setup = Op .MSTORE (CORRECT_SEL_MSTORE_OFFSET , selector )
536537 args_size = 4
537538 gas = GAS_UNKNOWN_SELECTOR + 10000
538539
You can’t perform that action at this time.
0 commit comments