Skip to content

Commit

Permalink
fix(tests): Remove type-2 txs, destination account is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Jan 22, 2025
1 parent 3642881 commit 41f00a1
Showing 1 changed file with 33 additions and 39 deletions.
72 changes: 33 additions & 39 deletions tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,9 @@ def pre_fork_blocks(
),
sender=sender,
)
if pre_fork_blobs_per_block > 0
else Transaction(
ty=2,
to=destination_account,
value=1,
gas_limit=3_000_000,
max_fee_per_gas=1_000_000,
max_priority_fee_per_gas=10,
access_list=[],
sender=sender,
)
],
]
if pre_fork_blobs_per_block > 0
else [],
timestamp=t,
)
for t in range(999, FORK_TIMESTAMP, 1_000)
Expand Down Expand Up @@ -132,7 +123,8 @@ def post_fork_blobs_per_block(fork: Fork) -> int:

@pytest.fixture
def destination_account(pre: Alloc) -> Address: # noqa: D103
return pre.deploy_contract(Op.STOP)
# Empty account to receive the blobs
return pre.fund_eoa(amount=0)


@pytest.fixture
Expand Down Expand Up @@ -162,33 +154,28 @@ def post_fork_blocks(
"""Generate blocks past the fork."""
blocks = []
for i in range(post_fork_block_count):
txs = [
Transaction(
ty=Spec.BLOB_TX_TYPE,
to=destination_account,
value=1,
gas_limit=3_000_000,
max_fee_per_gas=1_000_000,
max_priority_fee_per_gas=10,
max_fee_per_blob_gas=100,
blob_versioned_hashes=add_kzg_version(
[Hash(x) for x in range(post_fork_blobs_per_block)],
Spec.BLOB_COMMITMENT_VERSION_KZG,
),
sender=sender,
)
txs = (
[
Transaction(
ty=Spec.BLOB_TX_TYPE,
to=destination_account,
value=1,
gas_limit=3_000_000,
max_fee_per_gas=1_000_000,
max_priority_fee_per_gas=10,
max_fee_per_blob_gas=100,
blob_versioned_hashes=add_kzg_version(
[Hash(x) for x in range(post_fork_blobs_per_block)],
Spec.BLOB_COMMITMENT_VERSION_KZG,
),
sender=sender,
)
]
if post_fork_blobs_per_block > 0
else Transaction(
ty=2,
to=destination_account,
value=1,
gas_limit=3_000_000,
max_fee_per_gas=1_000_000,
max_priority_fee_per_gas=10,
sender=sender,
)
]
else []
)
if i == 0:
# Check the excess blob gas on the first block of the new fork
blocks.append(
Block(
txs=txs,
Expand All @@ -203,11 +190,18 @@ def post_fork_blocks(
@pytest.fixture
def post( # noqa: D103
pre_fork_blocks: List[Block],
pre_fork_blobs_per_block: int,
post_fork_block_count: int,
post_fork_blobs_per_block: int,
destination_account: Address,
) -> Mapping[Address, Account]:
pre_fork_value = len(pre_fork_blocks) if pre_fork_blobs_per_block > 0 else 0
post_fork_value = post_fork_block_count if post_fork_blobs_per_block > 0 else 0
total_value = pre_fork_value + post_fork_value
if total_value == 0:
return {}
return {
destination_account: Account(balance=post_fork_block_count + len(pre_fork_blocks)),
destination_account: Account(balance=total_value),
}


Expand Down

0 comments on commit 41f00a1

Please sign in to comment.