From 4e46f8354d7ceed60b879efe8201868c4418fe02 Mon Sep 17 00:00:00 2001 From: Luis Mastrangelo Date: Sat, 4 Oct 2025 17:41:35 +0200 Subject: [PATCH 1/4] Fix storage slot of expected value Signed-off-by: Luis Mastrangelo --- tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py index 8fc048309b6..1e52abb2b29 100644 --- a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py +++ b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py @@ -52,7 +52,7 @@ def caller_code( callee_address: Address, ) -> Bytecode: """Bytecode used to call the bytecode containing the BLOBBASEFEE opcode.""" - return Op.SSTORE(Op.NUMBER, Op.CALL(gas=call_gas, address=callee_address)) + return Op.SSTORE(1, Op.CALL(gas=call_gas, address=callee_address)) @pytest.fixture From ea972f4427ff14997bb62d31f2e7892fd97c91dd Mon Sep 17 00:00:00 2001 From: Luis Mastrangelo Date: Mon, 6 Oct 2025 06:25:48 +0200 Subject: [PATCH 2/4] Fix test for `fill` mode Signed-off-by: Luis Mastrangelo --- .../eip7516_blobgasfee/test_blobgasfee_opcode.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py index 1e52abb2b29..837ee0ed5a9 100644 --- a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py +++ b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py @@ -46,13 +46,20 @@ def callee_address(pre: Alloc, callee_code: Bytecode) -> Address: return pre.deploy_contract(callee_code) +@pytest.fixture +def expected_value_slot() -> Bytecode: + """Storage slot where to save the expected value, by default 1.""" + return Op.PUSH1(1) + + @pytest.fixture def caller_code( call_gas: int, callee_address: Address, + expected_value_slot: Bytecode, ) -> Bytecode: """Bytecode used to call the bytecode containing the BLOBBASEFEE opcode.""" - return Op.SSTORE(1, Op.CALL(gas=call_gas, address=callee_address)) + return Op.SSTORE(expected_value_slot, Op.CALL(gas=call_gas, address=callee_address)) @pytest.fixture @@ -191,6 +198,7 @@ def test_blobbasefee_before_fork( timestamps = [7_500, 14_999, 15_000] +@pytest.mark.parametrize("expected_value_slot", [Op.NUMBER]) @pytest.mark.parametrize( "caller_pre_storage", [{block_number: 0xFF for block_number, _ in enumerate(timestamps, start=1)}], From 8b0ef6ff574fb62f26175a465d5b0939b1c215a8 Mon Sep 17 00:00:00 2001 From: Luis Mastrangelo Date: Mon, 6 Oct 2025 17:52:09 +0200 Subject: [PATCH 3/4] Apply reviewer's suggestion to rename parameter Signed-off-by: Luis Mastrangelo --- tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py index 837ee0ed5a9..5d635eb8ebd 100644 --- a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py +++ b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py @@ -47,7 +47,7 @@ def callee_address(pre: Alloc, callee_code: Bytecode) -> Address: @pytest.fixture -def expected_value_slot() -> Bytecode: +def store_slot() -> Bytecode: """Storage slot where to save the expected value, by default 1.""" return Op.PUSH1(1) @@ -56,10 +56,10 @@ def expected_value_slot() -> Bytecode: def caller_code( call_gas: int, callee_address: Address, - expected_value_slot: Bytecode, + store_slot: Bytecode, ) -> Bytecode: """Bytecode used to call the bytecode containing the BLOBBASEFEE opcode.""" - return Op.SSTORE(expected_value_slot, Op.CALL(gas=call_gas, address=callee_address)) + return Op.SSTORE(store_slot, Op.CALL(gas=call_gas, address=callee_address)) @pytest.fixture @@ -198,7 +198,7 @@ def test_blobbasefee_before_fork( timestamps = [7_500, 14_999, 15_000] -@pytest.mark.parametrize("expected_value_slot", [Op.NUMBER]) +@pytest.mark.parametrize("store_slot", [Op.NUMBER]) @pytest.mark.parametrize( "caller_pre_storage", [{block_number: 0xFF for block_number, _ in enumerate(timestamps, start=1)}], From c3e4b0915b70c8ea361d4764b193ab4bc3ea01e7 Mon Sep 17 00:00:00 2001 From: Luis Mastrangelo Date: Tue, 7 Oct 2025 01:47:47 +0200 Subject: [PATCH 4/4] Apply suggestion to use `SELFBALANCE` as result slot Signed-off-by: Luis Mastrangelo --- .../eip7516_blobgasfee/test_blobgasfee_opcode.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py index 5d635eb8ebd..0080477326b 100644 --- a/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py +++ b/tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py @@ -46,20 +46,13 @@ def callee_address(pre: Alloc, callee_code: Bytecode) -> Address: return pre.deploy_contract(callee_code) -@pytest.fixture -def store_slot() -> Bytecode: - """Storage slot where to save the expected value, by default 1.""" - return Op.PUSH1(1) - - @pytest.fixture def caller_code( call_gas: int, callee_address: Address, - store_slot: Bytecode, ) -> Bytecode: """Bytecode used to call the bytecode containing the BLOBBASEFEE opcode.""" - return Op.SSTORE(store_slot, Op.CALL(gas=call_gas, address=callee_address)) + return Op.SSTORE(Op.SELFBALANCE, Op.CALL(gas=call_gas, address=callee_address)) @pytest.fixture @@ -90,6 +83,7 @@ def tx(pre: Alloc, caller_address: Address) -> Transaction: sender=pre.fund_eoa(), gas_limit=1_000_000, to=caller_address, + value=1, ) @@ -198,7 +192,6 @@ def test_blobbasefee_before_fork( timestamps = [7_500, 14_999, 15_000] -@pytest.mark.parametrize("store_slot", [Op.NUMBER]) @pytest.mark.parametrize( "caller_pre_storage", [{block_number: 0xFF for block_number, _ in enumerate(timestamps, start=1)}],