|
37 | 37 | )
|
38 | 38 | from eth_utils.toolz import (
|
39 | 39 | assoc,
|
| 40 | + merge, |
40 | 41 | )
|
41 | 42 | from hexbytes import (
|
42 | 43 | HexBytes,
|
@@ -717,7 +718,7 @@ async def test_async_sign_and_send_raw_middleware(
|
717 | 718 | async_w3.middleware_onion.remove("signing")
|
718 | 719 |
|
719 | 720 | @pytest.mark.asyncio
|
720 |
| - async def test_async_sign_authorization_and_send_raw_set_code_transaction( |
| 721 | + async def test_async_sign_authorization_send_raw_and_send_set_code_transactions( |
721 | 722 | self,
|
722 | 723 | async_w3: "AsyncWeb3",
|
723 | 724 | keyfile_account_pkey: HexStr,
|
@@ -752,6 +753,7 @@ async def test_async_sign_authorization_and_send_raw_set_code_transaction(
|
752 | 753 | "authorizationList": [signed_auth],
|
753 | 754 | }
|
754 | 755 |
|
| 756 | + # test eth_sendRawTransaction |
755 | 757 | signed = keyfile_account.sign_transaction(txn)
|
756 | 758 | tx_hash = await async_w3.eth.send_raw_transaction(signed.raw_transaction)
|
757 | 759 | get_tx = await async_w3.eth.get_transaction(tx_hash)
|
@@ -790,14 +792,17 @@ async def test_async_sign_authorization_and_send_raw_set_code_transaction(
|
790 | 792 | "nonce": nonce + 3,
|
791 | 793 | }
|
792 | 794 | signed_reset_auth = keyfile_account.sign_authorization(reset_auth)
|
793 |
| - new_txn = dict(txn) |
794 |
| - new_txn["authorizationList"] = [signed_reset_auth] |
795 |
| - new_txn["nonce"] = nonce + 2 |
796 |
| - |
797 |
| - signed_reset = keyfile_account.sign_transaction(new_txn) |
798 |
| - reset_tx_hash = await async_w3.eth.send_raw_transaction( |
799 |
| - signed_reset.raw_transaction |
| 795 | + reset_code_txn = merge( |
| 796 | + txn, |
| 797 | + { |
| 798 | + "from": keyfile_account.address, |
| 799 | + "authorizationList": [signed_reset_auth], |
| 800 | + "nonce": nonce + 2, |
| 801 | + }, |
800 | 802 | )
|
| 803 | + |
| 804 | + # test eth_sendTransaction |
| 805 | + reset_tx_hash = await async_w3.eth.send_transaction(reset_code_txn) |
801 | 806 | reset_tx_receipt = await async_w3.eth.wait_for_transaction_receipt(
|
802 | 807 | reset_tx_hash, timeout=10
|
803 | 808 | )
|
@@ -3867,7 +3872,7 @@ def test_sign_and_send_raw_middleware(
|
3867 | 3872 | # cleanup
|
3868 | 3873 | w3.middleware_onion.remove("signing")
|
3869 | 3874 |
|
3870 |
| - def test_sign_authorization_and_send_raw_set_code_transaction( |
| 3875 | + def test_sign_authorization_send_raw_and_send_set_code_transactions( |
3871 | 3876 | self, w3: "Web3", keyfile_account_pkey: HexStr, math_contract: "Contract"
|
3872 | 3877 | ) -> None:
|
3873 | 3878 | # TODO: remove blockNumber block_id from eth_call and eth_getCode calls once
|
@@ -3899,6 +3904,7 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
|
3899 | 3904 | "authorizationList": [signed_auth],
|
3900 | 3905 | }
|
3901 | 3906 |
|
| 3907 | + # test eth_sendRawTransaction |
3902 | 3908 | signed = keyfile_account.sign_transaction(txn)
|
3903 | 3909 | tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
|
3904 | 3910 | get_tx = w3.eth.get_transaction(tx_hash)
|
@@ -3939,12 +3945,17 @@ def test_sign_authorization_and_send_raw_set_code_transaction(
|
3939 | 3945 | "nonce": nonce + 3,
|
3940 | 3946 | }
|
3941 | 3947 | signed_reset_auth = keyfile_account.sign_authorization(reset_auth)
|
3942 |
| - new_txn = dict(txn) |
3943 |
| - new_txn["authorizationList"] = [signed_reset_auth] |
3944 |
| - new_txn["nonce"] = nonce + 2 |
| 3948 | + reset_code_txn = merge( |
| 3949 | + txn, |
| 3950 | + { |
| 3951 | + "from": keyfile_account.address, |
| 3952 | + "authorizationList": [signed_reset_auth], |
| 3953 | + "nonce": nonce + 2, |
| 3954 | + }, |
| 3955 | + ) |
3945 | 3956 |
|
3946 |
| - signed_reset = keyfile_account.sign_transaction(new_txn) |
3947 |
| - reset_tx_hash = w3.eth.send_raw_transaction(signed_reset.raw_transaction) |
| 3957 | + # test eth_sendTransaction |
| 3958 | + reset_tx_hash = w3.eth.send_transaction(reset_code_txn) |
3948 | 3959 | reset_tx_receipt = w3.eth.wait_for_transaction_receipt(
|
3949 | 3960 | reset_tx_hash, timeout=10
|
3950 | 3961 | )
|
|
0 commit comments