bug: uint and uint256 parsed different in EIP-712 Typed Data event signatures
krzkaczor opened this issue · 5 comments
Is there an existing issue for this?
- I have searched the existing issues
Package Version
0.1.7
Current Behavior
This results in two different types ie. uint
doesn't get coerced to uint256
.
// works
const logs = await client.getLogs({
address: erc20Address,
event: parseAbiItem('event Transfer(address indexed from, address indexed to, uint256 value)'),
fromBlock: 16790000n,
})
//doesnt work (no results)
const logs2 = await client.getLogs({
address: erc20Address,
event: parseAbiItem('event Transfer(address indexed from, address indexed to, uint value)'), // uint instead of uint256 here
fromBlock: 16790000n,
})
NOTE: Maybe this issue should be moved to abitype, i am not sure which library is responsible for ABI normalization.
Expected Behavior
Both queries works.
Steps To Reproduce
Just run the code stored above.
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
https://stackblitz.com/edit/viem-getting-started-vwxiwl?file=index.ts
Anything else?
Sorry I couldn't create repro on stackblitz due to some random error. I think the problem is also that template new.viev.sh
uses old viem version in package.json.
Anyway, great job on the library! I can't wait to use it more.
Isn't this intended? uint is a solidity alias, is it ABI conforming?
@greenlucid you are right that EIP-712 doesn't support uint
alias (i copied the whole selector from the sourcecode -- that's why i hit that).
However, I think that there should be some kind of error instead of a silent failure.
Thanks for reporting! Think we already have some code in PR that will solve this.
@tmm not sure if the current PRs have a fix for this. Unless I am missing something on your side.
If you don't have anything I can work on a PR that fix this.
Based on my interpretation of this (also below):
uint
,int
: synonyms foruint256
,int256
respectively. For computing the function selector,uint256
andint256
have to be used.
"type": "uint"
and "type": "int"
are both allowed. Not sure if any compilers output these as-is or convert to the fixed versions. Either way, converting things in #110
Separately, uint
and int
are already not allowed in EIP-712 Typed Data (see TypedDataType
).