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