diff --git a/crates/primitives-traits/Cargo.toml b/crates/primitives-traits/Cargo.toml index 2fec75666..b34987327 100644 --- a/crates/primitives-traits/Cargo.toml +++ b/crates/primitives-traits/Cargo.toml @@ -64,4 +64,4 @@ arbitrary = [ "dep:proptest", "dep:proptest-arbitrary-interop", ] -serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"] +serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"] \ No newline at end of file diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index ccc3ea13b..9c244226b 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -20,6 +20,9 @@ pub use constants::gas_units::{format_gas, format_gas_throughput}; pub mod account; pub use account::{Account, Bytecode}; +pub mod receipt; +pub use receipt::Receipt; + mod integer_list; pub use integer_list::{IntegerList, IntegerListError}; diff --git a/crates/primitives-traits/src/receipt.rs b/crates/primitives-traits/src/receipt.rs new file mode 100644 index 000000000..e2d19e4d4 --- /dev/null +++ b/crates/primitives-traits/src/receipt.rs @@ -0,0 +1,29 @@ +//! Receipt abstraction + +use alloc::fmt; + +use alloy_consensus::TxReceipt; +use reth_codecs::Compact; +use serde::{Deserialize, Serialize}; + +/// Helper trait that unifies all behaviour required by receipt to support full node operations. +pub trait FullReceipt: Receipt + Compact {} + +impl FullReceipt for T where T: Receipt + Compact {} + +/// Abstraction of a receipt. +pub trait Receipt: + TxReceipt + + Clone + + fmt::Debug + + PartialEq + + Eq + + Default + + alloy_rlp::Encodable + + alloy_rlp::Decodable + + Serialize + + for<'de> Deserialize<'de> +{ + /// Returns transaction type. + fn tx_type(&self) -> u8; +}