web3 7.4.0__py3-none-any.whl → 7.5.0__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/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 +5 -5
- 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/method_formatters.py +108 -1
- web3/_utils/module_testing/__init__.py +4 -0
- web3/_utils/module_testing/go_ethereum_debug_module.py +128 -0
- web3/_utils/rpc_abi.py +3 -0
- web3/contract/async_contract.py +45 -2
- web3/contract/base_contract.py +248 -63
- web3/contract/contract.py +41 -0
- web3/contract/utils.py +48 -0
- web3/geth.py +59 -0
- web3/main.py +4 -0
- web3/manager.py +10 -0
- web3/types.py +87 -2
- {web3-7.4.0.dist-info → web3-7.5.0.dist-info}/METADATA +2 -1
- {web3-7.4.0.dist-info → web3-7.5.0.dist-info}/RECORD +38 -37
- {web3-7.4.0.dist-info → web3-7.5.0.dist-info}/WHEEL +1 -1
- {web3-7.4.0.dist-info → web3-7.5.0.dist-info}/LICENSE +0 -0
- {web3-7.4.0.dist-info → web3-7.5.0.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.28.
|
|
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 = "0x608060405234801561000f575f5ffd5b50604051610c1a380380610c1a83398181016040528101906100319190610193565b805f908161003f91906103ea565b50506104b9565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100a58261005f565b810181811067ffffffffffffffff821117156100c4576100c361006f565b5b80604052505050565b5f6100d6610046565b90506100e2828261009c565b919050565b5f67ffffffffffffffff8211156101015761010061006f565b5b61010a8261005f565b9050602081019050919050565b8281835e5f83830152505050565b5f610137610132846100e7565b6100cd565b9050828152602081018484840111156101535761015261005b565b5b61015e848285610117565b509392505050565b5f82601f83011261017a57610179610057565b5b815161018a848260208601610125565b91505092915050565b5f602082840312156101a8576101a761004f565b5b5f82015167ffffffffffffffff8111156101c5576101c4610053565b5b6101d184828501610166565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061022857607f821691505b60208210810361023b5761023a6101e4565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261029d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610262565b6102a78683610262565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6102eb6102e66102e1846102bf565b6102c8565b6102bf565b9050919050565b5f819050919050565b610304836102d1565b610318610310826102f2565b84845461026e565b825550505050565b5f5f905090565b61032f610320565b61033a8184846102fb565b505050565b5b8181101561035d576103525f82610327565b600181019050610340565b5050565b601f8211156103a25761037381610241565b61037c84610253565b8101602085101561038b578190505b61039f61039785610253565b83018261033f565b50505b505050565b5f82821c905092915050565b5f6103c25f19846008026103a7565b1980831691505092915050565b5f6103da83836103b3565b9150826002028217905092915050565b6103f3826101da565b67ffffffffffffffff81111561040c5761040b61006f565b5b6104168254610211565b610421828285610361565b5f60209050601f831160018114610452575f8415610440578287015190505b61044a85826103cf565b8655506104b1565b601f19841661046086610241565b5f5b8281101561048757848901518255600182019150602085019450602081019050610462565b868310156104a457848901516104a0601f8916826103b3565b8355505b6001600288020188555050505b505050505050565b610754806104c65f395ff3fe608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220f8c6a3162990f5374f6e82d531ae725cfff144e0b78604067cef98a7c9b2794364736f6c634300081c0033" # noqa: E501
|
|
8
|
+
STRING_CONTRACT_RUNTIME = "0x608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220f8c6a3162990f5374f6e82d531ae725cfff144e0b78604067cef98a7c9b2794364736f6c634300081c0033" # 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.28.
|
|
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 = "0x6080604052348015600e575f5ffd5b50610a688061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220688d7c1933bc8458c33b311fef8cd1eabb9fad171f74729d08c558a805acaafb64736f6c634300081c0033" # noqa: E501
|
|
8
|
+
TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220688d7c1933bc8458c33b311fef8cd1eabb9fad171f74729d08c558a805acaafb64736f6c634300081c0033" # 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 = "0x6080604052348015600e575f5ffd5b5061067b8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220f5c624356ac8a8f7232e74f6d7ddfb2174750d834bbdb0855da9ba0d26ff61df64736f6c634300081c0033" # noqa: E501
|
|
75
|
+
NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220f5c624356ac8a8f7232e74f6d7ddfb2174750d834bbdb0855da9ba0d26ff61df64736f6c634300081c0033" # noqa: E501
|
|
76
76
|
NESTED_TUPLE_CONTRACT_ABI = [
|
|
77
77
|
{
|
|
78
78
|
"inputs": [
|
web3/_utils/method_formatters.py
CHANGED
|
@@ -9,6 +9,7 @@ from typing import (
|
|
|
9
9
|
Iterable,
|
|
10
10
|
NoReturn,
|
|
11
11
|
Tuple,
|
|
12
|
+
TypeVar,
|
|
12
13
|
Union,
|
|
13
14
|
cast,
|
|
14
15
|
)
|
|
@@ -111,6 +112,8 @@ if TYPE_CHECKING:
|
|
|
111
112
|
from web3.eth import Eth # noqa: F401
|
|
112
113
|
from web3.module import Module # noqa: F401
|
|
113
114
|
|
|
115
|
+
TValue = TypeVar("TValue")
|
|
116
|
+
|
|
114
117
|
|
|
115
118
|
def bytes_to_ascii(value: bytes) -> str:
|
|
116
119
|
return codecs.decode(value, "ascii")
|
|
@@ -607,6 +610,102 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
607
610
|
}
|
|
608
611
|
|
|
609
612
|
# --- Result Formatters --- #
|
|
613
|
+
# -- debug -- #
|
|
614
|
+
DEBUG_CALLTRACE_LOG_ENTRY_FORMATTERS = apply_formatter_if(
|
|
615
|
+
is_not_null,
|
|
616
|
+
type_aware_apply_formatters_to_dict(
|
|
617
|
+
{
|
|
618
|
+
"address": to_checksum_address,
|
|
619
|
+
"topics": apply_list_to_array_formatter(to_hexbytes(32)),
|
|
620
|
+
"data": HexBytes,
|
|
621
|
+
"position": to_integer_if_hex,
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
debug_calltrace_log_list_result_formatter: Callable[
|
|
628
|
+
[Formatters], Any
|
|
629
|
+
] = apply_formatter_to_array(DEBUG_CALLTRACE_LOG_ENTRY_FORMATTERS)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
PRETRACE_INNER_FORMATTERS = {
|
|
633
|
+
"balance": to_integer_if_hex,
|
|
634
|
+
"nonce": to_integer_if_hex,
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
def has_pretrace_keys(val: Any) -> bool:
|
|
639
|
+
if isinstance(val, dict) or isinstance(val, AttributeDict):
|
|
640
|
+
return (
|
|
641
|
+
val.get("balance")
|
|
642
|
+
or val.get("nonce")
|
|
643
|
+
or val.get("code")
|
|
644
|
+
or val.get("storage")
|
|
645
|
+
)
|
|
646
|
+
return False
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
@curry
|
|
650
|
+
def pretrace_formatter(
|
|
651
|
+
resp: Union[AttributeDict[str, Any], Dict[str, Any]],
|
|
652
|
+
) -> Union[ReadableAttributeDict[str, Any], Dict[str, Any]]:
|
|
653
|
+
return type_aware_apply_formatters_to_dict_keys_and_values(
|
|
654
|
+
apply_formatter_if(is_address, to_checksum_address),
|
|
655
|
+
apply_formatter_if(
|
|
656
|
+
has_pretrace_keys,
|
|
657
|
+
type_aware_apply_formatters_to_dict(PRETRACE_INNER_FORMATTERS),
|
|
658
|
+
),
|
|
659
|
+
resp,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
DEBUG_PRESTATE_DIFFMODE_FORMATTERS = {
|
|
664
|
+
"pre": pretrace_formatter,
|
|
665
|
+
"post": pretrace_formatter,
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
DEBUG_CALLTRACE_FORMATTERS = {
|
|
670
|
+
"from": to_checksum_address,
|
|
671
|
+
"to": to_checksum_address,
|
|
672
|
+
"value": to_integer_if_hex,
|
|
673
|
+
"gas": to_integer_if_hex,
|
|
674
|
+
"gasUsed": to_integer_if_hex,
|
|
675
|
+
"input": HexBytes,
|
|
676
|
+
"output": HexBytes,
|
|
677
|
+
"calls": lambda calls: debug_calltrace_list_result_formatter(calls),
|
|
678
|
+
"logs": debug_calltrace_log_list_result_formatter,
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
OPCODE_TRACE_FORMATTERS = {
|
|
683
|
+
"pc": to_integer_if_hex,
|
|
684
|
+
"gas": to_integer_if_hex,
|
|
685
|
+
"gasCost": to_integer_if_hex,
|
|
686
|
+
"refund": to_integer_if_hex,
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
DEBUG_TRACE_FORMATTERS = {
|
|
691
|
+
**DEBUG_CALLTRACE_FORMATTERS,
|
|
692
|
+
**OPCODE_TRACE_FORMATTERS,
|
|
693
|
+
**DEBUG_PRESTATE_DIFFMODE_FORMATTERS,
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
trace_result_formatters = type_aware_apply_formatters_to_dict(DEBUG_TRACE_FORMATTERS)
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
debug_calltrace_result_formatter = type_aware_apply_formatters_to_dict(
|
|
701
|
+
DEBUG_CALLTRACE_FORMATTERS
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
debug_calltrace_list_result_formatter: Callable[
|
|
706
|
+
[Formatters], Any
|
|
707
|
+
] = apply_formatter_to_array(debug_calltrace_result_formatter)
|
|
708
|
+
|
|
610
709
|
|
|
611
710
|
# -- tracing -- #
|
|
612
711
|
|
|
@@ -646,7 +745,7 @@ TRACE_RESULT_FORMATTERS = apply_formatter_if(
|
|
|
646
745
|
)
|
|
647
746
|
|
|
648
747
|
# result formatters for the trace field
|
|
649
|
-
TRACE_FORMATTERS = apply_formatter_if(
|
|
748
|
+
TRACE_FORMATTERS: Callable[[TValue], Union[Any, TValue]] = apply_formatter_if(
|
|
650
749
|
is_not_null,
|
|
651
750
|
type_aware_apply_formatters_to_dict(
|
|
652
751
|
{
|
|
@@ -795,6 +894,14 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
795
894
|
RPC.evm_snapshot: hex_to_integer,
|
|
796
895
|
# Net
|
|
797
896
|
RPC.net_peerCount: to_integer_if_hex,
|
|
897
|
+
# Debug
|
|
898
|
+
RPC.debug_traceTransaction: apply_formatter_if(
|
|
899
|
+
is_not_null,
|
|
900
|
+
compose(
|
|
901
|
+
pretrace_formatter,
|
|
902
|
+
trace_result_formatters,
|
|
903
|
+
),
|
|
904
|
+
),
|
|
798
905
|
# tracing
|
|
799
906
|
RPC.trace_block: trace_list_result_formatter,
|
|
800
907
|
RPC.trace_call: common_tracing_result_formatter,
|
|
@@ -5,6 +5,10 @@ from .eth_module import (
|
|
|
5
5
|
from .go_ethereum_admin_module import (
|
|
6
6
|
GoEthereumAdminModuleTest,
|
|
7
7
|
)
|
|
8
|
+
from .go_ethereum_debug_module import (
|
|
9
|
+
GoEthereumAsyncDebugModuleTest,
|
|
10
|
+
GoEthereumDebugModuleTest,
|
|
11
|
+
)
|
|
8
12
|
from .go_ethereum_txpool_module import (
|
|
9
13
|
GoEthereumAsyncTxPoolModuleTest,
|
|
10
14
|
GoEthereumTxPoolModuleTest,
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from typing import (
|
|
3
|
+
cast,
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
from eth_typing import (
|
|
7
|
+
HexStr,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from web3 import (
|
|
11
|
+
AsyncWeb3,
|
|
12
|
+
Web3,
|
|
13
|
+
)
|
|
14
|
+
from web3.types import (
|
|
15
|
+
BlockData,
|
|
16
|
+
CallTrace,
|
|
17
|
+
ChecksumAddress,
|
|
18
|
+
DiffModeTrace,
|
|
19
|
+
OpcodeTrace,
|
|
20
|
+
PrestateTrace,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class GoEthereumAsyncDebugModuleTest:
|
|
25
|
+
@pytest.mark.asyncio
|
|
26
|
+
async def test_async_geth_debug_trace_transaction_opcode_logger(
|
|
27
|
+
self, async_w3: "AsyncWeb3", txn_hash_with_log: HexStr
|
|
28
|
+
) -> None:
|
|
29
|
+
result = await async_w3.geth.debug.trace_transaction(txn_hash_with_log)
|
|
30
|
+
assert "structLogs" in dict(result).keys()
|
|
31
|
+
assert "gas" in dict(result).keys()
|
|
32
|
+
assert "failed" in dict(result).keys()
|
|
33
|
+
|
|
34
|
+
@pytest.mark.asyncio
|
|
35
|
+
async def test_async_geth_debug_trace_transaction_call_tracer(
|
|
36
|
+
self, async_w3: "AsyncWeb3", txn_hash_with_log: HexStr
|
|
37
|
+
) -> None:
|
|
38
|
+
result = cast(
|
|
39
|
+
CallTrace,
|
|
40
|
+
await async_w3.geth.debug.trace_transaction(
|
|
41
|
+
txn_hash_with_log, {"tracer": "callTracer"}
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
assert result.get("type") == "CALL"
|
|
45
|
+
|
|
46
|
+
@pytest.mark.asyncio
|
|
47
|
+
async def test_async_geth_debug_trace_transaction_prestate_tracer_diffMode(
|
|
48
|
+
self, async_w3: "AsyncWeb3", txn_hash_with_log: HexStr
|
|
49
|
+
) -> None:
|
|
50
|
+
result = cast(
|
|
51
|
+
DiffModeTrace,
|
|
52
|
+
await async_w3.geth.debug.trace_transaction(
|
|
53
|
+
txn_hash_with_log,
|
|
54
|
+
{"tracer": "prestateTracer", "tracerConfig": {"diffMode": True}},
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
assert "post" in dict(result).keys()
|
|
58
|
+
assert "pre" in dict(result).keys()
|
|
59
|
+
|
|
60
|
+
@pytest.mark.asyncio
|
|
61
|
+
async def test_async_geth_debug_trace_transaction_prestate_tracer(
|
|
62
|
+
self,
|
|
63
|
+
async_w3: "AsyncWeb3",
|
|
64
|
+
txn_hash_with_log: HexStr,
|
|
65
|
+
async_block_with_txn_with_log: BlockData,
|
|
66
|
+
) -> None:
|
|
67
|
+
result = cast(
|
|
68
|
+
PrestateTrace,
|
|
69
|
+
await async_w3.geth.debug.trace_transaction(
|
|
70
|
+
txn_hash_with_log,
|
|
71
|
+
{"tracer": "prestateTracer"},
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
tx = await async_w3.eth.get_transaction(txn_hash_with_log)
|
|
75
|
+
from_addr: ChecksumAddress = tx["from"]
|
|
76
|
+
assert isinstance(result[from_addr].get("balance"), int)
|
|
77
|
+
assert "post" not in dict(result).keys()
|
|
78
|
+
assert "pre" not in dict(result).keys()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class GoEthereumDebugModuleTest:
|
|
82
|
+
def test_geth_debug_trace_transaction_opcode_logger(
|
|
83
|
+
self, w3: "Web3", txn_hash_with_log: HexStr
|
|
84
|
+
) -> None:
|
|
85
|
+
result = cast(OpcodeTrace, w3.geth.debug.trace_transaction(txn_hash_with_log))
|
|
86
|
+
assert "structLogs" in dict(result).keys()
|
|
87
|
+
assert "gas" in dict(result).keys()
|
|
88
|
+
assert "failed" in dict(result).keys()
|
|
89
|
+
|
|
90
|
+
def test_geth_debug_trace_transaction_call_tracer(
|
|
91
|
+
self, w3: "Web3", txn_hash_with_log: HexStr
|
|
92
|
+
) -> None:
|
|
93
|
+
result = cast(
|
|
94
|
+
CallTrace,
|
|
95
|
+
w3.geth.debug.trace_transaction(
|
|
96
|
+
txn_hash_with_log, {"tracer": "callTracer"}
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
assert result.get("type") == "CALL"
|
|
100
|
+
|
|
101
|
+
def test_geth_debug_trace_transaction_prestate_tracer_diffmode(
|
|
102
|
+
self, w3: "Web3", txn_hash_with_log: HexStr
|
|
103
|
+
) -> None:
|
|
104
|
+
result = cast(
|
|
105
|
+
DiffModeTrace,
|
|
106
|
+
w3.geth.debug.trace_transaction(
|
|
107
|
+
txn_hash_with_log,
|
|
108
|
+
{"tracer": "prestateTracer", "tracerConfig": {"diffMode": True}},
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
assert "post" in dict(result).keys()
|
|
112
|
+
assert "pre" in dict(result).keys()
|
|
113
|
+
|
|
114
|
+
def test_geth_debug_trace_transaction_prestate_tracer(
|
|
115
|
+
self, w3: "Web3", txn_hash_with_log: HexStr
|
|
116
|
+
) -> None:
|
|
117
|
+
result = cast(
|
|
118
|
+
PrestateTrace,
|
|
119
|
+
w3.geth.debug.trace_transaction(
|
|
120
|
+
txn_hash_with_log,
|
|
121
|
+
{"tracer": "prestateTracer"},
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
tx = w3.eth.get_transaction(txn_hash_with_log)
|
|
125
|
+
from_addr: ChecksumAddress = tx["from"]
|
|
126
|
+
assert isinstance(result[from_addr].get("balance"), int)
|
|
127
|
+
assert "post" not in dict(result).keys()
|
|
128
|
+
assert "pre" not in dict(result).keys()
|
web3/_utils/rpc_abi.py
CHANGED
web3/contract/async_contract.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import (
|
|
|
15
15
|
|
|
16
16
|
from eth_typing import (
|
|
17
17
|
ABI,
|
|
18
|
+
ABIEvent,
|
|
18
19
|
ChecksumAddress,
|
|
19
20
|
)
|
|
20
21
|
from eth_utils import (
|
|
@@ -79,7 +80,9 @@ from web3.contract.utils import (
|
|
|
79
80
|
async_call_contract_function,
|
|
80
81
|
async_estimate_gas_for_function,
|
|
81
82
|
async_transact_with_contract_function,
|
|
83
|
+
find_events_by_identifier,
|
|
82
84
|
find_functions_by_identifier,
|
|
85
|
+
get_event_by_identifier,
|
|
83
86
|
get_function_by_identifier,
|
|
84
87
|
)
|
|
85
88
|
from web3.exceptions import (
|
|
@@ -97,6 +100,9 @@ from web3.types import (
|
|
|
97
100
|
StateOverride,
|
|
98
101
|
TxParams,
|
|
99
102
|
)
|
|
103
|
+
from web3.utils.abi import (
|
|
104
|
+
get_abi_element,
|
|
105
|
+
)
|
|
100
106
|
|
|
101
107
|
if TYPE_CHECKING:
|
|
102
108
|
from ens import AsyncENS # noqa: F401
|
|
@@ -107,6 +113,17 @@ class AsyncContractEvent(BaseContractEvent):
|
|
|
107
113
|
# mypy types
|
|
108
114
|
w3: "AsyncWeb3"
|
|
109
115
|
|
|
116
|
+
def __call__(self) -> "AsyncContractEvent":
|
|
117
|
+
clone = copy.copy(self)
|
|
118
|
+
|
|
119
|
+
if not self.abi:
|
|
120
|
+
self.abi = cast(
|
|
121
|
+
ABIEvent,
|
|
122
|
+
get_abi_element(self.contract_abi, self.event_name),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return clone
|
|
126
|
+
|
|
110
127
|
@combomethod
|
|
111
128
|
async def get_logs(
|
|
112
129
|
self,
|
|
@@ -135,7 +152,7 @@ class AsyncContractEvent(BaseContractEvent):
|
|
|
135
152
|
from = max(mycontract.web3.eth.block_number - 10, 1)
|
|
136
153
|
to = mycontract.web3.eth.block_number
|
|
137
154
|
|
|
138
|
-
events = mycontract.events.Transfer.
|
|
155
|
+
events = mycontract.events.Transfer.get_logs(from_block=from, to_block=to)
|
|
139
156
|
|
|
140
157
|
for e in events:
|
|
141
158
|
print(e["args"]["from"],
|
|
@@ -197,7 +214,9 @@ class AsyncContractEvent(BaseContractEvent):
|
|
|
197
214
|
all_event_logs,
|
|
198
215
|
argument_filters,
|
|
199
216
|
)
|
|
200
|
-
|
|
217
|
+
sorted_logs = sorted(filtered_logs, key=lambda e: e["logIndex"])
|
|
218
|
+
sorted_logs = sorted(sorted_logs, key=lambda e: e["blockNumber"])
|
|
219
|
+
return cast(Awaitable[Iterable[EventData]], sorted_logs)
|
|
201
220
|
|
|
202
221
|
@combomethod
|
|
203
222
|
async def create_filter(
|
|
@@ -239,6 +258,12 @@ class AsyncContractEvent(BaseContractEvent):
|
|
|
239
258
|
builder.address = self.address
|
|
240
259
|
return builder
|
|
241
260
|
|
|
261
|
+
@classmethod
|
|
262
|
+
def factory(cls, class_name: str, **kwargs: Any) -> Self:
|
|
263
|
+
return PropertyCheckingFactory(class_name, (cls,), kwargs)(
|
|
264
|
+
abi=kwargs.get("abi")
|
|
265
|
+
)
|
|
266
|
+
|
|
242
267
|
|
|
243
268
|
class AsyncContractEvents(BaseContractEvents):
|
|
244
269
|
def __init__(
|
|
@@ -556,6 +581,24 @@ class AsyncContract(BaseContract):
|
|
|
556
581
|
) -> "AsyncContractFunction":
|
|
557
582
|
return get_function_by_identifier(fns, identifier)
|
|
558
583
|
|
|
584
|
+
@combomethod
|
|
585
|
+
def find_events_by_identifier(
|
|
586
|
+
cls,
|
|
587
|
+
contract_abi: ABI,
|
|
588
|
+
w3: "AsyncWeb3",
|
|
589
|
+
address: ChecksumAddress,
|
|
590
|
+
callable_check: Callable[..., Any],
|
|
591
|
+
) -> List["AsyncContractEvent"]:
|
|
592
|
+
return find_events_by_identifier(
|
|
593
|
+
contract_abi, w3, address, callable_check, AsyncContractEvent
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
@combomethod
|
|
597
|
+
def get_event_by_identifier(
|
|
598
|
+
cls, events: Sequence["AsyncContractEvent"], identifier: str
|
|
599
|
+
) -> "AsyncContractEvent":
|
|
600
|
+
return get_event_by_identifier(events, identifier)
|
|
601
|
+
|
|
559
602
|
|
|
560
603
|
class AsyncContractCaller(BaseContractCaller):
|
|
561
604
|
# mypy types
|