-
Notifications
You must be signed in to change notification settings - Fork 392
enhance(test-tests): more execute mainnet marked tests #1820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marioevz
merged 9 commits into
ethereum:forks/osaka
from
felix314159:mainnet-tests-batch-2
Dec 3, 2025
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6804926
feat: added more mainnet tests
felix314159 aa7d465
fix: fix modexp tests
felix314159 c4ff085
fix: fix
felix314159 8ea8367
chore(test-tests): update mainnet marked tests for osaka
spencer-tb 5d8aeff
chore(test-types): add logging for rejected txs
spencer-tb d67495f
chore: fix static tox ruff format ci fail
spencer-tb 71ecfd9
Apply suggestions from code review
marioevz e10409a
fix(tests): Change all mainnet osaka tests to ty-2 tx
marioevz 0ed6103
fix(tests): Fix EIP-7883 tests
marioevz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
tests/osaka/eip7823_modexp_upper_bounds/test_eip_mainnet.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| """ | ||
| Mainnet marked execute checklist tests for | ||
| [EIP-7823: ModExp Upper Bound](https://eips.ethereum.org/EIPS/eip-7823). | ||
| """ | ||
|
|
||
| from typing import Dict | ||
|
|
||
| import pytest | ||
| from execution_testing import ( | ||
| Alloc, | ||
| StateTestFiller, | ||
| Transaction, | ||
| ) | ||
| from execution_testing.base_types.base_types import Bytes | ||
| from execution_testing.test_types.block_types import Environment | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| from ...byzantium.eip198_modexp_precompile.helpers import ( | ||
| ModExpInput, | ||
| ModExpOutput, | ||
| ) | ||
| from ..eip7883_modexp_gas_increase.spec import Spec | ||
| from .spec import ref_spec_7823 | ||
|
|
||
| REFERENCE_SPEC_GIT_PATH = ref_spec_7823.git_path | ||
| REFERENCE_SPEC_VERSION = ref_spec_7823.version | ||
|
|
||
| pytestmark = [pytest.mark.valid_at("Osaka"), pytest.mark.mainnet] | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def call_succeeds(modexp_expected: ModExpOutput) -> bool: | ||
| """Override `call_succeeds` to use the parametrized ModExpOutput value.""" | ||
| return modexp_expected.call_success | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "modexp_input,modexp_expected", | ||
| [ | ||
| pytest.param( | ||
| ModExpInput( | ||
| base=b"\x01" * Spec.MAX_LENGTH_BYTES, | ||
| exponent=b"\x00", | ||
| modulus=b"\x02", | ||
| ), | ||
| ModExpOutput( | ||
| call_success=True, | ||
| returned_data=Bytes(bytes.fromhex("01")), | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ), | ||
| id="base-boundary-1024-bytes", | ||
| ), | ||
| ], | ||
| ) | ||
| def test_modexp_boundary( | ||
| state_test: StateTestFiller, | ||
| pre: Alloc, | ||
| tx: Transaction, | ||
| post: Dict, | ||
| ) -> None: | ||
| """ | ||
| Mainnet test at the 1024-byte boundary. | ||
| Tests that the ModExp precompile correctly handles input at the maximum | ||
| allowed length (1024 bytes) per EIP-7823. | ||
| """ | ||
| state_test(env=Environment(), pre=pre, tx=tx, post=post) | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "modexp_input,modexp_expected", | ||
| [ | ||
| pytest.param( | ||
| ModExpInput( | ||
| base=b"\x01" * (Spec.MAX_LENGTH_BYTES + 1), | ||
| exponent=b"\x00", | ||
| modulus=b"\x02", | ||
| ), | ||
| ModExpOutput( | ||
| call_success=False, | ||
| returned_data=Bytes(), | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ), | ||
| id="base-over-boundary-1025-bytes", | ||
| ), | ||
| ], | ||
| ) | ||
| def test_modexp_over_boundary( | ||
| state_test: StateTestFiller, | ||
| pre: Alloc, | ||
| tx: Transaction, | ||
| post: Dict, | ||
| ) -> None: | ||
| """ | ||
| Mainnet test exceeding the 1024-byte boundary. | ||
| Tests that the ModExp precompile correctly rejects input exceeding the | ||
| maximum allowed length (1024 bytes) per EIP-7823. This proves the EIP | ||
| is correctly activated. | ||
| """ | ||
| state_test(env=Environment(), pre=pre, tx=tx, post=post) | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
68 changes: 68 additions & 0 deletions
68
tests/osaka/eip7825_transaction_gas_limit_cap/test_eip_mainnet.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| """ | ||
| Mainnet marked execute checklist tests for | ||
| [EIP-7825: Transaction Gas Limit Cap](https://eips.ethereum.org/EIPS/eip-7825). | ||
| """ | ||
|
|
||
| import pytest | ||
| from execution_testing import ( | ||
| Account, | ||
| Alloc, | ||
| Environment, | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Op, | ||
| StateTestFiller, | ||
| Storage, | ||
| Transaction, | ||
| TransactionException, | ||
| ) | ||
|
|
||
| from .spec import Spec, ref_spec_7825 | ||
|
|
||
| REFERENCE_SPEC_GIT_PATH = ref_spec_7825.git_path | ||
| REFERENCE_SPEC_VERSION = ref_spec_7825.version | ||
|
|
||
| pytestmark = [pytest.mark.valid_at("Osaka"), pytest.mark.mainnet] | ||
|
|
||
|
|
||
| def test_tx_gas_limit_cap_at_maximum( | ||
| state_test: StateTestFiller, | ||
| pre: Alloc, | ||
| env: Environment, | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) -> None: | ||
| """Test transaction at exactly the gas limit cap (2^24).""" | ||
| storage = Storage() | ||
| contract_address = pre.deploy_contract( | ||
| code=Op.SSTORE(storage.store_next(1), 1) + Op.STOP, | ||
| ) | ||
|
|
||
| tx = Transaction( | ||
| to=contract_address, | ||
marioevz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sender=pre.fund_eoa(), | ||
| gas_limit=Spec.tx_gas_limit_cap, | ||
| ) | ||
|
|
||
| post = { | ||
| contract_address: Account(storage=storage), | ||
| } | ||
|
|
||
| state_test(env=env, pre=pre, post=post, tx=tx) | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| @pytest.mark.exception_test | ||
| def test_tx_gas_limit_cap_exceeded( | ||
| state_test: StateTestFiller, | ||
| pre: Alloc, | ||
| env: Environment, | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) -> None: | ||
| """Test transaction exceeding the gas limit cap (2^24 + 1).""" | ||
| contract_address = pre.deploy_contract( | ||
| code=Op.SSTORE(0, 1) + Op.STOP, | ||
| ) | ||
|
|
||
| tx = Transaction( | ||
| to=contract_address, | ||
marioevz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sender=pre.fund_eoa(), | ||
| gas_limit=Spec.tx_gas_limit_cap + 1, | ||
| error=TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM, | ||
| ) | ||
|
|
||
| state_test(env=env, pre=pre, post={}, tx=tx) | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/osaka/eip7939_count_leading_zeros/test_eip_mainnet.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """ | ||
| Mainnet marked execute checklist tests for | ||
| [EIP-7939: Count leading zeros (CLZ)](https://eips.ethereum.org/EIPS/eip-7939). | ||
| """ | ||
|
|
||
| import pytest | ||
| from execution_testing import ( | ||
| Account, | ||
| Alloc, | ||
| Op, | ||
| StateTestFiller, | ||
| Transaction, | ||
| ) | ||
| from execution_testing.test_types.block_types import Environment | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| from .spec import ref_spec_7939 | ||
|
|
||
| REFERENCE_SPEC_GIT_PATH = ref_spec_7939.git_path | ||
| REFERENCE_SPEC_VERSION = ref_spec_7939.version | ||
|
|
||
| pytestmark = [pytest.mark.valid_at("Osaka"), pytest.mark.mainnet] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "clz_input,clz_expected", | ||
| [ | ||
| pytest.param( | ||
| 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, | ||
| 8, | ||
| id="clz-8-leading-zeros", | ||
| ), | ||
| pytest.param(0, 256, id="clz-all-zeros"), | ||
| ], | ||
| ) | ||
| def test_clz_mainnet( | ||
| state_test: StateTestFiller, | ||
| pre: Alloc, | ||
| clz_input: int, | ||
| clz_expected: int, | ||
| ) -> None: | ||
| """ | ||
| Test CLZ opcode on mainnet. | ||
| """ | ||
| sender = pre.fund_eoa() | ||
| contract_address = pre.deploy_contract( | ||
| code=Op.SSTORE(0, Op.CLZ(clz_input)), | ||
| storage={"0x00": "0xdeadbeef"}, | ||
| ) | ||
| tx = Transaction( | ||
| to=contract_address, | ||
marioevz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sender=sender, | ||
| gas_limit=200_000, | ||
| ) | ||
| post = { | ||
| contract_address: Account(storage={"0x00": clz_expected}), | ||
| } | ||
| state_test(env=Environment(), pre=pre, post=post, tx=tx) | ||
marioevz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.