-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
getBaseEncoder to support "uint" #4541
Comments
That does look wrong… I’ll get that fixed right away. Thanks! |
@ricmoo I would much appreciate it! I am trying to deploy my code with ethers V6 as soon as possible. |
In the meantime, you can just use "uint256" instead (which is the same thing), but I will get it out today. :) |
I've added a fix to the repo, but want to sleep on the solution over night before publishing. Please feel free to check ou the change above though. And all dust files have been updated, so you can try it out by installing it (via npm) from the GitHub repo. Would love some feedback. Basically, I normalize the types in the constructor so there is no change to the getBaseEncoder, since the types are also required in other parts of the encoder to reflect what the baseEncoder would use. I also add a case allowing for a custom type of There are test cases too, if curious what I mean. :) |
Thanks. I think it should support |
Still getting error
|
Is that from GitHub? The error indicates you are using 6.10.0, but the fix is only in 6.10.1 (which is not on npm yet). |
You’re right. I need to add the arrayification to that. I’m going to break that out into another function, like I should’ve in the first place. |
I installed as this.
by running command
|
@charlie-kim I've refactored the Array parsing code. I'd love an extra set of eyes to look it over. ;) You should be able to install the |
Hey @ricmoo , I just found out I was running code in lib.commonjs and it didn't have the change you made. What is the process to have the change in the code here? |
The |
The current main branch seems to have the code built for lib.commonjs. I think the current main branch is working but let me test further to make sure. |
FYI, my contract has signature type defined with It looks good to me! |
There shouldn’t be any difference between using |
I tried your above example, swapping out the |
My test called
returns
and
returns
And contract can only validate the signature from the first one. My test uses hardhat-ethers and it does this to create signature.
|
I can successfully test signature by using pure ethers js. But using it with hardhat-ethers does not work with the new version. This one works.
This one does not work.
The work might be on them not you. |
I think I spotted the problem earlier. I just need to prepare a test case for the before-and-after. I think it’s a one-line fix when preparing the payload. Just got back from a tooth extraction though, so I’ll get to it in the next couple hours. :) |
Oh dang! Are you still under influence of anesthesia?? Take it easy! |
Oh no. They just froze my mouth. No crazy anesthesia. :) I've pushed a new version up to GitHub, if you could test against the main branch again? :) |
It works fine now! |
Without updating the contract? It unfortunately is not possible, as no wallet would be able to produce a valid hash for that (such as MetaMask); the hash is incorrect, so software like MetaMask will correctly reject it. The v5 Typed Encoder should not have worked either though? Also, you should talk to your auditing company, because that is definitely something that should have been caught... |
Actually, the contract has been working in production about a year with V5. We are generating signature in server side and let user call Also, V5 typed encoder uses |
Yikes. That is definitely a bug in v5 then. The hash is not to spec, so would not work with any other (non-buggy ;)) software. It is bad though, since it means wallets cannot accurately represent EIP-712 data to the user. It basically forces "blind signing", when it shouldn't. |
I will have to use v5 for now until we can upgrade the contract 😭 Thank you! |
@ricmoo I am trying to use event selector like you suggested. But the signature cannot be validated with it. Is there a working code sample? I used solidity 0.8.23. |
* docs: fixed typo in jsdocs for Wallet.createRandom (ethers-io#4461) * admin: added diff scripts for build page * admin: updated dist files * Added safe and finalized provider events (ethers-io#3921). * tests: bumped Node versions for testing (ethers-io#4451) * admin: style fix (ethers-io#4356) * More robust FallbackProvider broadcast (ethers-io#4186, ethers-io#4297, ethers-io#4442). * Account for provider config weight when kicking off a request in FallbackProvider (ethers-io#4298). * Fixed ParamType formatting causing bad tuple full and minimal ABI output (ethers-io#4329, ethers-io#4479). * Added Base network to AlchemyProvider (ethers-io#4384). * Add auto-detected static network support to providers and allow customizing socket provider options (ethers-io#4199, ethers-io#4418, ethers-io#4441). * Use provider-specified suggested priority fee when available, otherwise fallback onto existing logic of 1 gwei (ethers-io#4463). * admin: updated dist files * admin: update changelog after build-clean * docs: Fixed some grammar in getting-started (ethers-io#4486, ethers-io#4487, ethers-io#4488) * Fix uncatchable issue when sending transactions over JSON-RPC and provide some retry-recovery for missing v (ethers-io#4513). * admin: update dist files * Fix Base58 padding for string representation of binary data (ethers-io#4527). * admin: updated dist files * Limit decoded result imflation ratio from ABI-encoded data (ethers-io#4537). * admin: updated dist files * Better debugging output on fetch errors. * docs: added StaticJsonRpcProvider to migration docs * Fixed typo in Error string (ethers-io#4539). * Fix EIP-712 type aliases for uint and int (ethers-io#4541). * Added additional sepolia testnets. * Updated third-party provider network URLs (ethers-io#4542). * admin: updated dist files * Fixed normalization and abstracted EIP-712 Array parsing (ethers-io#4541). * admin: updated dist files * tests: added testing for correct thrid-party URLs * Updated thrid-part provider URLs for QuickNode. * tests: rename test suite to follow naming convention * admin: updated dist files * Normalize EIP-712 types before computing the payload (ethers-io#4541). * tests: add tests for EIP-712 payload aliases * admin: updated dist files --------- Co-authored-by: Richard Moore <me@ricmoo.com>
* Fix uncatchable issue when sending transactions over JSON-RPC and provide some retry-recovery for missing v (ethers-io#4513). * admin: update dist files * Fix Base58 padding for string representation of binary data (ethers-io#4527). * admin: updated dist files * Limit decoded result imflation ratio from ABI-encoded data (ethers-io#4537). * admin: updated dist files * Better debugging output on fetch errors. * docs: added StaticJsonRpcProvider to migration docs * Fixed typo in Error string (ethers-io#4539). * Fix EIP-712 type aliases for uint and int (ethers-io#4541). * Added additional sepolia testnets. * Updated third-party provider network URLs (ethers-io#4542). * admin: updated dist files * Fixed normalization and abstracted EIP-712 Array parsing (ethers-io#4541). * admin: updated dist files * tests: added testing for correct thrid-party URLs * Updated thrid-part provider URLs for QuickNode. * tests: rename test suite to follow naming convention * admin: updated dist files * Normalize EIP-712 types before computing the payload (ethers-io#4541). * tests: add tests for EIP-712 payload aliases * admin: updated dist files * (feat) ZIL-5458: Add emacs backups to .gitignore (feat) ZIL-5458: Don't validate canonical signatures --------- Co-authored-by: Richard Moore <me@ricmoo.com>
Ethers Version
6.9.2
Search Terms
hash
Describe the Problem
getBaseEncoder
function crashes whentype
isuint
.match[2]
is an empty string and it is not equal tonull
.https://github.com/ethers-io/ethers.js/blob/main/src.ts/hash/typed-data.ts#L132C2-L132C2
Updating to this might work.
(match[2] == null || match[2] == '' || match[2] === String(width))
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: