Replies: 4 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? |
Beta Was this translation helpful? Give feedback.
-
|
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"
}
] |
Beta Was this translation helpful? Give feedback.
-
|
Yeah. That is literally not enough data to process. :) |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What was wrong?
Abicoderfails to properly parse/use the ABI generated bysolcfor a library. One example of this is that for contracts thetypeof an enum is reported as an integer type (uint8if enum has 256 of less entries) while for libraries it'senum L.E(whereLis a library name andEis some enum).An attempt to use such an
enumresults in an error:Code that produced the error
This assumes that you have
solc,npmandnodein yourPATH.Just run these commands in a shell in an empty directory:
Full error output
Environment
[email protected]npm 6.14.7node.js v10.22.1solc 0.7.4How 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 argotorg/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.
Beta Was this translation helpful? Give feedback.
All reactions