Skip to content

test_basic_tload_other_after_tstore()

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

Generate fixtures for these test cases for Prague with:

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

Ported .json vectors.

(03_tloadAfterStoreIs0Filler.yml) Loading any other slot after storing to a slot returns 0.

Source code in tests/cancun/eip1153_tstore/test_basic_tload.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@pytest.mark.valid_from("Cancun")
def test_basic_tload_other_after_tstore(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """
    Ported .json vectors.

    (03_tloadAfterStoreIs0Filler.yml)
    Loading any other slot after storing to a slot returns 0.
    """
    tstore_value = 88

    slot_tload_untouched_slot_after_tstore_result = 1
    slot_code_worked = 2

    address_to = pre.deploy_contract(
        code=Op.JUMPDEST()
        # 03 test
        + Op.TSTORE(3, tstore_value)
        + Op.SSTORE(slot_tload_untouched_slot_after_tstore_result, Op.TLOAD(0))
        + Op.SSTORE(slot_code_worked, 1),
        storage={
            slot_tload_untouched_slot_after_tstore_result: 0xFF,
        },
    )

    post = {
        address_to: Account(
            storage={
                slot_tload_untouched_slot_after_tstore_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