Skip to content

test_system_contract_deployment()

Documentation for tests/prague/eip7251_consolidations/test_contract_deployment.py::test_system_contract_deployment@83970623.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip7251_consolidations/test_contract_deployment.py::test_system_contract_deployment --fork Prague

Verify calling the consolidation system contract after deployment.

Source code in tests/prague/eip7251_consolidations/test_contract_deployment.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@generate_system_contract_deploy_test(
    fork=Prague,
    tx_json_path=Path(realpath(__file__)).parent / "contract_deploy_tx.json",
    expected_deploy_address=Address(Spec.CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS),
)
def test_system_contract_deployment(
    *,
    fork: Fork,
    pre: Alloc,
    **kwargs,
) -> Generator[Block, None, None]:
    """Verify calling the consolidation system contract after deployment."""
    sender = pre.fund_eoa()
    consolidation_request = ConsolidationRequest(
        source_pubkey=0x01,
        target_pubkey=0x02,
        fee=Spec.get_fee(0),
        source_address=sender,
    )
    pre.fund_address(sender, consolidation_request.value)
    intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
    test_transaction_gas = intrinsic_gas_calculator(calldata=consolidation_request.calldata)

    test_transaction = Transaction(
        data=consolidation_request.calldata,
        gas_limit=test_transaction_gas * 10,
        to=Spec.CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS,
        sender=sender,
        value=consolidation_request.value,
    )

    yield Block(
        txs=[test_transaction],
        header=Header(
            requests_hash=Requests(consolidation_request),
        ),
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) test_type has_balance
...fork_CancunToPragueAtTime15k-blockchain_test-deploy_before_fork-nonzero_balance DeploymentTestType.DEPLOY_BEFORE_FORK ContractAddressHasBalance.NONZERO_BALANCE
...fork_CancunToPragueAtTime15k-blockchain_test-deploy_before_fork-zero_balance DeploymentTestType.DEPLOY_BEFORE_FORK ContractAddressHasBalance.ZERO_BALANCE
...fork_CancunToPragueAtTime15k-blockchain_test-deploy_after_fork-nonzero_balance DeploymentTestType.DEPLOY_AFTER_FORK ContractAddressHasBalance.NONZERO_BALANCE
...fork_CancunToPragueAtTime15k-blockchain_test-deploy_after_fork-zero_balance DeploymentTestType.DEPLOY_AFTER_FORK ContractAddressHasBalance.ZERO_BALANCE