-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web3.eth.contract with no abi #2539
Comments
I want to make sure I reiterate that I know in most common usage of web3.py you would need to have the abi. |
I believe if you are interacting through a contract instance, the ABI is required. A check and/or documentation could certainly be improved, so I'll leave this open. If you want to work around that, you can just use |
Thank you, yes if this is expected behavior I can see about adding to the documentation. I am working on offensive security tooling for interacting with contracts. The abi is not always available and being able to call the function signature directly helps in certain reversing flows. I can look at the code, but if the web3.py library is calling the same function under the hood then there is no technical requirement for needing the abi when calling by function selector. If that is the case, is there any reason for enforcing the need of abi for those lower level calls? |
Yeah, we do not call |
pip freeze
outputWhat was wrong?
testContract = w3.eth.contract(address=add)
testContract.get_function_by_selector("0x370158ea")
Gives an error:
running the same commands but with abi included gives the correct value:
testContract = web3.eth.contract(address=add,abi=abi)
testContract.get_function_by_selector("0x370158ea")
<Function info()>
The documentation documentation
Does not show abi as a required parameter when instantiating the Contract class. But all the examples show it being used.
I can instantiate a contract by passing it an address without an abi parameter. But later calls fail. Is this expected behavior?
I should still be able to interact with the bytecode at a specific address as long as I can either generate a function signature or call the selector directly.
Is it expected behavior to require abi for all contract interaction, even those that don't require it?
Please include any of the following that are applicable:
I used a remote infura node. I noticed this issue when working with brownie and verified that it was happening in using web3 directly.
How can it be fixed?
Updating the documentation if this is expected behavior. If this is not expected behavior then adding a check on for set abi on the contract function calls.
Note: We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our documentation and/or join the conversation
on discord.
The text was updated successfully, but these errors were encountered: