Skip to content
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

Fails to generate types with a library that defines enums #216

Closed
stwiname opened this issue Feb 17, 2020 · 11 comments · Fixed by #281
Closed

Fails to generate types with a library that defines enums #216

stwiname opened this issue Feb 17, 2020 · 11 comments · Fixed by #281
Labels

Comments

@stwiname
Copy link

When I attempt to generate types I am getting this error Error occured: Unknown type: ALib.BOOL

I have attached a minimal example: Archive.zip
To repro: yarn && yarn build

The error seems to be the same as #125 but is still happening

@quezak
Copy link
Contributor

quezak commented Mar 31, 2020

Preliminary research shows that the ABI for the other function is different for a library:

// ...
      "inputs": [
        {
          "internalType": "enum ALib.BOOL",
          "name": "b",
          "type": "ALib.BOOL"
        }

While if I just change interface ALib to contract ALib, the type of the argument is plain uint8:

// ...
      "inputs": [
        {
          "internalType": "enum ALib.BOOL",
          "name": "b",
          "type": "uint8"
        }

I'll check if that's only when compiling with Truffle (personally I'm using Waffle :) )

@quezak
Copy link
Contributor

quezak commented Mar 31, 2020

Confirmed, the situation is the same. We'll need to see why the ABI differs between these two cases and how we can handle that in the generation step -- it will probably affect all targets.

Btw, sorry @stwiname for the delayed response, and thanks for the full repro.

@quezak quezak added the bug label Mar 31, 2020
@SilentCicero
Copy link

I'm stuck on this as well.

@quezak
Copy link
Contributor

quezak commented Sep 16, 2020

@SilentCicero what solc version are you using? I'm wondering if it's still the same in v0.7.0

@SilentCicero
Copy link

SilentCicero commented Sep 16, 2020 via email

@krzkaczor
Copy link
Member

@stwiname @SilentCicero Can someone prepare minimal repro for this?

@quezak
Copy link
Contributor

quezak commented Sep 30, 2020

@krzkaczor OP already contains a minimal repro :D when I checked it in March it was correct (ie. was bugged as described above)

@krzkaczor
Copy link
Member

Sorry I missed it 😆 I will work on this later today

@krzkaczor
Copy link
Member

This should be fixed now! Relased as typechain@2.0.1

@SilentCicero
Copy link

SilentCicero commented Oct 5, 2020 via email

@cameel
Copy link

cameel commented Oct 28, 2020

This is not the only inconsistency in the library ABI. This comes mostly from the fact that selectors for library functions are computed differently than for contract functions, but still, it's a bit of a mess. There's already an issue for it in Solidity repo and the discussion on how to handle it is ongoing. Since you're clearly affected by this, any feedback from your side would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants