web3 7.11.0__py3-none-any.whl → 7.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/decorators.py +2 -2
- web3/_utils/error_formatters_utils.py +17 -0
- web3/_utils/filters.py +39 -28
- web3/_utils/method_formatters.py +2 -0
- web3/_utils/module_testing/eth_module.py +83 -34
- web3/eth/async_eth.py +4 -0
- web3/eth/eth.py +15 -2
- web3/method.py +10 -2
- web3/providers/persistent/async_ipc.py +3 -1
- web3/providers/persistent/subscription_manager.py +1 -0
- web3/utils/abi.py +1 -1
- {web3-7.11.0.dist-info → web3-7.11.1.dist-info}/METADATA +56 -69
- {web3-7.11.0.dist-info → web3-7.11.1.dist-info}/RECORD +38 -38
- {web3-7.11.0.dist-info → web3-7.11.1.dist-info}/WHEEL +1 -1
- {web3-7.11.0.dist-info/licenses → web3-7.11.1.dist-info}/LICENSE +0 -0
- {web3-7.11.0.dist-info → web3-7.11.1.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.30.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/StringContract.sol:StringContract
|
|
7
|
-
STRING_CONTRACT_BYTECODE = "
|
|
8
|
-
STRING_CONTRACT_RUNTIME = "
|
|
7
|
+
STRING_CONTRACT_BYTECODE = "0x608060405234801561000f575f5ffd5b50604051610c1a380380610c1a83398181016040528101906100319190610193565b805f908161003f91906103ea565b50506104b9565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100a58261005f565b810181811067ffffffffffffffff821117156100c4576100c361006f565b5b80604052505050565b5f6100d6610046565b90506100e2828261009c565b919050565b5f67ffffffffffffffff8211156101015761010061006f565b5b61010a8261005f565b9050602081019050919050565b8281835e5f83830152505050565b5f610137610132846100e7565b6100cd565b9050828152602081018484840111156101535761015261005b565b5b61015e848285610117565b509392505050565b5f82601f83011261017a57610179610057565b5b815161018a848260208601610125565b91505092915050565b5f602082840312156101a8576101a761004f565b5b5f82015167ffffffffffffffff8111156101c5576101c4610053565b5b6101d184828501610166565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061022857607f821691505b60208210810361023b5761023a6101e4565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261029d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610262565b6102a78683610262565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6102eb6102e66102e1846102bf565b6102c8565b6102bf565b9050919050565b5f819050919050565b610304836102d1565b610318610310826102f2565b84845461026e565b825550505050565b5f5f905090565b61032f610320565b61033a8184846102fb565b505050565b5b8181101561035d576103525f82610327565b600181019050610340565b5050565b601f8211156103a25761037381610241565b61037c84610253565b8101602085101561038b578190505b61039f61039785610253565b83018261033f565b50505b505050565b5f82821c905092915050565b5f6103c25f19846008026103a7565b1980831691505092915050565b5f6103da83836103b3565b9150826002028217905092915050565b6103f3826101da565b67ffffffffffffffff81111561040c5761040b61006f565b5b6104168254610211565b610421828285610361565b5f60209050601f831160018114610452575f8415610440578287015190505b61044a85826103cf565b8655506104b1565b601f19841661046086610241565b5f5b8281101561048757848901518255600182019150602085019450602081019050610462565b868310156104a457848901516104a0601f8916826103b3565b8355505b6001600288020188555050505b505050505050565b610754806104c65f395ff3fe608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea264697066735822122062c13ebbeffccc0fada8dca300714023d382cee7cbd94c78a6bcf2350afd835d64736f6c634300081e0033" # noqa: E501
|
|
8
|
+
STRING_CONTRACT_RUNTIME = "0x608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea264697066735822122062c13ebbeffccc0fada8dca300714023d382cee7cbd94c78a6bcf2350afd835d64736f6c634300081e0033" # noqa: E501
|
|
9
9
|
STRING_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [{"internalType": "string", "name": "_value", "type": "string"}],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.30.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/TupleContracts.sol:TupleContract
|
|
7
|
-
TUPLE_CONTRACT_BYTECODE = "
|
|
8
|
-
TUPLE_CONTRACT_RUNTIME = "
|
|
7
|
+
TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b50610a688061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea26469706673582212207c5620c2257d173ed894791417ffad7e98aad1aab11d2ec22b5148e5d77de0c464736f6c634300081e0033" # noqa: E501
|
|
8
|
+
TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea26469706673582212207c5620c2257d173ed894791417ffad7e98aad1aab11d2ec22b5148e5d77de0c464736f6c634300081e0033" # noqa: E501
|
|
9
9
|
TUPLE_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [
|
|
@@ -71,8 +71,8 @@ TUPLE_CONTRACT_DATA = {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
# source: web3/_utils/contract_sources/TupleContracts.sol:NestedTupleContract
|
|
74
|
-
NESTED_TUPLE_CONTRACT_BYTECODE = "
|
|
75
|
-
NESTED_TUPLE_CONTRACT_RUNTIME = "
|
|
74
|
+
NESTED_TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b5061067b8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220e9a46dd271224211ac317ab5deb76259a8309e527c859b3d977cfc261a3780db64736f6c634300081e0033" # noqa: E501
|
|
75
|
+
NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220e9a46dd271224211ac317ab5deb76259a8309e527c859b3d977cfc261a3780db64736f6c634300081e0033" # noqa: E501
|
|
76
76
|
NESTED_TUPLE_CONTRACT_ABI = [
|
|
77
77
|
{
|
|
78
78
|
"inputs": [
|
web3/_utils/decorators.py
CHANGED
|
@@ -43,7 +43,7 @@ def deprecated_for(replace_message: str) -> Callable[..., Any]:
|
|
|
43
43
|
"""
|
|
44
44
|
Decorate a deprecated function, with info about what to use instead, like:
|
|
45
45
|
|
|
46
|
-
@deprecated_for("to_bytes()")
|
|
46
|
+
@deprecated_for("use to_bytes() instead")
|
|
47
47
|
def toAscii(arg):
|
|
48
48
|
...
|
|
49
49
|
"""
|
|
@@ -52,7 +52,7 @@ def deprecated_for(replace_message: str) -> Callable[..., Any]:
|
|
|
52
52
|
@functools.wraps(to_wrap)
|
|
53
53
|
def wrapper(*args: Any, **kwargs: Any) -> Callable[..., Any]:
|
|
54
54
|
warnings.warn(
|
|
55
|
-
f"{to_wrap.__name__} is deprecated
|
|
55
|
+
f"{to_wrap.__name__} is deprecated: {replace_message}",
|
|
56
56
|
category=DeprecationWarning,
|
|
57
57
|
stacklevel=2,
|
|
58
58
|
)
|
|
@@ -8,6 +8,7 @@ from eth_utils import (
|
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
from web3.exceptions import (
|
|
11
|
+
BlockNotFound,
|
|
11
12
|
ContractCustomError,
|
|
12
13
|
ContractLogicError,
|
|
13
14
|
ContractPanicError,
|
|
@@ -185,3 +186,19 @@ def raise_transaction_indexing_error_if_indexing(response: RPCResponse) -> RPCRe
|
|
|
185
186
|
raise TransactionIndexingInProgress(message)
|
|
186
187
|
|
|
187
188
|
return response
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def raise_block_not_found_on_error(response: RPCResponse) -> RPCResponse:
|
|
192
|
+
"""
|
|
193
|
+
Raise ``BlockNotFound`` on specific error message(s).
|
|
194
|
+
"""
|
|
195
|
+
error = response.get("error")
|
|
196
|
+
if not isinstance(error, str) and error is not None:
|
|
197
|
+
message = error.get("message")
|
|
198
|
+
if message is not None:
|
|
199
|
+
if "not found" in message.lower() and any(
|
|
200
|
+
key in message.lower() for key in ("block", "header")
|
|
201
|
+
):
|
|
202
|
+
raise BlockNotFound(message)
|
|
203
|
+
|
|
204
|
+
return response
|
web3/_utils/filters.py
CHANGED
|
@@ -8,6 +8,7 @@ from typing import (
|
|
|
8
8
|
List,
|
|
9
9
|
Optional,
|
|
10
10
|
Sequence,
|
|
11
|
+
Set,
|
|
11
12
|
Tuple,
|
|
12
13
|
Union,
|
|
13
14
|
)
|
|
@@ -26,7 +27,6 @@ from eth_typing import (
|
|
|
26
27
|
)
|
|
27
28
|
from eth_utils import (
|
|
28
29
|
is_hex,
|
|
29
|
-
is_list_like,
|
|
30
30
|
is_string,
|
|
31
31
|
is_text,
|
|
32
32
|
)
|
|
@@ -67,15 +67,48 @@ if TYPE_CHECKING:
|
|
|
67
67
|
from web3.eth import Eth # noqa: F401
|
|
68
68
|
|
|
69
69
|
|
|
70
|
+
def _sanitize_addresses(
|
|
71
|
+
*address: Union[ChecksumAddress, List[ChecksumAddress]],
|
|
72
|
+
) -> Union[ChecksumAddress, List[ChecksumAddress]]:
|
|
73
|
+
"""
|
|
74
|
+
Validates an address or list of addresses and returns a single
|
|
75
|
+
ChecksumAddress or a list of ChecksumAddresses.
|
|
76
|
+
Raises Web3ValueError if the address is not valid.
|
|
77
|
+
|
|
78
|
+
:param address: A single address or a list of addresses.
|
|
79
|
+
:return: A list of ChecksumAddress.
|
|
80
|
+
"""
|
|
81
|
+
address_set: Set[ChecksumAddress] = set()
|
|
82
|
+
for arg in address:
|
|
83
|
+
if not arg:
|
|
84
|
+
continue
|
|
85
|
+
elif isinstance(arg, str) or isinstance(arg, bytes):
|
|
86
|
+
address_set.add(arg)
|
|
87
|
+
elif isinstance(arg, list):
|
|
88
|
+
address_set.update(arg)
|
|
89
|
+
else:
|
|
90
|
+
raise Web3ValueError(
|
|
91
|
+
f"Unsupported type for `address` parameter: {type(address)}"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if not address_set:
|
|
95
|
+
return []
|
|
96
|
+
else:
|
|
97
|
+
for addr in address_set:
|
|
98
|
+
validate_address(addr)
|
|
99
|
+
|
|
100
|
+
return list(address_set) if len(address_set) > 1 else address_set.pop()
|
|
101
|
+
|
|
102
|
+
|
|
70
103
|
def construct_event_filter_params(
|
|
71
104
|
event_abi: ABIEvent,
|
|
72
105
|
abi_codec: ABICodec,
|
|
73
|
-
contract_address: Optional[ChecksumAddress] = None,
|
|
106
|
+
contract_address: Optional[Union[ChecksumAddress, List[ChecksumAddress]]] = None,
|
|
74
107
|
argument_filters: Optional[Dict[str, Any]] = None,
|
|
75
108
|
topics: Optional[Sequence[HexStr]] = None,
|
|
76
109
|
from_block: Optional[BlockIdentifier] = None,
|
|
77
110
|
to_block: Optional[BlockIdentifier] = None,
|
|
78
|
-
address: Optional[ChecksumAddress] = None,
|
|
111
|
+
address: Optional[Union[ChecksumAddress, List[ChecksumAddress]]] = None,
|
|
79
112
|
) -> Tuple[List[List[Optional[HexStr]]], FilterParams]:
|
|
80
113
|
filter_params: FilterParams = {}
|
|
81
114
|
topic_set: Sequence[HexStr] = construct_event_topic_set(
|
|
@@ -92,31 +125,9 @@ def construct_event_filter_params(
|
|
|
92
125
|
|
|
93
126
|
filter_params["topics"] = topic_set
|
|
94
127
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
elif is_string(address):
|
|
99
|
-
filter_params["address"] = (
|
|
100
|
-
[address, contract_address]
|
|
101
|
-
if address != contract_address
|
|
102
|
-
else [address]
|
|
103
|
-
)
|
|
104
|
-
else:
|
|
105
|
-
raise Web3ValueError(
|
|
106
|
-
f"Unsupported type for `address` parameter: {type(address)}"
|
|
107
|
-
)
|
|
108
|
-
elif address:
|
|
109
|
-
filter_params["address"] = address
|
|
110
|
-
elif contract_address:
|
|
111
|
-
filter_params["address"] = contract_address
|
|
112
|
-
|
|
113
|
-
if "address" not in filter_params:
|
|
114
|
-
pass
|
|
115
|
-
elif is_list_like(filter_params["address"]):
|
|
116
|
-
for addr in filter_params["address"]:
|
|
117
|
-
validate_address(addr)
|
|
118
|
-
else:
|
|
119
|
-
validate_address(filter_params["address"])
|
|
128
|
+
sanitized_addresses = _sanitize_addresses(address, contract_address)
|
|
129
|
+
if sanitized_addresses:
|
|
130
|
+
filter_params["address"] = sanitized_addresses
|
|
120
131
|
|
|
121
132
|
if from_block is not None:
|
|
122
133
|
filter_params["fromBlock"] = from_block
|
web3/_utils/method_formatters.py
CHANGED
|
@@ -55,6 +55,7 @@ from web3._utils.abi import (
|
|
|
55
55
|
is_length,
|
|
56
56
|
)
|
|
57
57
|
from web3._utils.error_formatters_utils import (
|
|
58
|
+
raise_block_not_found_on_error,
|
|
58
59
|
raise_contract_logic_error_on_revert,
|
|
59
60
|
raise_transaction_indexing_error_if_indexing,
|
|
60
61
|
)
|
|
@@ -1092,6 +1093,7 @@ ERROR_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
1092
1093
|
RPC.eth_estimateGas: raise_contract_logic_error_on_revert,
|
|
1093
1094
|
RPC.eth_call: raise_contract_logic_error_on_revert,
|
|
1094
1095
|
RPC.eth_getTransactionReceipt: raise_transaction_indexing_error_if_indexing,
|
|
1096
|
+
RPC.eth_getBlockReceipts: raise_block_not_found_on_error,
|
|
1095
1097
|
}
|
|
1096
1098
|
|
|
1097
1099
|
|
|
@@ -723,6 +723,8 @@ class AsyncEthModuleTest:
|
|
|
723
723
|
keyfile_account_pkey: HexStr,
|
|
724
724
|
async_math_contract: "AsyncContract",
|
|
725
725
|
) -> None:
|
|
726
|
+
# TODO: remove blockNumber block_id from eth_call and eth_getCode calls once
|
|
727
|
+
# geth behavior for "latest" seems stable again.
|
|
726
728
|
keyfile_account = async_w3.eth.account.from_key(keyfile_account_pkey)
|
|
727
729
|
|
|
728
730
|
chain_id = await async_w3.eth.chain_id
|
|
@@ -737,9 +739,7 @@ class AsyncEthModuleTest:
|
|
|
737
739
|
|
|
738
740
|
# get current math counter and increase it only in the delegation by n
|
|
739
741
|
math_counter = await async_math_contract.functions.counter().call()
|
|
740
|
-
|
|
741
|
-
math_counter + 1337
|
|
742
|
-
).build_transaction({})
|
|
742
|
+
data = async_math_contract.encode_abi("incrementCounter", [math_counter + 1337])
|
|
743
743
|
txn: TxParams = {
|
|
744
744
|
"chainId": chain_id,
|
|
745
745
|
"to": keyfile_account.address,
|
|
@@ -748,23 +748,30 @@ class AsyncEthModuleTest:
|
|
|
748
748
|
"nonce": nonce,
|
|
749
749
|
"maxPriorityFeePerGas": Wei(10**9),
|
|
750
750
|
"maxFeePerGas": Wei(10**9),
|
|
751
|
-
"data":
|
|
751
|
+
"data": data,
|
|
752
752
|
"authorizationList": [signed_auth],
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
signed = keyfile_account.sign_transaction(txn)
|
|
756
756
|
tx_hash = await async_w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
757
757
|
get_tx = await async_w3.eth.get_transaction(tx_hash)
|
|
758
|
-
await async_w3.eth.wait_for_transaction_receipt(
|
|
758
|
+
tx_receipt = await async_w3.eth.wait_for_transaction_receipt(
|
|
759
|
+
tx_hash, timeout=10
|
|
760
|
+
)
|
|
759
761
|
|
|
760
|
-
code = await async_w3.eth.get_code(
|
|
762
|
+
code = await async_w3.eth.get_code(
|
|
763
|
+
keyfile_account.address, block_identifier=tx_receipt["blockNumber"]
|
|
764
|
+
)
|
|
761
765
|
assert code.to_0x_hex() == f"0xef0100{async_math_contract.address[2:].lower()}"
|
|
762
766
|
delegated = async_w3.eth.contract(
|
|
763
767
|
address=keyfile_account.address, abi=async_math_contract.abi
|
|
764
768
|
)
|
|
769
|
+
|
|
765
770
|
# assert the math counter is increased by 1337 only in delegated acct
|
|
766
771
|
assert await async_math_contract.functions.counter().call() == math_counter
|
|
767
|
-
delegated_call = await delegated.functions.counter().call(
|
|
772
|
+
delegated_call = await delegated.functions.counter().call(
|
|
773
|
+
block_identifier=tx_receipt["blockNumber"]
|
|
774
|
+
)
|
|
768
775
|
assert delegated_call == math_counter + 1337
|
|
769
776
|
|
|
770
777
|
assert len(get_tx["authorizationList"]) == 1
|
|
@@ -791,9 +798,13 @@ class AsyncEthModuleTest:
|
|
|
791
798
|
reset_tx_hash = await async_w3.eth.send_raw_transaction(
|
|
792
799
|
signed_reset.raw_transaction
|
|
793
800
|
)
|
|
794
|
-
await async_w3.eth.wait_for_transaction_receipt(
|
|
801
|
+
reset_tx_receipt = await async_w3.eth.wait_for_transaction_receipt(
|
|
802
|
+
reset_tx_hash, timeout=10
|
|
803
|
+
)
|
|
795
804
|
|
|
796
|
-
reset_code = await async_w3.eth.get_code(
|
|
805
|
+
reset_code = await async_w3.eth.get_code(
|
|
806
|
+
keyfile_account.address, reset_tx_receipt["blockNumber"]
|
|
807
|
+
)
|
|
797
808
|
assert reset_code == HexBytes("0x")
|
|
798
809
|
|
|
799
810
|
@pytest.mark.asyncio
|
|
@@ -1881,6 +1892,10 @@ class AsyncEthModuleTest:
|
|
|
1881
1892
|
assert effective_gas_price > 0
|
|
1882
1893
|
|
|
1883
1894
|
@pytest.mark.asyncio
|
|
1895
|
+
# TODO: Remove xfail when issue has been identified
|
|
1896
|
+
@pytest.mark.xfail(
|
|
1897
|
+
reason="latest geth seems to cause this to be flaky", strict=False
|
|
1898
|
+
)
|
|
1884
1899
|
async def test_async_eth_wait_for_transaction_receipt_unmined(
|
|
1885
1900
|
self,
|
|
1886
1901
|
async_w3: "AsyncWeb3",
|
|
@@ -2221,19 +2236,31 @@ class AsyncEthModuleTest:
|
|
|
2221
2236
|
async def test_eth_getUncleCountByBlockHash(
|
|
2222
2237
|
self, async_w3: "AsyncWeb3", async_empty_block: BlockData
|
|
2223
2238
|
) -> None:
|
|
2224
|
-
|
|
2239
|
+
with pytest.warns(
|
|
2240
|
+
DeprecationWarning,
|
|
2241
|
+
match=r"get_uncle_count is deprecated: all get_uncle\* "
|
|
2242
|
+
r"methods will be removed in v8",
|
|
2243
|
+
):
|
|
2244
|
+
uncle_count = await async_w3.eth.get_uncle_count(async_empty_block["hash"])
|
|
2225
2245
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2246
|
+
assert is_integer(uncle_count)
|
|
2247
|
+
assert uncle_count == 0
|
|
2228
2248
|
|
|
2229
2249
|
@pytest.mark.asyncio
|
|
2230
2250
|
async def test_eth_getUncleCountByBlockNumber(
|
|
2231
2251
|
self, async_w3: "AsyncWeb3", async_empty_block: BlockData
|
|
2232
2252
|
) -> None:
|
|
2233
|
-
|
|
2253
|
+
with pytest.warns(
|
|
2254
|
+
DeprecationWarning,
|
|
2255
|
+
match=r"get_uncle_count is deprecated: all get_uncle\* "
|
|
2256
|
+
r"methods will be removed in v8",
|
|
2257
|
+
):
|
|
2258
|
+
uncle_count = await async_w3.eth.get_uncle_count(
|
|
2259
|
+
async_empty_block["number"]
|
|
2260
|
+
)
|
|
2234
2261
|
|
|
2235
|
-
|
|
2236
|
-
|
|
2262
|
+
assert is_integer(uncle_count)
|
|
2263
|
+
assert uncle_count == 0
|
|
2237
2264
|
|
|
2238
2265
|
@pytest.mark.asyncio
|
|
2239
2266
|
async def test_eth_getBlockTransactionCountByNumber_block_with_txn(
|
|
@@ -2718,13 +2745,15 @@ class EthModuleTest:
|
|
|
2718
2745
|
assert balance >= 0
|
|
2719
2746
|
|
|
2720
2747
|
def test_eth_get_balance_with_block_identifier(self, w3: "Web3") -> None:
|
|
2721
|
-
|
|
2722
|
-
|
|
2748
|
+
genesis_block = w3.eth.get_block(0)
|
|
2749
|
+
miner_address = genesis_block["miner"]
|
|
2750
|
+
|
|
2751
|
+
balance_genesis = w3.eth.get_balance(miner_address, 0)
|
|
2723
2752
|
later_balance = w3.eth.get_balance(miner_address, "latest")
|
|
2724
2753
|
|
|
2725
|
-
assert is_integer(
|
|
2754
|
+
assert is_integer(balance_genesis)
|
|
2726
2755
|
assert is_integer(later_balance)
|
|
2727
|
-
assert later_balance
|
|
2756
|
+
assert later_balance != balance_genesis
|
|
2728
2757
|
|
|
2729
2758
|
@pytest.mark.parametrize(
|
|
2730
2759
|
"address, expect_success",
|
|
@@ -2843,18 +2872,24 @@ class EthModuleTest:
|
|
|
2843
2872
|
def test_eth_getUncleCountByBlockHash(
|
|
2844
2873
|
self, w3: "Web3", empty_block: BlockData
|
|
2845
2874
|
) -> None:
|
|
2846
|
-
|
|
2875
|
+
with pytest.warns(
|
|
2876
|
+
DeprecationWarning, match=r"All get_uncle\* methods have been deprecated"
|
|
2877
|
+
):
|
|
2878
|
+
uncle_count = w3.eth.get_uncle_count(empty_block["hash"])
|
|
2847
2879
|
|
|
2848
|
-
|
|
2849
|
-
|
|
2880
|
+
assert is_integer(uncle_count)
|
|
2881
|
+
assert uncle_count == 0
|
|
2850
2882
|
|
|
2851
2883
|
def test_eth_getUncleCountByBlockNumber(
|
|
2852
2884
|
self, w3: "Web3", empty_block: BlockData
|
|
2853
2885
|
) -> None:
|
|
2854
|
-
|
|
2886
|
+
with pytest.warns(
|
|
2887
|
+
DeprecationWarning, match=r"All get_uncle\* methods have been deprecated"
|
|
2888
|
+
):
|
|
2889
|
+
uncle_count = w3.eth.get_uncle_count(empty_block["number"])
|
|
2855
2890
|
|
|
2856
|
-
|
|
2857
|
-
|
|
2891
|
+
assert is_integer(uncle_count)
|
|
2892
|
+
assert uncle_count == 0
|
|
2858
2893
|
|
|
2859
2894
|
def test_eth_get_code(
|
|
2860
2895
|
self, w3: "Web3", math_contract_address: ChecksumAddress
|
|
@@ -3835,6 +3870,8 @@ class EthModuleTest:
|
|
|
3835
3870
|
def test_sign_authorization_and_send_raw_set_code_transaction(
|
|
3836
3871
|
self, w3: "Web3", keyfile_account_pkey: HexStr, math_contract: "Contract"
|
|
3837
3872
|
) -> None:
|
|
3873
|
+
# TODO: remove blockNumber block_id from eth_call and eth_getCode calls once
|
|
3874
|
+
# geth behavior for "latest" seems stable again.
|
|
3838
3875
|
keyfile_account = w3.eth.account.from_key(keyfile_account_pkey)
|
|
3839
3876
|
|
|
3840
3877
|
chain_id = w3.eth.chain_id
|
|
@@ -3849,9 +3886,7 @@ class EthModuleTest:
|
|
|
3849
3886
|
|
|
3850
3887
|
# get current math counter and increase it only in the delegation by n
|
|
3851
3888
|
math_counter = math_contract.functions.counter().call()
|
|
3852
|
-
data = math_contract.
|
|
3853
|
-
math_counter + 1337
|
|
3854
|
-
).build_transaction({})["data"]
|
|
3889
|
+
data = math_contract.encode_abi("incrementCounter", [math_counter + 1337])
|
|
3855
3890
|
txn: TxParams = {
|
|
3856
3891
|
"chainId": chain_id,
|
|
3857
3892
|
"to": keyfile_account.address,
|
|
@@ -3867,16 +3902,26 @@ class EthModuleTest:
|
|
|
3867
3902
|
signed = keyfile_account.sign_transaction(txn)
|
|
3868
3903
|
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
3869
3904
|
get_tx = w3.eth.get_transaction(tx_hash)
|
|
3870
|
-
w3.eth.wait_for_transaction_receipt(tx_hash, timeout=10)
|
|
3905
|
+
receipt = w3.eth.wait_for_transaction_receipt(tx_hash, timeout=10)
|
|
3871
3906
|
|
|
3872
|
-
code = w3.eth.get_code(
|
|
3907
|
+
code = w3.eth.get_code(
|
|
3908
|
+
keyfile_account.address, block_identifier=receipt["blockNumber"]
|
|
3909
|
+
)
|
|
3873
3910
|
assert code.to_0x_hex() == f"0xef0100{math_contract.address[2:].lower()}"
|
|
3874
3911
|
delegated = w3.eth.contract(
|
|
3875
3912
|
address=keyfile_account.address, abi=math_contract.abi
|
|
3876
3913
|
)
|
|
3877
3914
|
# assert the math counter is increased by 1337 only in delegated acct
|
|
3878
|
-
assert
|
|
3879
|
-
|
|
3915
|
+
assert (
|
|
3916
|
+
math_contract.functions.counter().call(
|
|
3917
|
+
block_identifier=receipt["blockNumber"]
|
|
3918
|
+
)
|
|
3919
|
+
== math_counter
|
|
3920
|
+
)
|
|
3921
|
+
assert (
|
|
3922
|
+
delegated.functions.counter().call(block_identifier=receipt["blockNumber"])
|
|
3923
|
+
== math_counter + 1337
|
|
3924
|
+
)
|
|
3880
3925
|
|
|
3881
3926
|
assert len(get_tx["authorizationList"]) == 1
|
|
3882
3927
|
get_auth = get_tx["authorizationList"][0]
|
|
@@ -3900,9 +3945,13 @@ class EthModuleTest:
|
|
|
3900
3945
|
|
|
3901
3946
|
signed_reset = keyfile_account.sign_transaction(new_txn)
|
|
3902
3947
|
reset_tx_hash = w3.eth.send_raw_transaction(signed_reset.raw_transaction)
|
|
3903
|
-
w3.eth.wait_for_transaction_receipt(
|
|
3948
|
+
reset_tx_receipt = w3.eth.wait_for_transaction_receipt(
|
|
3949
|
+
reset_tx_hash, timeout=10
|
|
3950
|
+
)
|
|
3904
3951
|
|
|
3905
|
-
reset_code = w3.eth.get_code(
|
|
3952
|
+
reset_code = w3.eth.get_code(
|
|
3953
|
+
keyfile_account.address, block_identifier=reset_tx_receipt["blockNumber"]
|
|
3954
|
+
)
|
|
3906
3955
|
assert reset_code == HexBytes("0x")
|
|
3907
3956
|
|
|
3908
3957
|
def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None:
|
web3/eth/async_eth.py
CHANGED
|
@@ -39,6 +39,9 @@ from web3._utils.blocks import (
|
|
|
39
39
|
from web3._utils.compat import (
|
|
40
40
|
Unpack,
|
|
41
41
|
)
|
|
42
|
+
from web3._utils.decorators import (
|
|
43
|
+
deprecated_for,
|
|
44
|
+
)
|
|
42
45
|
from web3._utils.fee_utils import (
|
|
43
46
|
async_fee_history_priority_fee,
|
|
44
47
|
)
|
|
@@ -669,6 +672,7 @@ class AsyncEth(BaseEth):
|
|
|
669
672
|
mungers=[default_root_munger],
|
|
670
673
|
)
|
|
671
674
|
|
|
675
|
+
@deprecated_for("all get_uncle* methods will be removed in v8")
|
|
672
676
|
async def get_uncle_count(self, block_identifier: BlockIdentifier) -> int:
|
|
673
677
|
return await self._get_uncle_count(block_identifier)
|
|
674
678
|
|
web3/eth/eth.py
CHANGED
|
@@ -69,6 +69,7 @@ from web3.exceptions import (
|
|
|
69
69
|
Web3ValueError,
|
|
70
70
|
)
|
|
71
71
|
from web3.method import (
|
|
72
|
+
DeprecatedMethod,
|
|
72
73
|
Method,
|
|
73
74
|
default_root_munger,
|
|
74
75
|
)
|
|
@@ -566,7 +567,7 @@ class Eth(BaseEth):
|
|
|
566
567
|
# eth_getUncleCountByBlockHash
|
|
567
568
|
# eth_getUncleCountByBlockNumber
|
|
568
569
|
|
|
569
|
-
|
|
570
|
+
_get_uncle_count: Method[Callable[[BlockIdentifier], int]] = Method(
|
|
570
571
|
method_choice_depends_on_args=select_method_for_block_identifier(
|
|
571
572
|
if_predefined=RPC.eth_getUncleCountByBlockNumber,
|
|
572
573
|
if_hash=RPC.eth_getUncleCountByBlockHash,
|
|
@@ -574,11 +575,17 @@ class Eth(BaseEth):
|
|
|
574
575
|
),
|
|
575
576
|
mungers=[default_root_munger],
|
|
576
577
|
)
|
|
578
|
+
get_uncle_count = DeprecatedMethod(
|
|
579
|
+
_get_uncle_count,
|
|
580
|
+
old_name="_get_uncle_count",
|
|
581
|
+
new_name="get_uncle_count",
|
|
582
|
+
msg="All get_uncle* methods have been deprecated",
|
|
583
|
+
)
|
|
577
584
|
|
|
578
585
|
# eth_getUncleByBlockHashAndIndex
|
|
579
586
|
# eth_getUncleByBlockNumberAndIndex
|
|
580
587
|
|
|
581
|
-
|
|
588
|
+
_get_uncle_by_block: Method[Callable[[BlockIdentifier, int], Uncle]] = Method(
|
|
582
589
|
method_choice_depends_on_args=select_method_for_block_identifier(
|
|
583
590
|
if_predefined=RPC.eth_getUncleByBlockNumberAndIndex,
|
|
584
591
|
if_hash=RPC.eth_getUncleByBlockHashAndIndex,
|
|
@@ -586,6 +593,12 @@ class Eth(BaseEth):
|
|
|
586
593
|
),
|
|
587
594
|
mungers=[default_root_munger],
|
|
588
595
|
)
|
|
596
|
+
get_uncle_by_block = DeprecatedMethod(
|
|
597
|
+
_get_uncle_by_block,
|
|
598
|
+
old_name="_get_uncle_by_block",
|
|
599
|
+
new_name="get_uncle_by_block",
|
|
600
|
+
msg="All get_uncle* methods have been deprecated",
|
|
601
|
+
)
|
|
589
602
|
|
|
590
603
|
def replace_transaction(
|
|
591
604
|
self, transaction_hash: _Hash32, new_transaction: TxParams
|