-
-
Notifications
You must be signed in to change notification settings - Fork 260
feat: Support Ethereum EIP-712 Sign Typed Data for Trezor T #983
Conversation
Hello, thanks for contribution! We are looking into it now. |
Ah, I'm sorry, I forgot to run an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm OK with using this code, you seem to be generally better at javascript than I am :) so this PR is the more complete one of the two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks very well overall. Only if you could please:
- add some very basic unit tests for
helpers/ethereumTypeDataConversions.js
. Not really needed to get 100% coverage. Basic tests for exported methods will be enough. - Use Buffer instead of TextEncoder to keep it consistent with the rest of the codebase. Is that possible for you?
Description of commits I made, since they're pretty much all just called
Just missed one more:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @aloisklink
thanks for the latest changes you have made. They look good.
Now I believe this is the last batch of changes requests. As you can see, these are mostly nitpicks but we would like to have them resolved to keep codebase consistent.
Great, from my perspective this is ready to go. I would still like to wait for @matejcik to resolve his conversation and my question on whether we need to do the client side checksum (I believe we don't). |
Ok, so please now squash your commits. I think this can all fit into 1 commit? Do you think it makes sense? Or is it better to keep some of the commits separated? |
da7872c
to
30d17ab
Compare
Hi @mroz22, I merged everything into one commit 30d17ab, except the change in (I use a bunch of Let me know if you want me to merge them into one commit too. |
Is it worth me rebasing on the There might be some style errors/merge conflicts in typescript files otherwise. |
Yes, please also rebase and fix potential conflicts and I believe we are done after that. |
Mainly useful for list destructuring, e.g.: const [_1, _2, b, c] = example; ([,,b,c] is kinda messy/confusing)
30d17ab
to
7075456
Compare
When I first made PR trezor#983, 8.2.4 wasn't out yet. And when I later ran `git rebase develop`, git merged the CHANGELOG.md entry into the wrong place 🤦. My fault, I should have double-checked after rebasing.
When I first made PR #983, 8.2.4 wasn't out yet. And when I later ran `git rebase develop`, git merged the CHANGELOG.md entry into the wrong place 🤦. My fault, I should have double-checked after rebasing.
Adds support for EIP-712 Typed Signed Data #825.
This is mostly adapted from the Python implementation in
python/src/trezorlib/ethereum.py
in trezor/trezor-firmware#1835One potential issue is TextEncoder, which is what I'm using to convert a UTF-8 string to bytes. It's supported in all the browsers Trezor Connect targets, except IE, and I'm unsure if Babel/Webpack is polyfilling it automatically. I've only runReplaced withkarma
tests on Chrome.Buffer.from('utf-8').toString('hex')
in 0103d17I also found quite a few Flow issues that I'm pretty sure would be fixed by updating Flow, (e.g.
await Promise
not always resolving the promise type) but unfortunately our.flowconfig
has deprecated options that aren't supported in the latest versions, so it's not trivial to update.