Skip to content

Commit

Permalink
feat(tests): Add blob gas subtraction order tests revision.
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-tb committed Jan 28, 2024
1 parent 464b83a commit 4be8852
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions tests/cancun/eip4844_blobs/test_blob_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,20 +892,6 @@ def test_sufficient_balance_blob_tx_pre_fund_tx(
)


@pytest.mark.parametrize(
"tx_access_list",
[[], [AccessList(address=100, storage_keys=[100, 200])]],
ids=["no_access_list", "access_list"],
)
@pytest.mark.parametrize("tx_max_fee_per_gas", [7, 14])
@pytest.mark.parametrize("tx_max_priority_fee_per_gas", [0, 7])
@pytest.mark.parametrize("tx_value", [0, 1])
@pytest.mark.parametrize(
"tx_calldata",
[b"", b"\x00", b"\x01"],
ids=["no_calldata", "single_zero_calldata"],
)
@pytest.mark.parametrize("tx_max_fee_per_blob_gas", [1, 100])
@pytest.mark.parametrize(
"tx_gas", [500_000], ids=[""]
) # Increase gas to account for contract code
Expand All @@ -918,16 +904,12 @@ def test_blob_gas_subtraction_tx(
txs: List[Transaction],
destination_account: str,
mid_tx_send_amount: int,
total_account_minimum_balance: int,
):
"""
Check that the blob gas fee for a transaction is subtracted from the sender balance before the
transaction is executed, including:
- Transactions with max fee equal or higher than current block base fee
- Transactions with and without priority fee
- Transactions with and without value
- Transactions with and without calldata
- Transactions with max fee per blob gas lower or higher than the priority fee
- Transactions where an externally owned account sends funds to the sender mid execution
"""
assert len(txs) == 1
Expand All @@ -937,9 +919,17 @@ def test_blob_gas_subtraction_tx(
+ Op.CALL(Op.GAS, Op.ORIGIN, mid_tx_send_amount, 0, 0, 0, 0)
+ Op.SSTORE(1, Op.BALANCE(Op.ORIGIN)),
)
post = {
destination_account: Account(
storage={
0: pre[TestAddress].balance - total_account_minimum_balance,
1: pre[TestAddress].balance - total_account_minimum_balance + mid_tx_send_amount,
}
)
}
state_test(
pre=pre,
post={},
post=post,
tx=txs[0],
env=state_env,
)
Expand Down

0 comments on commit 4be8852

Please sign in to comment.