Skip to content

test_blake2b_large_gas_limit()

Documentation for tests/istanbul/eip152_blake2/test_blake2.py::test_blake2b_large_gas_limit@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/istanbul/eip152_blake2/test_blake2.py::test_blake2b_large_gas_limit --fork Bogota

Test BLAKE2b precompile with large gas limit.

Source code in tests/istanbul/eip152_blake2/test_blake2.py
@pytest.mark.valid_from("Istanbul")
@pytest.mark.parametrize("call_opcode", [Op.CALL, Op.CALLCODE])
@pytest.mark.parametrize(
    ["data", "output"],
    [
        pytest.param(
            Blake2bInput(
                rounds=100_000,
            ),
            ExpectedOutput(
                data_1="0x165da71a32e91bca2623bfaeab079f7e6edfba2259028cc854ec497f9fb0fe75",
                data_2="0xd37f63034b83f4a0a07cd238483874862921ef0c40630826a76e41bf3b02ffe3",
            ),
            id="EIP-152-modified-case8-data9-large-gas-limit",
        ),
    ],
)
@pytest.mark.slow()
def test_blake2b_large_gas_limit(
    state_test: StateTestFiller,
    pre: Alloc,
    call_opcode: Op,
    blake2b_contract_bytecode: Bytecode,
    data: Blake2bInput | bytes,
    output: ExpectedOutput,
) -> None:
    """Test BLAKE2b precompile with large gas limit."""
    account = pre.deploy_contract(
        blake2b_contract_bytecode, storage={0: 0xDEADBEEF}
    )
    sender = pre.fund_eoa()

    tx = Transaction(to=account, data=data, sender=sender)

    post = {
        account: Account(storage={0: 0x1, 1: output.data_1, 2: output.data_2})
    }
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 2 parametrized test cases across 10 forks.