Skip to content

Commit 7a58fab

Browse files
fselmomarioevz
authored andcommitted
fix(tests): minor fixes and updates for eip7843 (#2057)
* fix(tests): minor updates to eip-7843 following #2007 * fix: account for slotnum in genesis creation * fix: append slot_number in fixture_loader.py
1 parent 2f7daf1 commit 7a58fab

6 files changed

Lines changed: 14 additions & 4 deletions

File tree

packages/testing/src/execution_testing/fixtures/blockchain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ def genesis(cls, fork: Fork, env: Environment, state_root: Hash) -> Self:
388388
),
389389
"slot_number": (
390390
0
391-
if fork.header_slot_number_required(block_number=0, timestamp=0)
391+
if fork.header_slot_number_required(
392+
block_number=0, timestamp=0
393+
)
392394
else None
393395
),
394396
"fork": fork,

packages/testing/src/execution_testing/specs/blockchain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,8 @@ def generate_block_data(
775775
if bal != t8n_bal and self.fork.header_bal_hash_required(
776776
block_number=int(env.number), timestamp=int(env.timestamp)
777777
):
778-
# If the BAL was modified and the fork requires it, update the header hash
778+
# If the BAL was modified and the fork requires it,
779+
# update the header hash
779780
header.block_access_list_hash = Hash(bal.rlp.keccak256())
780781

781782
built_block = BuiltBlock(

packages/testing/src/execution_testing/vm/opcodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,7 +2246,7 @@ class Opcodes(Opcode, Enum):
22462246
22472247
Fork
22482248
----
2249-
TBD
2249+
Amsterdam
22502250
22512251
Gas
22522252
----

src/ethereum/genesis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ def add_genesis_block(
262262
if has_field(hardfork.Header, "block_access_list_hash"):
263263
fields["block_access_list_hash"] = keccak256(rlp.encode([]))
264264

265+
if has_field(hardfork.Header, "slot_number"):
266+
fields["slot_number"] = U64(0)
267+
265268
genesis_header = hardfork.Header(**fields)
266269

267270
block_fields = {

src/ethereum_spec_tools/evm_tools/loaders/fixture_loader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,8 @@ def json_to_header(self, raw: Any) -> Any:
200200
bal_hash = hex_to_bytes32(raw.get("blockAccessListHash"))
201201
parameters.append(bal_hash)
202202

203+
if "slotNumber" in raw:
204+
slot_number = hex_to_u64(raw.get("slotNumber"))
205+
parameters.append(slot_number)
206+
203207
return self.fork.Header(*parameters)

tests/amsterdam/eip7843_slotnum/spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ReferenceSpec:
1313

1414
ref_spec_7843 = ReferenceSpec(
1515
git_path="EIPS/eip-7843.md",
16-
version="8140e7f3a1c93249e9e9ee5ab5281396341306ec",
16+
version="6bc5d6b7acbc016a79fa573f98975093b5c2ca52",
1717
)
1818

1919

0 commit comments

Comments
 (0)