Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
class Alloc(SharedAlloc):
"""Allocation of accounts in the state, pre and post test execution."""

_eoa_fund_amount_default: int = PrivateAttr(10**21)
_eoa_fund_amount_default: int = PrivateAttr(10**27)
_account_salt: Dict[Hash, int] = PrivateAttr(default_factory=dict)
_stub_accounts: Dict[str, Account] = PrivateAttr(default_factory=dict)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def count_keys_in_fixture(file_path: Path) -> int: # noqa: D103
@pytest.mark.valid_until("Shanghai")
def test_paris_one(state_test) -> None:
state_test(env=Environment(),
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction())
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction(gas_limit=0x5208))

@pytest.mark.valid_from("Paris")
@pytest.mark.valid_until("Shanghai")
def test_paris_two(state_test) -> None:
state_test(env=Environment(),
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction())
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction(gas_limit=0x5208))
"""
)
test_count_paris = 4
Expand All @@ -79,14 +79,14 @@ def test_paris_two(state_test) -> None:
@pytest.mark.valid_until("Shanghai")
def test_shanghai_one(state_test) -> None:
state_test(env=Environment(),
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction())
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction(gas_limit=0x5208))

@pytest.mark.parametrize("x", [1, 2, 3])
@pytest.mark.valid_from("Paris")
@pytest.mark.valid_until("Shanghai")
def test_shanghai_two(state_test, x) -> None:
state_test(env=Environment(),
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction())
pre={TestAddress: Account(balance=1_000_000)}, post={}, tx=Transaction(gas_limit=0x5208))
"""
)

Expand Down Expand Up @@ -988,7 +988,7 @@ def test_benchmark_one(state_test) -> None:
env=Environment(),
pre={TestAddress: Account(balance=1_000_000)},
post={},
tx=Transaction(),
tx=Transaction(gas_limit=0x5208),
)
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_verify_sync_default(blockchain_test) -> None:
blockchain_test(
pre={TestAddress: TEST_ADDRESS},
post={},
blocks=[Block(txs=[Transaction()])]
blocks=[Block(txs=[Transaction(gas_limit=0x5208)])]
)


Expand All @@ -33,7 +33,7 @@ def test_verify_sync_with_marker(blockchain_test) -> None:
blockchain_test(
pre={TestAddress: TEST_ADDRESS},
post={},
blocks=[Block(txs=[Transaction()])]
blocks=[Block(txs=[Transaction(gas_limit=0x5208)])]
)

@pytest.mark.valid_at("Cancun")
Expand All @@ -52,7 +52,7 @@ def test_verify_sync_with_param_marks(blockchain_test, has_exception) -> None:
post={},
blocks=[
Block(
txs=[Transaction()],
txs=[Transaction(gas_limit=0x5208)],
rlp_modifier=Header(gas_limit=0) if has_exception else None,
exception=BlockException.INCORRECT_BLOCK_FORMAT if has_exception else None,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def type_0_default_transaction(sender: EOA) -> Transaction:
ty=0,
sender=sender,
gas_price=10**9,
gas_limit=100_000,
data=b"\x00" * 100,
protected=True,
)
Expand All @@ -38,7 +37,6 @@ def type_1_default_transaction(sender: EOA) -> Transaction:
ty=1,
sender=sender,
gas_price=10**9,
gas_limit=100_000,
data=b"\x00" * 100,
access_list=[
AccessList(address=0x1234, storage_keys=[0, 1, 2]),
Expand All @@ -56,7 +54,6 @@ def type_2_default_transaction(sender: EOA) -> Transaction:
sender=sender,
max_fee_per_gas=10**10,
max_priority_fee_per_gas=10**9,
gas_limit=100_000,
data=b"\x00" * 200,
access_list=[
AccessList(address=0x2468, storage_keys=[10, 20, 30]),
Expand All @@ -74,7 +71,6 @@ def type_3_default_transaction(sender: EOA) -> Transaction:
max_fee_per_gas=10**10,
max_priority_fee_per_gas=10**9,
max_fee_per_blob_gas=10**9,
gas_limit=100_000,
data=b"\x00" * 150,
access_list=[
AccessList(address=0x3690, storage_keys=[100, 200]),
Expand Down Expand Up @@ -106,7 +102,6 @@ def type_4_default_transaction(sender: EOA, pre: Alloc) -> Transaction:
sender=sender,
max_fee_per_gas=10**10,
max_priority_fee_per_gas=10**9,
gas_limit=500_000,
data=b"\x00" * 200,
access_list=[
AccessList(address=0x4567, storage_keys=[1000, 2000, 3000]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_json_dict() -> None:
),
transactions=[
Transaction(
gas_limit=0x5208,
max_fee_per_gas=7,
).with_signature_and_sender(),
],
Expand Down Expand Up @@ -131,6 +132,7 @@ def test_json_dict() -> None:
),
transactions=[
Transaction(
gas_limit=0x5208,
max_fee_per_gas=7,
).with_signature_and_sender(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
pytest.param(
True,
FixtureTransaction.from_transaction(
Transaction().with_signature_and_sender()
Transaction(gas_limit=0x5208).with_signature_and_sender()
),
{
"type": "0x00",
Expand All @@ -99,7 +99,10 @@
pytest.param(
True,
FixtureTransaction.from_transaction(
Transaction(to=None).with_signature_and_sender()
Transaction(
to=None,
gas_limit=0x5208,
).with_signature_and_sender()
),
{
"type": "0x00",
Expand All @@ -120,7 +123,7 @@
pytest.param(
True,
FixtureTransaction.from_transaction(
Transaction(ty=1).with_signature_and_sender()
Transaction(ty=1, gas_limit=0x5208).with_signature_and_sender()
),
{
"type": "0x01",
Expand All @@ -143,7 +146,7 @@
True,
FixtureTransaction.from_transaction(
Transaction(
ty=2, max_fee_per_gas=7
ty=2, max_fee_per_gas=7, gas_limit=0x5208
).with_signature_and_sender()
),
{
Expand Down Expand Up @@ -172,6 +175,7 @@
max_fee_per_gas=7,
max_fee_per_blob_gas=1,
blob_versioned_hashes=[],
gas_limit=0x5208,
).with_signature_and_sender()
),
{
Expand Down Expand Up @@ -208,6 +212,7 @@
signer=EOA(key=TestPrivateKey),
)
],
gas_limit=0x5208,
).with_signature_and_sender()
),
{
Expand Down Expand Up @@ -256,6 +261,7 @@
max_fee_per_gas=20,
max_fee_per_blob_gas=30,
blob_versioned_hashes=[0, 1],
gas_limit=0x5208,
).with_signature_and_sender()
),
{
Expand Down Expand Up @@ -401,7 +407,9 @@
),
txs=[
FixtureTransaction.from_transaction(
Transaction().with_signature_and_sender()
Transaction(
gas_limit=0x5208
).with_signature_and_sender()
)
],
),
Expand Down Expand Up @@ -475,7 +483,10 @@
),
txs=[
FixtureTransaction.from_transaction(
Transaction(to=None).with_signature_and_sender()
Transaction(
to=None,
gas_limit=0x5208,
).with_signature_and_sender()
)
],
),
Expand Down Expand Up @@ -615,6 +626,7 @@
max_fee_per_gas=20,
max_fee_per_blob_gas=30,
blob_versioned_hashes=[0, 1],
gas_limit=0x5208,
).with_signature_and_sender(),
],
withdrawals=[
Expand Down Expand Up @@ -642,6 +654,7 @@
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -701,6 +714,7 @@
transactions=[
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -767,6 +781,7 @@
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -861,6 +876,7 @@
transactions=[
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -926,6 +942,7 @@
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1205,6 +1222,7 @@ def test_json_deserialization(
transactions=[
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1249,6 +1267,7 @@ def test_json_deserialization(
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1308,6 +1327,7 @@ def test_json_deserialization(
transactions=[
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1354,6 +1374,7 @@ def test_json_deserialization(
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1415,6 +1436,7 @@ def test_json_deserialization(
transactions=[
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down Expand Up @@ -1480,6 +1502,7 @@ def test_json_deserialization(
"transactions": [
Transaction(
to=0x1234,
gas_limit=0x5208,
data=b"\x01\x00",
access_list=[
AccessList(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
EIP-7883: ModExp Gas Cost Increase.

Increases cost of ModExp precompile.

https://eips.ethereum.org/EIPS/eip-7883
"""

from ....base_fork import BaseFork


class EIP7883(BaseFork):
"""EIP-7883 class."""

pass
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ class Osaka(
eips.EIP7918,
eips.EIP7594,
eips.EIP7951,
eips.EIP7883,
Prague,
solc_name="cancun",
):
Expand Down
25 changes: 24 additions & 1 deletion packages/testing/src/execution_testing/specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,30 @@ def generate_block_data(
block_number=env.number, timestamp=env.timestamp
)
env = env.set_fork_requirements(fork)
txs = [tx.with_signature_and_sender() for tx in block.txs]
txs = block.txs[:]
if any(tx.gas_limit is None for tx in block.txs):
available_gas = env.gas_limit
tx_unset_gas_limit_count = 0
for tx in block.txs:
if tx.gas_limit is None:
tx_unset_gas_limit_count += 1
else:
available_gas -= tx.gas_limit
if available_gas <= 0:
raise Exception(
"test correctness: unable to automatically calculate gas "
"limit for transactions (No remaining gas)."
)
max_gas_limit = available_gas // tx_unset_gas_limit_count
tx_gas_limit_cap = fork.transaction_gas_limit_cap()
if fork.is_eip_enabled(8037):
tx_gas_limit_cap = None
if tx_gas_limit_cap:
max_gas_limit = min(max_gas_limit, tx_gas_limit_cap)
for i in range(len(txs)):
if txs[i].gas_limit is None:
txs[i] = txs[i].with_gas_limit(max_gas_limit)
txs = [tx.with_signature_and_sender() for tx in txs]

if failing_tx_count := len([tx for tx in txs if tx.error]) > 0:
if failing_tx_count > 1:
Expand Down
Loading
Loading