Revert "Revert "chore(sdk): Add MaybeArbitrary as super trait"" (#12810)

Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
Matthias Seitz
2024-11-24 08:46:16 +01:00
committed by GitHub
parent 6695d07c65
commit 0d6ebec574
13 changed files with 175 additions and 133 deletions

View File

@ -34,9 +34,13 @@ serde = { workspace = true, optional = true }
# misc
derive_more.workspace = true
# test-utils
arbitrary = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies]
reth-codecs = { workspace = true, features = ["test-utils"] }
rstest.workspace = true
arbitrary.workspace = true
[features]
default = ["std", "reth-codec"]
@ -65,3 +69,13 @@ serde = [
"reth-codecs/serde",
"op-alloy-consensus/serde",
]
arbitrary = [
"dep:arbitrary",
"reth-primitives-traits/arbitrary",
"reth-primitives/arbitrary",
"reth-codecs?/arbitrary",
"op-alloy-consensus/arbitrary",
"alloy-consensus/arbitrary",
"alloy-eips/arbitrary",
"alloy-primitives/arbitrary",
]

View File

@ -2,10 +2,11 @@
//! `OpTxType` implements `reth_primitives_traits::TxType`.
//! This type is required because a `Compact` impl is needed on the deposit tx type.
use core::fmt::Debug;
use alloy_primitives::{U64, U8};
use alloy_rlp::{Decodable, Encodable, Error};
use bytes::BufMut;
use core::fmt::Debug;
use derive_more::{
derive::{From, Into},
Display,
@ -13,8 +14,10 @@ use derive_more::{
use op_alloy_consensus::OpTxType as AlloyOpTxType;
use reth_primitives_traits::{InMemorySize, TxType};
/// Wrapper type for [`op_alloy_consensus::OpTxType`] to implement [`TxType`] trait.
/// Wrapper type for [`op_alloy_consensus::OpTxType`] to implement
/// [`TxType`] trait.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Display, Ord, Hash, From, Into)]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
#[into(u8)]
pub struct OpTxType(AlloyOpTxType);