-
Notifications
You must be signed in to change notification settings - Fork 80
Always maintain the invariant for TransactionSignature #67
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
Conversation
odd_y_parity: false, | ||
r: hex!("36b241b061a36a32ab7fe86c7aa9eb592dd59018cd0443adc0903590c16b02b0").into(), | ||
s: hex!("5edcc541b4741c5cc6dd347c5ed9577ef293a62787b4510465fadbfe39ee4094").into(), | ||
signature: eip2930::TransactionSignature::new( |
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.
signature: eip2930::TransactionSignature::new( | |
signature: eip1559::TransactionSignature::new( |
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.
Nevermind, just saw that it reuses eip2930::TransactionSignature.
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.
Maybe it could be in a common module that shares the common types like TransactionSignature
, AccessList
and TransactionAction
, just to avoid confusion?
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.
The idea is to reuse unchanged struct from older hard forks to newer hard forks.
- We have legacy -> EIP-2930 -> EIP-1559 -> EIP-7702.
- In legacy, a
TransactionSignature
is defined. This becomeslegacy::TransactionSignature
. - In EIP-2930, the format of
TransactionSignature
is changed, so we define aeip2930::TransactionSignature
. - The format of signature is unchanged in EIP-1559 and EIP-7702, so in
eip1559
andeip-7702
mods, wepub use super::eip2930::TransactionSignature
.
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.
LGTM
Just added a small remark
When the signature is invalid, the specification still asks that only the item is ignored, but not that decoding fails.
The
TransactionSignature
type was designed to always maintain the invariant for EIP-2, but this wasn't later properly done for EIP-1559, EIP-2930, etc.