fix: enforce correct parity encoding for typed transactions#1305
Conversation
|
Wondering if we should consider introducing parity generic on signature? this might end up hacky, but likely can be done in a nice way with some helper traits |
|
eg we could do trait SignableTransaction {
type Signature;
...
}
struct Signed<Unsigned: SignableTransaction> {
tx: Unsigned,
signature: Unsigned::Signature,
}
impl SignableTransaction for TxLegacy {
type Signature = primitives::Signature<LegacyParity>;
...
}
impl SignableTransaction for TxLegacy {
// default generic would be a simple bool
type Signature = primitives::Signature;
...
} |
mattsse
left a comment
There was a problem hiding this comment.
we def need to enforce this on decoding, but I think we have a problem an encoding where it would be possible to use an incorrect signature, right?
so making the sig tx specific makes sense, if we can make the ergonomics right, because dealing with these things manually is a pita
yeah, we enforce correct parity in alloy/crates/consensus/src/transaction/eip1559.rs Lines 339 to 342 in e57eb86 |
Motivation
Enforces that we only accept 0 or 1 as parity for typed transactions, and only 27, 28 or 35.. for legacy transactions
ref paradigmxyz/reth#10758
Solution
PR Checklist