Skip to content

Commit bb2a383

Browse files
committed
refactor(tests): EIP-4844: Add gas used check to precompile tests
1 parent fc90a1c commit bb2a383

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

tests/cancun/eip4844_blobs/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from ethereum_test_tools import (
77
Address,
8+
Hash,
89
TestAddress,
910
YulCompiler,
1011
add_kzg_version,
@@ -263,7 +264,7 @@ class BlobhashScenario:
263264
"""A utility class for generating blobhash calls."""
264265

265266
@staticmethod
266-
def create_blob_hashes_list(length: int, max_blobs_per_block: int) -> list[list[bytes]]:
267+
def create_blob_hashes_list(length: int, max_blobs_per_block: int) -> List[List[Hash]]:
267268
"""
268269
Create list of MAX_BLOBS_PER_BLOCK blob hashes
269270
using `random_blob_hashes`.

tests/cancun/eip4844_blobs/test_blob_txs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def blobs_per_tx() -> List[int]:
101101

102102

103103
@pytest.fixture
104-
def blob_hashes_per_tx(blobs_per_tx: List[int]) -> List[List[bytes]]:
104+
def blob_hashes_per_tx(blobs_per_tx: List[int]) -> List[List[Hash]]:
105105
"""
106106
Produce the list of blob hashes that are sent during the test.
107107

tests/cancun/eip4844_blobs/test_blobhash_opcode_contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def create_opcode_context(pre, tx, post):
4242
@pytest.fixture()
4343
def simple_blob_hashes(
4444
max_blobs_per_block: int,
45-
) -> List[bytes]:
45+
) -> List[Hash]:
4646
"""Return a simple list of blob versioned hashes ranging from bytes32(1 to 4)."""
4747
return add_kzg_version(
4848
[(1 << x) for x in range(max_blobs_per_block)],

tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
StateTestFiller,
5151
Storage,
5252
Transaction,
53+
TransactionReceipt,
5354
call_return_code,
5455
)
5556
from ethereum_test_tools.vm.opcode import Opcodes as Op
@@ -532,8 +533,7 @@ def test_tx_entry_point(
532533
- Using `gas_limit` with exact necessary gas, insufficient gas and extra gas.
533534
- Using correct and incorrect proofs
534535
"""
535-
start_balance = 10**18
536-
sender = pre.fund_eoa(amount=start_balance)
536+
sender = pre.fund_eoa()
537537

538538
# Starting from EIP-7623, we need to use an access list to raise the intrinsic gas cost to be
539539
# above the floor data cost.
@@ -557,21 +557,19 @@ def test_tx_entry_point(
557557
access_list=access_list,
558558
return_cost_deducted_prior_execution=True,
559559
)
560-
fee_per_gas = 7
561560

562561
tx = Transaction(
563562
sender=sender,
564563
data=precompile_input,
565564
access_list=access_list,
566565
to=Address(Spec.POINT_EVALUATION_PRECOMPILE_ADDRESS),
567566
gas_limit=call_gas + intrinsic_gas_cost,
568-
gas_price=fee_per_gas,
567+
expected_receipt=TransactionReceipt(gas_used=consumed_gas),
569568
)
570569

571570
post = {
572571
sender: Account(
573572
nonce=1,
574-
balance=start_balance - (consumed_gas * fee_per_gas),
575573
)
576574
}
577575

0 commit comments

Comments
 (0)