test_basic_tload_works()
Documentation for tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_works@a86d4327
.
Generate fixtures for these test cases for Cancun with:
Cancun only:
fill -v tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_works --fork=Cancun --evm-bin=/path/to/evm-tool-dev-version
For all forks up to and including Cancun:
fill -v tests/cancun/eip1153_tstore/test_basic_tload.py::test_basic_tload_works --until=Cancun
Ported .json vectors:
(02_tloadAfterTstoreFiller.yml)
tload from same slot after tstore returns correct value
Source code in tests/cancun/eip1153_tstore/test_basic_tload.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113 | @pytest.mark.valid_from("Cancun")
def test_basic_tload_works(
state_test: StateTestFiller,
pre: Alloc,
):
"""
Ported .json vectors:
(02_tloadAfterTstoreFiller.yml)
tload from same slot after tstore returns correct value
"""
tstore_value = 88
slot_tload_after_tstore_result = 0
slot_tload_after_tstore_result_second_time = 1
slot_code_worked = 2
address_to = pre.deploy_contract(
code=Op.JUMPDEST()
# 02 test
+ Op.TSTORE(2, tstore_value)
+ Op.SSTORE(slot_tload_after_tstore_result, Op.TLOAD(2))
+ Op.SSTORE(slot_tload_after_tstore_result_second_time, Op.TLOAD(2))
+ Op.SSTORE(slot_code_worked, 1),
storage={
slot_tload_after_tstore_result: 0xFF,
slot_tload_after_tstore_result_second_time: 0xFF,
},
)
post = {
address_to: Account(
storage={
slot_tload_after_tstore_result: tstore_value,
slot_tload_after_tstore_result_second_time: tstore_value,
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)
|