You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked there isn't already an issue for the bug I encountered.
Viem Version
2.21.44
Current Behavior
Good afternoon!
I can pass any value as domain to the hashTypedData function and it will be hashed regardless without checking its type at runtime.
hashTypedData({
...typedData.complex,
domain: 'wrong' as unknown as Record<string, unknown>,
primaryType: 'Mail',
}),
The equivalent in ethers does check the value at runtime.
Expected Behavior
I get an error since I am trying to fool the function and the hash that I get as a result does not take the domain into account (might be just an error on my side).
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
Check existing issues
Viem Version
2.21.44
Current Behavior
Good afternoon!
I can pass any value as
domain
to thehashTypedData
function and it will be hashed regardless without checking its type at runtime.The equivalent in
ethers
does check the value at runtime.Expected Behavior
I get an error since I am trying to fool the function and the hash that I get as a result does not take the domain into account (might be just an error on my side).
Steps To Reproduce
Run
pnpm vitest run src/utils/signature/hashTypedData.test.ts -t 'wrong domain value'
on this forked branch: https://github.com/freemanzMrojo/viem/tree/test-hash-typed-data (it uses the code above).Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: