chore(sdk): Add InMemorySize as super trait (#12615)

This commit is contained in:
Tien Nguyen
2024-11-18 18:56:10 +07:00
committed by GitHub
parent 4daec16272
commit 378e097aea
8 changed files with 52 additions and 8 deletions

View File

@ -7,6 +7,8 @@ use core::fmt;
use reth_codecs::Compact;
use serde::{Deserialize, Serialize};
use crate::InMemorySize;
/// Helper trait that unifies all behaviour required by receipt to support full node operations.
pub trait FullReceipt: Receipt + Compact {}
@ -25,6 +27,7 @@ pub trait Receipt:
+ alloy_rlp::Encodable
+ alloy_rlp::Decodable
+ Serialize
+ InMemorySize
+ for<'de> Deserialize<'de>
{
/// Returns transaction type.

View File

@ -8,7 +8,7 @@ use alloy_primitives::{keccak256, Address, PrimitiveSignature, TxHash, B256};
use reth_codecs::Compact;
use revm_primitives::TxEnv;
use crate::{FullTransaction, MaybeArbitrary, Transaction};
use crate::{FullTransaction, InMemorySize, MaybeArbitrary, Transaction};
/// Helper trait that unifies all behaviour required by block to support full node operations.
pub trait FullSignedTx: SignedTransaction<Transaction: FullTransaction> + Compact {}
@ -35,6 +35,7 @@ pub trait SignedTransaction:
+ Decodable2718
+ alloy_consensus::Transaction
+ MaybeArbitrary
+ InMemorySize
{
/// Transaction type that is signed.
type Transaction: Transaction;

View File

@ -3,6 +3,8 @@ use core::fmt;
use alloy_primitives::{U64, U8};
use reth_codecs::Compact;
use crate::InMemorySize;
/// Helper trait that unifies all behaviour required by transaction type ID to support full node
/// operations.
pub trait FullTxType: TxType + Compact {}
@ -29,6 +31,7 @@ pub trait TxType:
+ TryFrom<U64>
+ alloy_rlp::Encodable
+ alloy_rlp::Decodable
+ InMemorySize
{
/// Returns `true` if this is a legacy transaction.
fn is_legacy(&self) -> bool;