This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Fixes a parsing issue of EIP712 chain_id (chain_id = 80001 parsed as chain_id = 0x80001) #892
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When using the Eip712 derive macro for a contract on the Polygon chain, chain_ids seem to be not parsed correctly.
This outputs the following domain, with a chain_id that seems incorrect (and not validated by the Solidity contract) :
The chain_id of 524289 is equal to 0x80001 where it should normally be 80001 in decimal.
Solution
I changed the parsing of domain.chain_id to be parsed into a u64, instead of directly to the U256 type.
After being parsed to u64, I convert it to U256.