File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
prague/eip7702_set_code_tx Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,66 @@ def test_set_code_to_sstore(
216216 )
217217
218218
219+ @pytest .mark .parametrize (
220+ "auth_signer_nonce" ,
221+ [
222+ pytest .param (
223+ 0 ,
224+ id = "zero_nonce" ,
225+ marks = pytest .mark .execute (pytest .mark .skip ("unrealistic scenario" )),
226+ ),
227+ pytest .param (None , id = "non_zero_nonce" ),
228+ ],
229+ )
230+ def test_set_code_to_non_empty_storage (
231+ state_test : StateTestFiller ,
232+ pre : Alloc ,
233+ auth_signer_nonce : int ,
234+ ):
235+ """
236+ Test the setting the code to an account that has non-empty storage.
237+ """
238+ auth_signer = pre .fund_eoa (
239+ amount = 0 ,
240+ storage = Storage ({0 : 1 }), # type: ignore
241+ nonce = auth_signer_nonce ,
242+ )
243+ sender = pre .fund_eoa ()
244+
245+ set_code = Op .SSTORE (0 , Op .ADD (Op .SLOAD (0 ), 1 )) + Op .STOP
246+ set_code_to_address = pre .deploy_contract (
247+ set_code ,
248+ )
249+
250+ tx = Transaction (
251+ gas_limit = 500_000 ,
252+ to = auth_signer ,
253+ value = 0 ,
254+ authorization_list = [
255+ AuthorizationTuple (
256+ address = set_code_to_address ,
257+ nonce = auth_signer .nonce ,
258+ signer = auth_signer ,
259+ ),
260+ ],
261+ sender = sender ,
262+ )
263+
264+ state_test (
265+ env = Environment (),
266+ pre = pre ,
267+ tx = tx ,
268+ post = {
269+ set_code_to_address : Account (
270+ storage = {},
271+ ),
272+ auth_signer : Account (
273+ storage = {0 : 2 },
274+ ),
275+ },
276+ )
277+
278+
219279def test_set_code_to_sstore_then_sload (
220280 blockchain_test : BlockchainTestFiller ,
221281 pre : Alloc ,
You can’t perform that action at this time.
0 commit comments