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(consensus): ensure into_signed forces correct format for eip1559/2930 txs #150

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/consensus/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,17 @@ impl Decodable for TxEip1559 {

impl Transaction for TxEip1559 {
type Signature = Signature;
// type Receipt = ReceiptWithBloom;

fn into_signed(self, signature: Signature) -> Signed<Self> {
let mut buf = vec![];
buf.put_u8(TxType::Eip1559 as u8);
self.encode_signed(&signature, &mut buf);
let hash = keccak256(&buf);

Signed::new_unchecked(self, signature, hash)
// Drop any v chain id value to ensure the signature format is correct at the time of
// combination for an EIP-1559 transaction. V should indicate the y-parity of the
// signature.
Signed::new_unchecked(self, signature.with_parity_bool(), hash)
}

fn encode_signed(&self, signature: &Signature, out: &mut dyn BufMut) {
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ impl Transaction for TxEip2930 {
self.encode_signed(&signature, &mut buf);
let hash = keccak256(&buf);

Signed::new_unchecked(self, signature, hash)
// Drop any v chain id value to ensure the signature format is correct at the time of
// combination for an EIP-2930 transaction. V should indicate the y-parity of the
// signature.
Signed::new_unchecked(self, signature.with_parity_bool(), hash)
}

fn encode_signed(&self, signature: &Signature, out: &mut dyn BufMut) {
Expand Down