Skip to content

Commit

Permalink
Fixture Format: Append withdrawals list to the end of genesisRLP for …
Browse files Browse the repository at this point in the history
…>= Shanghai (#80)

* Add withdrawals field to b11r.

* Small refactor of state_test/blockchain_test.

* Tox fixes.
  • Loading branch information
spencer-tb authored Mar 17, 2023
1 parent 1c827ec commit b244137
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
17 changes: 10 additions & 7 deletions src/ethereum_test_tools/spec/blockchain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ def make_genesis(
else None,
)

(genesis_rlp, h) = b11r.build(genesis.to_geth_dict(), "", [])
genesis.hash = h

(genesis_rlp, genesis.hash) = b11r.build(
header=genesis.to_geth_dict(),
txs="",
ommers=[],
withdrawals=env.withdrawals,
)
return genesis_rlp, genesis

def make_block(
Expand Down Expand Up @@ -133,10 +136,10 @@ def make_block(
env = set_fork_requirements(env, fork)

(next_alloc, result, txs_rlp) = t8n.evaluate(
previous_alloc,
to_json_or_none(block.txs),
to_json(env),
fork,
alloc=previous_alloc,
txs=to_json_or_none(block.txs),
env=to_json(env),
fork=fork,
chain_id=chain_id,
reward=reward,
eips=eips,
Expand Down
17 changes: 10 additions & 7 deletions src/ethereum_test_tools/spec/state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ def make_genesis(
else None,
)

(genesis_rlp, h) = b11r.build(genesis.to_geth_dict(), "", [])
genesis.hash = h

(genesis_rlp, genesis.hash) = b11r.build(
header=genesis.to_geth_dict(),
txs="",
ommers=[],
withdrawals=env.withdrawals,
)
return genesis_rlp, genesis

def make_blocks(
Expand All @@ -104,10 +107,10 @@ def make_blocks(
env = set_fork_requirements(env, fork)

(alloc, result, txs_rlp) = t8n.evaluate(
to_json(self.pre),
to_json(self.txs),
to_json(env),
fork,
alloc=to_json(self.pre),
txs=to_json(self.txs),
env=to_json(env),
fork=fork,
chain_id=chain_id,
reward=reward,
eips=eips,
Expand Down
1 change: 1 addition & 0 deletions src/evm_block_builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def build(
"--input.ommers=stdin",
"--seal.clique=stdin",
"--output.block=stdout",
"--input.withdrawals=stdin" if withdrawals is not None else "",
]

if ethash:
Expand Down

0 comments on commit b244137

Please sign in to comment.