style: resort trait impl order (#1749)

This commit is contained in:
Matthias Seitz
2023-03-14 11:01:18 +01:00
committed by GitHub
parent b121e4d8c7
commit c3a49aea72

View File

@@ -176,6 +176,8 @@ pub enum Transaction {
Eip1559(TxEip1559),
}
// === impl Transaction ===
impl Transaction {
/// Heavy operation that return signature hash over rlp encoded transaction.
/// It is only for signature signing or signer recovery.
@@ -856,6 +858,8 @@ pub struct TransactionSignedEcRecovered {
signed_transaction: TransactionSigned,
}
// === impl TransactionSignedEcRecovered ===
impl TransactionSignedEcRecovered {
/// Signer of transaction recovered from signature
pub fn signer(&self) -> Address {
@@ -874,23 +878,6 @@ impl TransactionSignedEcRecovered {
}
}
/// A transaction type that can be created from a [`TransactionSignedEcRecovered`] transaction.
///
/// This is a conversion trait that'll ensure transactions received via P2P can be converted to the
/// transaction type that the transaction pool uses.
pub trait FromRecoveredTransaction {
/// Converts to this type from the given [`TransactionSignedEcRecovered`].
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self;
}
// Noop conversion
impl FromRecoveredTransaction for TransactionSignedEcRecovered {
#[inline]
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self {
tx
}
}
impl Encodable for TransactionSignedEcRecovered {
fn encode(&self, out: &mut dyn bytes::BufMut) {
self.signed_transaction.encode(out)
@@ -911,6 +898,23 @@ impl Decodable for TransactionSignedEcRecovered {
}
}
/// A transaction type that can be created from a [`TransactionSignedEcRecovered`] transaction.
///
/// This is a conversion trait that'll ensure transactions received via P2P can be converted to the
/// transaction type that the transaction pool uses.
pub trait FromRecoveredTransaction {
/// Converts to this type from the given [`TransactionSignedEcRecovered`].
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self;
}
// Noop conversion
impl FromRecoveredTransaction for TransactionSignedEcRecovered {
#[inline]
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self {
tx
}
}
/// The inverse of [`FromRecoveredTransaction`] that ensure the transaction can be sent over the
/// network
pub trait IntoRecoveredTransaction {