Skip to content

Commit

Permalink
Partially remove enum_behaviour from project
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Oct 18, 2022
1 parent 89b64a6 commit 46ffb7f
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 54 deletions.
42 changes: 15 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ slot_clock = { path = "../../common/slot_clock" }
eth2_hashing = "0.3.0"
eth2_ssz = "0.4.1"
eth2_ssz_types = "0.2.2"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
state_processing = { path = "../../consensus/state_processing" }
tree_hash = "0.4.1"
types = { path = "../../consensus/types" }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/eth1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hex = "0.4.2"
types = { path = "../../consensus/types"}
merkle_proof = { path = "../../consensus/merkle_proof"}
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
tree_hash = "0.4.1"
parking_lot = "0.12.0"
slog = "2.5.2"
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ eth2_ssz_types = "0.2.2"
serde = { version = "1.0.116", features = ["derive"] }
serde_derive = "1.0.116"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
slog = { version = "2.5.2", features = ["max_level_trace"] }
lighthouse_version = { path = "../../common/lighthouse_version" }
tokio = { version = "1.14.0", features = ["time", "macros"] }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub struct Ping {
)]
#[derive(Clone, Debug, PartialEq, Serialize, Encode)]
#[serde(bound = "T: EthSpec")]
#[ssz(enum_behaviour = "transparent")]
#[ssz(transparent)]
pub struct MetaData<T: EthSpec> {
/// A sequential counter indicating when data gets modified.
pub seq_number: u64,
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/operation_pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parking_lot = "0.12.0"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
rayon = "1.5.0"
serde = "1.0.116"
serde_derive = "1.0.116"
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ leveldb = { version = "0.8.6", default-features = false }
parking_lot = "0.12.0"
itertools = "0.10.0"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
slog = "2.5.2"
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/store/src/partial_beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use types::*;
variant_attributes(derive(Debug, PartialEq, Clone, Encode, Decode))
)]
#[derive(Debug, PartialEq, Clone, Encode)]
#[ssz(enum_behaviour = "transparent")]
#[ssz(transparent)]
pub struct PartialBeaconState<T>
where
T: EthSpec,
Expand Down
2 changes: 1 addition & 1 deletion common/eth2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bytes = "1.0.1"
account_utils = { path = "../../common/account_utils" }
sensitive_url = { path = "../../common/sensitive_url" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
futures-util = "0.3.8"
futures = "0.3.8"
store = { path = "../../beacon_node/store", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion consensus/cached_tree_hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
ethereum-types = "0.12.1"
eth2_ssz_types = "0.2.2"
eth2_hashing = "0.3.0"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
eth2_ssz = "0.4.1"
tree_hash = "0.4.1"
smallvec = "1.6.1"
Expand Down
2 changes: 1 addition & 1 deletion consensus/fork_choice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ types = { path = "../types" }
state_processing = { path = "../state_processing" }
proto_array = { path = "../proto_array" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
slog = { version = "2.5.2", features = ["max_level_trace", "release_max_level_trace"] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion consensus/proto_array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ path = "src/bin.rs"
[dependencies]
types = { path = "../types" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_yaml = "0.8.13"
2 changes: 1 addition & 1 deletion consensus/proto_array/src/proto_array_fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct VoteTracker {

/// Represents the verification status of an execution payload.
#[derive(Clone, Copy, Debug, PartialEq, Encode, Decode, Serialize, Deserialize)]
#[ssz(enum_behaviour = "union")]
#[ssz(union)]
pub enum ExecutionStatus {
/// An EL has determined that the payload is valid.
Valid(ExecutionBlockHash),
Expand Down
17 changes: 10 additions & 7 deletions consensus/ssz_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,18 @@ impl Config {
fn read(item: &DeriveInput) -> Self {
let opts = StructOpts::from_derive_input(item).unwrap();

let enum_behaviour = match (opts.transparent, opts.union, &opts.enum_behaviour) {
(false, false, None) => EnumBehaviour::Unspecified,
(true, false, None) => EnumBehaviour::Transparent,
(false, true, None) => EnumBehaviour::Union,
(true, true, _) => panic!("cannot provide both \"transparent\" and \"union\""),
(_, _, Some(_)) => panic!(
if opts.enum_behaviour.is_some() {
panic!(
"the \"enum_behaviour\" attribute has been removed, please use \
either #[ssz(transparent)] or #[ssz(union)] instead"
),
)
}

let enum_behaviour = match (opts.transparent, opts.union) {
(true, true) => panic!("cannot provide both \"transparent\" and \"union\""),
(false, false) => EnumBehaviour::Unspecified,
(true, false) => EnumBehaviour::Transparent,
(false, true) => EnumBehaviour::Union,
};

// Don't allow `enum_behaviour` for structs.
Expand Down
2 changes: 1 addition & 1 deletion consensus/state_processing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bls = { path = "../../crypto/bls" }
integer-sqrt = "0.1.5"
itertools = "0.10.0"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
eth2_ssz_types = "0.2.2"
merkle_proof = { path = "../merkle_proof" }
safe_arith = { path = "../safe_arith" }
Expand Down
2 changes: 1 addition & 1 deletion consensus/tree_hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tree_hash_derive = "0.4.0"
types = { path = "../types" }
beacon_chain = { path = "../../beacon_node/beacon_chain" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"

[dependencies]
ethereum-types = "0.12.1"
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde = {version = "1.0.116" , features = ["rc"] }
serde_derive = "1.0.116"
slog = "2.5.2"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
eth2_ssz_types = "0.2.2"
swap_or_not_shuffle = { path = "../swap_or_not_shuffle" }
test_random_derive = { path = "../../common/test_random_derive" }
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/src/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use tree_hash_derive::TreeHash;
#[serde(bound = "T: EthSpec, Payload: ExecPayload<T>")]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[ssz(transparent)]
pub struct BeaconBlock<T: EthSpec, Payload: ExecPayload<T> = FullPayload<T>> {
#[superstruct(getter(copy))]
pub slot: Slot,
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl From<BeaconStateHash> for Hash256 {
#[serde(bound = "T: EthSpec")]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[ssz(transparent)]
pub struct BeaconState<T>
where
T: EthSpec,
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/src/signed_beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl From<SignedBeaconBlockHash> for Hash256 {
#[serde(bound = "E: EthSpec, Payload: ExecPayload<E>")]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[ssz(transparent)]
pub struct SignedBeaconBlock<E: EthSpec, Payload: ExecPayload<E> = FullPayload<E>> {
#[superstruct(only(Base), partial_getter(rename = "message_base"))]
pub message: BeaconBlockBase<E, Payload>,
Expand Down
2 changes: 1 addition & 1 deletion slasher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lmdb = ["lmdb-rkv", "lmdb-rkv-sys"]
bincode = "1.3.1"
byteorder = "1.3.4"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
flate2 = { version = "1.0.14", features = ["zlib"], default-features = false }
lazy_static = "1.4.0"
lighthouse_metrics = { path = "../common/lighthouse_metrics" }
Expand Down
2 changes: 1 addition & 1 deletion testing/ef_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde_derive = "1.0.116"
serde_repr = "0.1.6"
serde_yaml = "0.8.13"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.4.0"
tree_hash = "0.4.1"
tree_hash_derive = "0.4.0"
cached_tree_hash = { path = "../../consensus/cached_tree_hash" }
Expand Down

0 comments on commit 46ffb7f

Please sign in to comment.