Migrate derivative to educe (#8125)

Fixes #7001.


  Mostly mechanical replacement of `derivative` attributes with `educe` ones.

### **Attribute Syntax Changes**

```rust
// Bounds: = "..." → (...)
#[derivative(Hash(bound = "E: EthSpec"))]
#[educe(Hash(bound(E: EthSpec)))]

// Ignore: = "ignore" → (ignore)
#[derivative(PartialEq = "ignore")]
#[educe(PartialEq(ignore))]

// Default values: value = "..." → expression = ...
#[derivative(Default(value = "ForkName::Base"))]
#[educe(Default(expression = ForkName::Base))]

// Methods: format_with/compare_with = "..." → method(...)
#[derivative(Debug(format_with = "fmt_peer_set_as_len"))]
#[educe(Debug(method(fmt_peer_set_as_len)))]

// Empty bounds: removed entirely, educe can infer appropriate bounds
#[derivative(Default(bound = ""))]
#[educe(Default)]

// Transparent debug: manual implementation (educe doesn't support it)
#[derivative(Debug = "transparent")]
// Replaced with manual Debug impl that delegates to inner field
```

**Note**: Some bounds use strings (`bound("E: EthSpec")`) for superstruct compatibility (`expected ','` errors).


Co-Authored-By: Javier Chávarri <javier.chavarri@gmail.com>

Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Javier Chávarri
2025-11-06 15:13:57 +01:00
committed by GitHub
parent 0090b35ee0
commit 2c1f1c1605
56 changed files with 277 additions and 287 deletions

View File

@@ -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<PathBuf>,
pub keystore_file_path: Option<PathBuf>,
pub vc_url: SensitiveUrl,
pub vc_token_path: PathBuf,
pub ignore_duplicates: bool,
#[derivative(Debug = "ignore")]
#[educe(Debug(ignore))]
pub password: Option<Zeroizing<String>>,
pub fee_recipient: Option<Address>,
pub gas_limit: Option<u64>,