Skip to content
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

fix(signer-ledger): use SIGN_ETH_EIP_712 instruction #1479

Merged
merged 5 commits into from
Nov 1, 2024

Conversation

Karrq
Copy link
Contributor

@Karrq Karrq commented Oct 14, 2024

Motivation

Signing EIP712 messages thru alloy_network::TxSigner's sign_transaction results in the usage of SIGN instruction which does not support EIP712 messages.

Solution

Detect if the incoming tx is indeed a EIP712 transaction and dispatch to the appropriate method

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not that familiar with this api

wdyt @DaniPopes

@DaniPopes
Copy link
Member

There's no such thing as a EIP-712 transaction, nor does any of the existing transaction ever return EIP-712-encoded data, so I don't know what this is trying to accomplish.

@DaniPopes
Copy link
Member

Nevermind, apparently there is #142
Please add a comment for this
cc @prestwich

@Karrq
Copy link
Contributor Author

Karrq commented Oct 15, 2024

This allows foundry-zksync to sign transactions using ledger, since we make use of sign_transaction to sign the encoded eip712 transacion.

@Karrq
Copy link
Contributor Author

Karrq commented Nov 1, 2024

Hey guys, any update on this? Please let me know if the bugfix is not clear.

The main issue that this addresses is the correct dispatch of EIP712 encoded tx, since TxSigner::sign_transaction is the only entrypoint available from foundry.
alloy-signer-ledger already supports EIP712 signing using sign_typed_data, but this method was just not accessible from sign_transaction, which is why the PR was made.

Please let me know if you any concerns so I may address them :)

crates/signer-ledger/src/signer.rs Show resolved Hide resolved
crates/signer-ledger/src/signer.rs Outdated Show resolved Hide resolved
crates/signer-ledger/src/signer.rs Outdated Show resolved Hide resolved
@Karrq Karrq requested a review from mattsse November 1, 2024 16:34
@DaniPopes DaniPopes merged commit b1c223e into alloy-rs:main Nov 1, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants