Skip to content

test_basic_tload_after_store()

Documentation for tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_after_store@49a16fac.

Generate fixtures for these test cases for Prague with:

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

Ported .json vectors.

(18_tloadAfterStoreFiller.yml) tload from same slot after store returns 0

Source code in tests/cancun/eip1153_tstore/test_basic_tload.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
@pytest.mark.valid_from("Cancun")
def test_basic_tload_after_store(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """
    Ported .json vectors.

    (18_tloadAfterStoreFiller.yml)
    tload from same slot after store returns 0
    """
    slot_tload_from_sstore_result = 1
    slot_code_worked = 2

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

    post: Dict[Address, Union[Account, object]] = {}
    post[address_to] = Account(
        storage={
            slot_tload_from_sstore_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-blockchain_test
...fork_Cancun-state_test
...fork_Prague-blockchain_test
...fork_Prague-state_test
...fork_Osaka-blockchain_test
...fork_Osaka-state_test