test_gas_costs()
Documentation for tests/byzantium/eip197_ec_pairing/test_gas.py::test_gas_costs@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/byzantium/eip197_ec_pairing/test_gas.py::test_gas_costs --fork Bogota
Test the base gas cost of the ecpairing precompile with zero pairs.
Source code in tests/byzantium/eip197_ec_pairing/test_gas.py
| @pytest.mark.valid_from("Byzantium")
@pytest.mark.parametrize("enough_gas", [True, False])
def test_gas_costs(
state_test: StateTestFiller,
pre: Alloc,
precompile_gas: int,
enough_gas: bool,
) -> None:
"""
Test the base gas cost of the ecpairing precompile with zero pairs.
"""
gas = precompile_gas if enough_gas else precompile_gas - 1
storage = Storage()
account = pre.deploy_contract(
code=Op.SSTORE(
storage.store_next(1 if enough_gas else 0),
Op.STATICCALL(gas=gas, address=Spec.ECPAIRING),
),
storage=storage.canary(),
)
tx = Transaction(
to=account,
sender=pre.fund_eoa(),
gas_limit=1_000_000,
protected=True,
)
post = {account: Account(storage=storage)}
state_test(pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 2 parametrized test cases across 13 forks.