Skip to content

Commit 4a6a8d0

Browse files
committed
more test coverage and dynamic prepared accounts
1 parent 31f350d commit 4a6a8d0

File tree

1 file changed

+43
-25
lines changed

1 file changed

+43
-25
lines changed

tests/verkle/eip7748/accounts.py

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,7 @@
2121
REFERENCE_SPEC_GIT_PATH = "EIPS/eip-7748.md"
2222
REFERENCE_SPEC_VERSION = "TODO"
2323

24-
# List of addressed ordered by MPT tree key.
25-
accounts = [
26-
# 03601462093b5945d1676df093446790fd31b20e7b12a2e8e5e09d068109616b
27-
Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"),
28-
# 1fe26fd0b8a197e7b85ed1ead2b52700041c5d465673aa744f3afc4704f83c03
29-
Address("0xd94f5374fce5edbc8e2a8697c15331677e6ebf0d"),
30-
# 257f371320e4696a5debc64a489e651fc4565eb07ce0e4d2ce5b6d5b1896d89a
31-
Address("0xd94f5374fce5edbc8e2a8697c15331677e6ebf0f"),
32-
# 6a7fc6037f7a0dca7004c2cd41d87bfd929be7eb0d31903b238839e8e7aaf897
33-
Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0a"),
34-
# 85174d7e61a36094fc9b58640ad245d4ab61d888699f3659137171ff2910b6cb
35-
Address("0xd94f5374fce5edbc8e2a8697c15331677e6ebf0e"),
36-
# b4102152d5f5995b7a017c9db0e186028190faafa4326ac1ecfb2bc817c423c9
37-
Address("0xd94f5374fce5edbc8e2a8697c15331677e6ebf05"),
38-
# e72525e3842ed775ed5c52ffc1520247deae64a217fcb3fb3ddbe59ffeb5949c
39-
Address("0xd94f5374fce5edbc8e2a8697c15331677e6ebf03"),
40-
]
24+
accounts = sorted([Address(i) for i in range(0, 50)], key=lambda x: x.keccak256())
4125

4226

4327
class AccountConfig:
@@ -51,28 +35,62 @@ def __init__(self, code_length: int, storage_slot_count: int):
5135
"account_configs",
5236
[
5337
[AccountConfig(0, 0)],
54-
[AccountConfig(0, 0), AccountConfig(0, 0)],
55-
[AccountConfig(0, 0), AccountConfig(0, 0), AccountConfig(0, 0)],
56-
[AccountConfig(15, 1)],
38+
[AccountConfig(0, 0)] * 2,
39+
[AccountConfig(0, 0)] * 7,
40+
[AccountConfig(15, 2)],
41+
[AccountConfig(31 * 2 + 1, 3)], # 3 code-chunks + 3 slots + account data = 7
42+
[AccountConfig(0, 0), AccountConfig(15, 2)],
43+
[
44+
AccountConfig(0, 0),
45+
AccountConfig(31 + 1, 3),
46+
],
47+
[
48+
AccountConfig(15, 2),
49+
AccountConfig(0, 0),
50+
],
51+
[
52+
AccountConfig(31 + 1, 3),
53+
AccountConfig(0, 0),
54+
],
55+
[
56+
AccountConfig(5, 1),
57+
AccountConfig(8, 1),
58+
],
59+
[
60+
AccountConfig(5, 2),
61+
AccountConfig(8, 1),
62+
],
63+
],
64+
ids=[
65+
"EOA",
66+
"EOAs under-fit",
67+
"EOAs perfect-fit",
68+
"Contract under-fit",
69+
"Contract perfect-fit",
70+
"EOA and Contract under-fit",
71+
"EOA and Contract perfect-fit",
72+
"Contract and EOA under-fit",
73+
"Contract and EOA perfect-fit",
74+
"Contract and Contract under-fit",
75+
"Contract and Contract perfect-fit",
5776
],
58-
ids=["One EOA", "Two EOAs", "Three EOAs", "Small contract"],
5977
)
6078
@pytest.mark.parametrize(
61-
"fill_first_block, stride",
79+
"fill_first_block",
6280
[
63-
(False, 3),
64-
(True, 3),
81+
False,
82+
True,
6583
],
6684
)
6785
def test_conversions(
6886
blockchain_test: BlockchainTestFiller,
6987
account_configs: list[AccountConfig],
7088
fill_first_block: bool,
71-
stride: int,
7289
):
7390
"""
7491
Test conversion cases.
7592
"""
93+
stride = 7
7694
conversion_units = 0
7795
pre_state = {}
7896
if fill_first_block:

0 commit comments

Comments
 (0)