diff --git a/src/ethereum_test_tools/spec/blockchain_test.py b/src/ethereum_test_tools/spec/blockchain_test.py index e82eac4a00..2c2bc5701f 100644 --- a/src/ethereum_test_tools/spec/blockchain_test.py +++ b/src/ethereum_test_tools/spec/blockchain_test.py @@ -159,9 +159,9 @@ def make_block( alloc=previous_alloc, txs=to_json(txs), env=to_json(env), - fork=fork, - block_number=Number(env.number), - block_timestamp=Number(env.timestamp), + fork_name=fork.fork( + block_number=Number(env.number), timestamp=Number(env.timestamp) + ), chain_id=chain_id, reward=fork.get_reward(Number(env.number), Number(env.timestamp)), eips=eips, diff --git a/src/ethereum_test_tools/spec/state_test.py b/src/ethereum_test_tools/spec/state_test.py index e710478149..ac1e19a45b 100644 --- a/src/ethereum_test_tools/spec/state_test.py +++ b/src/ethereum_test_tools/spec/state_test.py @@ -126,9 +126,7 @@ def make_blocks( alloc=to_json(Alloc(self.pre)), txs=to_json(txs), env=to_json(env), - fork=fork, - block_number=Number(env.number), - block_timestamp=Number(env.timestamp), + fork_name=fork.fork(block_number=Number(env.number), timestamp=Number(env.timestamp)), chain_id=chain_id, reward=fork.get_reward(Number(env.number), Number(env.timestamp)), eips=eips, diff --git a/src/evm_transition_tool/besu.py b/src/evm_transition_tool/besu.py index 15f859381a..f7656b953d 100644 --- a/src/evm_transition_tool/besu.py +++ b/src/evm_transition_tool/besu.py @@ -81,12 +81,11 @@ def evaluate( alloc: Any, txs: Any, env: Any, - fork: Fork, - block_number: int, - block_timestamp: int, + fork_name: str, chain_id: int = 1, reward: int = 0, eips: Optional[List[int]] = None, + debug_output_path: str = "", ) -> Tuple[Dict[str, Any], Dict[str, Any]]: """ Executes `evm t8n` with the specified arguments. @@ -94,7 +93,6 @@ def evaluate( if not self.process: self.start_server() - fork_name = fork.fork(block_number, block_timestamp) if eips is not None: fork_name = "+".join([fork_name] + [str(eip) for eip in eips]) diff --git a/src/evm_transition_tool/evmone.py b/src/evm_transition_tool/evmone.py index 7b6d25bf3f..581903f977 100644 --- a/src/evm_transition_tool/evmone.py +++ b/src/evm_transition_tool/evmone.py @@ -50,9 +50,7 @@ def evaluate( alloc: Any, txs: Any, env: Any, - fork: Fork, - block_number: int, - block_timestamp: int, + fork_name: str, chain_id: int = 1, reward: int = 0, eips: Optional[List[int]] = None, @@ -61,7 +59,6 @@ def evaluate( """ Executes `evmone-t8n` with the specified arguments. """ - fork_name = fork.fork(block_number, block_timestamp) if eips is not None: fork_name = "+".join([fork_name] + [str(eip) for eip in eips]) diff --git a/src/evm_transition_tool/geth.py b/src/evm_transition_tool/geth.py index e2183c8306..dcab8b58f0 100644 --- a/src/evm_transition_tool/geth.py +++ b/src/evm_transition_tool/geth.py @@ -49,9 +49,7 @@ def evaluate( alloc: Any, txs: Any, env: Any, - fork: Fork, - block_number: int, - block_timestamp: int, + fork_name: str, chain_id: int = 1, reward: int = 0, eips: Optional[List[int]] = None, @@ -60,7 +58,6 @@ def evaluate( """ Executes `evm t8n` with the specified arguments. """ - fork_name = fork.fork(block_number, block_timestamp) if eips is not None: fork_name = "+".join([fork_name] + [str(eip) for eip in eips]) diff --git a/src/evm_transition_tool/tests/test_evaluate.py b/src/evm_transition_tool/tests/test_evaluate.py index 5e18886d6c..0513dc62a9 100644 --- a/src/evm_transition_tool/tests/test_evaluate.py +++ b/src/evm_transition_tool/tests/test_evaluate.py @@ -112,16 +112,17 @@ def test_evm_t8n(t8n: TransitionTool, test_dir: str) -> None: print(expected_path) alloc = json.load(alloc) txs = json.load(txs) - env = json.load(env) + env_json = json.load(env) expected = json.load(exp) result_alloc, result = t8n.evaluate( alloc=alloc, txs=txs, - env=env, - fork=Berlin, - block_number=0, - block_timestamp=0, + env=env_json, + fork_name=Berlin.fork( + block_number=int(env_json["currentNumber"], 0), + timestamp=int(env_json["currentTimestamp"], 0), + ), ) print(result) assert result_alloc == expected.get("alloc") diff --git a/src/evm_transition_tool/transition_tool.py b/src/evm_transition_tool/transition_tool.py index 4910f4d625..5093e7c8e7 100644 --- a/src/evm_transition_tool/transition_tool.py +++ b/src/evm_transition_tool/transition_tool.py @@ -154,9 +154,7 @@ def evaluate( alloc: Any, txs: Any, env: Any, - fork: Fork, - block_number: int, - block_timestamp: int, + fork_name: str, chain_id: int = 1, reward: int = 0, eips: Optional[List[int]] = None, @@ -232,9 +230,7 @@ def calc_state_root(self, *, alloc: Any, fork: Fork, debug_output_path: str = "" alloc=alloc, txs=[], env=env, - fork=fork, - block_number=0, - block_timestamp=0, + fork_name=fork.fork(block_number=0, timestamp=0), debug_output_path=debug_output_path, ) state_root = result.get("stateRoot") @@ -276,9 +272,7 @@ def calc_withdrawals_root( alloc={}, txs=[], env=env, - fork=fork, - block_number=0, - block_timestamp=0, + fork_name=fork.fork(block_number=0, timestamp=0), debug_output_path=debug_output_path, ) withdrawals_root = result.get("withdrawalsRoot")