feat: optional serde features (#1214)

Co-authored-by: lambdaclass-user <github@lambdaclass.com>
This commit is contained in:
Tomás
2023-02-07 20:52:32 -03:00
committed by GitHub
parent 8ace2fb0ea
commit 1d1d90bd19
28 changed files with 156 additions and 208 deletions

2
Cargo.lock generated
View File

@ -4331,7 +4331,6 @@ dependencies = [
"reth-primitives", "reth-primitives",
"reth-rpc-types", "reth-rpc-types",
"secp256k1 0.24.3", "secp256k1 0.24.3",
"serde",
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
@ -4554,7 +4553,6 @@ dependencies = [
"reth-primitives", "reth-primitives",
"reth-rpc-types", "reth-rpc-types",
"secp256k1 0.24.3", "secp256k1 0.24.3",
"serde",
"test-fuzz", "test-fuzz",
"thiserror", "thiserror",
"tokio", "tokio",

View File

@ -21,7 +21,6 @@ bytes = "1.2"
reth-eth-wire = { path = "../net/eth-wire" } reth-eth-wire = { path = "../net/eth-wire" }
# codecs # codecs
serde = { version = "1.0.*", default-features = false }
parity-scale-codec = { version = "3.2.1", features = ["bytes"] } parity-scale-codec = { version = "3.2.1", features = ["bytes"] }
futures = "0.3.25" futures = "0.3.25"
tokio-stream = "0.1.11" tokio-stream = "0.1.11"

View File

@ -23,7 +23,6 @@ secp256k1 = { version = "0.24", features = [
"global-context", "global-context",
"rand-std", "rand-std",
"recovery", "recovery",
"serde",
] } ] }
enr = { version = "0.7.0", default-features = false, features = [ enr = { version = "0.7.0", default-features = false, features = [
"rust-secp256k1", "rust-secp256k1",
@ -40,7 +39,7 @@ thiserror = "1.0"
hex = "0.4" hex = "0.4"
rand = { version = "0.8", optional = true } rand = { version = "0.8", optional = true }
generic-array = "0.14" generic-array = "0.14"
serde = "1.0" serde = { version = "1.0", optional = true }
[dev-dependencies] [dev-dependencies]
rand = "0.8" rand = "0.8"
@ -48,4 +47,6 @@ tokio = { version = "1", features = ["macros"] }
reth-tracing = { path = "../../tracing" } reth-tracing = { path = "../../tracing" }
[features] [features]
test-utils = ["rand"] default = ["serde"]
test-utils = ["dep:rand"]
serde = ["dep:serde"]

View File

@ -8,14 +8,17 @@ use reth_net_common::ban_list::BanList;
use reth_net_nat::{NatResolver, ResolveNatInterval}; use reth_net_nat::{NatResolver, ResolveNatInterval};
use reth_primitives::NodeRecord; use reth_primitives::NodeRecord;
use reth_rlp::Encodable; use reth_rlp::Encodable;
use secp256k1::serde::{Deserialize, Serialize};
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
time::Duration, time::Duration,
}; };
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Configuration parameters that define the performance of the discovery network. /// Configuration parameters that define the performance of the discovery network.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Discv4Config { pub struct Discv4Config {
/// Whether to enable the incoming packet filter. Default: false. /// Whether to enable the incoming packet filter. Default: false.
pub enable_packet_filter: bool, pub enable_packet_filter: bool,
@ -39,7 +42,7 @@ pub struct Discv4Config {
/// The duration we set for neighbours responses /// The duration we set for neighbours responses
pub neighbours_expiration: Duration, pub neighbours_expiration: Duration,
/// Provides a way to ban peers and ips. /// Provides a way to ban peers and ips.
#[serde(skip)] #[cfg_attr(feature = "serde", serde(skip))]
pub ban_list: BanList, pub ban_list: BanList,
/// Set the default duration for which nodes are banned for. This timeouts are checked every 5 /// Set the default duration for which nodes are banned for. This timeouts are checked every 5
/// minutes, so the precision will be to the nearest 5 minutes. If set to `None`, bans from /// minutes, so the precision will be to the nearest 5 minutes. If set to `None`, bans from
@ -137,7 +140,8 @@ impl Default for Discv4Config {
} }
/// Builder type for [`Discv4Config`] /// Builder type for [`Discv4Config`]
#[derive(Clone, Debug, Default, Serialize, Deserialize)] #[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Discv4ConfigBuilder { pub struct Discv4ConfigBuilder {
config: Discv4Config, config: Discv4Config,
} }

View File

@ -37,9 +37,13 @@ lru = "0.9"
thiserror = "1.0" thiserror = "1.0"
tracing = "0.1" tracing = "0.1"
parking_lot = "0.12" parking_lot = "0.12"
serde = "1.0" serde = { version = "1.0", optional = true }
serde_with = "2.1.0" serde_with = { version = "2.1.0", optional = true }
[dev-dependencies] [dev-dependencies]
tokio = { version = "1", features = ["sync", "rt", "rt-multi-thread"] } tokio = { version = "1", features = ["sync", "rt", "rt-multi-thread"] }
reth-tracing = { path = "../../tracing" } reth-tracing = { path = "../../tracing" }
[features]
default = ["serde"]
serde = ["dep:serde", "dep:serde_with"]

View File

@ -1,10 +1,12 @@
use serde::{Deserialize, Serialize};
use crate::tree::LinkEntry; use crate::tree::LinkEntry;
use std::{collections::HashSet, num::NonZeroUsize, time::Duration}; use std::{collections::HashSet, num::NonZeroUsize, time::Duration};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Settings for the [DnsDiscoveryService](crate::DnsDiscoveryService). /// Settings for the [DnsDiscoveryService](crate::DnsDiscoveryService).
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct DnsDiscoveryConfig { pub struct DnsDiscoveryConfig {
/// Timeout for DNS lookups. /// Timeout for DNS lookups.
/// ///

View File

@ -28,9 +28,11 @@ use data_encoding::{BASE32_NOPAD, BASE64URL_NOPAD};
use enr::{Enr, EnrError, EnrKey, EnrKeyUnambiguous, EnrPublicKey}; use enr::{Enr, EnrError, EnrKey, EnrKeyUnambiguous, EnrPublicKey};
use reth_primitives::hex; use reth_primitives::hex;
use secp256k1::SecretKey; use secp256k1::SecretKey;
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{fmt, str::FromStr}; use std::{fmt, str::FromStr};
#[cfg(feature = "serde")]
use serde_with::{DeserializeFromStr, SerializeDisplay};
const ROOT_V1_PREFIX: &str = "enrtree-root:v1"; const ROOT_V1_PREFIX: &str = "enrtree-root:v1";
const LINK_PREFIX: &str = "enrtree://"; const LINK_PREFIX: &str = "enrtree://";
const BRANCH_PREFIX: &str = "enrtree-branch:"; const BRANCH_PREFIX: &str = "enrtree-branch:";
@ -221,7 +223,8 @@ impl fmt::Display for BranchEntry {
} }
/// A link entry /// A link entry
#[derive(Debug, Clone, Hash, Eq, PartialEq, SerializeDisplay, DeserializeFromStr)] #[derive(Debug, Clone, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(SerializeDisplay, DeserializeFromStr))]
pub struct LinkEntry<K: EnrKeyUnambiguous = SecretKey> { pub struct LinkEntry<K: EnrKeyUnambiguous = SecretKey> {
pub domain: String, pub domain: String,
pub pubkey: K::PublicKey, pub pubkey: K::PublicKey,

View File

@ -11,7 +11,7 @@ readme = "README.md"
bytes = { version = "1.1" } bytes = { version = "1.1" }
hex = "0.4" hex = "0.4"
thiserror = "1" thiserror = "1"
serde = "1" serde = { version = "1", optional = true }
# reth # reth
reth-codecs = { path = "../../storage/codecs" } reth-codecs = { path = "../../storage/codecs" }
@ -27,7 +27,7 @@ tokio-stream = "0.1.11"
pin-project = "1.0" pin-project = "1.0"
tracing = "0.1.37" tracing = "0.1.37"
snap = "1.0.5" snap = "1.0.5"
smol_str = { version = "0.1", features = ["serde"] } smol_str = "0.1"
metrics = "0.20.1" metrics = "0.20.1"
# arbitrary utils # arbitrary utils
@ -52,10 +52,11 @@ proptest = { version = "1.0" }
proptest-derive = "0.3" proptest-derive = "0.3"
[features] [features]
default = [] default = ["serde"]
serde = ["dep:serde", "smol_str/serde"]
arbitrary = ["reth-primitives/arbitrary", "dep:arbitrary", "dep:proptest", "dep:proptest-derive"] arbitrary = ["reth-primitives/arbitrary", "dep:arbitrary", "dep:proptest", "dep:proptest-derive"]
[[test]] [[test]]
name = "fuzz_roundtrip" name = "fuzz_roundtrip"
path = "tests/fuzz_roundtrip.rs" path = "tests/fuzz_roundtrip.rs"
required-features = ["arbitrary"] required-features = ["arbitrary", "serde"]

View File

@ -4,9 +4,11 @@ use crate::{version::ParseVersionError, EthMessage, EthVersion};
use bytes::{BufMut, Bytes}; use bytes::{BufMut, Bytes};
use reth_codecs::add_arbitrary_tests; use reth_codecs::add_arbitrary_tests;
use reth_rlp::{Decodable, DecodeError, Encodable, RlpDecodable, RlpEncodable}; use reth_rlp::{Decodable, DecodeError, Encodable, RlpDecodable, RlpEncodable};
use serde::{Deserialize, Serialize};
use smol_str::SmolStr; use smol_str::SmolStr;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(any(test, feature = "arbitrary"))] #[cfg(any(test, feature = "arbitrary"))]
use proptest::{ use proptest::{
arbitrary::{any_with, ParamsFor}, arbitrary::{any_with, ParamsFor},
@ -14,7 +16,8 @@ use proptest::{
}; };
/// A Capability message consisting of the message-id and the payload /// A Capability message consisting of the message-id and the payload
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct RawCapabilityMessage { pub struct RawCapabilityMessage {
/// Identifier of the message. /// Identifier of the message.
pub id: usize, pub id: usize,
@ -24,7 +27,8 @@ pub struct RawCapabilityMessage {
/// Various protocol related event types bubbled up from a session that need to be handled by the /// Various protocol related event types bubbled up from a session that need to be handled by the
/// network. /// network.
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CapabilityMessage { pub enum CapabilityMessage {
/// Eth sub-protocol message. /// Eth sub-protocol message.
Eth(EthMessage), Eth(EthMessage),
@ -34,9 +38,8 @@ pub enum CapabilityMessage {
/// A message indicating a supported capability and capability version. /// A message indicating a supported capability and capability version.
#[add_arbitrary_tests(rlp)] #[add_arbitrary_tests(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Default, Hash)]
Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize, Default, Hash, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct Capability { pub struct Capability {
/// The name of the subprotocol /// The name of the subprotocol
pub name: SmolStr, pub name: SmolStr,

View File

@ -3,13 +3,16 @@
use bytes::Buf; use bytes::Buf;
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_rlp::{Decodable, DecodeError, Encodable, Header}; use reth_rlp::{Decodable, DecodeError, Encodable, Header};
use serde::{Deserialize, Serialize};
use std::fmt::Display; use std::fmt::Display;
use thiserror::Error; use thiserror::Error;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// RLPx disconnect reason. /// RLPx disconnect reason.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum DisconnectReason { pub enum DisconnectReason {
/// Disconnect requested by the local node or remote peer. /// Disconnect requested by the local node or remote peer.
#[default] #[default]

View File

@ -2,6 +2,8 @@ use crate::{capability::Capability, EthVersion, ProtocolVersion};
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::PeerId; use reth_primitives::PeerId;
use reth_rlp::{RlpDecodable, RlpEncodable}; use reth_rlp::{RlpDecodable, RlpEncodable};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// The client version: `reth/v{major}.{minor}.{patch}` /// The client version: `reth/v{major}.{minor}.{patch}`
@ -11,7 +13,8 @@ pub(crate) const DEFAULT_CLIENT_VERSION: &str = concat!("reth/v", env!("CARGO_PK
/// Message used in the `p2p` handshake, containing information about the supported RLPx protocol /// Message used in the `p2p` handshake, containing information about the supported RLPx protocol
/// version and capabilities. /// version and capabilities.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct HelloMessage { pub struct HelloMessage {
/// The version of the `p2p` protocol. /// The version of the `p2p` protocol.
pub protocol_version: ProtocolVersion, pub protocol_version: ProtocolVersion,

View File

@ -11,7 +11,6 @@ use metrics::counter;
use pin_project::pin_project; use pin_project::pin_project;
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_rlp::{Decodable, DecodeError, Encodable, EMPTY_LIST_CODE}; use reth_rlp::{Decodable, DecodeError, Encodable, EMPTY_LIST_CODE};
use serde::{Deserialize, Serialize};
use std::{ use std::{
collections::{BTreeSet, HashMap, HashSet, VecDeque}, collections::{BTreeSet, HashMap, HashSet, VecDeque},
io, io,
@ -21,6 +20,9 @@ use std::{
}; };
use tokio_stream::Stream; use tokio_stream::Stream;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// [`MAX_PAYLOAD_SIZE`] is the maximum size of an uncompressed message payload. /// [`MAX_PAYLOAD_SIZE`] is the maximum size of an uncompressed message payload.
/// This is defined in [EIP-706](https://eips.ethereum.org/EIPS/eip-706). /// This is defined in [EIP-706](https://eips.ethereum.org/EIPS/eip-706).
const MAX_PAYLOAD_SIZE: usize = 16 * 1024 * 1024; const MAX_PAYLOAD_SIZE: usize = 16 * 1024 * 1024;
@ -615,7 +617,8 @@ pub fn set_capability_offsets(
/// This represents only the reserved `p2p` subprotocol messages. /// This represents only the reserved `p2p` subprotocol messages.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum P2PMessage { pub enum P2PMessage {
/// The first packet sent over the connection, and sent once by both sides. /// The first packet sent over the connection, and sent once by both sides.
Hello(HelloMessage), Hello(HelloMessage),
@ -747,7 +750,8 @@ impl TryFrom<u8> for P2PMessageID {
/// RLPx `p2p` protocol version /// RLPx `p2p` protocol version
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ProtocolVersion { pub enum ProtocolVersion {
/// `p2p` version 4 /// `p2p` version 4
V4 = 4, V4 = 4,

View File

@ -4,6 +4,8 @@ use super::RawBlockBody;
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{BlockHashOrNumber, Header, HeadersDirection, TransactionSigned, H256}; use reth_primitives::{BlockHashOrNumber, Header, HeadersDirection, TransactionSigned, H256};
use reth_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use reth_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A request for a peer to return block headers starting at the requested block. /// A request for a peer to return block headers starting at the requested block.
@ -16,9 +18,8 @@ use serde::{Deserialize, Serialize};
/// If the [`skip`](#structfield.skip) field is non-zero, the peer must skip that amount of headers /// If the [`skip`](#structfield.skip) field is non-zero, the peer must skip that amount of headers
/// in the direction specified by [`reverse`](#structfield.reverse). /// in the direction specified by [`reverse`](#structfield.reverse).
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable)]
Copy, Clone, Debug, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable, Serialize, Deserialize, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct GetBlockHeaders { pub struct GetBlockHeaders {
/// The block number or hash that the peer should start returning headers from. /// The block number or hash that the peer should start returning headers from.
pub start_block: BlockHashOrNumber, pub start_block: BlockHashOrNumber,
@ -38,17 +39,8 @@ pub struct GetBlockHeaders {
/// The response to [`GetBlockHeaders`], containing headers if any headers were found. /// The response to [`GetBlockHeaders`], containing headers if any headers were found.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct BlockHeaders( pub struct BlockHeaders(
/// The requested headers. /// The requested headers.
pub Vec<Header>, pub Vec<Header>,
@ -62,17 +54,8 @@ impl From<Vec<Header>> for BlockHeaders {
/// A request for a peer to return block bodies for the given block hashes. /// A request for a peer to return block bodies for the given block hashes.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct GetBlockBodies( pub struct GetBlockBodies(
/// The block hashes to request bodies for. /// The block hashes to request bodies for.
pub Vec<H256>, pub Vec<H256>,
@ -87,9 +70,8 @@ impl From<Vec<H256>> for GetBlockBodies {
// TODO(onbjerg): We should have this type in primitives // TODO(onbjerg): We should have this type in primitives
/// A response to [`GetBlockBodies`], containing bodies if any bodies were found. /// A response to [`GetBlockBodies`], containing bodies if any bodies were found.
#[derive_arbitrary(rlp, 10)] #[derive_arbitrary(rlp, 10)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Default)]
Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize, Default, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct BlockBody { pub struct BlockBody {
/// Transactions in the block /// Transactions in the block
pub transactions: Vec<TransactionSigned>, pub transactions: Vec<TransactionSigned>,
@ -111,17 +93,8 @@ impl BlockBody {
/// The response to [`GetBlockBodies`], containing the block bodies that the peer knows about if /// The response to [`GetBlockBodies`], containing the block bodies that the peer knows about if
/// any were found. /// any were found.
#[derive_arbitrary(rlp, 1)] #[derive_arbitrary(rlp, 1)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct BlockBodies( pub struct BlockBodies(
/// The requested block bodies, each of which should correspond to a hash in the request. /// The requested block bodies, each of which should correspond to a hash in the request.
pub Vec<BlockBody>, pub Vec<BlockBody>,

View File

@ -2,22 +2,15 @@
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{Header, TransactionSigned, H256, U128}; use reth_primitives::{Header, TransactionSigned, H256, U128};
use reth_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use reth_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use serde::{Deserialize, Serialize};
use std::sync::Arc; use std::sync::Arc;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// This informs peers of new blocks that have appeared on the network. /// This informs peers of new blocks that have appeared on the network.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct NewBlockHashes( pub struct NewBlockHashes(
/// New block hashes and the block number for each blockhash. /// New block hashes and the block number for each blockhash.
/// Clients should request blocks using a [`GetBlockBodies`](crate::GetBlockBodies) message. /// Clients should request blocks using a [`GetBlockBodies`](crate::GetBlockBodies) message.
@ -40,9 +33,8 @@ impl NewBlockHashes {
/// A block hash _and_ a block number. /// A block hash _and_ a block number.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Default)]
Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize, Default, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct BlockHashNumber { pub struct BlockHashNumber {
/// The block hash /// The block hash
pub hash: H256, pub hash: H256,
@ -64,9 +56,8 @@ impl From<NewBlockHashes> for Vec<BlockHashNumber> {
/// A block body, including transactions and uncle headers. /// A block body, including transactions and uncle headers.
#[derive_arbitrary(rlp, 25)] #[derive_arbitrary(rlp, 25)]
#[derive( #[derive(Debug, Clone, PartialEq, Eq, Default, RlpEncodable, RlpDecodable)]
Debug, Clone, PartialEq, Eq, Default, RlpEncodable, RlpDecodable, Serialize, Deserialize, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct RawBlockBody { pub struct RawBlockBody {
/// This block's header /// This block's header
pub header: Header, pub header: Header,
@ -79,9 +70,8 @@ pub struct RawBlockBody {
/// A new block with the current total difficulty, which includes the difficulty of the returned /// A new block with the current total difficulty, which includes the difficulty of the returned
/// block. /// block.
#[derive_arbitrary(rlp, 25)] #[derive_arbitrary(rlp, 25)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Default)]
Clone, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize, Default, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
)]
pub struct NewBlock { pub struct NewBlock {
/// A new block. /// A new block.
pub block: RawBlockBody, pub block: RawBlockBody,
@ -92,17 +82,8 @@ pub struct NewBlock {
/// This informs peers of transactions that have appeared on the network and are not yet included /// This informs peers of transactions that have appeared on the network and are not yet included
/// in a block. /// in a block.
#[derive_arbitrary(rlp, 10)] #[derive_arbitrary(rlp, 10)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct Transactions( pub struct Transactions(
/// New transactions for the peer to include in its mempool. /// New transactions for the peer to include in its mempool.
pub Vec<TransactionSigned>, pub Vec<TransactionSigned>,
@ -134,17 +115,8 @@ pub struct SharedTransactions(
/// This informs peers of transaction hashes for transactions that have appeared on the network, /// This informs peers of transaction hashes for transactions that have appeared on the network,
/// but have not been included in a block. /// but have not been included in a block.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct NewPooledTransactionHashes( pub struct NewPooledTransactionHashes(
/// Transaction hashes for new transactions that have appeared on the network. /// Transaction hashes for new transactions that have appeared on the network.
/// Clients should request the transactions with the given hashes using a /// Clients should request the transactions with the given hashes using a

View File

@ -7,11 +7,14 @@ use super::{
use crate::SharedTransactions; use crate::SharedTransactions;
use bytes::{Buf, BufMut}; use bytes::{Buf, BufMut};
use reth_rlp::{length_of_length, Decodable, Encodable, Header}; use reth_rlp::{length_of_length, Decodable, Encodable, Header};
use serde::{Deserialize, Serialize};
use std::{fmt::Debug, sync::Arc}; use std::{fmt::Debug, sync::Arc};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// An `eth` protocol message, containing a message ID and payload. /// An `eth` protocol message, containing a message ID and payload.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ProtocolMessage { pub struct ProtocolMessage {
pub message_type: EthMessageID, pub message_type: EthMessageID,
pub message: EthMessage, pub message: EthMessage,
@ -140,7 +143,8 @@ impl From<EthBroadcastMessage> for ProtocolBroadcastMessage {
/// ///
/// The newer `eth/66` is an efficiency upgrade on top of `eth/65`, introducing a request id to /// The newer `eth/66` is an efficiency upgrade on top of `eth/65`, introducing a request id to
/// correlate request-response message pairs. This allows for request multiplexing. /// correlate request-response message pairs. This allows for request multiplexing.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum EthMessage { pub enum EthMessage {
/// Status is required for the protocol handshake /// Status is required for the protocol handshake
Status(Status), Status(Status),
@ -270,7 +274,8 @@ impl Encodable for EthBroadcastMessage {
/// Represents message IDs for eth protocol messages. /// Represents message IDs for eth protocol messages.
#[repr(u8)] #[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum EthMessageID { pub enum EthMessageID {
Status = 0x00, Status = 0x00,
NewBlockHashes = 0x01, NewBlockHashes = 0x01,
@ -352,7 +357,8 @@ impl TryFrom<usize> for EthMessageID {
/// This is used for all request-response style `eth` protocol messages. /// This is used for all request-response style `eth` protocol messages.
/// This can represent either a request or a response, since both include a message payload and /// This can represent either a request or a response, since both include a message payload and
/// request id. /// request id.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct RequestPair<T> { pub struct RequestPair<T> {
/// id for the contained request or response message /// id for the contained request or response message
pub request_id: u64, pub request_id: u64,

View File

@ -2,21 +2,14 @@
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{Receipt, H256}; use reth_primitives::{Receipt, H256};
use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A request for transaction receipts from the given block hashes. /// A request for transaction receipts from the given block hashes.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct GetReceipts( pub struct GetReceipts(
/// The block hashes to request receipts for. /// The block hashes to request receipts for.
pub Vec<H256>, pub Vec<H256>,
@ -25,17 +18,8 @@ pub struct GetReceipts(
/// The response to [`GetReceipts`], containing receipt lists that correspond to each block /// The response to [`GetReceipts`], containing receipt lists that correspond to each block
/// requested. /// requested.
#[derive_arbitrary(rlp, 1)] #[derive_arbitrary(rlp, 1)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct Receipts( pub struct Receipts(
/// Each receipt hash should correspond to a block hash in the request. /// Each receipt hash should correspond to a block hash in the request.
pub Vec<Vec<Receipt>>, pub Vec<Vec<Receipt>>,

View File

@ -2,23 +2,16 @@
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{Bytes, H256}; use reth_primitives::{Bytes, H256};
use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A request for state tree nodes corresponding to the given hashes. /// A request for state tree nodes corresponding to the given hashes.
/// This message was removed in `eth/67`, only clients running `eth/66` or earlier will respond to /// This message was removed in `eth/67`, only clients running `eth/66` or earlier will respond to
/// this message. /// this message.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct GetNodeData(pub Vec<H256>); pub struct GetNodeData(pub Vec<H256>);
/// The response to [`GetNodeData`], containing the state tree nodes or contract bytecode /// The response to [`GetNodeData`], containing the state tree nodes or contract bytecode
@ -27,17 +20,8 @@ pub struct GetNodeData(pub Vec<H256>);
/// Not all nodes are guaranteed to be returned by the peer. /// Not all nodes are guaranteed to be returned by the peer.
/// This message was removed in `eth/67`. /// This message was removed in `eth/67`.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct NodeData(pub Vec<Bytes>); pub struct NodeData(pub Vec<Bytes>);
#[cfg(test)] #[cfg(test)]

View File

@ -4,16 +4,19 @@ use ethers_core::utils::Genesis;
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{Chain, ChainSpec, ForkId, Hardfork, Head, H256, MAINNET, U256}; use reth_primitives::{Chain, ChainSpec, ForkId, Hardfork, Head, H256, MAINNET, U256};
use reth_rlp::{RlpDecodable, RlpEncodable}; use reth_rlp::{RlpDecodable, RlpEncodable};
use serde::{Deserialize, Serialize};
use std::fmt::{Debug, Display}; use std::fmt::{Debug, Display};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// The status message is used in the eth protocol handshake to ensure that peers are on the same /// The status message is used in the eth protocol handshake to ensure that peers are on the same
/// network and are following the same fork. /// network and are following the same fork.
/// ///
/// When performing a handshake, the total difficulty is not guaranteed to correspond to the block /// When performing a handshake, the total difficulty is not guaranteed to correspond to the block
/// hash. This information should be treated as untrusted. /// hash. This information should be treated as untrusted.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive(Copy, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable, Serialize, Deserialize)] #[derive(Copy, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Status { pub struct Status {
/// The current protocol version. For example, peers running `eth/66` would have a version of /// The current protocol version. For example, peers running `eth/66` would have a version of
/// 66. /// 66.

View File

@ -2,21 +2,14 @@
use reth_codecs::derive_arbitrary; use reth_codecs::derive_arbitrary;
use reth_primitives::{TransactionSigned, H256}; use reth_primitives::{TransactionSigned, H256};
use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use reth_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A list of transaction hashes that the peer would like transaction bodies for. /// A list of transaction hashes that the peer would like transaction bodies for.
#[derive_arbitrary(rlp)] #[derive_arbitrary(rlp)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct GetPooledTransactions( pub struct GetPooledTransactions(
/// The transaction hashes to request transaction bodies for. /// The transaction hashes to request transaction bodies for.
pub Vec<H256>, pub Vec<H256>,
@ -39,17 +32,8 @@ where
/// corresponds to a requested hash. Hashes may need to be re-requested if the bodies are not /// corresponds to a requested hash. Hashes may need to be re-requested if the bodies are not
/// included in the response. /// included in the response.
#[derive_arbitrary(rlp, 10)] #[derive_arbitrary(rlp, 10)]
#[derive( #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
Clone, #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Debug,
PartialEq,
Eq,
RlpEncodableWrapper,
RlpDecodableWrapper,
Serialize,
Deserialize,
Default,
)]
pub struct PooledTransactions( pub struct PooledTransactions(
/// The transaction bodies, each of which should correspond to a requested hash. /// The transaction bodies, each of which should correspond to a requested hash.
pub Vec<TransactionSigned>, pub Vec<TransactionSigned>,

View File

@ -23,8 +23,12 @@ tracing = "0.1"
pin-project-lite = "0.2.9" pin-project-lite = "0.2.9"
tokio = { version = "1", features = ["time"] } tokio = { version = "1", features = ["time"] }
thiserror = "1.0" thiserror = "1.0"
serde_with = "2.1.0" serde_with = { version = "2.1.0", optional = true }
[dev-dependencies] [dev-dependencies]
reth-tracing = { path = "../../tracing" } reth-tracing = { path = "../../tracing" }
tokio = { version = "1", features = ["macros"] } tokio = { version = "1", features = ["macros"] }
[features]
default = ["serde"]
serde = ["dep:serde_with"]

View File

@ -9,7 +9,6 @@
use igd::aio::search_gateway; use igd::aio::search_gateway;
use pin_project_lite::pin_project; use pin_project_lite::pin_project;
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{ use std::{
fmt, fmt,
future::{poll_fn, Future}, future::{poll_fn, Future},
@ -21,10 +20,12 @@ use std::{
}; };
use tracing::warn; use tracing::warn;
#[cfg(feature = "serde")]
use serde_with::{DeserializeFromStr, SerializeDisplay};
/// All builtin resolvers. /// All builtin resolvers.
#[derive( #[derive(Debug, Clone, Copy, Eq, PartialEq, Default, Hash)]
Debug, Clone, Copy, Eq, PartialEq, Default, Hash, SerializeDisplay, DeserializeFromStr, #[cfg_attr(feature = "serde", derive(SerializeDisplay, DeserializeFromStr))]
)]
pub enum NatResolver { pub enum NatResolver {
/// Resolve with any available resolver. /// Resolve with any available resolver.
#[default] #[default]

View File

@ -13,7 +13,7 @@ reth-primitives = { path = "../../primitives" }
reth-eth-wire = { path = "../eth-wire" } reth-eth-wire = { path = "../eth-wire" }
# io # io
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"], optional = true }
# misc # misc
async-trait = "0.1" async-trait = "0.1"
@ -21,4 +21,6 @@ thiserror = "1.0.37"
tokio = { version = "1.21.2", features = ["sync"] } tokio = { version = "1.21.2", features = ["sync"] }
[features] [features]
default = ["serde"]
serde = ["dep:serde"]
test-utils = [] test-utils = []

View File

@ -12,9 +12,11 @@
use async_trait::async_trait; use async_trait::async_trait;
use reth_eth_wire::DisconnectReason; use reth_eth_wire::DisconnectReason;
use reth_primitives::{NodeRecord, PeerId, H256, U256}; use reth_primitives::{NodeRecord, PeerId, H256, U256};
use serde::{Deserialize, Serialize};
use std::net::SocketAddr; use std::net::SocketAddr;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
pub use error::NetworkError; pub use error::NetworkError;
pub use reputation::{Reputation, ReputationChangeKind}; pub use reputation::{Reputation, ReputationChangeKind};
@ -90,7 +92,8 @@ pub enum PeerKind {
} }
/// The status of the network being ran by the local node. /// The status of the network being ran by the local node.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct NetworkStatus { pub struct NetworkStatus {
/// The local node client version. /// The local node client version.
pub client_version: String, pub client_version: String,
@ -100,10 +103,14 @@ pub struct NetworkStatus {
pub eth_protocol_info: EthProtocolInfo, pub eth_protocol_info: EthProtocolInfo,
} }
/// Information about the Ethereum Wire Protocol (ETH) /// Information about the Ethereum Wire Protocol (ETH)
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct EthProtocolInfo { pub struct EthProtocolInfo {
/// The current difficulty at the head of the chain. /// The current difficulty at the head of the chain.
#[serde(deserialize_with = "reth_primitives::serde_helper::deserialize_json_u256")] #[cfg_attr(
feature = "serde",
serde(deserialize_with = "reth_primitives::serde_helper::deserialize_json_u256")
)]
pub difficulty: U256, pub difficulty: U256,
/// The block hash of the head of the chain. /// The block hash of the head of the chain.
pub head: H256, pub head: H256,

View File

@ -63,10 +63,9 @@ secp256k1 = { version = "0.24", features = [
"global-context", "global-context",
"rand-std", "rand-std",
"recovery", "recovery",
"serde",
] } ] }
enr = { version = "0.7.0", features = ["serde", "rust-secp256k1"], optional = true } enr = { version = "0.7.0", features = ["rust-secp256k1"], optional = true }
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false, optional = true } ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false, optional = true }
tempfile = { version = "3.3", optional = true } tempfile = { version = "3.3", optional = true }
@ -97,5 +96,5 @@ serial_test = "0.10"
[features] [features]
default = ["serde"] default = ["serde"]
serde = ["dep:serde", "dep:humantime-serde"] serde = ["dep:serde", "dep:humantime-serde", "secp256k1/serde", "enr?/serde"]
test-utils = ["reth-provider/test-utils", "dep:enr", "dep:ethers-core", "dep:tempfile"] test-utils = ["reth-provider/test-utils", "dep:enr", "dep:ethers-core", "dep:tempfile"]

View File

@ -16,7 +16,7 @@ enr = { version = "0.7", default-features = false, optional = true }
rlp = { version = "0.5.2", default-features = false, optional = true } rlp = { version = "0.5.2", default-features = false, optional = true }
ethereum-types = { version = "0.14", features = ["codec"], optional = true } ethereum-types = { version = "0.14", features = ["codec"], optional = true }
reth-rlp-derive = { version = "0.1", path = "./rlp-derive", optional = true } reth-rlp-derive = { version = "0.1", path = "./rlp-derive", optional = true }
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = ["serde"] } revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = [] }
[dev-dependencies] [dev-dependencies]
reth-rlp = { path = ".", package = "reth-rlp", features = [ reth-rlp = { path = ".", package = "reth-rlp", features = [

View File

@ -16,7 +16,6 @@ reth-rpc-types = { path = "../../rpc/rpc-types" }
reth-db = { path = "../db" } reth-db = { path = "../db" }
# codecs # codecs
serde = { version = "1.0.*", default-features = false }
postcard = { version = "1.0.2", features = ["alloc"] } postcard = { version = "1.0.2", features = ["alloc"] }
parity-scale-codec = { version = "3.2.1", features = ["bytes"] } parity-scale-codec = { version = "3.2.1", features = ["bytes"] }

View File

@ -34,7 +34,7 @@ reth-metrics-derive = { path = "../metrics/metrics-derive" }
aquamarine = "0.2.1" # docs aquamarine = "0.2.1" # docs
thiserror = "1.0" thiserror = "1.0"
tracing = "0.1" tracing = "0.1"
serde = { version = "1.0", features = ["derive", "rc"] } serde = { version = "1.0", features = ["derive", "rc"], optional = true }
fnv = "1.0.7" fnv = "1.0.7"
bitflags = "1.3" bitflags = "1.3"
@ -52,4 +52,6 @@ rand = "0.8"
[features] [features]
test-utils = ["rand", "paste"] default = ["serde"]
serde = ["dep:serde"]
test-utils = ["rand", "paste", "serde"]

View File

@ -1,10 +1,13 @@
use crate::traits::PropagateKind; use crate::traits::PropagateKind;
use reth_primitives::{TxHash, H256}; use reth_primitives::{TxHash, H256};
use serde::{Deserialize, Serialize};
use std::sync::Arc; use std::sync::Arc;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Various events that describe status changes of a transaction. /// Various events that describe status changes of a transaction.
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum TransactionEvent { pub enum TransactionEvent {
/// Transaction has been added to the pending pool. /// Transaction has been added to the pending pool.
Pending, Pending,