Educe migration

This commit is contained in:
Eitan Seri- Levi
2025-11-06 22:55:38 -08:00
parent 0feede4ae5
commit b2a5337ce5
5 changed files with 19 additions and 23 deletions

View File

@@ -1,15 +1,15 @@
use crate::{test_utils::TestRandom, *}; use crate::{test_utils::TestRandom, *};
use derivative::Derivative; use educe::Educe;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode}; use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom; use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash; use tree_hash_derive::TreeHash;
#[derive( #[derive(
Default, Debug, Clone, Serialize, Encode, Decode, Deserialize, TreeHash, Derivative, TestRandom, Default, Debug, Clone, Serialize, Encode, Decode, Deserialize, TreeHash, Educe, TestRandom,
)] )]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)] #[educe(PartialEq, Hash)]
#[context_deserialize(ForkName)] #[context_deserialize(ForkName)]
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#executionpayloadbid // https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#executionpayloadbid
pub struct ExecutionPayloadBid { pub struct ExecutionPayloadBid {

View File

@@ -1,7 +1,7 @@
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use crate::*; use crate::*;
use beacon_block_body::KzgCommitments; use beacon_block_body::KzgCommitments;
use derivative::Derivative; use educe::Educe;
use serde::de::{Deserializer, Error as _}; use serde::de::{Deserializer, Error as _};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode}; use ssz_derive::{Decode, Encode};
@@ -22,10 +22,10 @@ use tree_hash_derive::TreeHash;
Decode, Decode,
TreeHash, TreeHash,
TestRandom, TestRandom,
Derivative Educe
), ),
cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary)), cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary)),
derivative(PartialEq, Hash(bound = "E: EthSpec")), educe(PartialEq, Hash(bound(E: EthSpec))),
serde(bound = "E: EthSpec", deny_unknown_fields), serde(bound = "E: EthSpec", deny_unknown_fields),
cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec")) cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec"))
), ),
@@ -36,8 +36,8 @@ use tree_hash_derive::TreeHash;
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"), cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant") partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
)] )]
#[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative)] #[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Educe)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] #[educe(PartialEq, Hash(bound(E: EthSpec)))]
#[serde(bound = "E: EthSpec", untagged)] #[serde(bound = "E: EthSpec", untagged)]
#[ssz(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")]
#[tree_hash(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")]

View File

@@ -1,18 +1,16 @@
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use crate::*; use crate::*;
use derivative::Derivative; use educe::Educe;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode}; use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom; use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash; use tree_hash_derive::TreeHash;
#[derive( #[derive(TestRandom, TreeHash, Debug, Clone, Encode, Decode, Serialize, Deserialize, Educe)]
TestRandom, TreeHash, Debug, Clone, Encode, Decode, Serialize, Deserialize, Derivative,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[serde(bound = "E: EthSpec", deny_unknown_fields)] #[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec"))] #[cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec"))]
#[derivative(PartialEq, Hash)] #[educe(PartialEq, Hash)]
#[context_deserialize(ForkName)] #[context_deserialize(ForkName)]
pub struct PayloadAttestation<E: EthSpec> { pub struct PayloadAttestation<E: EthSpec> {
pub aggregation_bits: BitList<E::PTCSize>, pub aggregation_bits: BitList<E::PTCSize>,

View File

@@ -1,16 +1,14 @@
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use crate::*; use crate::*;
use derivative::Derivative; use educe::Educe;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode}; use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom; use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash; use tree_hash_derive::TreeHash;
#[derive( #[derive(TestRandom, TreeHash, Debug, Clone, Encode, Decode, Serialize, Deserialize, Educe)]
TestRandom, TreeHash, Debug, Clone, Encode, Decode, Serialize, Deserialize, Derivative,
)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)] #[educe(PartialEq, Hash)]
#[context_deserialize(ForkName)] #[context_deserialize(ForkName)]
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#signedexecutionpayloadbid // https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#signedexecutionpayloadbid
pub struct SignedExecutionPayloadBid { pub struct SignedExecutionPayloadBid {

View File

@@ -1,6 +1,6 @@
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use crate::*; use crate::*;
use derivative::Derivative; use educe::Educe;
use serde::de::{Deserializer, Error as _}; use serde::de::{Deserializer, Error as _};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode}; use ssz_derive::{Decode, Encode};
@@ -20,10 +20,10 @@ use tree_hash_derive::TreeHash;
Decode, Decode,
TreeHash, TreeHash,
TestRandom, TestRandom,
Derivative Educe
), ),
cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary)), cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary)),
derivative(PartialEq, Hash(bound = "E: EthSpec")), educe(PartialEq, Hash(bound(E: EthSpec))),
serde(bound = "E: EthSpec", deny_unknown_fields), serde(bound = "E: EthSpec", deny_unknown_fields),
cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec")) cfg_attr(feature = "arbitrary", arbitrary(bound = "E: EthSpec"))
), ),
@@ -34,8 +34,8 @@ use tree_hash_derive::TreeHash;
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"), cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant") partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
)] )]
#[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative)] #[derive(Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Educe)]
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))] #[educe(PartialEq, Hash(bound(E: EthSpec)))]
#[serde(bound = "E: EthSpec", untagged)] #[serde(bound = "E: EthSpec", untagged)]
#[ssz(enum_behaviour = "transparent")] #[ssz(enum_behaviour = "transparent")]
#[tree_hash(enum_behaviour = "transparent")] #[tree_hash(enum_behaviour = "transparent")]