-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in 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! |
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: