Skip to content

Commit 5f9538a

Browse files
feat(tests): fix XEN approval spam test
1 parent 0c05d9c commit 5f9538a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/benchmark/mainnet/test_state_xen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from ethereum_test_tools.vm.opcode import Opcodes as Op
3333

3434

35+
@pytest.mark.valid_from("Frontier")
3536
def test_xen_approve(
3637
blockchain_test: BlockchainTestFiller,
3738
pre: Alloc,
@@ -47,7 +48,9 @@ def test_xen_approve(
4748
xen_contract = 0x06450DEE7FD2FB8E39061434BABCFC05599A6FB8
4849
gas_threshold = 40_000
4950

50-
fn_signature_approve = 0x095EA7B3 # Function selector of `approve(address,uint256)`
51+
fn_signature_approve = bytes.fromhex(
52+
"095EA7B3"
53+
) # Function selector of `approve(address,uint256)`
5154
# This code loops until there is less than threshold_gas left and reads two items from calldata:
5255
# The first 32 bytes are interpreted as the start address to start approving for
5356
# The second 32 bytes is the approval amount
@@ -57,7 +60,7 @@ def test_xen_approve(
5760
# The attack block can then target all of the just initialized storage slots to edit
5861
# (This should thus yield more dirty trie nodes than the )
5962
approval_loop_code = (
60-
Op.MSTORE(0, Hash(fn_signature_approve, left_padding=True))
63+
Om.MSTORE(fn_signature_approve)
6164
+ Op.MSTORE(4 + 32, Op.CALLDATALOAD(32))
6265
+ Op.CALLDATALOAD(0)
6366
+ While(

0 commit comments

Comments
 (0)