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

[Bug] Improperly encoded uint8 (enum) @ decoding constructor #196

Open
0x19 opened this issue Apr 5, 2024 · 1 comment
Open

[Bug] Improperly encoded uint8 (enum) @ decoding constructor #196

0x19 opened this issue Apr 5, 2024 · 1 comment
Assignees
Labels
abi Application Binary Interface ast Abstract Syntax Tree bug Something isn't working high priority High Priority Tasks unit test

Comments

@0x19
Copy link
Contributor

0x19 commented Apr 5, 2024

There's an edge case with advanced use of constructor arguments.

Etherscan addr: https://etherscan.io/address/0x8e7e518b0481ADFaF969ED1f2B25bf553B79a677#code

Constructor ABI:

[{"inputs":[{"internalType":"address","name":"cvpToken_","type":"address"},{"internalType":"address","name":"reservoir_","type":"address"},{"internalType":"uint256","name":"anchorPeriod_","type":"uint256"},{"internalType":"struct UniswapConfig.TokenConfig","name":"TokenConfig","type":"tuple","components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"bytes32","name":"symbolHash","type":"bytes32"},{"internalType":"uint256","name":"baseUnit","type":"uint256"},{"internalType":"enum UniswapConfig.PriceSource","name":"priceSource","type":"uint8"},{"internalType":"uint256","name":"fixedPrice","type":"uint256"},{"internalType":"address","name":"uniswapMarket","type":"address"},{"internalType":"bool","name":"isUniswapReversed","type":"bool"}]}],"outputs":[],"name":"","type":"constructor","stateMutability":"nonpayable"}]

Basically it results back with error failed to unpack values: abi: improperly encoded uint8 value

@0x19
Copy link
Contributor Author

0x19 commented Apr 5, 2024

Potential root causes:

  • Something in our Source Code -> AST -> IR -> ABI conversion is broken.
  • Way we are trying to decode is broken.

I've checked and constructor bytecode passed for unpacking is correct. That's not issue.

@0x19 0x19 self-assigned this Apr 5, 2024
@0x19 0x19 added bug Something isn't working abi Application Binary Interface unit test ast Abstract Syntax Tree high priority High Priority Tasks labels Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi Application Binary Interface ast Abstract Syntax Tree bug Something isn't working high priority High Priority Tasks unit test
Projects
None yet
Development

No branches or pull requests

1 participant