mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 01:28:21 -05:00
chore: add optimism_deposit_tx_signature function (#5457)
This commit is contained in:
@@ -1209,7 +1209,7 @@ impl TransactionSigned {
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
let signature = if tx_type == DEPOSIT_TX_TYPE_ID {
|
||||
Signature::default()
|
||||
Signature::optimism_deposit_tx_signature()
|
||||
} else {
|
||||
Signature::decode(data)?
|
||||
};
|
||||
@@ -1358,11 +1358,10 @@ impl proptest::arbitrary::Arbitrary for TransactionSigned {
|
||||
}
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
let sig = if transaction.is_deposit() {
|
||||
Signature { r: crate::U256::ZERO, s: crate::U256::ZERO, odd_y_parity: false }
|
||||
} else {
|
||||
sig
|
||||
};
|
||||
let sig = transaction
|
||||
.is_deposit()
|
||||
.then(Signature::optimism_deposit_tx_signature)
|
||||
.unwrap_or(sig);
|
||||
|
||||
let mut tx =
|
||||
TransactionSigned { hash: Default::default(), signature: sig, transaction };
|
||||
|
||||
@@ -19,6 +19,15 @@ pub struct Signature {
|
||||
pub odd_y_parity: bool,
|
||||
}
|
||||
|
||||
impl Signature {
|
||||
/// Returns the signature for the optimism deposit transactions, which don't include a
|
||||
/// signature.
|
||||
#[cfg(feature = "optimism")]
|
||||
pub(crate) const fn optimism_deposit_tx_signature() -> Self {
|
||||
Signature { r: U256::ZERO, s: U256::ZERO, odd_y_parity: false }
|
||||
}
|
||||
}
|
||||
|
||||
impl Compact for Signature {
|
||||
fn to_compact<B>(self, buf: &mut B) -> usize
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user