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

22
Cargo.lock generated
View File

@@ -862,7 +862,7 @@ dependencies = [
"bitvec 1.0.1",
"bls",
"criterion",
"derivative",
"educe",
"eth2",
"eth2_network_config",
"ethereum_hashing",
@@ -2543,7 +2543,7 @@ dependencies = [
"bls",
"compare_fields",
"context_deserialize",
"derivative",
"educe",
"eth2_network_config",
"ethereum_ssz",
"ethereum_ssz_derive",
@@ -2862,7 +2862,7 @@ dependencies = [
name = "eth2"
version = "0.1.0"
dependencies = [
"derivative",
"educe",
"eip_3076",
"either",
"enr",
@@ -5014,7 +5014,7 @@ dependencies = [
"arbitrary",
"c-kzg",
"criterion",
"derivative",
"educe",
"ethereum_hashing",
"ethereum_serde_utils",
"ethereum_ssz",
@@ -6309,7 +6309,7 @@ dependencies = [
"beacon_processor",
"bls",
"delay_map",
"derivative",
"educe",
"eth2",
"eth2_network_config",
"ethereum_ssz",
@@ -6745,7 +6745,7 @@ version = "0.2.0"
dependencies = [
"beacon_chain",
"bitvec 1.0.1",
"derivative",
"educe",
"ethereum_ssz",
"ethereum_ssz_derive",
"itertools 0.10.5",
@@ -8748,7 +8748,7 @@ version = "0.1.0"
dependencies = [
"bincode",
"byteorder",
"derivative",
"educe",
"ethereum_ssz",
"ethereum_ssz_derive",
"filesystem",
@@ -8917,7 +8917,7 @@ dependencies = [
"arbitrary",
"beacon_chain",
"bls",
"derivative",
"educe",
"ethereum_hashing",
"ethereum_ssz",
"ethereum_ssz_derive",
@@ -9855,7 +9855,7 @@ dependencies = [
"compare_fields",
"context_deserialize",
"criterion",
"derivative",
"educe",
"eth2_interop_keypairs",
"ethereum_hashing",
"ethereum_serde_utils",
@@ -10099,7 +10099,7 @@ version = "0.1.0"
dependencies = [
"bls",
"deposit_contract",
"derivative",
"educe",
"eth2_keystore",
"filesystem",
"hex",
@@ -10187,7 +10187,7 @@ dependencies = [
"beacon_chain",
"clap",
"clap_utils",
"derivative",
"educe",
"environment",
"eth2",
"eth2_network_config",