mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(sdk): limit FillTxEnv to super trait of FullSignedTx (#12614)
This commit is contained in:
@ -26,6 +26,7 @@ pub use receipt::{FullReceipt, Receipt};
|
||||
|
||||
pub mod transaction;
|
||||
pub use transaction::{
|
||||
execute::FillTxEnv,
|
||||
signed::{FullSignedTx, SignedTransaction},
|
||||
FullTransaction, Transaction, TransactionExt,
|
||||
};
|
||||
|
||||
10
crates/primitives-traits/src/transaction/execute.rs
Normal file
10
crates/primitives-traits/src/transaction/execute.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//! Abstraction of an executable transaction.
|
||||
|
||||
use alloy_primitives::Address;
|
||||
use revm_primitives::TxEnv;
|
||||
|
||||
/// Loads transaction into execution environment.
|
||||
pub trait FillTxEnv {
|
||||
/// Fills [`TxEnv`] with an [`Address`] and transaction.
|
||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, sender: Address);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
//! Transaction abstraction
|
||||
|
||||
pub mod execute;
|
||||
pub mod signed;
|
||||
|
||||
use core::{fmt, hash::Hash};
|
||||
|
||||
@ -6,14 +6,19 @@ use core::hash::Hash;
|
||||
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
|
||||
use alloy_primitives::{keccak256, Address, PrimitiveSignature, TxHash, B256};
|
||||
use reth_codecs::Compact;
|
||||
use revm_primitives::TxEnv;
|
||||
|
||||
use crate::{FullTransaction, InMemorySize, MaybeArbitrary, MaybeSerde, Transaction};
|
||||
use crate::{FillTxEnv, FullTransaction, InMemorySize, MaybeArbitrary, MaybeSerde, Transaction};
|
||||
|
||||
/// Helper trait that unifies all behaviour required by block to support full node operations.
|
||||
pub trait FullSignedTx: SignedTransaction<Transaction: FullTransaction> + Compact {}
|
||||
pub trait FullSignedTx:
|
||||
SignedTransaction<Transaction: FullTransaction> + FillTxEnv + Compact
|
||||
{
|
||||
}
|
||||
|
||||
impl<T> FullSignedTx for T where T: SignedTransaction<Transaction: FullTransaction> + Compact {}
|
||||
impl<T> FullSignedTx for T where
|
||||
T: SignedTransaction<Transaction: FullTransaction> + FillTxEnv + Compact
|
||||
{
|
||||
}
|
||||
|
||||
/// A signed transaction.
|
||||
#[auto_impl::auto_impl(&, Arc)]
|
||||
@ -71,9 +76,6 @@ pub trait SignedTransaction:
|
||||
fn recalculate_hash(&self) -> B256 {
|
||||
keccak256(self.encoded_2718())
|
||||
}
|
||||
|
||||
/// Fills [`TxEnv`] with an [`Address`] and transaction.
|
||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, sender: Address);
|
||||
}
|
||||
|
||||
/// Helper trait used in testing.
|
||||
|
||||
Reference in New Issue
Block a user