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

Create a transaction type that validates signature conforms to EIP-2 #260

Open
Tracked by #303
Wodann opened this issue Dec 22, 2023 · 0 comments
Open
Tracked by #303

Create a transaction type that validates signature conforms to EIP-2 #260

Wodann opened this issue Dec 22, 2023 · 0 comments

Comments

@Wodann
Copy link
Contributor

Wodann commented Dec 22, 2023

Per EIP-2, signatures with high s values are invalid Ethereum protocol signatures and shouldn't be used in transactions, as of the Homestead hardfork.

Currently, we don't validate this upon creation of a SignedTransaction, resulting in a k256 error when recovering the address of the signature. For ease of debugging, it should be illegal to construct a SignedTransaction in this invalid state.

We propose introducing two separate structs:

  1. struct for deserializing transactions with "unvalidated" signatures
  2. struct for validated signatures: SignedTransaction

The SignedTransaction should have a fallible constructor which validates an "unvalidated" signature, as well as an unsafe infallible constructor which accepts an "unvalidated" signature, given the function caller's guarantee that they have pre-validated the signature.

An example of the latter use cases is when signing a transaction, as k256 pre-normalises the signature.

Definition of Done
Split the deserialization logic of SignedTransaction to a separate struct and add a safe and unsafe constructor to SignedTransaction - according to the above specification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants