-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Abicoder reports invalid type when library ABI contains enums #1126
Comments
I don’t know it’s even possible to extract this from an ABI fragment. Can you include the generated ABI in this issue? |
Sure. Here's what I get from [
{
"inputs": [
{
"internalType": "enum L.BOOL",
"name": "b",
"type": "L.BOOL"
}
],
"name": "f",
"outputs": [
{
"internalType": "enum L.BOOL",
"name": "",
"type": "L.BOOL"
}
],
"stateMutability": "pure",
"type": "function"
}
] |
Yeah. That is literally not enough data to process. :) |
Yeah. This will probably have to be fixed in the compiler. Still I wanted to make you aware of this issue since it won't disappear in older compiler versions and knowing about it might save you some needless debugging down the line. And it likely affects more than just enums. You might also want to detect it and at least handle the error gracefully. |
* Returned unused parameter * Updated README * Updated version * Fixed await this._overrideConnectMethod(contract); * Clarified error * Optimized network usage * Improved UX with TruffleReporter * Improved deployed function * Deleted redundant _waitForDeployment * fixes due to Reporter optimizations * Added new line before summary * Updated version * Resolved errors related to verifier * Add one-second delay before next attempt * Tried to fix ethers-io/ethers.js#1126 * Optimized getInterfaceOnlyWithConstructor * Updated version
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
What was wrong?
Abicoder
fails to properly parse/use the ABI generated bysolc
for a library. One example of this is that for contracts thetype
of an enum is reported as an integer type (uint8
if enum has 256 of less entries) while for libraries it'senum L.E
(whereL
is a library name andE
is some enum).An attempt to use such an
enum
results in an error:Code that produced the error
This assumes that you have
solc
,npm
andnode
in yourPATH
.Just run these commands in a shell in an empty directory:
Full error output
Environment
[email protected]
npm 6.14.7
node.js v10.22.1
solc 0.7.4
How can it be fixed?
The inconsistent ABI for libraries is actually a problem in the compiler and is likely to be fixed in the near future (feedback welcome in ethereum/solidity#9278). It affects other tools too: dethcrypto/TypeChain#216, ethereum/eth-abi#146.
In the meantime (and for older versions when it's fixed), tools need to handle it differently than in contracts.
The text was updated successfully, but these errors were encountered: