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@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

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

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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@pytest.mark.ported_from(
    [
        "https://github.com/ethereum/tests/blob/v13.3/src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0Filler.yml",
    ],
    pr=["https://github.com/ethereum/execution-spec-tests/pull/440"],
)
@pytest.mark.valid_from("Cancun")
def test_basic_tload_other_after_tstore(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    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 generates 1 parametrized test case across 4 forks.