From 3801c0c6920eab95cd7a6480eb91c29b48c0264a Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Thu, 19 Oct 2023 17:54:35 -0600 Subject: [PATCH] missing `transparent` attr on generated types --- ethereum-consensus/src/types/beacon_block.rs | 1 + ethereum-consensus/src/types/beacon_block_body.rs | 1 + ethereum-consensus/src/types/beacon_state.rs | 1 + ethereum-consensus/src/types/blinded_beacon_block.rs | 1 + ethereum-consensus/src/types/blinded_beacon_block_body.rs | 1 + ethereum-consensus/src/types/execution_payload.rs | 1 + ethereum-consensus/src/types/execution_payload_header.rs | 1 + ethereum-consensus/src/types/signed_beacon_block.rs | 1 + ethereum-consensus/src/types/signed_blinded_beacon_block.rs | 1 + spec-gen/src/type_generator.rs | 1 + 10 files changed, 10 insertions(+) diff --git a/ethereum-consensus/src/types/beacon_block.rs b/ethereum-consensus/src/types/beacon_block.rs index 963a6585b..74573995c 100644 --- a/ethereum-consensus/src/types/beacon_block.rs +++ b/ethereum-consensus/src/types/beacon_block.rs @@ -11,6 +11,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum BeaconBlock< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/ethereum-consensus/src/types/beacon_block_body.rs b/ethereum-consensus/src/types/beacon_block_body.rs index 186e4afb0..239a07267 100644 --- a/ethereum-consensus/src/types/beacon_block_body.rs +++ b/ethereum-consensus/src/types/beacon_block_body.rs @@ -14,6 +14,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum BeaconBlockBody< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/ethereum-consensus/src/types/beacon_state.rs b/ethereum-consensus/src/types/beacon_state.rs index baa6fb606..187597973 100644 --- a/ethereum-consensus/src/types/beacon_state.rs +++ b/ethereum-consensus/src/types/beacon_state.rs @@ -17,6 +17,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum BeaconState< const SLOTS_PER_HISTORICAL_ROOT: usize, diff --git a/ethereum-consensus/src/types/blinded_beacon_block.rs b/ethereum-consensus/src/types/blinded_beacon_block.rs index ab985311f..37e6a4686 100644 --- a/ethereum-consensus/src/types/blinded_beacon_block.rs +++ b/ethereum-consensus/src/types/blinded_beacon_block.rs @@ -9,6 +9,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum BlindedBeaconBlock< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/ethereum-consensus/src/types/blinded_beacon_block_body.rs b/ethereum-consensus/src/types/blinded_beacon_block_body.rs index 193326052..288ba7774 100644 --- a/ethereum-consensus/src/types/blinded_beacon_block_body.rs +++ b/ethereum-consensus/src/types/blinded_beacon_block_body.rs @@ -13,6 +13,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum BlindedBeaconBlockBody< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/ethereum-consensus/src/types/execution_payload.rs b/ethereum-consensus/src/types/execution_payload.rs index 7cc5dffb1..50ca3a93b 100644 --- a/ethereum-consensus/src/types/execution_payload.rs +++ b/ethereum-consensus/src/types/execution_payload.rs @@ -8,6 +8,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum ExecutionPayload< const BYTES_PER_LOGS_BLOOM: usize, diff --git a/ethereum-consensus/src/types/execution_payload_header.rs b/ethereum-consensus/src/types/execution_payload_header.rs index f9410a9e9..1c2dc6841 100644 --- a/ethereum-consensus/src/types/execution_payload_header.rs +++ b/ethereum-consensus/src/types/execution_payload_header.rs @@ -8,6 +8,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum ExecutionPayloadHeader< const BYTES_PER_LOGS_BLOOM: usize, diff --git a/ethereum-consensus/src/types/signed_beacon_block.rs b/ethereum-consensus/src/types/signed_beacon_block.rs index f8fce347a..f51f5c97e 100644 --- a/ethereum-consensus/src/types/signed_beacon_block.rs +++ b/ethereum-consensus/src/types/signed_beacon_block.rs @@ -11,6 +11,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum SignedBeaconBlock< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/ethereum-consensus/src/types/signed_blinded_beacon_block.rs b/ethereum-consensus/src/types/signed_blinded_beacon_block.rs index 10ac56245..6ed47e75b 100644 --- a/ethereum-consensus/src/types/signed_blinded_beacon_block.rs +++ b/ethereum-consensus/src/types/signed_blinded_beacon_block.rs @@ -9,6 +9,7 @@ use crate::{ Fork as Version, }; #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] +#[ssz(transparent)] #[serde(untagged)] pub enum SignedBlindedBeaconBlock< const MAX_PROPOSER_SLASHINGS: usize, diff --git a/spec-gen/src/type_generator.rs b/spec-gen/src/type_generator.rs index 430916173..89db8ca16 100644 --- a/spec-gen/src/type_generator.rs +++ b/spec-gen/src/type_generator.rs @@ -371,6 +371,7 @@ fn derive_type_defn(target_type: &Type, merge_type: &MergeType) -> (Item, Generi .collect::>(); let enum_defn = parse_quote! { #[derive(Debug, Clone, PartialEq, Eq, Merkleized, serde::Serialize)] + #[ssz(transparent)] #[serde(untagged)] pub enum #type_name #generics { #(#variant_defns),*