@@ -742,6 +742,11 @@ async def test_async_sign_authorization_and_send_raw_set_code_transaction(
742
742
}
743
743
signed_auth = keyfile_account .sign_authorization (auth )
744
744
745
+ # get current math counter and increase it only in the delegation by n
746
+ math_counter = await async_math_contract .functions .counter ().call ()
747
+ built_tx = await async_math_contract .functions .incrementCounter (
748
+ math_counter + 1337
749
+ ).build_transaction ({})
745
750
txn : TxParams = {
746
751
"chainId" : chain_id ,
747
752
"to" : keyfile_account .address ,
@@ -750,7 +755,7 @@ async def test_async_sign_authorization_and_send_raw_set_code_transaction(
750
755
"nonce" : nonce ,
751
756
"maxPriorityFeePerGas" : Wei (10 ** 9 ),
752
757
"maxFeePerGas" : Wei (10 ** 9 ),
753
- "data" : HexBytes ( "0x" ) ,
758
+ "data" : built_tx [ "data" ] ,
754
759
"authorizationList" : [signed_auth ],
755
760
}
756
761
@@ -761,6 +766,13 @@ async def test_async_sign_authorization_and_send_raw_set_code_transaction(
761
766
762
767
code = await async_w3 .eth .get_code (keyfile_account .address )
763
768
assert code .to_0x_hex () == f"0xef0100{ async_math_contract .address [2 :].lower ()} "
769
+ delegated = async_w3 .eth .contract (
770
+ address = keyfile_account .address , abi = async_math_contract .abi
771
+ )
772
+ # assert the math counter is increased by 1337 only in delegated acct
773
+ assert await async_math_contract .functions .counter ().call () == math_counter
774
+ delegated_call = await delegated .functions .counter ().call ()
775
+ assert delegated_call == math_counter + 1337
764
776
765
777
assert len (get_tx ["authorizationList" ]) == 1
766
778
get_auth = get_tx ["authorizationList" ][0 ]
@@ -3868,6 +3880,11 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
3868
3880
}
3869
3881
signed_auth = keyfile_account .sign_authorization (auth )
3870
3882
3883
+ # get current math counter and increase it only in the delegation by n
3884
+ math_counter = math_contract .functions .counter ().call ()
3885
+ data = math_contract .functions .incrementCounter (
3886
+ math_counter + 1337
3887
+ ).build_transaction ({})["data" ]
3871
3888
txn : TxParams = {
3872
3889
"chainId" : chain_id ,
3873
3890
"to" : keyfile_account .address ,
@@ -3876,7 +3893,7 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
3876
3893
"nonce" : nonce ,
3877
3894
"maxPriorityFeePerGas" : Wei (10 ** 9 ),
3878
3895
"maxFeePerGas" : Wei (10 ** 9 ),
3879
- "data" : HexBytes ( "0x" ) ,
3896
+ "data" : data ,
3880
3897
"authorizationList" : [signed_auth ],
3881
3898
}
3882
3899
@@ -3887,6 +3904,12 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
3887
3904
3888
3905
code = w3 .eth .get_code (keyfile_account .address )
3889
3906
assert code .to_0x_hex () == f"0xef0100{ math_contract .address [2 :].lower ()} "
3907
+ delegated = w3 .eth .contract (
3908
+ address = keyfile_account .address , abi = math_contract .abi
3909
+ )
3910
+ # assert the math counter is increased by 1337 only in delegated acct
3911
+ assert math_contract .functions .counter ().call () == math_counter
3912
+ assert delegated .functions .counter ().call () == math_counter + 1337
3890
3913
3891
3914
assert len (get_tx ["authorizationList" ]) == 1
3892
3915
get_auth = get_tx ["authorizationList" ][0 ]
@@ -3897,7 +3920,7 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
3897
3920
assert isinstance (get_auth ["r" ], HexBytes )
3898
3921
assert isinstance (get_auth ["s" ], HexBytes )
3899
3922
3900
- # reset code
3923
+ # reset storage value and code
3901
3924
reset_auth = {
3902
3925
"chainId" : chain_id ,
3903
3926
"address" : "0x" + ("00" * 20 ),
0 commit comments