Skip to content

test_basic_tload_transaction_begin()

Documentation for tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_transaction_begin@21fb11c8.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_transaction_begin --fork Prague

Ported .json vectors.

(01_tloadBeginningTxnFiller.yml) load arbitrary value is 0 at beginning of transaction

Source code in tests/cancun/eip1153_tstore/test_basic_tload.py
19
20
21
22
23
24
25
26
27
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
@pytest.mark.valid_from("Cancun")
def test_basic_tload_transaction_begin(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """
    Ported .json vectors.

    (01_tloadBeginningTxnFiller.yml)
    load arbitrary value is 0 at beginning of transaction
    """
    slot_tload_at_transaction_begin_result = 1
    slot_code_worked = 2

    address_to = pre.deploy_contract(
        code=Op.JUMPDEST()
        # 01 test
        + Op.SSTORE(slot_tload_at_transaction_begin_result, Op.TLOAD(0))
        + Op.SSTORE(slot_code_worked, 1),
        storage={
            slot_tload_at_transaction_begin_result: 0xFF,
        },
    )

    post = {
        address_to: Account(
            storage={
                slot_tload_at_transaction_begin_result: 0x00,
                slot_code_worked: 0x01,
            }
        )
    }

    tx = Transaction(
        sender=pre.fund_eoa(7_000_000_000_000_000_000),
        to=address_to,
        gas_price=10,
        data=b"",
        gas_limit=5000000,
        value=0,
    )

    state_test(env=Environment(), pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated)
...fork_Cancun-state_test
...fork_Cancun-blockchain_test_from_state_test
...fork_Prague-state_test
...fork_Prague-blockchain_test_from_state_test
...fork_Osaka-state_test
...fork_Osaka-blockchain_test_from_state_test