test_reentrant_selfdestructing_call()
Documentation for tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py::test_reentrant_selfdestructing_call@892e6d1e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py::test_reentrant_selfdestructing_call --fork Amsterdam
Test transient storage in different reentrancy contexts after
selfdestructing.
Source code in tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py
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
285
286
287
288 | @SelfDestructCases.parametrize()
def test_reentrant_selfdestructing_call(
state_test: StateTestFiller,
pre: Alloc,
pre_existing_contract: bool,
caller_bytecode: Bytecode,
callee_bytecode: Bytecode,
expected_storage: Dict,
) -> None:
"""
Test transient storage in different reentrancy contexts after
selfdestructing.
"""
env = Environment()
caller_address = pre.deploy_contract(code=caller_bytecode)
data: bytes | Bytecode
if pre_existing_contract:
callee_address = pre.deploy_contract(code=callee_bytecode)
data = Hash(callee_address, left_padding=True)
else:
callee_address = compute_create_address(
address=caller_address, nonce=1
)
data = Initcode(deploy_code=callee_bytecode)
tx = Transaction(
sender=pre.fund_eoa(),
to=caller_address,
gas_limit=1_000_000,
data=data,
)
post_storage = {**expected_storage, 0: callee_address}
post: Dict = {caller_address: Account(storage=post_storage)}
if pre_existing_contract:
post[callee_address] = Account(code=callee_bytecode)
else:
post[callee_address] = Account.NONEXISTENT
state_test(env=env, pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 6 parametrized test cases across 4 forks.