-
-
Notifications
You must be signed in to change notification settings - Fork 261
Support domain-only EthereumSignTypedData and other improvements #1033
Conversation
if (payload.message_hash) { | ||
this.params = { | ||
...this.params, | ||
domain_separator_hash: payload.domain_separator_hash, | ||
message_hash: payload.message_hash, | ||
}; | ||
} |
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.
This is in a separate if
-statement to make Flow-type happy.
Hi, we are switching to master branch of trezor-common here https://github.com/trezor/connect/pull/1036/files and yes. It needs to sort out some types incompabilities. Patience please. |
Updated trezor-common is now in develop branch. |
Hello @aloisklink |
No worries, this isn't urgent, this PR is currently mainly just documentation/improved-types. I'm also very close to being done with adding support for trezor/trezor-firmware#2036 (I can push it into this PR, or into a separate one), which fixes any of the failing tests in I did encounter a bug with |
c7e516b
to
0bff3e5
Compare
Rebased on the latest I did it last night before you commented, so GitHub's UI is showing the commit before your comment. I also added support for trezor/trezor-firmware#2036 in 0bff3e5, so that the T1/TT tests now pass on the updated fixtures. Let me know if you'd prefer me to put this into a separate PR. I've tested locally using:
Fixup commits |
Hi, please rebase and feel free to include everything you need into this PR. I think it looks good so once conflicts are resolved we can merge it. |
BREAKING CHANGE: EthereumSignTypedData now requires passing Trezor T variables. Trezor Model 1 parameters are still optional, as blind signing requires using an extra dependency on an external library, and is less secure.
Add support for signing domain-only data in ethereumSignTypedData, e.g. when primaryType = EIP712Domain. On Trezor T, this behaviour previously gave incorrect signatures or threw errors. On Trezor Model 1, not passing the "message_hash" parameter caused an error.
Adds support for domain-only EIP-712 hashes to plugins/ethereum/typedData.js
d780e6e
to
4e8873a
Compare
ethereumSignTypedData now passes on tests, so we can add it to CI.
4e8873a
to
5530f40
Compare
Thanks for the feedback! I've rebased on Since It's ready to merge from my side 😄 Side-note, I didn't add a CI test for |
Running plugins in CI would be great. Github is a good fit for this as it runs for external contributions automatically (gitlab does not) and plugins are mostly developed by external contributors I guess. So I think we would appreciate such effort. |
Add documentation on using
EthereumSignTypedData
on T1 and improved types. These were missing from #1015.Minor breaking change
EthereumSignTypedData
now requires passing Trezor T variables. This seems makes sense from my side, since everybody using this function should pass Trezor T variables anyway, and since this function was only recently released, I doubt this change would affect any users of this library.Plus, it makes all the code (especially types!) simpler.
Trezor Model 1 parameters are still optional, as blind signing requires using an extra dependency on an external library, and is less secure.
Support for
primaryType
=EIP712Domain
I tried adding docs/tests/types for trezor/trezor-firmware#2036 in this PR too, but updating thesubmodules/trezor-common
submodule just causes a bunch of other Protobuf type errors to occur, so I'll do that in another separate PR in the future.I've added support for trezor/trezor-firmware#2036 in this PR too, since they both edit similar files.
I've tested locally using:
./tests/run.sh -D 'podman' -i 'ethereumSignTypedData'
Success now FixgetFirmwareRange()
for multiple matching firmware ranges #1042 been mergedFails./tests/run.sh -D 'podman' -i 'ethereumSignTypedData' -f '2-master'
Success./tests/run.sh -D 'podman' -i 'ethereumSignTypedData' -f '1-master'
Success