uniswap-oracle: REN/WETH sushiswap price fetch error
I tried to get REN(https://etherscan.io/token/0x408e41876cccdc0f92210600ef50372656052a38) price in WETH(https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2).
Sushi Factory: https://etherscan.io/address/0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac
I got Returned error: execution reverted: invalid extension node
error
The other tokens on sushiswap are working correctly, This is very wierd.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 22 (11 by maintainers)
Glad to hear it! I recommend taking some time to verify that the suggested change is the correct behavior. I think it is, but I haven’t looked at this code for a very long time so my confidence is low.
There are a couple known edge cases that we never handled because they didn’t come up in the Uniswap scenario, and this may be what you are running into if you are using it for other contracts.
One is that it doesn’t support validation of unset/0 values. If you have a proof that some value is unset/0, then verification will incorrectly fail.
The other I only vaguely remember, but I think it had something to do with extension paths not being processed correctly in some cases. Quickly reading back over the docs for MPTs, I think the problem might be that I move the path pointer forward here: https://github.com/Keydonix/uniswap-oracle/blob/339c7521e2b42c752e842560fc941aed25fe2d6a/contracts/source/MerklePatriciaVerifier.sol#L51 and then below I check to see if there are still nibbles remaining in the path: https://github.com/Keydonix/uniswap-oracle/blob/339c7521e2b42c752e842560fc941aed25fe2d6a/contracts/source/MerklePatriciaVerifier.sol#L57
However, you could end up in a situation where the nibbles that are walked in the first call take us to the end of the path and there is nothing left to walk through, thus the function will return
0
. A fix that you may want to try is to change the first line above to:And then change the second line linked above to: