diff --git a/src/ethereum/osaka/vm/precompiled_contracts/modexp.py b/src/ethereum/osaka/vm/precompiled_contracts/modexp.py index afe6beba95..996f8517cb 100644 --- a/src/ethereum/osaka/vm/precompiled_contracts/modexp.py +++ b/src/ethereum/osaka/vm/precompiled_contracts/modexp.py @@ -95,11 +95,10 @@ def complexity(base_length: U256, modulus_length: U256) -> Uint: """ max_length = max(Uint(base_length), Uint(modulus_length)) words = (max_length + Uint(7)) // Uint(8) - complexity = words ** Uint(2) - if max_length <= Uint(32): - return complexity - else: - return Uint(2) * complexity + complexity = Uint(16) + if max_length > Uint(32): + complexity = Uint(2) * words ** Uint(2) + return complexity def iterations(exponent_length: U256, exponent_head: U256) -> Uint: diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py index e289a14b88..d58ec9ebed 100644 --- a/tests/helpers/__init__.py +++ b/tests/helpers/__init__.py @@ -26,8 +26,14 @@ class _FixtureSource(TypedDict): "url": "https://github.com/ethereum/execution-spec-tests/releases/download/v4.5.0/fixtures_stable.tar.gz", "fixture_path": "tests/fixtures/latest_fork_tests", }, + "osaka_tests": { + "url": "https://github.com/ethereum/execution-spec-tests/releases/download/fusaka-devnet-2%40v1.1.0/fixtures_fusaka-devnet-2.tar.gz", + "fixture_path": "tests/fixtures/osaka_tests", + }, } ETHEREUM_TESTS_PATH = TEST_FIXTURES["ethereum_tests"]["fixture_path"] EEST_TESTS_PATH = TEST_FIXTURES["latest_fork_tests"]["fixture_path"] + +OSAKA_TEST_PATH = TEST_FIXTURES["osaka_tests"]["fixture_path"] diff --git a/tests/osaka/test_evm_tools.py b/tests/osaka/test_evm_tools.py index 7c8ae237bb..2078846201 100644 --- a/tests/osaka/test_evm_tools.py +++ b/tests/osaka/test_evm_tools.py @@ -3,7 +3,7 @@ import pytest -from tests.helpers import EEST_TESTS_PATH, ETHEREUM_TESTS_PATH +from tests.helpers import ETHEREUM_TESTS_PATH, OSAKA_TEST_PATH from tests.helpers.load_evm_tools_tests import ( fetch_evm_tools_tests, idfn, @@ -11,7 +11,7 @@ ) ETHEREUM_STATE_TESTS_DIR = f"{ETHEREUM_TESTS_PATH}/GeneralStateTests/" -EEST_STATE_TESTS_DIR = f"{EEST_TESTS_PATH}/state_tests/" +EEST_STATE_TESTS_DIR = f"{OSAKA_TEST_PATH}/fixtures/state_tests/" FORK_NAME = "Osaka" diff --git a/tests/osaka/test_state_transition.py b/tests/osaka/test_state_transition.py index a835f7f481..49a32ee2a9 100644 --- a/tests/osaka/test_state_transition.py +++ b/tests/osaka/test_state_transition.py @@ -3,7 +3,7 @@ import pytest -from tests.helpers import EEST_TESTS_PATH, ETHEREUM_TESTS_PATH +from tests.helpers import ETHEREUM_TESTS_PATH, OSAKA_TEST_PATH from tests.helpers.load_state_tests import ( Load, fetch_state_test_files, @@ -12,7 +12,7 @@ ) ETHEREUM_BLOCKCHAIN_TESTS_DIR = f"{ETHEREUM_TESTS_PATH}/BlockchainTests/" -EEST_BLOCKCHAIN_TESTS_DIR = f"{EEST_TESTS_PATH}/blockchain_tests/" +EEST_BLOCKCHAIN_TESTS_DIR = f"{OSAKA_TEST_PATH}/fixtures/blockchain_tests/" NETWORK = "Osaka" PACKAGE = "osaka"