From 0384418e1cf7bf9cd13d161996f3e9098b569c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 12 Apr 2024 12:47:58 +0200 Subject: [PATCH] new(test): add tests for EOF/EIP-663 DUPN SWAPN --- .../eip663_dupn_swapn_exchange/test_dupn.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/prague/eip663_dupn_swapn_exchange/test_dupn.py diff --git a/tests/prague/eip663_dupn_swapn_exchange/test_dupn.py b/tests/prague/eip663_dupn_swapn_exchange/test_dupn.py new file mode 100644 index 0000000000..89eb56aa91 --- /dev/null +++ b/tests/prague/eip663_dupn_swapn_exchange/test_dupn.py @@ -0,0 +1,31 @@ +import pytest + +from ethereum_test_tools import * + +REFERENCE_SPEC_GIT_PATH = "EIPS/eip-663.md" +REFERENCE_SPEC_VERSION = "6aed382f86258f33603f5dc275956f739aaae096" +CODE_ADDRESS = 0xC0DE + + +@pytest.mark.valid_from("Prague") +def test_dupn_example1( + state_test: StateTestFiller, +): + code_hex = "ef0001010004020001020904000000008001026001600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002600260026002e6ff60005560015500" + code = bytes.fromhex(code_hex) + + pre = { + TestAddress: Account(balance=1_000_000_000), + CODE_ADDRESS: Account(code=code), + } + + post = {CODE_ADDRESS: Account(storage={0: 1, 1: 2})} + + tx = Transaction(to=CODE_ADDRESS, gas_limit=1_000_000) + + state_test( + env=Environment(), + pre=pre, + post=post, + tx=tx, + )