Feature gate arbitrary crate in the consensus types crate (#7743)

Which issue # does this PR address?


  Puts the `arbitrary` crate behind a feature flag in the `types` crate.
This commit is contained in:
Eric Tu
2025-07-23 12:55:02 -04:00
committed by GitHub
parent 4daa015971
commit 9911f348bc
82 changed files with 404 additions and 576 deletions

4
Cargo.lock generated
View File

@@ -6016,9 +6016,9 @@ dependencies = [
[[package]]
name = "milhouse"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdc758ed0c2597254f45baa97c8aa35f44ae0c8b04ddc355f135ced531f316d6"
checksum = "2bdb104e38d3a8c5ffb7e9d2c43c522e6bcc34070edbadba565e722f0dee56c7"
dependencies = [
"alloy-primitives",
"arbitrary",

View File

@@ -184,7 +184,7 @@ malloc_utils = { path = "common/malloc_utils" }
maplit = "1"
merkle_proof = { path = "consensus/merkle_proof" }
metrics = { path = "common/metrics" }
milhouse = "0.6"
milhouse = { version = "0.7", default-features = false }
mockall = "0.13"
mockall_double = "0.3"
mockito = "1.5.0"

View File

@@ -1,4 +1,4 @@
FROM rust:1.84.0-bullseye AS builder
FROM rust:1.88.0-bullseye AS builder
RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev
COPY . lighthouse
ARG FEATURES

View File

@@ -9,18 +9,22 @@ default = ["sqlite", "legacy-arith"]
# Allow saturating arithmetic on slots and epochs. Enabled by default, but deprecated.
legacy-arith = []
sqlite = ["dep:rusqlite"]
# The `arbitrary-fuzz` feature is a no-op provided for backwards compatibility.
# For simplicity `Arbitrary` is now derived regardless of the feature's presence.
arbitrary-fuzz = []
arbitrary = [
"dep:arbitrary",
"bls/arbitrary",
"ethereum_ssz/arbitrary",
"milhouse/arbitrary",
"ssz_types/arbitrary",
"swap_or_not_shuffle/arbitrary",
]
arbitrary-fuzz = ["arbitrary"]
portable = ["bls/supranational-portable"]
[dependencies]
alloy-primitives = { workspace = true }
alloy-rlp = { version = "0.3.4", features = ["derive"] }
# The arbitrary dependency is enabled by default since Capella to avoid complexity introduced by
# `AbstractExecPayload`
arbitrary = { workspace = true, features = ["derive"] }
bls = { workspace = true, features = ["arbitrary"] }
arbitrary = { workspace = true, features = ["derive"], optional = true }
bls = { workspace = true }
compare_fields = { workspace = true }
compare_fields_derive = { workspace = true }
context_deserialize = { workspace = true }
@@ -29,7 +33,7 @@ derivative = { workspace = true }
eth2_interop_keypairs = { path = "../../common/eth2_interop_keypairs" }
ethereum_hashing = { workspace = true }
ethereum_serde_utils = { workspace = true }
ethereum_ssz = { workspace = true, features = ["arbitrary"] }
ethereum_ssz = { workspace = true }
ethereum_ssz_derive = { workspace = true }
fixed_bytes = { workspace = true }
hex = { workspace = true }
@@ -52,9 +56,9 @@ serde = { workspace = true, features = ["rc"] }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
smallvec = { workspace = true }
ssz_types = { workspace = true, features = ["arbitrary"] }
ssz_types = { workspace = true }
superstruct = { workspace = true }
swap_or_not_shuffle = { workspace = true, features = ["arbitrary"] }
swap_or_not_shuffle = { workspace = true }
tempfile = { workspace = true }
test_random_derive = { path = "../../common/test_random_derive" }
tracing = { workspace = true }

View File

@@ -2,7 +2,8 @@ use crate::{ChainSpec, Epoch, Validator};
use std::collections::BTreeSet;
/// Activation queue computed during epoch processing for use in the *next* epoch.
#[derive(Debug, PartialEq, Eq, Default, Clone, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Eq, Default, Clone)]
pub struct ActivationQueue {
/// Validators represented by `(activation_eligibility_epoch, index)` in sorted order.
///

View File

@@ -16,7 +16,6 @@ use tree_hash_derive::TreeHash;
variants(Base, Electra),
variant_attributes(
derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
@@ -29,23 +28,29 @@ use tree_hash_derive::TreeHash;
),
context_deserialize(ForkName),
serde(bound = "E: EthSpec"),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
),
ref_attributes(
derive(Debug, PartialEq, TreeHash, Serialize,),
derive(Debug, PartialEq, TreeHash, Serialize),
serde(untagged, bound = "E: EthSpec"),
tree_hash(enum_behaviour = "transparent")
),
map_ref_into(AttestationRef)
)]
#[derive(
arbitrary::Arbitrary, Debug, Clone, PartialEq, Serialize, Deserialize, Encode, TreeHash,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, TreeHash)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct AggregateAndProof<E: EthSpec> {
/// The index of the validator that created the attestation.
#[serde(with = "serde_utils::quoted_u64")]

View File

@@ -46,34 +46,31 @@ impl From<ssz_types::Error> for Error {
Encode,
TestRandom,
Derivative,
arbitrary::Arbitrary,
TreeHash,
),
context_deserialize(ForkName),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)
),
ref_attributes(derive(TreeHash), tree_hash(enum_behaviour = "transparent")),
cast_error(ty = "Error", expr = "Error::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "Error::IncorrectStateVariant")
)]
#[derive(
Debug,
Clone,
Serialize,
TreeHash,
Encode,
Derivative,
Deserialize,
arbitrary::Arbitrary,
PartialEq,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, TreeHash, Encode, Derivative, Deserialize, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct Attestation<E: EthSpec> {
#[superstruct(only(Base), partial_getter(rename = "aggregation_bits_base"))]
pub aggregation_bits: BitList<E::MaxValidatorsPerCommittee>,
@@ -601,6 +598,7 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for Vec<Attestation<E>>
}
*/
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
Debug,
Clone,
@@ -610,7 +608,6 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for Vec<Attestation<E>>
Encode,
TestRandom,
Derivative,
arbitrary::Arbitrary,
TreeHash,
PartialEq,
)]

View File

@@ -9,8 +9,8 @@ use tree_hash_derive::TreeHash;
/// The data upon which an attestation is based.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,

View File

@@ -1,7 +1,8 @@
use crate::*;
use serde::{Deserialize, Serialize};
#[derive(arbitrary::Arbitrary, Debug, PartialEq, Clone, Copy, Default, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Clone, Copy, Default, Serialize, Deserialize)]
pub struct AttestationDuty {
/// The slot during which the attester must attest.
pub slot: Slot,

View File

@@ -25,21 +25,26 @@ use tree_hash_derive::TreeHash;
Decode,
TreeHash,
TestRandom,
arbitrary::Arbitrary
),
context_deserialize(ForkName),
derivative(PartialEq, Eq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec"),
arbitrary(bound = "E: EthSpec")
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
),
),
ref_attributes(derive(Debug))
)]
#[derive(
Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative, arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative)]
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec", untagged)]
#[arbitrary(bound = "E: EthSpec")]
#[ssz(enum_behaviour = "transparent")]
#[tree_hash(enum_behaviour = "transparent")]
pub struct AttesterSlashing<E: EthSpec> {

View File

@@ -28,14 +28,17 @@ use self::indexed_attestation::IndexedAttestationBase;
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary
),
derivative(PartialEq, Hash(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")),
serde(
bound = "E: EthSpec, Payload: AbstractExecPayload<E>",
deny_unknown_fields
),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")
)
),
ref_attributes(
derive(Debug, PartialEq, TreeHash),
@@ -44,13 +47,15 @@ use self::indexed_attestation::IndexedAttestationBase;
map_ref_into(BeaconBlockBodyRef, BeaconBlock),
map_ref_mut_into(BeaconBlockBodyRefMut)
)]
#[derive(
Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative, arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(untagged)]
#[serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
#[arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
pub struct BeaconBlock<E: EthSpec, Payload: AbstractExecPayload<E> = FullPayload<E>> {

View File

@@ -40,14 +40,17 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11;
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary
),
derivative(PartialEq, Hash(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")),
serde(
bound = "E: EthSpec, Payload: AbstractExecPayload<E>",
deny_unknown_fields
),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
),
context_deserialize(ForkName),
),
specific_variant_attributes(
@@ -62,12 +65,16 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11;
cast_error(ty = "Error", expr = "Error::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "Error::IncorrectStateVariant")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Derivative, TreeHash, arbitrary::Arbitrary)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Derivative, TreeHash)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(untagged)]
#[serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
#[tree_hash(enum_behaviour = "transparent")]
#[arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPayload<E>> {
pub randao_reveal: Signature,
pub eth1_data: Eth1Data,
@@ -128,7 +135,7 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
#[ssz(skip_serializing, skip_deserializing)]
#[tree_hash(skip_hashing)]
#[serde(skip)]
#[arbitrary(default)]
#[cfg_attr(feature = "arbitrary", arbitrary(default))]
pub _phantom: PhantomData<Payload>,
}

View File

@@ -11,19 +11,9 @@ use tree_hash_derive::TreeHash;
/// A header of a `BeaconBlock`.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct BeaconBlockHeader {

View File

@@ -17,7 +17,8 @@ impl BeaconCommittee<'_> {
}
}
#[derive(arbitrary::Arbitrary, Default, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Default, Clone, Debug, PartialEq)]
pub struct OwnedBeaconCommittee {
pub slot: Slot,
pub index: CommitteeIndex,

View File

@@ -191,7 +191,8 @@ impl AllowNextEpoch {
}
}
#[derive(PartialEq, Eq, Hash, Clone, Copy, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct BeaconStateHash(Hash256);
impl fmt::Debug for BeaconStateHash {
@@ -240,10 +241,13 @@ impl From<BeaconStateHash> for Hash256 {
TreeHash,
TestRandom,
CompareFields,
arbitrary::Arbitrary,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
),
derivative(Clone),
),
specific_variant_attributes(
@@ -350,10 +354,14 @@ impl From<BeaconStateHash> for Hash256 {
partial_getter_error(ty = "Error", expr = "Error::IncorrectStateVariant"),
map_ref_mut_into(BeaconStateRef)
)]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, arbitrary::Arbitrary)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode)]
#[serde(untagged)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[ssz(enum_behaviour = "transparent")]
pub struct BeaconState<E>
where

View File

@@ -1,10 +1,12 @@
#[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary;
use safe_arith::{ArithError, SafeArith};
/// A balance which will never be below the specified `minimum`.
///
/// This is an effort to ensure the `EFFECTIVE_BALANCE_INCREMENT` minimum is always respected.
#[derive(PartialEq, Debug, Clone, Copy, Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(PartialEq, Debug, Clone, Copy)]
pub struct Balance {
raw: u64,
minimum: u64,

View File

@@ -374,6 +374,7 @@ where
active
}
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for CommitteeCache {
fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
Ok(Self::default())

View File

@@ -86,6 +86,7 @@ impl ExitCache {
}
}
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for ExitCache {
fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
Ok(Self::default())

View File

@@ -6,6 +6,7 @@ use crate::{
},
BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, ParticipationFlags,
};
#[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary;
use safe_arith::SafeArith;
@@ -13,12 +14,14 @@ use safe_arith::SafeArith;
/// epochs. The cached values can be utilised by fork choice to calculate unrealized justification
/// and finalization instead of converting epoch participation arrays to balances for each block we
/// process.
#[derive(Default, Debug, PartialEq, Arbitrary, Clone)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Default, Debug, PartialEq, Clone)]
pub struct ProgressiveBalancesCache {
inner: Option<Inner>,
}
#[derive(Debug, PartialEq, Arbitrary, Clone)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Debug, PartialEq, Clone)]
struct Inner {
pub current_epoch: Epoch,
pub previous_epoch_cache: EpochTotalBalances,
@@ -26,7 +29,8 @@ struct Inner {
}
/// Caches the participation values for one epoch (either the previous or current).
#[derive(PartialEq, Debug, Clone, Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(PartialEq, Debug, Clone)]
pub struct EpochTotalBalances {
/// Stores the sum of the balances for all validators in `self.unslashed_participating_indices`
/// for all flags in `NUM_FLAG_INDICES`.

View File

@@ -43,6 +43,7 @@ impl PubkeyCache {
}
}
#[cfg(feature = "arbitrary")]
impl arbitrary::Arbitrary<'_> for PubkeyCache {
fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
Ok(Self::default())

View File

@@ -1,12 +1,14 @@
use crate::{BeaconStateError, Slot, Validator};
#[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary;
use rpds::HashTrieSetSync as HashTrieSet;
/// Persistent (cheap to clone) cache of all slashed validator indices.
#[derive(Debug, Default, Clone, PartialEq, Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct SlashingsCache {
latest_block_slot: Option<Slot>,
#[arbitrary(default)]
#[cfg_attr(feature = "arbitrary", arbitrary(default))]
slashed_validators: HashTrieSet<usize>,
}

View File

@@ -44,21 +44,16 @@ impl Ord for BlobIdentifier {
}
}
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(
Debug,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary,
Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative,
)]
#[context_deserialize(ForkName)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
pub struct BlobSidecar<E: EthSpec> {
#[serde(with = "serde_utils::quoted_u64")]

View File

@@ -5,19 +5,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct BlsToExecutionChange {

View File

@@ -33,7 +33,8 @@ pub enum Domain {
/// Lighthouse's internal configuration struct.
///
/// Contains a mixture of "preset" and "config" values w.r.t to the EF definitions.
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Debug, Clone)]
pub struct ChainSpec {
/*
* Config name
@@ -1459,7 +1460,8 @@ impl Default for ChainSpec {
}
}
#[derive(arbitrary::Arbitrary, Serialize, Deserialize, Debug, PartialEq, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(rename_all = "UPPERCASE")]
pub struct BlobParameters {
pub epoch: Epoch,
@@ -1469,7 +1471,8 @@ pub struct BlobParameters {
// A wrapper around a vector of BlobParameters to ensure that the vector is reverse
// sorted by epoch.
#[derive(arbitrary::Arbitrary, Debug, PartialEq, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Clone)]
pub struct BlobSchedule(Vec<BlobParameters>);
impl<'de> Deserialize<'de> for BlobSchedule {

View File

@@ -9,8 +9,8 @@ use tree_hash_derive::TreeHash;
/// Casper FFG checkpoint, used in attestations.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
Copy,

View File

@@ -6,19 +6,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct ConsolidationRequest {

View File

@@ -10,20 +10,14 @@ use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
/// A Validators aggregate sync committee contribution and selection proof.
#[derive(
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TestRandom,
TreeHash,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[context_deserialize(ForkName)]
pub struct ContributionAndProof<E: EthSpec> {
/// The index of the validator that created the sync contribution.

View File

@@ -95,20 +95,15 @@ impl RuntimeVariableList<DataColumnsByRootIdentifier> {
pub type DataColumnSidecarList<E> = Vec<Arc<DataColumnSidecar<E>>>;
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(
Debug,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary,
Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative,
)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
#[context_deserialize(ForkName)]
pub struct DataColumnSidecar<E: EthSpec> {

View File

@@ -6,7 +6,8 @@ use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};
use std::ops::{Deref, DerefMut};
#[derive(arbitrary::Arbitrary, Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DataColumnSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);

View File

@@ -12,18 +12,9 @@ pub const DEPOSIT_TREE_DEPTH: usize = 32;
/// A deposit to potentially become a beacon chain validator.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct Deposit {

View File

@@ -8,18 +8,9 @@ use tree_hash_derive::TreeHash;
/// The data supplied by the user to the deposit contract.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct DepositData {

View File

@@ -9,18 +9,8 @@ use tree_hash_derive::TreeHash;
/// The data supplied by the user to the deposit contract.
///
/// Spec v0.12.1
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[context_deserialize(ForkName)]
pub struct DepositMessage {
pub pubkey: PublicKeyBytes,

View File

@@ -8,18 +8,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct DepositRequest {

View File

@@ -10,18 +10,9 @@ use tree_hash_derive::TreeHash;
/// a nodes local ENR.
///
/// Spec v0.11
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
Default,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
pub struct EnrForkId {
/// Fork digest of the current fork computed from [`ChainSpec::compute_fork_digest`].

View File

@@ -8,12 +8,14 @@ use std::sync::Arc;
/// to as the "decision block". This cache is very similar to the `BeaconProposerCache` in that
/// beacon proposers are determined at exactly the same time as the values in this cache, so
/// the keys for the two caches are identical.
#[derive(Debug, PartialEq, Eq, Clone, Default, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Eq, Clone, Default)]
pub struct EpochCache {
inner: Option<Arc<Inner>>,
}
#[derive(Debug, PartialEq, Eq, Clone, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Eq, Clone)]
struct Inner {
/// Unique identifier for this cache, which can be used to check its validity before use
/// with any `BeaconState`.
@@ -30,7 +32,8 @@ struct Inner {
effective_balance_increment: u64,
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub struct EpochCacheKey {
pub epoch: Epoch,
pub decision_block_root: Hash256,

View File

@@ -10,8 +10,8 @@ use tree_hash_derive::TreeHash;
/// Contains data obtained from the Eth1 chain.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Clone,

View File

@@ -49,9 +49,7 @@ impl fmt::Display for EthSpecId {
}
}
pub trait EthSpec:
'static + Default + Sync + Send + Clone + Debug + PartialEq + Eq + for<'a> arbitrary::Arbitrary<'a>
{
pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq + Eq {
/*
* Constants
*/
@@ -394,7 +392,8 @@ macro_rules! params_from_eth_spec {
}
/// Ethereum Foundation specifications.
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
pub struct MainnetEthSpec;
impl EthSpec for MainnetEthSpec {
@@ -460,7 +459,8 @@ impl EthSpec for MainnetEthSpec {
}
/// Ethereum Foundation minimal spec, as defined in the eth2.0-specs repo.
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
pub struct MinimalEthSpec;
impl EthSpec for MinimalEthSpec {
@@ -529,7 +529,8 @@ impl EthSpec for MinimalEthSpec {
}
/// Gnosis Beacon Chain specifications.
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
pub struct GnosisEthSpec;
impl EthSpec for GnosisEthSpec {

View File

@@ -7,18 +7,8 @@ use serde::{Deserialize, Serialize};
use ssz::{Decode, DecodeError, Encode};
use std::fmt;
#[derive(
arbitrary::Arbitrary,
Default,
Clone,
Copy,
Serialize,
Deserialize,
Eq,
PartialEq,
Hash,
Derivative,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, Hash, Derivative)]
#[derivative(Debug = "transparent")]
#[serde(transparent)]
pub struct ExecutionBlockHash(#[serde(with = "serde_utils::b256_hex")] pub Hash256);

View File

@@ -28,24 +28,29 @@ pub type Withdrawals<E> = VariableList<Withdrawal, <E as EthSpec>::MaxWithdrawal
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary
),
context_deserialize(ForkName),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec")
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
),
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
map_into(FullPayload, BlindedPayload),
map_ref_into(ExecutionPayloadHeader)
)]
#[derive(
Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative, arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec", untagged)]
#[arbitrary(bound = "E: EthSpec")]
#[ssz(enum_behaviour = "transparent")]
#[tree_hash(enum_behaviour = "transparent")]
pub struct ExecutionPayload<E: EthSpec> {

View File

@@ -21,11 +21,14 @@ use tree_hash_derive::TreeHash;
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary
),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
),
ref_attributes(
@@ -36,12 +39,14 @@ use tree_hash_derive::TreeHash;
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
map_ref_into(ExecutionPayloadHeader)
)]
#[derive(
Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative, arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec", untagged)]
#[arbitrary(bound = "E: EthSpec")]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
pub struct ExecutionPayloadHeader<E: EthSpec> {

View File

@@ -18,21 +18,15 @@ pub type WithdrawalRequests<E> =
pub type ConsolidationRequests<E> =
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>;
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(
arbitrary::Arbitrary,
Debug,
Derivative,
Default,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, Derivative, Default, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
#[context_deserialize(ForkName)]
pub struct ExecutionRequests<E: EthSpec> {

View File

@@ -10,8 +10,8 @@ use tree_hash_derive::TreeHash;
/// Specifies a fork of the `BeaconChain`, to prevent replay attacks.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
Copy,

View File

@@ -10,18 +10,9 @@ use tree_hash_derive::TreeHash;
/// Specifies a fork of the `BeaconChain`, to prevent replay attacks.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
Default,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct ForkData {

View File

@@ -12,9 +12,9 @@ use tree_hash::{PackedEncoding, TreeHash};
pub const GRAFFITI_BYTES_LEN: usize = 32;
/// The 32-byte `graffiti` field on a beacon block.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Default, Debug, PartialEq, Hash, Clone, Copy, Serialize, Deserialize)]
#[serde(transparent)]
#[derive(arbitrary::Arbitrary)]
pub struct Graffiti(#[serde(with = "serde_graffiti")] pub [u8; GRAFFITI_BYTES_LEN]);
impl Graffiti {

View File

@@ -9,19 +9,12 @@ use tree_hash_derive::TreeHash;
/// Historical block and state roots.
///
/// Spec v0.12.1
#[derive(
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[arbitrary(bound = "E: EthSpec")]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[context_deserialize(ForkName)]
pub struct HistoricalBatch<E: EthSpec> {
#[test_random(default)]

View File

@@ -13,6 +13,7 @@ use tree_hash_derive::TreeHash;
/// in the Capella hard fork.
///
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#historicalsummary
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
Debug,
PartialEq,
@@ -27,7 +28,6 @@ use tree_hash_derive::TreeHash;
Clone,
Copy,
Default,
arbitrary::Arbitrary,
)]
#[context_deserialize(ForkName)]
pub struct HistoricalSummary {

View File

@@ -29,31 +29,28 @@ use tree_hash_derive::TreeHash;
Encode,
TestRandom,
Derivative,
arbitrary::Arbitrary,
TreeHash,
),
context_deserialize(ForkName),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
)
)]
#[derive(
Debug,
Clone,
Serialize,
TreeHash,
Encode,
Derivative,
Deserialize,
arbitrary::Arbitrary,
PartialEq,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, TreeHash, Encode, Derivative, Deserialize, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct IndexedAttestation<E: EthSpec> {
/// Lists validator registry indices, not committee indices.
#[superstruct(only(Base), partial_getter(rename = "attesting_indices_base"))]

View File

@@ -29,22 +29,27 @@ use tree_hash_derive::TreeHash;
Decode,
Encode,
TestRandom,
arbitrary::Arbitrary,
TreeHash,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
)
)]
#[derive(
Debug, Clone, Serialize, TreeHash, Encode, Deserialize, arbitrary::Arbitrary, PartialEq,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, TreeHash, Encode, Deserialize, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct LightClientBootstrap<E: EthSpec> {
/// The requested beacon block header.
#[superstruct(only(Altair), partial_getter(rename = "header_altair"))]

View File

@@ -28,20 +28,27 @@ use tree_hash_derive::TreeHash;
Decode,
Encode,
TestRandom,
arbitrary::Arbitrary,
TreeHash,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
)
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct LightClientFinalityUpdate<E: EthSpec> {
/// The last `BeaconBlockHeader` from the last attested block by the sync committee.
#[superstruct(only(Altair), partial_getter(rename = "attested_header_altair"))]

View File

@@ -30,20 +30,27 @@ use tree_hash_derive::TreeHash;
Decode,
Encode,
TestRandom,
arbitrary::Arbitrary,
TreeHash,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
)
)]
#[derive(Debug, Clone, Serialize, TreeHash, Encode, arbitrary::Arbitrary, PartialEq)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, TreeHash, Encode, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct LightClientHeader<E: EthSpec> {
pub beacon: BeaconBlockHeader,
@@ -68,7 +75,7 @@ pub struct LightClientHeader<E: EthSpec> {
#[ssz(skip_serializing, skip_deserializing)]
#[tree_hash(skip_hashing)]
#[serde(skip)]
#[arbitrary(default)]
#[cfg_attr(feature = "arbitrary", arbitrary(default))]
pub _phantom_data: PhantomData<E>,
}

View File

@@ -31,20 +31,27 @@ use tree_hash_derive::TreeHash;
Decode,
Encode,
TestRandom,
arbitrary::Arbitrary,
TreeHash,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
)
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct LightClientOptimisticUpdate<E: EthSpec> {
/// The last `BeaconBlockHeader` from the last attested block by the sync committee.
#[superstruct(only(Altair), partial_getter(rename = "attested_header_altair"))]

View File

@@ -112,20 +112,27 @@ impl From<milhouse::Error> for Error {
Decode,
Encode,
TestRandom,
arbitrary::Arbitrary,
TreeHash,
),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
context_deserialize(ForkName),
)
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Encode, TreeHash, PartialEq)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct LightClientUpdate<E: EthSpec> {
/// The last `BeaconBlockHeader` from the last attested block by the sync committee.
#[superstruct(only(Altair), partial_getter(rename = "attested_header_altair"))]

View File

@@ -7,7 +7,7 @@ use tree_hash::{PackedEncoding, TreeHash, TreeHashType};
#[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize, TestRandom)]
#[serde(transparent)]
#[derive(arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct ParticipationFlags {
#[serde(with = "serde_utils::quoted_u8")]
bits: u8,

View File

@@ -49,6 +49,7 @@ pub trait ExecPayload<E: EthSpec>: Debug + Clone + PartialEq + Hash + TreeHash +
}
/// `ExecPayload` functionality the requires ownership.
#[cfg(feature = "arbitrary")]
pub trait OwnedExecPayload<E: EthSpec>:
ExecPayload<E>
+ Default
@@ -61,7 +62,7 @@ pub trait OwnedExecPayload<E: EthSpec>:
+ 'static
{
}
#[cfg(feature = "arbitrary")]
impl<E: EthSpec, P> OwnedExecPayload<E> for P where
P: ExecPayload<E>
+ Default
@@ -75,6 +76,25 @@ impl<E: EthSpec, P> OwnedExecPayload<E> for P where
{
}
/// `ExecPayload` functionality the requires ownership.
#[cfg(not(feature = "arbitrary"))]
pub trait OwnedExecPayload<E: EthSpec>:
ExecPayload<E> + Default + Serialize + DeserializeOwned + Encode + Decode + TestRandom + 'static
{
}
#[cfg(not(feature = "arbitrary"))]
impl<E: EthSpec, P> OwnedExecPayload<E> for P where
P: ExecPayload<E>
+ Default
+ Serialize
+ DeserializeOwned
+ Encode
+ Decode
+ TestRandom
+ 'static
{
}
pub trait AbstractExecPayload<E: EthSpec>:
ExecPayload<E>
+ Sized
@@ -135,11 +155,14 @@ pub trait AbstractExecPayload<E: EthSpec>:
TestRandom,
TreeHash,
Derivative,
arbitrary::Arbitrary,
),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
ssz(struct_behaviour = "transparent"),
),
ref_attributes(
@@ -152,10 +175,14 @@ pub trait AbstractExecPayload<E: EthSpec>:
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
)]
#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative, arbitrary::Arbitrary)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[tree_hash(enum_behaviour = "transparent")]
pub struct FullPayload<E: EthSpec> {
#[superstruct(
@@ -496,11 +523,14 @@ impl<E: EthSpec> TryFrom<ExecutionPayloadHeader<E>> for FullPayload<E> {
TestRandom,
TreeHash,
Derivative,
arbitrary::Arbitrary
),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec", deny_unknown_fields),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
ssz(struct_behaviour = "transparent"),
),
ref_attributes(
@@ -512,10 +542,14 @@ impl<E: EthSpec> TryFrom<ExecutionPayloadHeader<E>> for FullPayload<E> {
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
)]
#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative, arbitrary::Arbitrary)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[tree_hash(enum_behaviour = "transparent")]
pub struct BlindedPayload<E: EthSpec> {
#[superstruct(

View File

@@ -9,19 +9,12 @@ use tree_hash_derive::TreeHash;
/// An attestation that has been included in the state but not yet fully processed.
///
/// Spec v0.12.1
#[derive(
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[arbitrary(bound = "E: EthSpec")]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[context_deserialize(ForkName)]
pub struct PendingAttestation<E: EthSpec> {
pub aggregation_bits: BitList<E::MaxValidatorsPerCommittee>,

View File

@@ -6,19 +6,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct PendingConsolidation {

View File

@@ -5,18 +5,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct PendingDeposit {

View File

@@ -6,19 +6,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct PendingPartialWithdrawal {

View File

@@ -10,19 +10,9 @@ use tree_hash_derive::TreeHash;
/// Two conflicting proposals from the same proposer (validator).
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct ProposerSlashing {

View File

@@ -18,7 +18,8 @@ impl From<ArithError> for Error {
/// to and following some epoch.
///
/// Spec v0.12.1
#[derive(Debug, PartialEq, Clone, Copy, arbitrary::Arbitrary)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum RelativeEpoch {
/// The prior epoch.
Previous,

View File

@@ -6,7 +6,8 @@ use safe_arith::{ArithError, SafeArith};
use ssz::Encode;
use std::cmp;
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Debug, Clone)]
pub struct SelectionProof(Signature);
impl SelectionProof {

View File

@@ -21,7 +21,6 @@ use tree_hash_derive::TreeHash;
variants(Base, Electra),
variant_attributes(
derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
@@ -34,19 +33,25 @@ use tree_hash_derive::TreeHash;
),
context_deserialize(ForkName),
serde(bound = "E: EthSpec"),
arbitrary(bound = "E: EthSpec"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec"),
),
),
map_into(Attestation),
map_ref_into(AggregateAndProofRef)
)]
#[derive(
arbitrary::Arbitrary, Debug, Clone, PartialEq, Serialize, Deserialize, Encode, TreeHash,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, TreeHash)]
#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct SignedAggregateAndProof<E: EthSpec> {
/// The `AggregateAndProof` that was signed.
#[superstruct(flatten)]

View File

@@ -11,7 +11,8 @@ use test_random_derive::TestRandom;
use tree_hash::TreeHash;
use tree_hash_derive::TreeHash;
#[derive(arbitrary::Arbitrary, PartialEq, Eq, Hash, Clone, Copy)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct SignedBeaconBlockHash(Hash256);
impl fmt::Debug for SignedBeaconBlockHash {
@@ -51,24 +52,29 @@ impl From<SignedBeaconBlockHash> for Hash256 {
Decode,
TreeHash,
Derivative,
arbitrary::Arbitrary,
TestRandom
),
derivative(PartialEq, Hash(bound = "E: EthSpec")),
serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
),
),
map_into(BeaconBlock),
map_ref_into(BeaconBlockRef),
map_ref_mut_into(BeaconBlockRefMut)
)]
#[derive(
Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative, arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")
)]
#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(untagged)]
#[serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
#[arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload<E>")]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
pub struct SignedBeaconBlock<E: EthSpec, Payload: AbstractExecPayload<E> = FullPayload<E>> {

View File

@@ -11,19 +11,9 @@ use tree_hash_derive::TreeHash;
/// A signed header of a `BeaconBlock`.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct SignedBeaconBlockHeader {

View File

@@ -5,19 +5,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct SignedBlsToExecutionChange {

View File

@@ -11,20 +11,13 @@ use tree_hash_derive::TreeHash;
/// A Validators signed contribution proof to publish on the `sync_committee_contribution_and_proof`
/// gossipsub topic.
#[derive(
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TestRandom,
TreeHash,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[context_deserialize(ForkName)]
pub struct SignedContributionAndProof<E: EthSpec> {
/// The `ContributionAndProof` that was signed.

View File

@@ -10,18 +10,9 @@ use tree_hash_derive::TreeHash;
/// An exit voluntarily submitted a validator who wishes to withdraw.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct SignedVoluntaryExit {

View File

@@ -8,18 +8,8 @@ use test_random_derive::TestRandom;
use tree_hash::TreeHash;
use tree_hash_derive::TreeHash;
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[context_deserialize(ForkName)]
pub struct SigningData {
pub object_root: Hash256,

View File

@@ -23,35 +23,13 @@ use std::hash::Hash;
#[cfg(feature = "legacy-arith")]
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssign};
#[derive(
arbitrary::Arbitrary,
Clone,
Copy,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Slot(#[serde(with = "serde_utils::quoted_u64")] u64);
#[derive(
arbitrary::Arbitrary,
Clone,
Copy,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Epoch(#[serde(with = "serde_utils::quoted_u64")] u64);

View File

@@ -22,7 +22,8 @@ static SUBNET_ID_TO_STRING: LazyLock<Vec<String>> = LazyLock::new(|| {
v
});
#[derive(arbitrary::Arbitrary, Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);

View File

@@ -21,22 +21,16 @@ impl From<ArithError> for Error {
Error::ArithError(e)
}
}
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(
Debug,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Derivative,
arbitrary::Arbitrary,
Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative,
)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[context_deserialize(ForkName)]
pub struct SyncAggregate<E: EthSpec> {
pub sync_committee_bits: BitVector<E::SyncCommitteeSize>,

View File

@@ -6,18 +6,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Clone,
Serialize,
Deserialize,
Hash,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Clone, Serialize, Deserialize, Hash, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct SyncAggregatorSelectionData {

View File

@@ -25,20 +25,13 @@ impl From<ArithError> for Error {
}
}
#[derive(
Debug,
PartialEq,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[context_deserialize(ForkName)]
pub struct SyncCommittee<E: EthSpec> {
pub pubkeys: FixedVector<PublicKeyBytes, E::SyncCommitteeSize>,

View File

@@ -15,20 +15,13 @@ pub enum Error {
}
/// An aggregation of `SyncCommitteeMessage`s, used in creating a `SignedContributionAndProof`.
#[derive(
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
arbitrary::Arbitrary,
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
arbitrary(bound = "E: EthSpec")
)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[serde(bound = "E: EthSpec")]
#[arbitrary(bound = "E: EthSpec")]
#[context_deserialize(ForkName)]
pub struct SyncCommitteeContribution<E: EthSpec> {
pub slot: Slot,

View File

@@ -10,18 +10,8 @@ use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
/// The data upon which a `SyncCommitteeContribution` is based.
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
#[context_deserialize(ForkName)]
pub struct SyncCommitteeMessage {
pub slot: Slot,

View File

@@ -11,7 +11,8 @@ use ssz::Encode;
use ssz_types::typenum::Unsigned;
use std::cmp;
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Debug, Clone)]
pub struct SyncSelectionProof(Signature);
impl SyncSelectionProof {

View File

@@ -18,7 +18,8 @@ static SYNC_SUBNET_ID_TO_STRING: LazyLock<Vec<String>> = LazyLock::new(|| {
v
});
#[derive(arbitrary::Arbitrary, Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SyncSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);

View File

@@ -11,18 +11,9 @@ use tree_hash_derive::TreeHash;
/// Information about a `BeaconChain` validator.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
Clone,
PartialEq,
Eq,
Serialize,
Deserialize,
Encode,
Decode,
TestRandom,
TreeHash,
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash,
)]
#[context_deserialize(ForkName)]
pub struct Validator {

View File

@@ -12,18 +12,9 @@ use tree_hash_derive::TreeHash;
/// An exit voluntarily submitted a validator who wishes to withdraw.
///
/// Spec v0.12.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct VoluntaryExit {

View File

@@ -5,19 +5,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct Withdrawal {

View File

@@ -7,19 +7,9 @@ use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
arbitrary::Arbitrary,
Debug,
PartialEq,
Eq,
Hash,
Clone,
Serialize,
Deserialize,
Encode,
Decode,
TreeHash,
TestRandom,
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
#[context_deserialize(ForkName)]
pub struct WithdrawalRequest {

View File

@@ -4,7 +4,7 @@ version = "7.1.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = { workspace = true }
autotests = false
rust-version = "1.83.0"
rust-version = "1.87.0"
# Prevent cargo-udeps from flagging the dummy package `target_check`, which exists only
# to assert properties of the compilation target.