Skip to content

Commit e1605e3

Browse files
committed
Deleted Some Deserialize Impls
1 parent b5b5492 commit e1605e3

File tree

6 files changed

+21
-28
lines changed

6 files changed

+21
-28
lines changed

common/eth2/src/types.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,8 +1131,8 @@ pub enum EventKind<E: EthSpec> {
11311131
ChainReorg(SseChainReorg),
11321132
ContributionAndProof(Box<SignedContributionAndProof<E>>),
11331133
LateHead(SseLateHead),
1134-
LightClientFinalityUpdate(Box<LightClientFinalityUpdate<E>>),
1135-
LightClientOptimisticUpdate(Box<LightClientOptimisticUpdate<E>>),
1134+
LightClientFinalityUpdate(Box<BeaconResponse<LightClientFinalityUpdate<E>>>),
1135+
LightClientOptimisticUpdate(Box<BeaconResponse<LightClientOptimisticUpdate<E>>>),
11361136
#[cfg(feature = "lighthouse")]
11371137
BlockReward(BlockReward),
11381138
PayloadAttributes(VersionedSsePayloadAttributes),
@@ -1212,22 +1212,24 @@ impl<E: EthSpec> EventKind<E> {
12121212
ServerError::InvalidServerSentEvent(format!("Payload Attributes: {:?}", e))
12131213
})?,
12141214
)),
1215-
"light_client_finality_update" => Ok(EventKind::LightClientFinalityUpdate(
1216-
serde_json::from_str(data).map_err(|e| {
1215+
"light_client_finality_update" => Ok(EventKind::LightClientFinalityUpdate(Box::new(
1216+
BeaconResponse::ForkVersioned(serde_json::from_str(data).map_err(|e| {
12171217
ServerError::InvalidServerSentEvent(format!(
12181218
"Light Client Finality Update: {:?}",
12191219
e
12201220
))
1221-
})?,
1222-
)),
1223-
"light_client_optimistic_update" => Ok(EventKind::LightClientOptimisticUpdate(
1224-
serde_json::from_str(data).map_err(|e| {
1225-
ServerError::InvalidServerSentEvent(format!(
1226-
"Light Client Optimistic Update: {:?}",
1227-
e
1228-
))
1229-
})?,
1230-
)),
1221+
})?),
1222+
))),
1223+
"light_client_optimistic_update" => {
1224+
Ok(EventKind::LightClientOptimisticUpdate(Box::new(
1225+
BeaconResponse::ForkVersioned(serde_json::from_str(data).map_err(|e| {
1226+
ServerError::InvalidServerSentEvent(format!(
1227+
"Light Client Optimistic Update: {:?}",
1228+
e
1229+
))
1230+
})?),
1231+
)))
1232+
}
12311233
#[cfg(feature = "lighthouse")]
12321234
"block_reward" => Ok(EventKind::BlockReward(serde_json::from_str(data).map_err(
12331235
|e| ServerError::InvalidServerSentEvent(format!("Block Reward: {:?}", e)),

consensus/types/src/light_client_finality_update.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ use tree_hash_derive::TreeHash;
3434
arbitrary(bound = "E: EthSpec"),
3535
)
3636
)]
37-
#[derive(
38-
Debug, Clone, Serialize, Encode, TreeHash, Deserialize, arbitrary::Arbitrary, PartialEq,
39-
)]
37+
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
4038
#[serde(untagged)]
4139
#[tree_hash(enum_behaviour = "transparent")]
4240
#[ssz(enum_behaviour = "transparent")]

consensus/types/src/light_client_header.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ use tree_hash_derive::TreeHash;
3636
arbitrary(bound = "E: EthSpec"),
3737
)
3838
)]
39-
#[derive(
40-
Debug, Clone, Serialize, TreeHash, Encode, Deserialize, arbitrary::Arbitrary, PartialEq,
41-
)]
39+
#[derive(Debug, Clone, Serialize, TreeHash, Encode, arbitrary::Arbitrary, PartialEq)]
4240
#[serde(untagged)]
4341
#[tree_hash(enum_behaviour = "transparent")]
4442
#[ssz(enum_behaviour = "transparent")]

consensus/types/src/light_client_optimistic_update.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ use tree_hash_derive::TreeHash;
3737
arbitrary(bound = "E: EthSpec"),
3838
)
3939
)]
40-
#[derive(
41-
Debug, Clone, Serialize, Encode, TreeHash, Deserialize, arbitrary::Arbitrary, PartialEq,
42-
)]
40+
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
4341
#[serde(untagged)]
4442
#[tree_hash(enum_behaviour = "transparent")]
4543
#[ssz(enum_behaviour = "transparent")]

consensus/types/src/light_client_update.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ impl From<milhouse::Error> for Error {
118118
arbitrary(bound = "E: EthSpec"),
119119
)
120120
)]
121-
#[derive(
122-
Debug, Clone, Serialize, Encode, TreeHash, Deserialize, arbitrary::Arbitrary, PartialEq,
123-
)]
121+
#[derive(Debug, Clone, Serialize, Encode, TreeHash, arbitrary::Arbitrary, PartialEq)]
124122
#[serde(untagged)]
125123
#[tree_hash(enum_behaviour = "transparent")]
126124
#[ssz(enum_behaviour = "transparent")]

testing/ef_tests/src/cases/light_client_verify_is_better_update.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use decode::ssz_decode_light_client_update;
33
use serde::Deserialize;
44
use types::{LightClientUpdate, Slot};
55

6-
#[derive(Debug, Clone, Deserialize)]
7-
#[serde(deny_unknown_fields)]
6+
#[derive(Debug, Clone)]
87
pub struct LightClientVerifyIsBetterUpdate<E: EthSpec> {
98
light_client_updates: Vec<LightClientUpdate<E>>,
109
}

0 commit comments

Comments
 (0)