From 8ecbab7da67ae3ae2f917a1cfdf77d0afe292c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 17:16:06 +0200 Subject: [PATCH 01/16] start migration to educe --- Cargo.lock | 2 +- Cargo.toml | 1 + crypto/kzg/Cargo.toml | 2 +- crypto/kzg/src/kzg_commitment.rs | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee651080973..c30d5d02fc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5020,7 +5020,7 @@ dependencies = [ "arbitrary", "c-kzg", "criterion", - "derivative", + "educe", "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", diff --git a/Cargo.toml b/Cargo.toml index 66378a16c46..75c9065ebfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -136,6 +136,7 @@ directory = { path = "common/directory" } dirs = "3" discv5 = { version = "0.10", features = ["libp2p"] } doppelganger_service = { path = "validator_client/doppelganger_service" } +educe = "0.6" either = "1.9" environment = { path = "lighthouse/environment" } eth2 = { path = "common/eth2" } diff --git a/crypto/kzg/Cargo.toml b/crypto/kzg/Cargo.toml index 432fcc1792e..5a36eb74f70 100644 --- a/crypto/kzg/Cargo.toml +++ b/crypto/kzg/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] arbitrary = { workspace = true } c-kzg = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } ethereum_hashing = { workspace = true } ethereum_serde_utils = { workspace = true } ethereum_ssz = { workspace = true } diff --git a/crypto/kzg/src/kzg_commitment.rs b/crypto/kzg/src/kzg_commitment.rs index cfab09f63e7..5a5e689429e 100644 --- a/crypto/kzg/src/kzg_commitment.rs +++ b/crypto/kzg/src/kzg_commitment.rs @@ -1,5 +1,5 @@ use c_kzg::BYTES_PER_COMMITMENT; -use derivative::Derivative; +use educe::Educe; use ethereum_hashing::hash_fixed; use serde::de::{Deserialize, Deserializer}; use serde::ser::{Serialize, Serializer}; @@ -11,8 +11,8 @@ use tree_hash::{Hash256, PackedEncoding, TreeHash}; pub const VERSIONED_HASH_VERSION_KZG: u8 = 0x01; -#[derive(Derivative, Clone, Copy, Encode, Decode)] -#[derivative(PartialEq, Eq, Hash)] +#[derive(Educe, Clone, Copy, Encode, Decode)] +#[educe(PartialEq, Eq, Hash)] #[ssz(struct_behaviour = "transparent")] pub struct KzgCommitment(pub [u8; c_kzg::BYTES_PER_COMMITMENT]); From ea0aa57c9649d4d13d66e9852ea1d22e59b5dcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 17:25:52 +0200 Subject: [PATCH 02/16] migrate validator_manager --- Cargo.lock | 2 +- validator_manager/Cargo.toml | 2 +- validator_manager/src/import_validators.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c30d5d02fc7..ecd179e4d4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10222,7 +10222,7 @@ dependencies = [ "beacon_chain", "clap", "clap_utils", - "derivative", + "educe", "environment", "eth2", "eth2_network_config", diff --git a/validator_manager/Cargo.toml b/validator_manager/Cargo.toml index 9192f0e86b0..6ef179fbe99 100644 --- a/validator_manager/Cargo.toml +++ b/validator_manager/Cargo.toml @@ -8,7 +8,7 @@ edition = { workspace = true } account_utils = { workspace = true } clap = { workspace = true } clap_utils = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } environment = { workspace = true } eth2 = { workspace = true } eth2_network_config = { workspace = true } diff --git a/validator_manager/src/import_validators.rs b/validator_manager/src/import_validators.rs index 5f5f049ed97..24917f7d1b4 100644 --- a/validator_manager/src/import_validators.rs +++ b/validator_manager/src/import_validators.rs @@ -3,7 +3,7 @@ use crate::DumpConfig; use account_utils::eth2_keystore::Keystore; use clap::{Arg, ArgAction, ArgMatches, Command}; use clap_utils::FLAG_HEADER; -use derivative::Derivative; +use educe::Educe; use eth2::lighthouse_vc::types::KeystoreJsonStr; use eth2::{SensitiveUrl, lighthouse_vc::std_types::ImportKeystoreStatus}; use serde::{Deserialize, Serialize}; @@ -159,15 +159,15 @@ pub fn cli_app() -> Command { ) } -#[derive(Clone, PartialEq, Serialize, Deserialize, Derivative)] -#[derivative(Debug)] +#[derive(Clone, PartialEq, Serialize, Deserialize, Educe)] +#[educe(Debug)] pub struct ImportConfig { pub validators_file_path: Option, pub keystore_file_path: Option, pub vc_url: SensitiveUrl, pub vc_token_path: PathBuf, pub ignore_duplicates: bool, - #[derivative(Debug = "ignore")] + #[educe(Debug(ignore))] pub password: Option>, pub fee_recipient: Option
, pub gas_limit: Option, From 03531917210594632291da10546b9776eaa89ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 17:29:07 +0200 Subject: [PATCH 03/16] eth2, slasher, state_processing, validator_dir --- Cargo.lock | 8 ++++---- common/eth2/Cargo.toml | 2 +- common/eth2/src/lib.rs | 8 ++++---- common/validator_dir/Cargo.toml | 2 +- common/validator_dir/src/validator_dir.rs | 8 ++++---- consensus/state_processing/Cargo.toml | 2 +- consensus/state_processing/src/verify_operation.rs | 6 +++--- slasher/Cargo.toml | 2 +- slasher/src/database/redb_impl.rs | 14 +++++++------- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecd179e4d4b..3f3951e7e87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2848,7 +2848,7 @@ dependencies = [ name = "eth2" version = "0.1.0" dependencies = [ - "derivative", + "educe", "either", "enr", "eth2_keystore", @@ -8783,7 +8783,7 @@ version = "0.1.0" dependencies = [ "bincode", "byteorder", - "derivative", + "educe", "ethereum_ssz", "ethereum_ssz_derive", "filesystem", @@ -8951,7 +8951,7 @@ dependencies = [ "arbitrary", "beacon_chain", "bls", - "derivative", + "educe", "ethereum_hashing", "ethereum_ssz", "ethereum_ssz_derive", @@ -10134,7 +10134,7 @@ version = "0.1.0" dependencies = [ "bls", "deposit_contract", - "derivative", + "educe", "eth2_keystore", "filesystem", "hex", diff --git a/common/eth2/Cargo.toml b/common/eth2/Cargo.toml index 81666a64216..ebfdcc1a722 100644 --- a/common/eth2/Cargo.toml +++ b/common/eth2/Cargo.toml @@ -9,7 +9,7 @@ default = ["lighthouse"] lighthouse = [] [dependencies] -derivative = { workspace = true } +educe = { workspace = true } either = { workspace = true } enr = { version = "0.13.0", features = ["ed25519"] } eth2_keystore = { workspace = true } diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 3368569d59f..b3a92a1926e 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -17,7 +17,7 @@ pub mod types; use self::mixin::{RequestAccept, ResponseOptional}; use self::types::{Error as ResponseError, *}; use ::types::beacon_response::ExecutionOptimisticFinalizedBeaconResponse; -use derivative::Derivative; +use educe::Educe; use futures::Stream; use futures_util::StreamExt; use libp2p_identity::PeerId; @@ -212,10 +212,10 @@ impl Timeouts { /// A wrapper around `reqwest::Client` which provides convenience methods for interfacing with a /// Lighthouse Beacon Node HTTP server (`http_api`). -#[derive(Clone, Debug, Derivative)] -#[derivative(PartialEq)] +#[derive(Clone, Debug, Educe)] +#[educe(PartialEq)] pub struct BeaconNodeHttpClient { - #[derivative(PartialEq = "ignore")] + #[educe(PartialEq(ignore))] client: reqwest::Client, server: SensitiveUrl, timeouts: Timeouts, diff --git a/common/validator_dir/Cargo.toml b/common/validator_dir/Cargo.toml index 4c03b7662ed..a5b373fcae9 100644 --- a/common/validator_dir/Cargo.toml +++ b/common/validator_dir/Cargo.toml @@ -11,7 +11,7 @@ insecure_keys = [] [dependencies] bls = { workspace = true } deposit_contract = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } eth2_keystore = { workspace = true } filesystem = { workspace = true } hex = { workspace = true } diff --git a/common/validator_dir/src/validator_dir.rs b/common/validator_dir/src/validator_dir.rs index 0ed28c4ddc2..352ede708ad 100644 --- a/common/validator_dir/src/validator_dir.rs +++ b/common/validator_dir/src/validator_dir.rs @@ -3,7 +3,7 @@ use crate::builder::{ WITHDRAWAL_KEYSTORE_FILE, keystore_password_path, }; use deposit_contract::decode_eth1_tx_data; -use derivative::Derivative; +use educe::Educe; use eth2_keystore::{Error as KeystoreError, Keystore, PlainText}; use lockfile::{Lockfile, LockfileError}; use std::fs::{File, read, write}; @@ -56,11 +56,11 @@ pub struct Eth1DepositData { /// /// Holds a lockfile in `self.dir` to attempt to prevent concurrent access from multiple /// processes. -#[derive(Debug, Derivative)] -#[derivative(PartialEq)] +#[derive(Debug, Educe)] +#[educe(PartialEq)] pub struct ValidatorDir { dir: PathBuf, - #[derivative(PartialEq = "ignore")] + #[educe(PartialEq(ignore))] _lockfile: Lockfile, } diff --git a/consensus/state_processing/Cargo.toml b/consensus/state_processing/Cargo.toml index fc55bde9c67..3821aa16891 100644 --- a/consensus/state_processing/Cargo.toml +++ b/consensus/state_processing/Cargo.toml @@ -20,7 +20,7 @@ portable = ["bls/supranational-portable"] [dependencies] arbitrary = { workspace = true } bls = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } ethereum_hashing = { workspace = true } ethereum_ssz = { workspace = true } ethereum_ssz_derive = { workspace = true } diff --git a/consensus/state_processing/src/verify_operation.rs b/consensus/state_processing/src/verify_operation.rs index a922e47cfef..297edef08e1 100644 --- a/consensus/state_processing/src/verify_operation.rs +++ b/consensus/state_processing/src/verify_operation.rs @@ -8,7 +8,7 @@ use crate::per_block_processing::{ verify_proposer_slashing, }; use arbitrary::Arbitrary; -use derivative::Derivative; +use educe::Educe; use smallvec::{SmallVec, smallvec}; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; @@ -39,8 +39,8 @@ pub trait TransformPersist { /// /// The inner `op` field is private, meaning instances of this type can only be constructed /// by calling `validate`. -#[derive(Derivative, Debug, Clone, Arbitrary)] -#[derivative( +#[derive(Educe, Debug, Clone, Arbitrary)] +#[educe( PartialEq, Eq, Hash(bound = "T: TransformPersist + std::hash::Hash, E: EthSpec") diff --git a/slasher/Cargo.toml b/slasher/Cargo.toml index b2f6eca9c37..cca55bcef88 100644 --- a/slasher/Cargo.toml +++ b/slasher/Cargo.toml @@ -14,7 +14,7 @@ portable = ["types/portable"] [dependencies] bincode = { workspace = true } byteorder = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } ethereum_ssz = { workspace = true } ethereum_ssz_derive = { workspace = true } filesystem = { workspace = true } diff --git a/slasher/src/database/redb_impl.rs b/slasher/src/database/redb_impl.rs index 4198e826455..cdabd012caf 100644 --- a/slasher/src/database/redb_impl.rs +++ b/slasher/src/database/redb_impl.rs @@ -7,7 +7,7 @@ use crate::{ *, }, }; -use derivative::Derivative; +use educe::Educe; use redb::{ReadableTable, TableDefinition}; use std::{borrow::Cow, path::PathBuf}; @@ -23,18 +23,18 @@ pub struct Database<'env> { _phantom: PhantomData<&'env ()>, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] pub struct RwTransaction<'env> { - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] txn: redb::WriteTransaction, _phantom: PhantomData<&'env ()>, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] pub struct Cursor<'env> { - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] txn: &'env redb::WriteTransaction, db: &'env Database<'env>, current_key: Option>, From 6a7e8ba62cddb79c0fc2d4df4bfcf4bb67525eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 17:47:55 +0200 Subject: [PATCH 04/16] network, operation_pool, ef_tests --- Cargo.lock | 6 +- beacon_node/network/Cargo.toml | 2 +- .../sync/block_lookups/single_block_lookup.rs | 26 ++-- .../network/src/sync/range_sync/batch.rs | 8 +- beacon_node/operation_pool/Cargo.toml | 2 +- beacon_node/operation_pool/src/persistence.rs | 6 +- testing/ef_tests/Cargo.toml | 2 +- testing/ef_tests/src/handler.rs | 126 +++++++++--------- 8 files changed, 89 insertions(+), 89 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f3951e7e87..a4328c0d5ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2540,7 +2540,7 @@ dependencies = [ "compare_fields", "compare_fields_derive", "context_deserialize", - "derivative", + "educe", "eth2_network_config", "ethereum_ssz", "ethereum_ssz_derive", @@ -6318,7 +6318,7 @@ dependencies = [ "beacon_processor", "bls", "delay_map", - "derivative", + "educe", "eth2", "eth2_network_config", "ethereum_ssz", @@ -6754,7 +6754,7 @@ version = "0.2.0" dependencies = [ "beacon_chain", "bitvec 1.0.1", - "derivative", + "educe", "ethereum_ssz", "ethereum_ssz_derive", "itertools 0.10.5", diff --git a/beacon_node/network/Cargo.toml b/beacon_node/network/Cargo.toml index 5615148648d..b60c5e6dbff 100644 --- a/beacon_node/network/Cargo.toml +++ b/beacon_node/network/Cargo.toml @@ -19,7 +19,7 @@ async-channel = { workspace = true } beacon_chain = { workspace = true } beacon_processor = { workspace = true } delay_map = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } ethereum_ssz = { workspace = true } execution_layer = { workspace = true } fnv = { workspace = true } diff --git a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs index 8fb3248a871..1cd6ee6a71c 100644 --- a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs +++ b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs @@ -5,7 +5,7 @@ use crate::sync::network_context::{ SyncNetworkContext, }; use beacon_chain::{BeaconChainTypes, BlockProcessStatus}; -use derivative::Derivative; +use educe::Educe; use lighthouse_network::service::api_types::Id; use lighthouse_tracing::SPAN_SINGLE_BLOCK_LOOKUP; use parking_lot::RwLock; @@ -57,8 +57,8 @@ pub enum LookupRequestError { }, } -#[derive(Derivative)] -#[derivative(Debug(bound = "T: BeaconChainTypes"))] +#[derive(Educe)] +#[educe(Debug(bound = "T: BeaconChainTypes"))] pub struct SingleBlockLookup { pub id: Id, pub block_request_state: BlockRequestState, @@ -67,7 +67,7 @@ pub struct SingleBlockLookup { /// the custody request to have an updated view of the peers that claim to have imported the /// block associated with this lookup. The peer set of a lookup can change rapidly, and faster /// than the lifetime of a custody request. - #[derivative(Debug(format_with = "fmt_peer_set_as_len"))] + #[educe(Debug(method(fmt_peer_set_as_len)))] peers: Arc>>, block_root: Hash256, awaiting_parent: Option, @@ -369,10 +369,10 @@ impl SingleBlockLookup { } /// The state of the blob request component of a `SingleBlockLookup`. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] pub struct BlobRequestState { - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] pub block_root: Hash256, pub state: SingleLookupRequestState>, } @@ -387,10 +387,10 @@ impl BlobRequestState { } /// The state of the custody request component of a `SingleBlockLookup`. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] pub struct CustodyRequestState { - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] pub block_root: Hash256, pub state: SingleLookupRequestState>, } @@ -405,10 +405,10 @@ impl CustodyRequestState { } /// The state of the block request component of a `SingleBlockLookup`. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] pub struct BlockRequestState { - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] pub requested_block_root: Hash256, pub state: SingleLookupRequestState>>, } diff --git a/beacon_node/network/src/sync/range_sync/batch.rs b/beacon_node/network/src/sync/range_sync/batch.rs index 31e65941390..ba7874ba421 100644 --- a/beacon_node/network/src/sync/range_sync/batch.rs +++ b/beacon_node/network/src/sync/range_sync/batch.rs @@ -1,5 +1,5 @@ use beacon_chain::block_verification_types::RpcBlock; -use derivative::Derivative; +use educe::Educe; use lighthouse_network::PeerId; use lighthouse_network::rpc::methods::BlocksByRangeRequest; use lighthouse_network::service::api_types::Id; @@ -97,8 +97,8 @@ pub enum BatchProcessingResult { NonFaultyFailure, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Educe)] +#[educe(Debug)] /// A segment of a chain. pub struct BatchInfo { /// Start slot of the batch. @@ -116,7 +116,7 @@ pub struct BatchInfo { /// Whether this batch contains all blocks or all blocks and blobs. batch_type: ByRangeRequestType, /// Pin the generic - #[derivative(Debug = "ignore")] + #[educe(Debug = "ignore")] marker: std::marker::PhantomData, } diff --git a/beacon_node/operation_pool/Cargo.toml b/beacon_node/operation_pool/Cargo.toml index beaf8188824..eeddb53c23e 100644 --- a/beacon_node/operation_pool/Cargo.toml +++ b/beacon_node/operation_pool/Cargo.toml @@ -9,7 +9,7 @@ portable = ["beacon_chain/portable"] [dependencies] bitvec = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } ethereum_ssz = { workspace = true } ethereum_ssz_derive = { workspace = true } itertools = { workspace = true } diff --git a/beacon_node/operation_pool/src/persistence.rs b/beacon_node/operation_pool/src/persistence.rs index 4d754534605..bc0885769f4 100644 --- a/beacon_node/operation_pool/src/persistence.rs +++ b/beacon_node/operation_pool/src/persistence.rs @@ -3,7 +3,7 @@ use crate::OperationPool; use crate::attestation_storage::AttestationMap; use crate::bls_to_execution_changes::{BlsToExecutionChanges, ReceivedPreCapella}; use crate::sync_aggregate_id::SyncAggregateId; -use derivative::Derivative; +use educe::Educe; use parking_lot::RwLock; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; @@ -23,8 +23,8 @@ type PersistedSyncContributions = Vec<(SyncAggregateId, Vec { - #[derive(Derivative)] - #[derivative(Default(bound = ""))] + #[derive(Educe)] + #[educe(Default)] pub struct $runner_name; impl Handler for $runner_name { @@ -174,8 +174,8 @@ macro_rules! bls_eth_handler { macro_rules! bls_handler { ($runner_name: ident, $case_name:ident, $handler_name:expr) => { - #[derive(Derivative)] - #[derivative(Default(bound = ""))] + #[derive(Educe)] + #[educe(Default)] pub struct $runner_name; impl Handler for $runner_name { @@ -335,8 +335,8 @@ impl SszStaticHandler { } /// Handler for SSZ types that implement `CachedTreeHash`. -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct SszStaticTHCHandler(PhantomData<(T, E)>); /// Handler for SSZ types that don't implement `ssz::Decode`. @@ -436,8 +436,8 @@ where } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct ShufflingHandler(PhantomData); impl Handler for ShufflingHandler { @@ -460,8 +460,8 @@ impl Handler for ShufflingHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct SanityBlocksHandler(PhantomData); impl Handler for SanityBlocksHandler { @@ -486,8 +486,8 @@ impl Handler for SanityBlocksHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct SanitySlotsHandler(PhantomData); impl Handler for SanitySlotsHandler { @@ -511,8 +511,8 @@ impl Handler for SanitySlotsHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct RandomHandler(PhantomData); impl Handler for RandomHandler { @@ -531,8 +531,8 @@ impl Handler for RandomHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct EpochProcessingHandler(PhantomData<(E, T)>); impl> Handler for EpochProcessingHandler { @@ -581,8 +581,8 @@ impl Handler for RewardsHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct ForkHandler(PhantomData); impl Handler for ForkHandler { @@ -601,8 +601,8 @@ impl Handler for ForkHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct TransitionHandler(PhantomData); impl Handler for TransitionHandler { @@ -621,8 +621,8 @@ impl Handler for TransitionHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct FinalityHandler(PhantomData); impl Handler for FinalityHandler { @@ -705,8 +705,8 @@ impl Handler for ForkChoiceHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct OptimisticSyncHandler(PhantomData); impl Handler for OptimisticSyncHandler { @@ -734,8 +734,8 @@ impl Handler for OptimisticSyncHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct GenesisValidityHandler(PhantomData); impl Handler for GenesisValidityHandler { @@ -754,8 +754,8 @@ impl Handler for GenesisValidityHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct GenesisInitializationHandler(PhantomData); impl Handler for GenesisInitializationHandler { @@ -774,8 +774,8 @@ impl Handler for GenesisInitializationHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGBlobToKZGCommitmentHandler(PhantomData); impl Handler for KZGBlobToKZGCommitmentHandler { @@ -794,8 +794,8 @@ impl Handler for KZGBlobToKZGCommitmentHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGComputeBlobKZGProofHandler(PhantomData); impl Handler for KZGComputeBlobKZGProofHandler { @@ -814,8 +814,8 @@ impl Handler for KZGComputeBlobKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGComputeKZGProofHandler(PhantomData); impl Handler for KZGComputeKZGProofHandler { @@ -834,8 +834,8 @@ impl Handler for KZGComputeKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGVerifyBlobKZGProofHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofHandler { @@ -854,8 +854,8 @@ impl Handler for KZGVerifyBlobKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGVerifyBlobKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofBatchHandler { @@ -874,8 +874,8 @@ impl Handler for KZGVerifyBlobKZGProofBatchHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGVerifyKZGProofHandler(PhantomData); impl Handler for KZGVerifyKZGProofHandler { @@ -894,8 +894,8 @@ impl Handler for KZGVerifyKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct GetCustodyGroupsHandler(PhantomData); impl Handler for GetCustodyGroupsHandler { @@ -914,8 +914,8 @@ impl Handler for GetCustodyGroupsHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct ComputeColumnsForCustodyGroupHandler(PhantomData); impl Handler for ComputeColumnsForCustodyGroupHandler { @@ -934,8 +934,8 @@ impl Handler for ComputeColumnsForCustodyGroupHandler } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGComputeCellsHandler(PhantomData); impl Handler for KZGComputeCellsHandler { @@ -954,8 +954,8 @@ impl Handler for KZGComputeCellsHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGComputeCellsAndKZGProofHandler(PhantomData); impl Handler for KZGComputeCellsAndKZGProofHandler { @@ -974,8 +974,8 @@ impl Handler for KZGComputeCellsAndKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGVerifyCellKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyCellKZGProofBatchHandler { @@ -994,8 +994,8 @@ impl Handler for KZGVerifyCellKZGProofBatchHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KZGRecoverCellsAndKZGProofHandler(PhantomData); impl Handler for KZGRecoverCellsAndKZGProofHandler { @@ -1014,8 +1014,8 @@ impl Handler for KZGRecoverCellsAndKZGProofHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for KzgInclusionMerkleProofValidityHandler { @@ -1038,8 +1038,8 @@ impl Handler for KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for MerkleProofValidityHandler { @@ -1062,8 +1062,8 @@ impl Handler for MerkleProofValidityHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct LightClientUpdateHandler(PhantomData); impl Handler for LightClientUpdateHandler { @@ -1088,8 +1088,8 @@ impl Handler for LightClientUpdateHandler { } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct OperationsHandler(PhantomData<(E, O)>); impl> Handler for OperationsHandler { @@ -1108,8 +1108,8 @@ impl> Handler for OperationsHandler } } -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive(Educe)] +#[educe(Default)] pub struct SszGenericHandler(PhantomData); impl Handler for SszGenericHandler { From 865f5c89e9e6037c20738f2e60f3f5bab8a6f568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 17:53:28 +0200 Subject: [PATCH 05/16] beacon_chain --- Cargo.lock | 2 +- beacon_node/beacon_chain/Cargo.toml | 2 +- .../beacon_chain/src/beacon_fork_choice_store.rs | 8 ++++---- beacon_node/beacon_chain/src/blob_verification.rs | 6 +++--- beacon_node/beacon_chain/src/block_verification.rs | 6 +++--- .../beacon_chain/src/block_verification_types.rs | 10 +++++----- .../beacon_chain/src/data_column_verification.rs | 14 +++++++------- .../light_client_finality_update_verification.rs | 6 +++--- .../light_client_optimistic_update_verification.rs | 6 +++--- .../beacon_chain/src/observed_operations.rs | 8 ++++---- .../src/sync_committee_verification.rs | 6 +++--- .../src/sync/block_lookups/single_block_lookup.rs | 2 +- consensus/state_processing/src/verify_operation.rs | 2 +- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4328c0d5ee..43d64601dae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -862,7 +862,7 @@ dependencies = [ "bitvec 1.0.1", "bls", "criterion", - "derivative", + "educe", "eth2", "eth2_network_config", "ethereum_hashing", diff --git a/beacon_node/beacon_chain/Cargo.toml b/beacon_node/beacon_chain/Cargo.toml index dca351cbac6..e889f53bb01 100644 --- a/beacon_node/beacon_chain/Cargo.toml +++ b/beacon_node/beacon_chain/Cargo.toml @@ -18,7 +18,7 @@ test_backfill = [] alloy-primitives = { workspace = true } bitvec = { workspace = true } bls = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } eth2 = { workspace = true } eth2_network_config = { workspace = true } ethereum_hashing = { workspace = true } diff --git a/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs b/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs index 440388661c2..0c203009bbe 100644 --- a/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs +++ b/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs @@ -5,7 +5,7 @@ //! reads when fork choice requires the validator balances of the justified state. use crate::{BeaconSnapshot, metrics}; -use derivative::Derivative; +use educe::Educe; use fork_choice::ForkChoiceStore; use proto_array::JustifiedBalances; use safe_arith::ArithError; @@ -127,10 +127,10 @@ impl BalancesCache { /// Implements `fork_choice::ForkChoiceStore` in order to provide a persistent backing to the /// `fork_choice::ForkChoice` struct. -#[derive(Debug, Derivative)] -#[derivative(PartialEq(bound = "E: EthSpec, Hot: ItemStore, Cold: ItemStore"))] +#[derive(Debug, Educe)] +#[educe(PartialEq(bound(E: EthSpec, Hot: ItemStore, Cold: ItemStore)))] pub struct BeaconForkChoiceStore, Cold: ItemStore> { - #[derivative(PartialEq = "ignore")] + #[educe(PartialEq(ignore))] store: Arc>, balances_cache: BalancesCache, time: Slot, diff --git a/beacon_node/beacon_chain/src/blob_verification.rs b/beacon_node/beacon_chain/src/blob_verification.rs index 53f2eff0ca3..874673b52e8 100644 --- a/beacon_node/beacon_chain/src/blob_verification.rs +++ b/beacon_node/beacon_chain/src/blob_verification.rs @@ -1,4 +1,4 @@ -use derivative::Derivative; +use educe::Educe; use slot_clock::SlotClock; use std::marker::PhantomData; use std::sync::Arc; @@ -245,8 +245,8 @@ impl GossipVerifiedBlob { /// Wrapper over a `BlobSidecar` for which we have completed kzg verification. /// i.e. `verify_blob_kzg_proof(blob, commitment, proof) == true`. -#[derive(Debug, Derivative, Clone, Encode, Decode)] -#[derivative(PartialEq, Eq)] +#[derive(Debug, Educe, Clone, Encode, Decode)] +#[educe(PartialEq, Eq)] #[ssz(struct_behaviour = "transparent")] pub struct KzgVerifiedBlob { blob: Arc>, diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index d0ed8258e55..fd8dbac73f4 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -66,7 +66,7 @@ use crate::{ beacon_chain::{BeaconForkChoice, ForkChoiceError}, metrics, }; -use derivative::Derivative; +use educe::Educe; use eth2::types::{BlockGossip, EventKind}; use execution_layer::PayloadStatus; pub use fork_choice::{AttestationFromBlock, PayloadVerificationStatus}; @@ -689,8 +689,8 @@ pub fn signature_verify_chain_segment( /// A wrapper around a `SignedBeaconBlock` that indicates it has been approved for re-gossiping on /// the p2p network. -#[derive(Derivative)] -#[derivative(Debug(bound = "T: BeaconChainTypes"))] +#[derive(Educe)] +#[educe(Debug(bound(T: BeaconChainTypes)))] pub struct GossipVerifiedBlock { pub block: Arc>, pub block_root: Hash256, diff --git a/beacon_node/beacon_chain/src/block_verification_types.rs b/beacon_node/beacon_chain/src/block_verification_types.rs index 1a0b188fdcd..5978e97c4d9 100644 --- a/beacon_node/beacon_chain/src/block_verification_types.rs +++ b/beacon_node/beacon_chain/src/block_verification_types.rs @@ -2,7 +2,7 @@ use crate::data_availability_checker::AvailabilityCheckError; pub use crate::data_availability_checker::{AvailableBlock, MaybeAvailableBlock}; use crate::data_column_verification::{CustodyDataColumn, CustodyDataColumnList}; use crate::{PayloadVerificationOutcome, get_block_root}; -use derivative::Derivative; +use educe::Educe; use ssz_types::VariableList; use state_processing::ConsensusContext; use std::fmt::{Debug, Formatter}; @@ -26,8 +26,8 @@ use types::{ /// Note: We make a distinction over blocks received over gossip because /// in a post-deneb world, the blobs corresponding to a given block that are received /// over rpc do not contain the proposer signature for dos resistance. -#[derive(Clone, Derivative)] -#[derivative(Hash(bound = "E: EthSpec"))] +#[derive(Clone, Educe)] +#[educe(Hash(bound(E: EthSpec)))] pub struct RpcBlock { block_root: Hash256, block: RpcBlockInner, @@ -80,8 +80,8 @@ impl RpcBlock { /// Note: This variant is intentionally private because we want to safely construct the /// internal variants after applying consistency checks to ensure that the block and blobs /// are consistent with respect to each other. -#[derive(Debug, Clone, Derivative)] -#[derivative(Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Educe)] +#[educe(Hash(bound(E: EthSpec)))] enum RpcBlockInner { /// Single block lookup response. This should potentially hit the data availability cache. Block(Arc>), diff --git a/beacon_node/beacon_chain/src/data_column_verification.rs b/beacon_node/beacon_chain/src/data_column_verification.rs index 600b107c1d1..82fb00b2c78 100644 --- a/beacon_node/beacon_chain/src/data_column_verification.rs +++ b/beacon_node/beacon_chain/src/data_column_verification.rs @@ -4,7 +4,7 @@ use crate::block_verification::{ use crate::kzg_utils::{reconstruct_data_columns, validate_data_columns}; use crate::observed_data_sidecars::{ObservationStrategy, Observe}; use crate::{BeaconChain, BeaconChainError, BeaconChainTypes, metrics}; -use derivative::Derivative; +use educe::Educe; use fork_choice::ProtoBlock; use kzg::{Error as KzgError, Kzg}; use proto_array::Block; @@ -287,8 +287,8 @@ impl GossipVerifiedDataColumn } /// Wrapper over a `DataColumnSidecar` for which we have completed kzg verification. -#[derive(Debug, Derivative, Clone, Encode, Decode)] -#[derivative(PartialEq, Eq)] +#[derive(Debug, Educe, Clone, Encode, Decode)] +#[educe(PartialEq, Eq)] #[ssz(struct_behaviour = "transparent")] pub struct KzgVerifiedDataColumn { data: Arc>, @@ -344,8 +344,8 @@ pub type CustodyDataColumnList = VariableList, ::NumberOfColumns>; /// Data column that we must custody -#[derive(Debug, Derivative, Clone, Encode, Decode)] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Educe, Clone, Encode, Decode)] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[ssz(struct_behaviour = "transparent")] pub struct CustodyDataColumn { data: Arc>, @@ -374,8 +374,8 @@ impl CustodyDataColumn { } /// Data column that we must custody and has completed kzg verification -#[derive(Debug, Derivative, Clone, Encode, Decode)] -#[derivative(PartialEq, Eq)] +#[derive(Debug, Educe, Clone, Encode, Decode)] +#[educe(PartialEq, Eq)] #[ssz(struct_behaviour = "transparent")] pub struct KzgVerifiedCustodyDataColumn { data: Arc>, diff --git a/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs b/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs index fe62b8ef903..2dc4de7d04b 100644 --- a/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs +++ b/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs @@ -1,5 +1,5 @@ use crate::{BeaconChain, BeaconChainTypes}; -use derivative::Derivative; +use educe::Educe; use slot_clock::SlotClock; use std::time::Duration; use strum::AsRefStr; @@ -55,8 +55,8 @@ pub enum Error { } /// Wraps a `LightClientFinalityUpdate` that has been verified for propagation on the gossip network. -#[derive(Derivative)] -#[derivative(Clone(bound = "T: BeaconChainTypes"))] +#[derive(Educe)] +#[educe(Clone(bound(T: BeaconChainTypes)))] pub struct VerifiedLightClientFinalityUpdate { light_client_finality_update: LightClientFinalityUpdate, seen_timestamp: Duration, diff --git a/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs b/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs index b59390ea0c4..4079a374f89 100644 --- a/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs +++ b/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs @@ -1,5 +1,5 @@ use crate::{BeaconChain, BeaconChainTypes}; -use derivative::Derivative; +use educe::Educe; use eth2::types::Hash256; use slot_clock::SlotClock; use std::time::Duration; @@ -49,8 +49,8 @@ pub enum Error { } /// Wraps a `LightClientOptimisticUpdate` that has been verified for propagation on the gossip network. -#[derive(Derivative)] -#[derivative(Clone(bound = "T: BeaconChainTypes"))] +#[derive(Educe)] +#[educe(Clone(bound(T: BeaconChainTypes)))] pub struct VerifiedLightClientOptimisticUpdate { light_client_optimistic_update: LightClientOptimisticUpdate, pub parent_root: Hash256, diff --git a/beacon_node/beacon_chain/src/observed_operations.rs b/beacon_node/beacon_chain/src/observed_operations.rs index 49614c5b542..4ca5371242c 100644 --- a/beacon_node/beacon_chain/src/observed_operations.rs +++ b/beacon_node/beacon_chain/src/observed_operations.rs @@ -1,4 +1,4 @@ -use derivative::Derivative; +use educe::Educe; use smallvec::{SmallVec, smallvec}; use state_processing::{SigVerifiedOp, TransformPersist, VerifyOperation, VerifyOperationAt}; use std::collections::HashSet; @@ -14,8 +14,8 @@ pub const SMALL_VEC_SIZE: usize = 8; /// Stateful tracker for exit/slashing operations seen on the network. /// /// Implements the conditions for gossip verification of exits and slashings from the P2P spec. -#[derive(Debug, Derivative)] -#[derivative(Default(bound = "T: ObservableOperation, E: EthSpec"))] +#[derive(Debug, Educe)] +#[educe(Default(bound(T: ObservableOperation, E: EthSpec)))] pub struct ObservedOperations, E: EthSpec> { /// Indices of validators for whom we have already seen an instance of an operation `T`. /// @@ -26,7 +26,7 @@ pub struct ObservedOperations, E: EthSpec> { /// `attestation_1.attester_indices` and `attestation_2.attester_indices`. observed_validator_indices: HashSet, /// The name of the current fork. The default will be overwritten on first use. - #[derivative(Default(value = "ForkName::Base"))] + #[educe(Default(expression = ForkName::Base))] current_fork: ForkName, _phantom: PhantomData<(T, E)>, } diff --git a/beacon_node/beacon_chain/src/sync_committee_verification.rs b/beacon_node/beacon_chain/src/sync_committee_verification.rs index f8041769210..3f02cfc34f0 100644 --- a/beacon_node/beacon_chain/src/sync_committee_verification.rs +++ b/beacon_node/beacon_chain/src/sync_committee_verification.rs @@ -31,7 +31,7 @@ use crate::{ BeaconChain, BeaconChainError, BeaconChainTypes, metrics, observed_aggregates::ObserveOutcome, }; use bls::{PublicKeyBytes, verify_signature_sets}; -use derivative::Derivative; +use educe::Educe; use safe_arith::ArithError; use slot_clock::SlotClock; use ssz_derive::{Decode, Encode}; @@ -261,8 +261,8 @@ impl From for Error { } /// Wraps a `SignedContributionAndProof` that has been verified for propagation on the gossip network.\ -#[derive(Derivative)] -#[derivative(Clone(bound = "T: BeaconChainTypes"))] +#[derive(Educe)] +#[educe(Clone(bound(T: BeaconChainTypes)))] pub struct VerifiedSyncContribution { signed_aggregate: SignedContributionAndProof, participant_pubkeys: Vec, diff --git a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs index 1cd6ee6a71c..5ebe6ebfc7d 100644 --- a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs +++ b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs @@ -58,7 +58,7 @@ pub enum LookupRequestError { } #[derive(Educe)] -#[educe(Debug(bound = "T: BeaconChainTypes"))] +#[educe(Debug(bound(T: BeaconChainTypes)))] pub struct SingleBlockLookup { pub id: Id, pub block_request_state: BlockRequestState, diff --git a/consensus/state_processing/src/verify_operation.rs b/consensus/state_processing/src/verify_operation.rs index 297edef08e1..1f76f19586f 100644 --- a/consensus/state_processing/src/verify_operation.rs +++ b/consensus/state_processing/src/verify_operation.rs @@ -43,7 +43,7 @@ pub trait TransformPersist { #[educe( PartialEq, Eq, - Hash(bound = "T: TransformPersist + std::hash::Hash, E: EthSpec") + Hash(bound(T: TransformPersist + std::hash::Hash, E: EthSpec)) )] #[arbitrary(bound = "T: TransformPersist + Arbitrary<'arbitrary>, E: EthSpec")] pub struct SigVerifiedOp { From c675799c81b4977bc3cda3e0cfa47a5b29b15706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 18:36:03 +0200 Subject: [PATCH 06/16] types --- Cargo.lock | 2 +- consensus/types/Cargo.toml | 2 +- consensus/types/src/attestation.rs | 13 +++++----- consensus/types/src/attester_slashing.rs | 14 +++++----- consensus/types/src/beacon_block.rs | 10 +++---- consensus/types/src/beacon_block_body.rs | 10 +++---- consensus/types/src/beacon_state.rs | 6 ++--- .../types/src/beacon_state/committee_cache.rs | 8 +++--- consensus/types/src/blob_sidecar.rs | 6 ++--- consensus/types/src/chain_spec.rs | 8 +++--- consensus/types/src/data_column_sidecar.rs | 6 ++--- consensus/types/src/data_column_subnet_id.rs | 6 ++--- consensus/types/src/execution_block_hash.rs | 6 ++--- consensus/types/src/execution_payload.rs | 10 +++---- .../types/src/execution_payload_header.rs | 10 +++---- consensus/types/src/execution_requests.rs | 6 ++--- consensus/types/src/indexed_attestation.rs | 9 ++++--- consensus/types/src/light_client_bootstrap.rs | 6 ++--- .../types/src/light_client_finality_update.rs | 6 ++--- consensus/types/src/light_client_header.rs | 6 ++--- .../src/light_client_optimistic_update.rs | 6 ++--- consensus/types/src/light_client_update.rs | 6 ++--- consensus/types/src/payload.rs | 26 +++++++++---------- consensus/types/src/runtime_var_list.rs | 6 ++--- consensus/types/src/signed_beacon_block.rs | 10 +++---- consensus/types/src/sync_aggregate.rs | 6 ++--- 26 files changed, 106 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43d64601dae..82128c90358 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9890,7 +9890,7 @@ dependencies = [ "compare_fields_derive", "context_deserialize", "criterion", - "derivative", + "educe", "eth2_interop_keypairs", "ethereum_hashing", "ethereum_serde_utils", diff --git a/consensus/types/Cargo.toml b/consensus/types/Cargo.toml index bfce4b72d22..230db59ca01 100644 --- a/consensus/types/Cargo.toml +++ b/consensus/types/Cargo.toml @@ -31,7 +31,7 @@ bls = { workspace = true } compare_fields = { workspace = true } compare_fields_derive = { workspace = true } context_deserialize = { workspace = true } -derivative = { workspace = true } +educe = { workspace = true } eth2_interop_keypairs = { path = "../../common/eth2_interop_keypairs" } ethereum_hashing = { workspace = true } ethereum_serde_utils = { workspace = true } diff --git a/consensus/types/src/attestation.rs b/consensus/types/src/attestation.rs index 860f0d0a2d3..fc70a6b0a70 100644 --- a/consensus/types/src/attestation.rs +++ b/consensus/types/src/attestation.rs @@ -8,7 +8,7 @@ use crate::{ }; use crate::{Hash256, Slot, test_utils::TestRandom}; use crate::{IndexedAttestation, context_deserialize}; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz_derive::{Decode, Encode}; use ssz_types::BitVector; @@ -45,11 +45,11 @@ impl From for Error { Decode, Encode, TestRandom, - Derivative, + Educe, TreeHash, ), context_deserialize(ForkName), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -66,7 +66,8 @@ impl From for Error { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, TreeHash, Encode, Derivative, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, TreeHash, Encode, Educe, Deserialize)] +#[educe(PartialEq)] #[serde(untagged)] #[tree_hash(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")] @@ -607,10 +608,10 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for Vec> Decode, Encode, TestRandom, - Derivative, + Educe, TreeHash, - PartialEq, )] +#[educe(PartialEq)] #[context_deserialize(ForkName)] pub struct SingleAttestation { #[serde(with = "serde_utils::quoted_u64")] diff --git a/consensus/types/src/attester_slashing.rs b/consensus/types/src/attester_slashing.rs index adc3695f4a4..9cf4d7526d0 100644 --- a/consensus/types/src/attester_slashing.rs +++ b/consensus/types/src/attester_slashing.rs @@ -4,7 +4,7 @@ use crate::indexed_attestation::{ }; use crate::{ContextDeserialize, ForkName}; use crate::{EthSpec, test_utils::TestRandom}; -use derivative::Derivative; +use educe::Educe; use rand::{Rng, RngCore}; use serde::{Deserialize, Deserializer, Serialize}; use ssz_derive::{Decode, Encode}; @@ -16,7 +16,7 @@ use tree_hash_derive::TreeHash; variants(Base, Electra), variant_attributes( derive( - Derivative, + Educe, Debug, Clone, Serialize, @@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash; TestRandom, ), context_deserialize(ForkName), - derivative(PartialEq, Eq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Eq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec"), cfg_attr( feature = "arbitrary", @@ -42,8 +42,8 @@ use tree_hash_derive::TreeHash; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative)] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Educe)] +#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] #[serde(bound = "E: EthSpec", untagged)] #[ssz(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")] @@ -57,8 +57,8 @@ pub struct AttesterSlashing { /// This is a copy of the `AttesterSlashing` enum but with `Encode` and `Decode` derived /// using the `union` behavior for the purposes of persistence on disk. We use a separate /// type so that we don't accidentally use this non-spec encoding in consensus objects. -#[derive(Debug, Clone, Encode, Decode, Derivative)] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Encode, Decode, Educe)] +#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] #[ssz(enum_behaviour = "union")] pub enum AttesterSlashingOnDisk { Base(AttesterSlashingBase), diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 61c32dd4ac9..25fabec02ef 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -1,7 +1,7 @@ use crate::attestation::AttestationBase; use crate::test_utils::TestRandom; use crate::*; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, DecodeError}; use ssz_derive::{Decode, Encode}; @@ -27,9 +27,9 @@ use self::indexed_attestation::IndexedAttestationBase; Decode, TreeHash, TestRandom, - Derivative, + Educe, ), - derivative(PartialEq, Hash(bound = "E: EthSpec, Payload: AbstractExecPayload")), + educe(PartialEq, Hash(bound("E: EthSpec, Payload: AbstractExecPayload"))), serde( bound = "E: EthSpec, Payload: AbstractExecPayload", deny_unknown_fields @@ -52,8 +52,8 @@ use self::indexed_attestation::IndexedAttestationBase; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] -#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound = "E: EthSpec"))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index e636fbb5346..382b6948251 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -1,6 +1,6 @@ use crate::test_utils::TestRandom; use crate::*; -use derivative::Derivative; +use educe::Educe; use merkle_proof::{MerkleTree, MerkleTreeError}; use metastruct::metastruct; use serde::{Deserialize, Deserializer, Serialize}; @@ -39,9 +39,9 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; Decode, TreeHash, TestRandom, - Derivative, + Educe, ), - derivative(PartialEq, Hash(bound = "E: EthSpec, Payload: AbstractExecPayload")), + educe(PartialEq, Hash(bound("E: EthSpec, Payload: AbstractExecPayload"))), serde( bound = "E: EthSpec, Payload: AbstractExecPayload", deny_unknown_fields @@ -71,8 +71,8 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] -#[derive(Debug, Clone, Serialize, Deserialize, Derivative, TreeHash)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, Educe, TreeHash)] +#[educe(PartialEq, Hash(bound = "E: EthSpec"))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index 0a3d768c593..1944c6d3146 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -6,7 +6,7 @@ use crate::test_utils::TestRandom; use crate::*; use compare_fields::CompareFields; use compare_fields_derive::CompareFields; -use derivative::Derivative; +use educe::Educe; use ethereum_hashing::hash; use int_to_bytes::{int_to_bytes4, int_to_bytes8}; use metastruct::{NumFields, metastruct}; @@ -246,7 +246,7 @@ impl From for Hash256 { variants(Base, Altair, Bellatrix, Capella, Deneb, Electra, Fulu, Gloas), variant_attributes( derive( - Derivative, + Educe, Debug, PartialEq, Serialize, @@ -263,7 +263,7 @@ impl From for Hash256 { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") ), - derivative(Clone), + educe(Clone), ), specific_variant_attributes( Base(metastruct( diff --git a/consensus/types/src/beacon_state/committee_cache.rs b/consensus/types/src/beacon_state/committee_cache.rs index 06242e8d20e..408c269da5f 100644 --- a/consensus/types/src/beacon_state/committee_cache.rs +++ b/consensus/types/src/beacon_state/committee_cache.rs @@ -2,7 +2,7 @@ use crate::*; use core::num::NonZeroUsize; -use derivative::Derivative; +use educe::Educe; use safe_arith::SafeArith; use serde::{Deserialize, Serialize}; use ssz::{Decode, DecodeError, Encode, four_byte_option_impl}; @@ -20,13 +20,13 @@ four_byte_option_impl!(four_byte_option_non_zero_usize, NonZeroUsize); /// Computes and stores the shuffling for an epoch. Provides various getters to allow callers to /// read the committees for the given epoch. -#[derive(Derivative, Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)] -#[derivative(PartialEq)] +#[derive(Educe, Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)] +#[educe(PartialEq)] pub struct CommitteeCache { #[ssz(with = "four_byte_option_epoch")] initialized_epoch: Option, shuffling: Vec, - #[derivative(PartialEq(compare_with = "compare_shuffling_positions"))] + #[educe(PartialEq(method(compare_shuffling_positions)))] shuffling_positions: Vec, committees_per_slot: u64, slots_per_epoch: u64, diff --git a/consensus/types/src/blob_sidecar.rs b/consensus/types/src/blob_sidecar.rs index 2e8c2578976..72a1d000dfa 100644 --- a/consensus/types/src/blob_sidecar.rs +++ b/consensus/types/src/blob_sidecar.rs @@ -7,7 +7,7 @@ use crate::{ beacon_block_body::BLOB_KZG_COMMITMENTS_INDEX, }; use bls::Signature; -use derivative::Derivative; +use educe::Educe; use kzg::{BYTES_PER_BLOB, BYTES_PER_FIELD_ELEMENT, Blob as KzgBlob, Kzg, KzgCommitment, KzgProof}; use merkle_proof::{MerkleTreeError, merkle_root_from_branch, verify_merkle_proof}; use rand::Rng; @@ -50,11 +50,11 @@ impl Ord for BlobIdentifier { arbitrary(bound = "E: EthSpec") )] #[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative, + Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] #[context_deserialize(ForkName)] #[serde(bound = "E: EthSpec")] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] pub struct BlobSidecar { #[serde(with = "serde_utils::quoted_u64")] pub index: u64, diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index 6670fff6298..b055c85edfd 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -2,7 +2,7 @@ use crate::application_domain::{APPLICATION_DOMAIN_BUILDER, ApplicationDomain}; use crate::blob_sidecar::BlobIdentifier; use crate::data_column_sidecar::DataColumnsByRootIdentifier; use crate::*; -use derivative::Derivative; +use educe::Educe; use ethereum_hashing::hash; use int_to_bytes::int_to_bytes4; use safe_arith::{ArithError, SafeArith}; @@ -1526,15 +1526,15 @@ pub struct BlobParameters { // A wrapper around a vector of BlobParameters to ensure that the vector is reverse // sorted by epoch. #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Debug, Derivative, Clone)] -#[derivative(PartialEq)] +#[derive(Debug, Educe, Clone)] +#[educe(PartialEq)] pub struct BlobSchedule { schedule: Vec, // This is a hack to prevent the blob schedule being serialized on the /eth/v1/config/spec // endpoint prior to the Fulu fork being scheduled. // // We can remove this once Fulu is live on mainnet. - #[derivative(PartialEq = "ignore")] + #[educe(PartialEq(ignore))] skip_serializing: bool, } diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 2272b1695c9..5c7a4de1d6b 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -6,7 +6,7 @@ use crate::{ SignedBeaconBlockHeader, Slot, }; use bls::Signature; -use derivative::Derivative; +use educe::Educe; use kzg::Error as KzgError; use kzg::{KzgCommitment, KzgProof}; use merkle_proof::verify_merkle_proof; @@ -41,10 +41,10 @@ pub type DataColumnSidecarList = Vec>>; arbitrary(bound = "E: EthSpec") )] #[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative, + Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] #[serde(bound = "E: EthSpec")] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] #[context_deserialize(ForkName)] pub struct DataColumnSidecar { #[serde(with = "serde_utils::quoted_u64")] diff --git a/consensus/types/src/data_column_subnet_id.rs b/consensus/types/src/data_column_subnet_id.rs index 4061cb4fdb0..090082348bb 100644 --- a/consensus/types/src/data_column_subnet_id.rs +++ b/consensus/types/src/data_column_subnet_id.rs @@ -1,15 +1,15 @@ //! Identifies each data column subnet by an integer identifier. use crate::ChainSpec; use crate::data_column_sidecar::ColumnIndex; -use derivative::Derivative; +use educe::Educe; use safe_arith::{ArithError, SafeArith}; use serde::{Deserialize, Serialize}; use std::fmt::{self, Display}; use std::ops::{Deref, DerefMut}; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Clone, Copy, Derivative, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[derivative(Debug = "transparent")] +#[derive(Clone, Copy, Educe, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[educe(Debug = "transparent")] #[serde(transparent)] pub struct DataColumnSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64); diff --git a/consensus/types/src/execution_block_hash.rs b/consensus/types/src/execution_block_hash.rs index d3065afbbb0..ed9a86dc608 100644 --- a/consensus/types/src/execution_block_hash.rs +++ b/consensus/types/src/execution_block_hash.rs @@ -1,15 +1,15 @@ use crate::FixedBytesExtended; use crate::Hash256; use crate::test_utils::TestRandom; -use derivative::Derivative; +use educe::Educe; use rand::RngCore; use serde::{Deserialize, Serialize}; use ssz::{Decode, DecodeError, Encode}; use std::fmt; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, Hash, Derivative)] -#[derivative(Debug = "transparent")] +#[derive(Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, Hash, Educe)] +#[educe(Debug = "transparent")] #[serde(transparent)] pub struct ExecutionBlockHash(#[serde(with = "serde_utils::b256_hex")] pub Hash256); diff --git a/consensus/types/src/execution_payload.rs b/consensus/types/src/execution_payload.rs index 7a899e5f022..bb8d4690784 100644 --- a/consensus/types/src/execution_payload.rs +++ b/consensus/types/src/execution_payload.rs @@ -1,5 +1,5 @@ use crate::{test_utils::TestRandom, *}; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; @@ -27,10 +27,10 @@ pub type Withdrawals = VariableList::MaxWithdrawal Decode, TreeHash, TestRandom, - Derivative, + Educe, ), context_deserialize(ForkName), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -48,8 +48,8 @@ pub type Withdrawals = VariableList::MaxWithdrawal derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec", untagged)] #[ssz(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index 2f5fac87a9a..14b39530430 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -1,5 +1,5 @@ use crate::{test_utils::TestRandom, *}; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; @@ -20,9 +20,9 @@ use tree_hash_derive::TreeHash; Decode, TreeHash, TestRandom, - Derivative, + Educe, ), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -44,8 +44,8 @@ use tree_hash_derive::TreeHash; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound = "E: EthSpec"))] #[serde(bound = "E: EthSpec", untagged)] #[tree_hash(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")] diff --git a/consensus/types/src/execution_requests.rs b/consensus/types/src/execution_requests.rs index 592dda5d5e1..a517f8412fa 100644 --- a/consensus/types/src/execution_requests.rs +++ b/consensus/types/src/execution_requests.rs @@ -2,7 +2,7 @@ use crate::context_deserialize; use crate::test_utils::TestRandom; use crate::{ConsolidationRequest, DepositRequest, EthSpec, ForkName, Hash256, WithdrawalRequest}; use alloy_primitives::Bytes; -use derivative::Derivative; +use educe::Educe; use ethereum_hashing::{DynamicContext, Sha256Context}; use serde::{Deserialize, Serialize}; use ssz::Encode; @@ -24,10 +24,10 @@ pub type ConsolidationRequests = arbitrary(bound = "E: EthSpec") )] #[derive( - Debug, Derivative, Default, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, + Debug, Educe, Default, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] #[serde(bound = "E: EthSpec")] -#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] #[context_deserialize(ForkName)] pub struct ExecutionRequests { pub deposits: DepositRequests, diff --git a/consensus/types/src/indexed_attestation.rs b/consensus/types/src/indexed_attestation.rs index 4ba695b9d51..c9704a0e2d4 100644 --- a/consensus/types/src/indexed_attestation.rs +++ b/consensus/types/src/indexed_attestation.rs @@ -3,7 +3,7 @@ use crate::{ AggregateSignature, AttestationData, EthSpec, ForkName, VariableList, test_utils::TestRandom, }; use core::slice::Iter; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Serialize}; use ssz::Encode; use ssz_derive::{Decode, Encode}; @@ -28,11 +28,11 @@ use tree_hash_derive::TreeHash; Decode, Encode, TestRandom, - Derivative, + Educe, TreeHash, ), context_deserialize(ForkName), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -46,7 +46,8 @@ use tree_hash_derive::TreeHash; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, TreeHash, Encode, Derivative, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, TreeHash, Encode, Educe, Deserialize)] +#[educe(PartialEq)] #[serde(untagged)] #[tree_hash(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")] diff --git a/consensus/types/src/light_client_bootstrap.rs b/consensus/types/src/light_client_bootstrap.rs index 5850db876c2..1269b41f7cb 100644 --- a/consensus/types/src/light_client_bootstrap.rs +++ b/consensus/types/src/light_client_bootstrap.rs @@ -5,7 +5,7 @@ use crate::{ LightClientHeaderElectra, LightClientHeaderFulu, LightClientHeaderGloas, SignedBlindedBeaconBlock, Slot, SyncCommittee, light_client_update::*, test_utils::TestRandom, }; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; @@ -22,15 +22,15 @@ use tree_hash_derive::TreeHash; derive( Debug, Clone, - PartialEq, Serialize, Deserialize, - Derivative, + Educe, Decode, Encode, TestRandom, TreeHash, ), + educe(PartialEq), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/light_client_finality_update.rs b/consensus/types/src/light_client_finality_update.rs index 4fa98de40be..8ccb30a94f6 100644 --- a/consensus/types/src/light_client_finality_update.rs +++ b/consensus/types/src/light_client_finality_update.rs @@ -7,7 +7,7 @@ use crate::{ LightClientHeaderGloas, SignedBlindedBeaconBlock, light_client_update::*, test_utils::TestRandom, }; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, Encode}; use ssz_derive::Decode; @@ -22,15 +22,15 @@ use tree_hash_derive::TreeHash; derive( Debug, Clone, - PartialEq, Serialize, Deserialize, - Derivative, + Educe, Decode, Encode, TestRandom, TreeHash, ), + educe(PartialEq), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/light_client_header.rs b/consensus/types/src/light_client_header.rs index 162203138ab..5820efcc91b 100644 --- a/consensus/types/src/light_client_header.rs +++ b/consensus/types/src/light_client_header.rs @@ -8,7 +8,7 @@ use crate::{ ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderFulu, ExecutionPayloadHeaderGloas, FixedVector, Hash256, SignedBlindedBeaconBlock, test_utils::TestRandom, }; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::Decode; use ssz_derive::{Decode, Encode}; @@ -23,15 +23,15 @@ use tree_hash_derive::TreeHash; derive( Debug, Clone, - PartialEq, Serialize, Deserialize, - Derivative, + Educe, Decode, Encode, TestRandom, TreeHash, ), + educe(PartialEq), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/light_client_optimistic_update.rs b/consensus/types/src/light_client_optimistic_update.rs index 7528322d567..ca9957331f8 100644 --- a/consensus/types/src/light_client_optimistic_update.rs +++ b/consensus/types/src/light_client_optimistic_update.rs @@ -6,7 +6,7 @@ use crate::{ LightClientHeaderElectra, LightClientHeaderFulu, LightClientHeaderGloas, SignedBlindedBeaconBlock, light_client_update::*, }; -use derivative::Derivative; +use educe::Educe; use serde::{Deserialize, Deserializer, Serialize}; use ssz::{Decode, Encode}; use ssz_derive::Decode; @@ -24,15 +24,15 @@ use tree_hash_derive::TreeHash; derive( Debug, Clone, - PartialEq, Serialize, Deserialize, - Derivative, + Educe, Decode, Encode, TestRandom, TreeHash, ), + educe(PartialEq), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/light_client_update.rs b/consensus/types/src/light_client_update.rs index bf1a8c614a7..c3dd9136fea 100644 --- a/consensus/types/src/light_client_update.rs +++ b/consensus/types/src/light_client_update.rs @@ -7,7 +7,7 @@ use crate::{ LightClientHeaderCapella, LightClientHeaderDeneb, LightClientHeaderFulu, LightClientHeaderGloas, SignedBlindedBeaconBlock, beacon_state, test_utils::TestRandom, }; -use derivative::Derivative; +use educe::Educe; use safe_arith::ArithError; use safe_arith::SafeArith; use serde::{Deserialize, Deserializer, Serialize}; @@ -105,15 +105,15 @@ impl From for Error { derive( Debug, Clone, - PartialEq, Serialize, Deserialize, - Derivative, + Educe, Decode, Encode, TestRandom, TreeHash, ), + educe(PartialEq), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/payload.rs b/consensus/types/src/payload.rs index 28dc10f9384..9e0fedec86f 100644 --- a/consensus/types/src/payload.rs +++ b/consensus/types/src/payload.rs @@ -1,5 +1,5 @@ use crate::{test_utils::TestRandom, *}; -use derivative::Derivative; +use educe::Educe; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use ssz::{Decode, Encode}; @@ -161,9 +161,9 @@ pub trait AbstractExecPayload: Decode, TestRandom, TreeHash, - Derivative, + Educe, ), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -173,8 +173,8 @@ pub trait AbstractExecPayload: ssz(struct_behaviour = "transparent"), ), ref_attributes( - derive(Debug, Derivative, TreeHash), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + derive(Debug, Educe, TreeHash), + educe(PartialEq, Hash(bound("E: EthSpec"))), tree_hash(enum_behaviour = "transparent"), ), map_into(ExecutionPayload), @@ -187,8 +187,8 @@ pub trait AbstractExecPayload: derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct FullPayload { @@ -531,9 +531,9 @@ impl TryFrom> for FullPayload { Decode, TestRandom, TreeHash, - Derivative, + Educe, ), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -543,8 +543,8 @@ impl TryFrom> for FullPayload { ssz(struct_behaviour = "transparent"), ), ref_attributes( - derive(Debug, Derivative, TreeHash), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + derive(Debug, Educe, TreeHash), + educe(PartialEq, Hash(bound("E: EthSpec"))), tree_hash(enum_behaviour = "transparent"), ), map_into(ExecutionPayloadHeader), @@ -556,8 +556,8 @@ impl TryFrom> for FullPayload { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct BlindedPayload { diff --git a/consensus/types/src/runtime_var_list.rs b/consensus/types/src/runtime_var_list.rs index d57c65b1b71..8a8ebfec284 100644 --- a/consensus/types/src/runtime_var_list.rs +++ b/consensus/types/src/runtime_var_list.rs @@ -1,5 +1,5 @@ use crate::ContextDeserialize; -use derivative::Derivative; +use educe::Educe; use serde::de::Error as DeError; use serde::{Deserialize, Deserializer, Serialize}; use ssz::Decode; @@ -44,8 +44,8 @@ use tree_hash::{Hash256, MerkleHasher, PackedEncoding, TreeHash, TreeHashType}; /// assert!(long.push(6).is_err()); /// /// ``` -#[derive(Clone, Serialize, Deserialize, Derivative)] -#[derivative(PartialEq, Eq, Hash(bound = "T: std::hash::Hash"))] +#[derive(Clone, Serialize, Deserialize, Educe)] +#[educe(PartialEq, Eq, Hash(bound = "T: std::hash::Hash"))] #[serde(transparent)] pub struct RuntimeVariableList { vec: Vec, diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index 979b91e30d5..f2657045f27 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -1,7 +1,7 @@ use crate::beacon_block_body::{BLOB_KZG_COMMITMENTS_INDEX, format_kzg_commitments}; use crate::test_utils::TestRandom; use crate::*; -use derivative::Derivative; +use educe::Educe; use merkle_proof::MerkleTree; use serde::{Deserialize, Deserializer, Serialize}; use ssz_derive::{Decode, Encode}; @@ -51,10 +51,10 @@ impl From for Hash256 { Encode, Decode, TreeHash, - Derivative, + Educe, TestRandom ), - derivative(PartialEq, Hash(bound = "E: EthSpec")), + educe(PartialEq, Hash(bound("E: EthSpec"))), serde(bound = "E: EthSpec, Payload: AbstractExecPayload"), cfg_attr( feature = "arbitrary", @@ -71,8 +71,8 @@ impl From for Hash256 { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] -#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Derivative)] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/sync_aggregate.rs b/consensus/types/src/sync_aggregate.rs index 7a4ef8f026a..d86eaf4d1cc 100644 --- a/consensus/types/src/sync_aggregate.rs +++ b/consensus/types/src/sync_aggregate.rs @@ -2,7 +2,7 @@ use crate::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT; use crate::context_deserialize; use crate::test_utils::TestRandom; use crate::{AggregateSignature, BitVector, EthSpec, ForkName, SyncCommitteeContribution}; -use derivative::Derivative; +use educe::Educe; use safe_arith::{ArithError, SafeArith}; use serde::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; @@ -27,9 +27,9 @@ impl From for Error { arbitrary(bound = "E: EthSpec") )] #[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Derivative, + Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] -#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Hash(bound = "E: EthSpec"))] #[serde(bound = "E: EthSpec")] #[context_deserialize(ForkName)] pub struct SyncAggregate { From 15a05371668a912e25eb50d44ab7d4f32efebe00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 18:41:11 +0200 Subject: [PATCH 07/16] remove derivative from cargo.toml --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 75c9065ebfb..90067c9453a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,7 +131,6 @@ context_deserialize_derive = { path = "consensus/context_deserialize/context_des criterion = "0.5" delay_map = "0.4" deposit_contract = { path = "common/deposit_contract" } -derivative = "2" directory = { path = "common/directory" } dirs = "3" discv5 = { version = "0.10", features = ["libp2p"] } From 7af7d680f365a832927c816d89a7d3ed6defa229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 18:56:18 +0200 Subject: [PATCH 08/16] avoid strings when possible --- .../network/src/sync/block_lookups/single_block_lookup.rs | 6 +++--- beacon_node/network/src/sync/range_sync/batch.rs | 2 +- consensus/types/src/attester_slashing.rs | 4 ++-- consensus/types/src/beacon_block.rs | 2 +- consensus/types/src/beacon_block_body.rs | 2 +- consensus/types/src/blob_sidecar.rs | 2 +- consensus/types/src/data_column_sidecar.rs | 2 +- consensus/types/src/execution_payload_header.rs | 2 +- consensus/types/src/execution_requests.rs | 2 +- consensus/types/src/runtime_var_list.rs | 2 +- consensus/types/src/sync_aggregate.rs | 2 +- slasher/src/database/redb_impl.rs | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs index 5ebe6ebfc7d..46897b2283b 100644 --- a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs +++ b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs @@ -372,7 +372,7 @@ impl SingleBlockLookup { #[derive(Educe)] #[educe(Debug)] pub struct BlobRequestState { - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] pub block_root: Hash256, pub state: SingleLookupRequestState>, } @@ -390,7 +390,7 @@ impl BlobRequestState { #[derive(Educe)] #[educe(Debug)] pub struct CustodyRequestState { - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] pub block_root: Hash256, pub state: SingleLookupRequestState>, } @@ -408,7 +408,7 @@ impl CustodyRequestState { #[derive(Educe)] #[educe(Debug)] pub struct BlockRequestState { - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] pub requested_block_root: Hash256, pub state: SingleLookupRequestState>>, } diff --git a/beacon_node/network/src/sync/range_sync/batch.rs b/beacon_node/network/src/sync/range_sync/batch.rs index ba7874ba421..5f916193959 100644 --- a/beacon_node/network/src/sync/range_sync/batch.rs +++ b/beacon_node/network/src/sync/range_sync/batch.rs @@ -116,7 +116,7 @@ pub struct BatchInfo { /// Whether this batch contains all blocks or all blocks and blobs. batch_type: ByRangeRequestType, /// Pin the generic - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] marker: std::marker::PhantomData, } diff --git a/consensus/types/src/attester_slashing.rs b/consensus/types/src/attester_slashing.rs index 9cf4d7526d0..5668179064b 100644 --- a/consensus/types/src/attester_slashing.rs +++ b/consensus/types/src/attester_slashing.rs @@ -43,7 +43,7 @@ use tree_hash_derive::TreeHash; arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Educe)] -#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec", untagged)] #[ssz(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")] @@ -58,7 +58,7 @@ pub struct AttesterSlashing { /// using the `union` behavior for the purposes of persistence on disk. We use a separate /// type so that we don't accidentally use this non-spec encoding in consensus objects. #[derive(Debug, Clone, Encode, Decode, Educe)] -#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] #[ssz(enum_behaviour = "union")] pub enum AttesterSlashingOnDisk { Base(AttesterSlashingBase), diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 25fabec02ef..99550b2fe22 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -53,7 +53,7 @@ use self::indexed_attestation::IndexedAttestationBase; arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index 382b6948251..fffc4df2088 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -72,7 +72,7 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] #[derive(Debug, Clone, Serialize, Deserialize, Educe, TreeHash)] -#[educe(PartialEq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/blob_sidecar.rs b/consensus/types/src/blob_sidecar.rs index 72a1d000dfa..45cc055d2e7 100644 --- a/consensus/types/src/blob_sidecar.rs +++ b/consensus/types/src/blob_sidecar.rs @@ -54,7 +54,7 @@ impl Ord for BlobIdentifier { )] #[context_deserialize(ForkName)] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] pub struct BlobSidecar { #[serde(with = "serde_utils::quoted_u64")] pub index: u64, diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 5c7a4de1d6b..943b36eb921 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -44,7 +44,7 @@ pub type DataColumnSidecarList = Vec>>; Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] #[context_deserialize(ForkName)] pub struct DataColumnSidecar { #[serde(with = "serde_utils::quoted_u64")] diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index 14b39530430..b48099db057 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -45,7 +45,7 @@ use tree_hash_derive::TreeHash; arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec", untagged)] #[tree_hash(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")] diff --git a/consensus/types/src/execution_requests.rs b/consensus/types/src/execution_requests.rs index a517f8412fa..3d98cd0201d 100644 --- a/consensus/types/src/execution_requests.rs +++ b/consensus/types/src/execution_requests.rs @@ -27,7 +27,7 @@ pub type ConsolidationRequests = Debug, Educe, Default, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] #[context_deserialize(ForkName)] pub struct ExecutionRequests { pub deposits: DepositRequests, diff --git a/consensus/types/src/runtime_var_list.rs b/consensus/types/src/runtime_var_list.rs index 8a8ebfec284..e7b846029ef 100644 --- a/consensus/types/src/runtime_var_list.rs +++ b/consensus/types/src/runtime_var_list.rs @@ -45,7 +45,7 @@ use tree_hash::{Hash256, MerkleHasher, PackedEncoding, TreeHash, TreeHashType}; /// /// ``` #[derive(Clone, Serialize, Deserialize, Educe)] -#[educe(PartialEq, Eq, Hash(bound = "T: std::hash::Hash"))] +#[educe(PartialEq, Eq, Hash(bound(T: std::hash::Hash)))] #[serde(transparent)] pub struct RuntimeVariableList { vec: Vec, diff --git a/consensus/types/src/sync_aggregate.rs b/consensus/types/src/sync_aggregate.rs index d86eaf4d1cc..dc879750a7c 100644 --- a/consensus/types/src/sync_aggregate.rs +++ b/consensus/types/src/sync_aggregate.rs @@ -29,7 +29,7 @@ impl From for Error { #[derive( Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] -#[educe(PartialEq, Hash(bound = "E: EthSpec"))] +#[educe(PartialEq, Hash(bound("E: EthSpec")))] #[serde(bound = "E: EthSpec")] #[context_deserialize(ForkName)] pub struct SyncAggregate { diff --git a/slasher/src/database/redb_impl.rs b/slasher/src/database/redb_impl.rs index cdabd012caf..570d7df1318 100644 --- a/slasher/src/database/redb_impl.rs +++ b/slasher/src/database/redb_impl.rs @@ -26,7 +26,7 @@ pub struct Database<'env> { #[derive(Educe)] #[educe(Debug)] pub struct RwTransaction<'env> { - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] txn: redb::WriteTransaction, _phantom: PhantomData<&'env ()>, } @@ -34,7 +34,7 @@ pub struct RwTransaction<'env> { #[derive(Educe)] #[educe(Debug)] pub struct Cursor<'env> { - #[educe(Debug = "ignore")] + #[educe(Debug(ignore))] txn: &'env redb::WriteTransaction, db: &'env Database<'env>, current_key: Option>, From 8f67cddc803a519fb40df2b55ee1a1882687983c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 19:12:35 +0200 Subject: [PATCH 09/16] less strings --- consensus/types/src/beacon_block.rs | 2 +- consensus/types/src/beacon_block_body.rs | 2 +- consensus/types/src/execution_payload.rs | 2 +- consensus/types/src/execution_payload_header.rs | 2 +- consensus/types/src/payload.rs | 4 ++-- consensus/types/src/signed_beacon_block.rs | 2 +- consensus/types/src/sync_aggregate.rs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 99550b2fe22..80753bbef73 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -53,7 +53,7 @@ use self::indexed_attestation::IndexedAttestationBase; arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index fffc4df2088..f14c989bb38 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -72,7 +72,7 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] #[derive(Debug, Clone, Serialize, Deserialize, Educe, TreeHash)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/execution_payload.rs b/consensus/types/src/execution_payload.rs index bb8d4690784..c8d2d8beb43 100644 --- a/consensus/types/src/execution_payload.rs +++ b/consensus/types/src/execution_payload.rs @@ -49,7 +49,7 @@ pub type Withdrawals = VariableList::MaxWithdrawal arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec", untagged)] #[ssz(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index b48099db057..d97ca8ba95b 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -45,7 +45,7 @@ use tree_hash_derive::TreeHash; arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec", untagged)] #[tree_hash(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")] diff --git a/consensus/types/src/payload.rs b/consensus/types/src/payload.rs index 9e0fedec86f..00219a43506 100644 --- a/consensus/types/src/payload.rs +++ b/consensus/types/src/payload.rs @@ -188,7 +188,7 @@ pub trait AbstractExecPayload: arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct FullPayload { @@ -557,7 +557,7 @@ impl TryFrom> for FullPayload { arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Deserialize, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct BlindedPayload { diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index f2657045f27..2224ac16586 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -72,7 +72,7 @@ impl From for Hash256 { arbitrary(bound = "E: EthSpec, Payload: AbstractExecPayload") )] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, Educe)] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(untagged)] #[serde(bound = "E: EthSpec, Payload: AbstractExecPayload")] #[tree_hash(enum_behaviour = "transparent")] diff --git a/consensus/types/src/sync_aggregate.rs b/consensus/types/src/sync_aggregate.rs index dc879750a7c..1f169fd362f 100644 --- a/consensus/types/src/sync_aggregate.rs +++ b/consensus/types/src/sync_aggregate.rs @@ -29,7 +29,7 @@ impl From for Error { #[derive( Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] -#[educe(PartialEq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec")] #[context_deserialize(ForkName)] pub struct SyncAggregate { From e885a268a6797ad548f086d5a9acb7145e273f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 19:25:15 +0200 Subject: [PATCH 10/16] remove debug transparent as it's not supported by educe --- consensus/types/src/data_column_subnet_id.rs | 10 +++++++--- consensus/types/src/execution_block_hash.rs | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/consensus/types/src/data_column_subnet_id.rs b/consensus/types/src/data_column_subnet_id.rs index 090082348bb..c6b8846c783 100644 --- a/consensus/types/src/data_column_subnet_id.rs +++ b/consensus/types/src/data_column_subnet_id.rs @@ -1,18 +1,22 @@ //! Identifies each data column subnet by an integer identifier. use crate::ChainSpec; use crate::data_column_sidecar::ColumnIndex; -use educe::Educe; use safe_arith::{ArithError, SafeArith}; use serde::{Deserialize, Serialize}; use std::fmt::{self, Display}; use std::ops::{Deref, DerefMut}; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Clone, Copy, Educe, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[educe(Debug = "transparent")] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(transparent)] pub struct DataColumnSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64); +impl fmt::Debug for DataColumnSubnetId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::Debug::fmt(&self.0, f) + } +} + impl DataColumnSubnetId { pub fn new(id: u64) -> Self { id.into() diff --git a/consensus/types/src/execution_block_hash.rs b/consensus/types/src/execution_block_hash.rs index ed9a86dc608..31905d64dfa 100644 --- a/consensus/types/src/execution_block_hash.rs +++ b/consensus/types/src/execution_block_hash.rs @@ -1,18 +1,22 @@ use crate::FixedBytesExtended; use crate::Hash256; use crate::test_utils::TestRandom; -use educe::Educe; use rand::RngCore; use serde::{Deserialize, Serialize}; use ssz::{Decode, DecodeError, Encode}; use std::fmt; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, Hash, Educe)] -#[educe(Debug = "transparent")] +#[derive(Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, Hash)] #[serde(transparent)] pub struct ExecutionBlockHash(#[serde(with = "serde_utils::b256_hex")] pub Hash256); +impl fmt::Debug for ExecutionBlockHash { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::Debug::fmt(&self.0, f) + } +} + impl ExecutionBlockHash { pub fn zero() -> Self { Self(Hash256::zero()) From ffcd5c7aefebd23e927a20b38c08ea03310506bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sat, 27 Sep 2025 19:29:32 +0200 Subject: [PATCH 11/16] remove more strings --- consensus/types/src/attester_slashing.rs | 4 ++-- consensus/types/src/blob_sidecar.rs | 2 +- consensus/types/src/data_column_sidecar.rs | 2 +- consensus/types/src/execution_requests.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/consensus/types/src/attester_slashing.rs b/consensus/types/src/attester_slashing.rs index 5668179064b..c8f97434bef 100644 --- a/consensus/types/src/attester_slashing.rs +++ b/consensus/types/src/attester_slashing.rs @@ -43,7 +43,7 @@ use tree_hash_derive::TreeHash; arbitrary(bound = "E: EthSpec") )] #[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Educe)] -#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec", untagged)] #[ssz(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")] @@ -58,7 +58,7 @@ pub struct AttesterSlashing { /// using the `union` behavior for the purposes of persistence on disk. We use a separate /// type so that we don't accidentally use this non-spec encoding in consensus objects. #[derive(Debug, Clone, Encode, Decode, Educe)] -#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[ssz(enum_behaviour = "union")] pub enum AttesterSlashingOnDisk { Base(AttesterSlashingBase), diff --git a/consensus/types/src/blob_sidecar.rs b/consensus/types/src/blob_sidecar.rs index 45cc055d2e7..b44480716ad 100644 --- a/consensus/types/src/blob_sidecar.rs +++ b/consensus/types/src/blob_sidecar.rs @@ -54,7 +54,7 @@ impl Ord for BlobIdentifier { )] #[context_deserialize(ForkName)] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] pub struct BlobSidecar { #[serde(with = "serde_utils::quoted_u64")] pub index: u64, diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 943b36eb921..6264fc427b3 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -44,7 +44,7 @@ pub type DataColumnSidecarList = Vec>>; Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, )] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[context_deserialize(ForkName)] pub struct DataColumnSidecar { #[serde(with = "serde_utils::quoted_u64")] diff --git a/consensus/types/src/execution_requests.rs b/consensus/types/src/execution_requests.rs index 3d98cd0201d..67396af71d4 100644 --- a/consensus/types/src/execution_requests.rs +++ b/consensus/types/src/execution_requests.rs @@ -27,7 +27,7 @@ pub type ConsolidationRequests = Debug, Educe, Default, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] #[serde(bound = "E: EthSpec")] -#[educe(PartialEq, Eq, Hash(bound("E: EthSpec")))] +#[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[context_deserialize(ForkName)] pub struct ExecutionRequests { pub deposits: DepositRequests, From 49e46307af5b1df14e1231c743305a2294204318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Sun, 28 Sep 2025 11:25:39 +0200 Subject: [PATCH 12/16] cargo fmt --all --- beacon_node/operation_pool/src/persistence.rs | 5 +---- consensus/types/src/attestation.rs | 12 +----------- consensus/types/src/blob_sidecar.rs | 4 +--- consensus/types/src/data_column_sidecar.rs | 4 +--- consensus/types/src/sync_aggregate.rs | 4 +--- 5 files changed, 5 insertions(+), 24 deletions(-) diff --git a/beacon_node/operation_pool/src/persistence.rs b/beacon_node/operation_pool/src/persistence.rs index bc0885769f4..ee45c8dd053 100644 --- a/beacon_node/operation_pool/src/persistence.rs +++ b/beacon_node/operation_pool/src/persistence.rs @@ -22,10 +22,7 @@ type PersistedSyncContributions = Vec<(SyncAggregateId, Vec ContextDeserialize<'de, ForkName> for Vec> */ #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive( - Debug, - Clone, - Serialize, - Deserialize, - Decode, - Encode, - TestRandom, - Educe, - TreeHash, -)] +#[derive(Debug, Clone, Serialize, Deserialize, Decode, Encode, TestRandom, Educe, TreeHash)] #[educe(PartialEq)] #[context_deserialize(ForkName)] pub struct SingleAttestation { diff --git a/consensus/types/src/blob_sidecar.rs b/consensus/types/src/blob_sidecar.rs index b44480716ad..d2c7331a579 100644 --- a/consensus/types/src/blob_sidecar.rs +++ b/consensus/types/src/blob_sidecar.rs @@ -49,9 +49,7 @@ impl Ord for BlobIdentifier { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, -)] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe)] #[context_deserialize(ForkName)] #[serde(bound = "E: EthSpec")] #[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 6264fc427b3..62ce4467dfa 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -40,9 +40,7 @@ pub type DataColumnSidecarList = Vec>>; derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, -)] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe)] #[serde(bound = "E: EthSpec")] #[educe(PartialEq, Eq, Hash(bound(E: EthSpec)))] #[context_deserialize(ForkName)] diff --git a/consensus/types/src/sync_aggregate.rs b/consensus/types/src/sync_aggregate.rs index 1f169fd362f..ba6d840a526 100644 --- a/consensus/types/src/sync_aggregate.rs +++ b/consensus/types/src/sync_aggregate.rs @@ -26,9 +26,7 @@ impl From for Error { derive(arbitrary::Arbitrary), arbitrary(bound = "E: EthSpec") )] -#[derive( - Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe, -)] +#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, Educe)] #[educe(PartialEq, Hash(bound(E: EthSpec)))] #[serde(bound = "E: EthSpec")] #[context_deserialize(ForkName)] From 943ac1ef174ac174c1b8dbbdb321075230558bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Tue, 30 Sep 2025 11:04:01 +0200 Subject: [PATCH 13/16] remove quoted attrs --- consensus/types/src/attestation.rs | 2 +- consensus/types/src/attester_slashing.rs | 2 +- consensus/types/src/beacon_block.rs | 2 +- consensus/types/src/beacon_block_body.rs | 2 +- consensus/types/src/execution_payload.rs | 2 +- consensus/types/src/execution_payload_header.rs | 2 +- consensus/types/src/indexed_attestation.rs | 2 +- consensus/types/src/payload.rs | 8 ++++---- consensus/types/src/signed_beacon_block.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/consensus/types/src/attestation.rs b/consensus/types/src/attestation.rs index 2d082f45193..4e2f842e979 100644 --- a/consensus/types/src/attestation.rs +++ b/consensus/types/src/attestation.rs @@ -49,7 +49,7 @@ impl From for Error { TreeHash, ), context_deserialize(ForkName), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/attester_slashing.rs b/consensus/types/src/attester_slashing.rs index c8f97434bef..2bfb65653c6 100644 --- a/consensus/types/src/attester_slashing.rs +++ b/consensus/types/src/attester_slashing.rs @@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash; TestRandom, ), context_deserialize(ForkName), - educe(PartialEq, Eq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Eq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec"), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 80753bbef73..060709d6556 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -29,7 +29,7 @@ use self::indexed_attestation::IndexedAttestationBase; TestRandom, Educe, ), - educe(PartialEq, Hash(bound("E: EthSpec, Payload: AbstractExecPayload"))), + educe(PartialEq, Hash(bound(E: EthSpec, Payload: AbstractExecPayload))), serde( bound = "E: EthSpec, Payload: AbstractExecPayload", deny_unknown_fields diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index f14c989bb38..ced8fea4a99 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -41,7 +41,7 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; TestRandom, Educe, ), - educe(PartialEq, Hash(bound("E: EthSpec, Payload: AbstractExecPayload"))), + educe(PartialEq, Hash(bound(E: EthSpec, Payload: AbstractExecPayload))), serde( bound = "E: EthSpec, Payload: AbstractExecPayload", deny_unknown_fields diff --git a/consensus/types/src/execution_payload.rs b/consensus/types/src/execution_payload.rs index c8d2d8beb43..3548f67db2e 100644 --- a/consensus/types/src/execution_payload.rs +++ b/consensus/types/src/execution_payload.rs @@ -30,7 +30,7 @@ pub type Withdrawals = VariableList::MaxWithdrawal Educe, ), context_deserialize(ForkName), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index d97ca8ba95b..241ecb4ce6e 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -22,7 +22,7 @@ use tree_hash_derive::TreeHash; TestRandom, Educe, ), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/indexed_attestation.rs b/consensus/types/src/indexed_attestation.rs index c9704a0e2d4..dc328842176 100644 --- a/consensus/types/src/indexed_attestation.rs +++ b/consensus/types/src/indexed_attestation.rs @@ -32,7 +32,7 @@ use tree_hash_derive::TreeHash; TreeHash, ), context_deserialize(ForkName), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", diff --git a/consensus/types/src/payload.rs b/consensus/types/src/payload.rs index 00219a43506..370c73ad0a6 100644 --- a/consensus/types/src/payload.rs +++ b/consensus/types/src/payload.rs @@ -163,7 +163,7 @@ pub trait AbstractExecPayload: TreeHash, Educe, ), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -174,7 +174,7 @@ pub trait AbstractExecPayload: ), ref_attributes( derive(Debug, Educe, TreeHash), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), tree_hash(enum_behaviour = "transparent"), ), map_into(ExecutionPayload), @@ -533,7 +533,7 @@ impl TryFrom> for FullPayload { TreeHash, Educe, ), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec", deny_unknown_fields), cfg_attr( feature = "arbitrary", @@ -544,7 +544,7 @@ impl TryFrom> for FullPayload { ), ref_attributes( derive(Debug, Educe, TreeHash), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), tree_hash(enum_behaviour = "transparent"), ), map_into(ExecutionPayloadHeader), diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index 2224ac16586..35d2faac483 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -54,7 +54,7 @@ impl From for Hash256 { Educe, TestRandom ), - educe(PartialEq, Hash(bound("E: EthSpec"))), + educe(PartialEq, Hash(bound(E: EthSpec))), serde(bound = "E: EthSpec, Payload: AbstractExecPayload"), cfg_attr( feature = "arbitrary", From 3df877822617b9948dd46e781e20d5f8e81bc6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Tue, 30 Sep 2025 18:57:05 +0200 Subject: [PATCH 14/16] remove unused educe from derive --- consensus/types/src/attestation.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/consensus/types/src/attestation.rs b/consensus/types/src/attestation.rs index 4e2f842e979..625eca60c41 100644 --- a/consensus/types/src/attestation.rs +++ b/consensus/types/src/attestation.rs @@ -600,8 +600,7 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for Vec> */ #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[derive(Debug, Clone, Serialize, Deserialize, Decode, Encode, TestRandom, Educe, TreeHash)] -#[educe(PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, Decode, Encode, TestRandom, TreeHash, PartialEq)] #[context_deserialize(ForkName)] pub struct SingleAttestation { #[serde(with = "serde_utils::quoted_u64")] From 10108bc7e3bd450514e838bfbf89270d1ba2bf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Tue, 30 Sep 2025 18:59:25 +0200 Subject: [PATCH 15/16] update default syntax --- testing/ef_tests/src/handler.rs | 62 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/testing/ef_tests/src/handler.rs b/testing/ef_tests/src/handler.rs index 628ae59e10e..83b26bcc2e3 100644 --- a/testing/ef_tests/src/handler.rs +++ b/testing/ef_tests/src/handler.rs @@ -155,7 +155,7 @@ pub trait Handler { macro_rules! bls_eth_handler { ($runner_name: ident, $case_name:ident, $handler_name:expr) => { #[derive(Educe)] - #[educe(Default)] + #[educe(Default())] pub struct $runner_name; impl Handler for $runner_name { @@ -175,7 +175,7 @@ macro_rules! bls_eth_handler { macro_rules! bls_handler { ($runner_name: ident, $case_name:ident, $handler_name:expr) => { #[derive(Educe)] - #[educe(Default)] + #[educe(Default())] pub struct $runner_name; impl Handler for $runner_name { @@ -336,7 +336,7 @@ impl SszStaticHandler { /// Handler for SSZ types that implement `CachedTreeHash`. #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct SszStaticTHCHandler(PhantomData<(T, E)>); /// Handler for SSZ types that don't implement `ssz::Decode`. @@ -437,7 +437,7 @@ where } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct ShufflingHandler(PhantomData); impl Handler for ShufflingHandler { @@ -461,7 +461,7 @@ impl Handler for ShufflingHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct SanityBlocksHandler(PhantomData); impl Handler for SanityBlocksHandler { @@ -487,7 +487,7 @@ impl Handler for SanityBlocksHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct SanitySlotsHandler(PhantomData); impl Handler for SanitySlotsHandler { @@ -512,7 +512,7 @@ impl Handler for SanitySlotsHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct RandomHandler(PhantomData); impl Handler for RandomHandler { @@ -532,7 +532,7 @@ impl Handler for RandomHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct EpochProcessingHandler(PhantomData<(E, T)>); impl> Handler for EpochProcessingHandler { @@ -582,7 +582,7 @@ impl Handler for RewardsHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct ForkHandler(PhantomData); impl Handler for ForkHandler { @@ -602,7 +602,7 @@ impl Handler for ForkHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct TransitionHandler(PhantomData); impl Handler for TransitionHandler { @@ -622,7 +622,7 @@ impl Handler for TransitionHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct FinalityHandler(PhantomData); impl Handler for FinalityHandler { @@ -706,7 +706,7 @@ impl Handler for ForkChoiceHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct OptimisticSyncHandler(PhantomData); impl Handler for OptimisticSyncHandler { @@ -735,7 +735,7 @@ impl Handler for OptimisticSyncHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct GenesisValidityHandler(PhantomData); impl Handler for GenesisValidityHandler { @@ -755,7 +755,7 @@ impl Handler for GenesisValidityHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct GenesisInitializationHandler(PhantomData); impl Handler for GenesisInitializationHandler { @@ -775,7 +775,7 @@ impl Handler for GenesisInitializationHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGBlobToKZGCommitmentHandler(PhantomData); impl Handler for KZGBlobToKZGCommitmentHandler { @@ -795,7 +795,7 @@ impl Handler for KZGBlobToKZGCommitmentHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGComputeBlobKZGProofHandler(PhantomData); impl Handler for KZGComputeBlobKZGProofHandler { @@ -815,7 +815,7 @@ impl Handler for KZGComputeBlobKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGComputeKZGProofHandler(PhantomData); impl Handler for KZGComputeKZGProofHandler { @@ -835,7 +835,7 @@ impl Handler for KZGComputeKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGVerifyBlobKZGProofHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofHandler { @@ -855,7 +855,7 @@ impl Handler for KZGVerifyBlobKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGVerifyBlobKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofBatchHandler { @@ -875,7 +875,7 @@ impl Handler for KZGVerifyBlobKZGProofBatchHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGVerifyKZGProofHandler(PhantomData); impl Handler for KZGVerifyKZGProofHandler { @@ -895,7 +895,7 @@ impl Handler for KZGVerifyKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct GetCustodyGroupsHandler(PhantomData); impl Handler for GetCustodyGroupsHandler { @@ -915,7 +915,7 @@ impl Handler for GetCustodyGroupsHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct ComputeColumnsForCustodyGroupHandler(PhantomData); impl Handler for ComputeColumnsForCustodyGroupHandler { @@ -935,7 +935,7 @@ impl Handler for ComputeColumnsForCustodyGroupHandler } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGComputeCellsHandler(PhantomData); impl Handler for KZGComputeCellsHandler { @@ -955,7 +955,7 @@ impl Handler for KZGComputeCellsHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGComputeCellsAndKZGProofHandler(PhantomData); impl Handler for KZGComputeCellsAndKZGProofHandler { @@ -975,7 +975,7 @@ impl Handler for KZGComputeCellsAndKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGVerifyCellKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyCellKZGProofBatchHandler { @@ -995,7 +995,7 @@ impl Handler for KZGVerifyCellKZGProofBatchHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KZGRecoverCellsAndKZGProofHandler(PhantomData); impl Handler for KZGRecoverCellsAndKZGProofHandler { @@ -1015,7 +1015,7 @@ impl Handler for KZGRecoverCellsAndKZGProofHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for KzgInclusionMerkleProofValidityHandler { @@ -1039,7 +1039,7 @@ impl Handler for KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for MerkleProofValidityHandler { @@ -1063,7 +1063,7 @@ impl Handler for MerkleProofValidityHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct LightClientUpdateHandler(PhantomData); impl Handler for LightClientUpdateHandler { @@ -1089,7 +1089,7 @@ impl Handler for LightClientUpdateHandler { } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct OperationsHandler(PhantomData<(E, O)>); impl> Handler for OperationsHandler { @@ -1109,7 +1109,7 @@ impl> Handler for OperationsHandler } #[derive(Educe)] -#[educe(Default)] +#[educe(Default())] pub struct SszGenericHandler(PhantomData); impl Handler for SszGenericHandler { From bd142715d14122e8ba28a4cc1fb2fea991282dac Mon Sep 17 00:00:00 2001 From: Mac L Date: Tue, 7 Oct 2025 18:29:26 +1100 Subject: [PATCH 16/16] Revert "update default syntax" This reverts commit 10108bc7e3bd450514e838bfbf89270d1ba2bf98. --- testing/ef_tests/src/handler.rs | 62 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/testing/ef_tests/src/handler.rs b/testing/ef_tests/src/handler.rs index 83b26bcc2e3..628ae59e10e 100644 --- a/testing/ef_tests/src/handler.rs +++ b/testing/ef_tests/src/handler.rs @@ -155,7 +155,7 @@ pub trait Handler { macro_rules! bls_eth_handler { ($runner_name: ident, $case_name:ident, $handler_name:expr) => { #[derive(Educe)] - #[educe(Default())] + #[educe(Default)] pub struct $runner_name; impl Handler for $runner_name { @@ -175,7 +175,7 @@ macro_rules! bls_eth_handler { macro_rules! bls_handler { ($runner_name: ident, $case_name:ident, $handler_name:expr) => { #[derive(Educe)] - #[educe(Default())] + #[educe(Default)] pub struct $runner_name; impl Handler for $runner_name { @@ -336,7 +336,7 @@ impl SszStaticHandler { /// Handler for SSZ types that implement `CachedTreeHash`. #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct SszStaticTHCHandler(PhantomData<(T, E)>); /// Handler for SSZ types that don't implement `ssz::Decode`. @@ -437,7 +437,7 @@ where } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct ShufflingHandler(PhantomData); impl Handler for ShufflingHandler { @@ -461,7 +461,7 @@ impl Handler for ShufflingHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct SanityBlocksHandler(PhantomData); impl Handler for SanityBlocksHandler { @@ -487,7 +487,7 @@ impl Handler for SanityBlocksHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct SanitySlotsHandler(PhantomData); impl Handler for SanitySlotsHandler { @@ -512,7 +512,7 @@ impl Handler for SanitySlotsHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct RandomHandler(PhantomData); impl Handler for RandomHandler { @@ -532,7 +532,7 @@ impl Handler for RandomHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct EpochProcessingHandler(PhantomData<(E, T)>); impl> Handler for EpochProcessingHandler { @@ -582,7 +582,7 @@ impl Handler for RewardsHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct ForkHandler(PhantomData); impl Handler for ForkHandler { @@ -602,7 +602,7 @@ impl Handler for ForkHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct TransitionHandler(PhantomData); impl Handler for TransitionHandler { @@ -622,7 +622,7 @@ impl Handler for TransitionHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct FinalityHandler(PhantomData); impl Handler for FinalityHandler { @@ -706,7 +706,7 @@ impl Handler for ForkChoiceHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct OptimisticSyncHandler(PhantomData); impl Handler for OptimisticSyncHandler { @@ -735,7 +735,7 @@ impl Handler for OptimisticSyncHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct GenesisValidityHandler(PhantomData); impl Handler for GenesisValidityHandler { @@ -755,7 +755,7 @@ impl Handler for GenesisValidityHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct GenesisInitializationHandler(PhantomData); impl Handler for GenesisInitializationHandler { @@ -775,7 +775,7 @@ impl Handler for GenesisInitializationHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGBlobToKZGCommitmentHandler(PhantomData); impl Handler for KZGBlobToKZGCommitmentHandler { @@ -795,7 +795,7 @@ impl Handler for KZGBlobToKZGCommitmentHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGComputeBlobKZGProofHandler(PhantomData); impl Handler for KZGComputeBlobKZGProofHandler { @@ -815,7 +815,7 @@ impl Handler for KZGComputeBlobKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGComputeKZGProofHandler(PhantomData); impl Handler for KZGComputeKZGProofHandler { @@ -835,7 +835,7 @@ impl Handler for KZGComputeKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGVerifyBlobKZGProofHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofHandler { @@ -855,7 +855,7 @@ impl Handler for KZGVerifyBlobKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGVerifyBlobKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyBlobKZGProofBatchHandler { @@ -875,7 +875,7 @@ impl Handler for KZGVerifyBlobKZGProofBatchHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGVerifyKZGProofHandler(PhantomData); impl Handler for KZGVerifyKZGProofHandler { @@ -895,7 +895,7 @@ impl Handler for KZGVerifyKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct GetCustodyGroupsHandler(PhantomData); impl Handler for GetCustodyGroupsHandler { @@ -915,7 +915,7 @@ impl Handler for GetCustodyGroupsHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct ComputeColumnsForCustodyGroupHandler(PhantomData); impl Handler for ComputeColumnsForCustodyGroupHandler { @@ -935,7 +935,7 @@ impl Handler for ComputeColumnsForCustodyGroupHandler } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGComputeCellsHandler(PhantomData); impl Handler for KZGComputeCellsHandler { @@ -955,7 +955,7 @@ impl Handler for KZGComputeCellsHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGComputeCellsAndKZGProofHandler(PhantomData); impl Handler for KZGComputeCellsAndKZGProofHandler { @@ -975,7 +975,7 @@ impl Handler for KZGComputeCellsAndKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGVerifyCellKZGProofBatchHandler(PhantomData); impl Handler for KZGVerifyCellKZGProofBatchHandler { @@ -995,7 +995,7 @@ impl Handler for KZGVerifyCellKZGProofBatchHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KZGRecoverCellsAndKZGProofHandler(PhantomData); impl Handler for KZGRecoverCellsAndKZGProofHandler { @@ -1015,7 +1015,7 @@ impl Handler for KZGRecoverCellsAndKZGProofHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for KzgInclusionMerkleProofValidityHandler { @@ -1039,7 +1039,7 @@ impl Handler for KzgInclusionMerkleProofValidityHandler(PhantomData); impl Handler for MerkleProofValidityHandler { @@ -1063,7 +1063,7 @@ impl Handler for MerkleProofValidityHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct LightClientUpdateHandler(PhantomData); impl Handler for LightClientUpdateHandler { @@ -1089,7 +1089,7 @@ impl Handler for LightClientUpdateHandler { } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct OperationsHandler(PhantomData<(E, O)>); impl> Handler for OperationsHandler { @@ -1109,7 +1109,7 @@ impl> Handler for OperationsHandler } #[derive(Educe)] -#[educe(Default())] +#[educe(Default)] pub struct SszGenericHandler(PhantomData); impl Handler for SszGenericHandler {