Remove arbitrary-fuzz (#8936)

We have duplicated features which enable `arbitrary` throughout the codebase. These are `arbitrary` and `arbitrary-fuzz`. I think historically these were supposed to be distinct however in practice these function identically and so we can unify them into a single feature to avoid confusion.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-03-07 01:09:31 +02:00
committed by GitHub
parent 9c4715c251
commit dbfb6fd923
11 changed files with 29 additions and 30 deletions

View File

@@ -321,8 +321,8 @@ make-ef-tests-nightly:
# Verifies that crates compile with fuzzing features enabled # Verifies that crates compile with fuzzing features enabled
arbitrary-fuzz: arbitrary-fuzz:
cargo check -p state_processing --features arbitrary-fuzz,$(TEST_FEATURES) cargo check -p state_processing --features arbitrary,$(TEST_FEATURES)
cargo check -p slashing_protection --features arbitrary-fuzz,$(TEST_FEATURES) cargo check -p slashing_protection --features arbitrary,$(TEST_FEATURES)
# Runs cargo audit (Audit Cargo.lock files for crates with security vulnerabilities reported to the RustSec Advisory Database) # Runs cargo audit (Audit Cargo.lock files for crates with security vulnerabilities reported to the RustSec Advisory Database)
audit: install-audit audit-CI audit: install-audit audit-CI

View File

@@ -6,7 +6,7 @@ edition = { workspace = true }
[features] [features]
default = [] default = []
arbitrary-fuzz = ["dep:arbitrary", "types/arbitrary"] arbitrary = ["dep:arbitrary", "types/arbitrary"]
json = ["dep:serde_json"] json = ["dep:serde_json"]
[dependencies] [dependencies]

View File

@@ -13,7 +13,7 @@ pub enum Error {
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct InterchangeMetadata { pub struct InterchangeMetadata {
#[serde(with = "serde_utils::quoted_u64::require_quotes")] #[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub interchange_format_version: u64, pub interchange_format_version: u64,
@@ -22,7 +22,7 @@ pub struct InterchangeMetadata {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct InterchangeData { pub struct InterchangeData {
pub pubkey: PublicKeyBytes, pub pubkey: PublicKeyBytes,
pub signed_blocks: Vec<SignedBlock>, pub signed_blocks: Vec<SignedBlock>,
@@ -31,7 +31,7 @@ pub struct InterchangeData {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct SignedBlock { pub struct SignedBlock {
#[serde(with = "serde_utils::quoted_u64::require_quotes")] #[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub slot: Slot, pub slot: Slot,
@@ -41,7 +41,7 @@ pub struct SignedBlock {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct SignedAttestation { pub struct SignedAttestation {
#[serde(with = "serde_utils::quoted_u64::require_quotes")] #[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub source_epoch: Epoch, pub source_epoch: Epoch,
@@ -52,7 +52,7 @@ pub struct SignedAttestation {
} }
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Interchange { pub struct Interchange {
pub metadata: InterchangeMetadata, pub metadata: InterchangeMetadata,
pub data: Vec<InterchangeData>, pub data: Vec<InterchangeData>,

View File

@@ -7,10 +7,10 @@ edition = { workspace = true }
[features] [features]
default = [] default = []
fake_crypto = ["bls/fake_crypto"] fake_crypto = ["bls/fake_crypto"]
arbitrary-fuzz = [ arbitrary = [
"dep:arbitrary", "dep:arbitrary",
"smallvec/arbitrary", "smallvec/arbitrary",
"types/arbitrary-fuzz", "types/arbitrary",
"merkle_proof/arbitrary", "merkle_proof/arbitrary",
"ethereum_ssz/arbitrary", "ethereum_ssz/arbitrary",
"ssz_types/arbitrary", "ssz_types/arbitrary",

View File

@@ -21,7 +21,7 @@ macro_rules! envelope_verify {
} }
/// The strategy to be used when validating the payloads state root. /// The strategy to be used when validating the payloads state root.
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq, Clone, Copy)]
pub enum VerifyStateRoot { pub enum VerifyStateRoot {
/// Validate state root. /// Validate state root.

View File

@@ -55,12 +55,12 @@ use crate::common::update_progressive_balances_cache::{
initialize_progressive_balances_cache, update_progressive_balances_metrics, initialize_progressive_balances_cache, update_progressive_balances_metrics,
}; };
use crate::epoch_cache::initialize_epoch_cache; use crate::epoch_cache::initialize_epoch_cache;
#[cfg(feature = "arbitrary-fuzz")] #[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary; use arbitrary::Arbitrary;
use tracing::instrument; use tracing::instrument;
/// The strategy to be used when validating the block's signatures. /// The strategy to be used when validating the block's signatures.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(PartialEq, Clone, Copy, Debug)] #[derive(PartialEq, Clone, Copy, Debug)]
pub enum BlockSignatureStrategy { pub enum BlockSignatureStrategy {
/// Do not validate any signature. Use with caution. /// Do not validate any signature. Use with caution.
@@ -74,7 +74,7 @@ pub enum BlockSignatureStrategy {
} }
/// The strategy to be used when validating the block's signatures. /// The strategy to be used when validating the block's signatures.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq, Clone, Copy)]
pub enum VerifySignatures { pub enum VerifySignatures {
/// Validate all signatures encountered. /// Validate all signatures encountered.
@@ -90,7 +90,7 @@ impl VerifySignatures {
} }
/// Control verification of the latest block header. /// Control verification of the latest block header.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq, Clone, Copy)]
pub enum VerifyBlockRoot { pub enum VerifyBlockRoot {
True, True,

View File

@@ -2,7 +2,7 @@ use crate::common::attesting_indices_base::get_attesting_indices;
use safe_arith::SafeArith; use safe_arith::SafeArith;
use types::{BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, PendingAttestation}; use types::{BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, PendingAttestation};
#[cfg(feature = "arbitrary-fuzz")] #[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary; use arbitrary::Arbitrary;
/// Sets the boolean `var` on `self` to be true if it is true on `other`. Otherwise leaves `self` /// Sets the boolean `var` on `self` to be true if it is true on `other`. Otherwise leaves `self`
@@ -16,7 +16,7 @@ macro_rules! set_self_if_other_is_true {
} }
/// The information required to reward a block producer for including an attestation in a block. /// The information required to reward a block producer for including an attestation in a block.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct InclusionInfo { pub struct InclusionInfo {
/// The distance between the attestation slot and the slot that attestation was included in a /// The distance between the attestation slot and the slot that attestation was included in a
@@ -48,7 +48,7 @@ impl InclusionInfo {
} }
/// Information required to reward some validator during the current and previous epoch. /// Information required to reward some validator during the current and previous epoch.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Debug, Default, Clone, PartialEq)] #[derive(Debug, Default, Clone, PartialEq)]
pub struct ValidatorStatus { pub struct ValidatorStatus {
/// True if the validator has been slashed, ever. /// True if the validator has been slashed, ever.
@@ -118,7 +118,7 @@ impl ValidatorStatus {
/// epochs. /// epochs.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
pub struct TotalBalances { pub struct TotalBalances {
/// The effective balance increment from the spec. /// The effective balance increment from the spec.
effective_balance_increment: u64, effective_balance_increment: u64,
@@ -175,7 +175,7 @@ impl TotalBalances {
/// Summarised information about validator participation in the _previous and _current_ epochs of /// Summarised information about validator participation in the _previous and _current_ epochs of
/// some `BeaconState`. /// some `BeaconState`.
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ValidatorStatuses { pub struct ValidatorStatuses {
/// Information about each individual validator from the state's validator registry. /// Information about each individual validator from the state's validator registry.

View File

@@ -7,7 +7,7 @@ use crate::per_block_processing::{
verify_attester_slashing, verify_bls_to_execution_change, verify_exit, verify_attester_slashing, verify_bls_to_execution_change, verify_exit,
verify_proposer_slashing, verify_proposer_slashing,
}; };
#[cfg(feature = "arbitrary-fuzz")] #[cfg(feature = "arbitrary")]
use arbitrary::Arbitrary; use arbitrary::Arbitrary;
use educe::Educe; use educe::Educe;
use smallvec::{SmallVec, smallvec}; use smallvec::{SmallVec, smallvec};
@@ -41,14 +41,14 @@ pub trait TransformPersist {
/// The inner `op` field is private, meaning instances of this type can only be constructed /// The inner `op` field is private, meaning instances of this type can only be constructed
/// by calling `validate`. /// by calling `validate`.
#[derive(Educe, Debug, Clone)] #[derive(Educe, Debug, Clone)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[educe( #[educe(
PartialEq, PartialEq,
Eq, Eq,
Hash(bound(T: TransformPersist + std::hash::Hash, E: EthSpec)) Hash(bound(T: TransformPersist + std::hash::Hash, E: EthSpec))
)] )]
#[cfg_attr( #[cfg_attr(
feature = "arbitrary-fuzz", feature = "arbitrary",
arbitrary(bound = "T: TransformPersist + Arbitrary<'arbitrary>, E: EthSpec") arbitrary(bound = "T: TransformPersist + Arbitrary<'arbitrary>, E: EthSpec")
)] )]
pub struct SigVerifiedOp<T: TransformPersist, E: EthSpec> { pub struct SigVerifiedOp<T: TransformPersist, E: EthSpec> {
@@ -139,7 +139,7 @@ struct SigVerifiedOpDecode<P: Decode> {
/// We need to store multiple `ForkVersion`s because attester slashings contain two indexed /// We need to store multiple `ForkVersion`s because attester slashings contain two indexed
/// attestations which may be signed using different versions. /// attestations which may be signed using different versions.
#[derive(Debug, PartialEq, Eq, Clone, Hash, Encode, Decode, TestRandom)] #[derive(Debug, PartialEq, Eq, Clone, Hash, Encode, Decode, TestRandom)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
pub struct VerifiedAgainst { pub struct VerifiedAgainst {
fork_versions: SmallVec<[ForkVersion; MAX_FORKS_VERIFIED_AGAINST]>, fork_versions: SmallVec<[ForkVersion; MAX_FORKS_VERIFIED_AGAINST]>,
} }

View File

@@ -22,7 +22,6 @@ arbitrary = [
"ssz_types/arbitrary", "ssz_types/arbitrary",
"swap_or_not_shuffle/arbitrary", "swap_or_not_shuffle/arbitrary",
] ]
arbitrary-fuzz = ["arbitrary"]
portable = ["bls/supranational-portable"] portable = ["bls/supranational-portable"]
[dependencies] [dependencies]

View File

@@ -6,7 +6,7 @@ edition = { workspace = true }
autotests = false autotests = false
[features] [features]
arbitrary-fuzz = ["dep:arbitrary", "types/arbitrary-fuzz", "eip_3076/arbitrary-fuzz"] arbitrary = ["dep:arbitrary", "types/arbitrary", "eip_3076/arbitrary"]
portable = ["types/portable"] portable = ["types/portable"]
[dependencies] [dependencies]

View File

@@ -11,7 +11,7 @@ use tempfile::tempdir;
use types::{Epoch, Hash256, Slot}; use types::{Epoch, Hash256, Slot};
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct MultiTestCase { pub struct MultiTestCase {
pub name: String, pub name: String,
pub genesis_validators_root: Hash256, pub genesis_validators_root: Hash256,
@@ -19,7 +19,7 @@ pub struct MultiTestCase {
} }
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct TestCase { pub struct TestCase {
pub should_succeed: bool, pub should_succeed: bool,
pub contains_slashable_data: bool, pub contains_slashable_data: bool,
@@ -29,7 +29,7 @@ pub struct TestCase {
} }
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct TestBlock { pub struct TestBlock {
pub pubkey: PublicKeyBytes, pub pubkey: PublicKeyBytes,
pub slot: Slot, pub slot: Slot,
@@ -39,7 +39,7 @@ pub struct TestBlock {
} }
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct TestAttestation { pub struct TestAttestation {
pub pubkey: PublicKeyBytes, pub pubkey: PublicKeyBytes,
pub source_epoch: Epoch, pub source_epoch: Epoch,