Skip to content

Commit b786e6d

Browse files
realbigseanMac L
authored andcommitted
Beta compiler fixes (sigp#5543)
* remove duplicate imports in gossip tests. get rid of duplicate trait bound locations * more double import fixes * cargo fmt
1 parent 969d12d commit b786e6d

File tree

8 files changed

+262
-15
lines changed

8 files changed

+262
-15
lines changed

beacon_node/lighthouse_network/gossipsub/src/behaviour/tests.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@
2222

2323
use super::*;
2424
use crate::subscription_filter::WhitelistSubscriptionFilter;
25-
use crate::transform::{DataTransform, IdentityTransform};
26-
use crate::types::{RpcOut, RpcReceiver};
27-
use crate::ValidationError;
28-
use crate::{
29-
config::Config, config::ConfigBuilder, types::Rpc, IdentTopic as Topic, TopicScoreParams,
30-
};
25+
use crate::types::RpcReceiver;
26+
use crate::{config::ConfigBuilder, types::Rpc, IdentTopic as Topic};
3127
use byteorder::{BigEndian, ByteOrder};
3228
use libp2p::core::ConnectedPoint;
3329
use rand::Rng;

beacon_node/lighthouse_network/gossipsub/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,6 @@ impl std::fmt::Debug for Config {
903903
mod test {
904904
use super::*;
905905
use crate::topic::IdentityHash;
906-
use crate::types::PeerKind;
907906
use crate::Topic;
908907
use libp2p::core::UpgradeInfo;
909908
use std::collections::hash_map::DefaultHasher;

beacon_node/lighthouse_network/gossipsub/src/mcache.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ impl MessageCache {
221221
#[cfg(test)]
222222
mod tests {
223223
use super::*;
224-
use crate::types::RawMessage;
225-
use crate::{IdentTopic as Topic, TopicHash};
226-
use libp2p::identity::PeerId;
224+
use crate::IdentTopic as Topic;
227225

228226
fn gen_testm(x: u64, topic: TopicHash) -> (MessageId, RawMessage) {
229227
let default_id = |message: &RawMessage| {

beacon_node/lighthouse_network/gossipsub/src/protocol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ impl Decoder for GossipsubCodec {
508508
mod tests {
509509
use super::*;
510510
use crate::config::Config;
511-
use crate::protocol::{BytesMut, GossipsubCodec, HandlerEvent};
512511
use crate::{Behaviour, ConfigBuilder, MessageAuthenticity};
513512
use crate::{IdentTopic as Topic, Version};
514513
use libp2p::identity::Keypair;

beacon_node/lighthouse_network/gossipsub/src/subscription_filter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ impl TopicSubscriptionFilter for RegexSubscriptionFilter {
212212
mod test {
213213
use super::*;
214214
use crate::types::SubscriptionAction::*;
215-
use std::iter::FromIterator;
216215

217216
#[test]
218217
fn test_filter_incoming_allow_all_with_duplicates() {

beacon_node/operation_pool/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl<E: EthSpec> OperationPool<E> {
708708
}
709709

710710
/// Filter up to a maximum number of operations out of an iterator.
711-
fn filter_limit_operations<'a, T: 'a, V: 'a, I, F, G>(
711+
fn filter_limit_operations<'a, T, V: 'a, I, F, G>(
712712
operations: I,
713713
filter: F,
714714
mapping: G,
@@ -718,7 +718,7 @@ where
718718
I: IntoIterator<Item = &'a T>,
719719
F: Fn(&T) -> bool,
720720
G: Fn(&T) -> V,
721-
T: Clone,
721+
T: Clone + 'a,
722722
{
723723
operations
724724
.into_iter()

consensus/types/src/chain_spec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,6 @@ where
16401640
mod tests {
16411641
use super::*;
16421642
use itertools::Itertools;
1643-
use safe_arith::SafeArith;
16441643

16451644
#[test]
16461645
fn test_mainnet_spec_can_be_constructed() {
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
use crate::{test_utils::TestRandom, *};
2+
use derivative::Derivative;
3+
use serde::{Deserialize, Serialize};
4+
use ssz_derive::{Decode, Encode};
5+
use test_random_derive::TestRandom;
6+
use tree_hash_derive::TreeHash;
7+
8+
#[derive(
9+
Default,
10+
Debug,
11+
Clone,
12+
Serialize,
13+
Deserialize,
14+
Encode,
15+
Decode,
16+
TreeHash,
17+
TestRandom,
18+
Derivative,
19+
arbitrary::Arbitrary,
20+
)]
21+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
22+
#[arbitrary(bound = "E: EthSpec")]
23+
#[serde(bound = "E: EthSpec")]
24+
#[ssz(struct_behaviour = "transparent")]
25+
#[serde(transparent)]
26+
pub struct BanderwagonGroupElement<E: EthSpec> {
27+
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
28+
inner: FixedVector<u8, E::BytesPerBanderwagonElement>,
29+
}
30+
31+
#[derive(
32+
Default,
33+
Debug,
34+
Clone,
35+
Serialize,
36+
Deserialize,
37+
Encode,
38+
Decode,
39+
TreeHash,
40+
TestRandom,
41+
Derivative,
42+
arbitrary::Arbitrary,
43+
)]
44+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
45+
#[arbitrary(bound = "E: EthSpec")]
46+
#[serde(bound = "E: EthSpec")]
47+
#[ssz(struct_behaviour = "transparent")]
48+
#[serde(transparent)]
49+
pub struct BanderwagonFieldElement<E: EthSpec> {
50+
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
51+
inner: FixedVector<u8, E::BytesPerBanderwagonElement>,
52+
}
53+
54+
#[derive(
55+
Default,
56+
Debug,
57+
Clone,
58+
Serialize,
59+
Deserialize,
60+
Encode,
61+
Decode,
62+
TreeHash,
63+
TestRandom,
64+
Derivative,
65+
arbitrary::Arbitrary,
66+
)]
67+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
68+
#[arbitrary(bound = "E: EthSpec")]
69+
#[serde(bound = "E: EthSpec")]
70+
#[ssz(struct_behaviour = "transparent")]
71+
#[serde(transparent)]
72+
pub struct Stem<E: EthSpec> {
73+
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
74+
inner: FixedVector<u8, E::MaxStemLength>,
75+
}
76+
77+
#[derive(
78+
Default,
79+
Debug,
80+
Clone,
81+
Serialize,
82+
Deserialize,
83+
Encode,
84+
Decode,
85+
TreeHash,
86+
TestRandom,
87+
Derivative,
88+
arbitrary::Arbitrary,
89+
)]
90+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
91+
#[arbitrary(bound = "E: EthSpec")]
92+
#[serde(bound = "E: EthSpec")]
93+
#[ssz(struct_behaviour = "transparent")]
94+
#[serde(transparent)]
95+
pub struct StateDiffValue<E: EthSpec> {
96+
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
97+
inner: FixedVector<u8, E::BytesPerSuffixStateDiffValue>,
98+
}
99+
100+
#[derive(
101+
Default,
102+
Debug,
103+
Clone,
104+
Serialize,
105+
Deserialize,
106+
Encode,
107+
Decode,
108+
TreeHash,
109+
TestRandom,
110+
Derivative,
111+
arbitrary::Arbitrary,
112+
)]
113+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
114+
#[arbitrary(bound = "E: EthSpec")]
115+
#[serde(bound = "E: EthSpec")]
116+
pub struct SuffixStateDiff<E: EthSpec> {
117+
//#[serde(with = "eth2_serde_utils::quoted_u8")]
118+
pub suffix: u8,
119+
// `None` means not currently present.
120+
pub current_value: Optional<StateDiffValue<E>>,
121+
// `None` means value is not updated.
122+
pub new_value: Optional<StateDiffValue<E>>,
123+
}
124+
125+
#[derive(
126+
Default,
127+
Debug,
128+
Clone,
129+
Serialize,
130+
Deserialize,
131+
Encode,
132+
Decode,
133+
TreeHash,
134+
TestRandom,
135+
Derivative,
136+
arbitrary::Arbitrary,
137+
)]
138+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
139+
#[arbitrary(bound = "E: EthSpec")]
140+
#[serde(bound = "E: EthSpec")]
141+
pub struct StemStateDiff<E: EthSpec> {
142+
pub stem: Stem<E>,
143+
pub suffix_diffs: VariableList<SuffixStateDiff<E>, E::MaxVerkleWidth>,
144+
}
145+
146+
#[derive(
147+
Default,
148+
Debug,
149+
Clone,
150+
Serialize,
151+
Deserialize,
152+
Encode,
153+
Decode,
154+
TreeHash,
155+
TestRandom,
156+
Derivative,
157+
arbitrary::Arbitrary,
158+
)]
159+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
160+
#[arbitrary(bound = "E: EthSpec")]
161+
#[serde(bound = "E: EthSpec")]
162+
#[ssz(struct_behaviour = "transparent")]
163+
#[serde(transparent)]
164+
pub struct StateDiff<E: EthSpec> {
165+
pub inner: VariableList<StemStateDiff<E>, E::MaxStems>,
166+
}
167+
168+
#[derive(
169+
Default,
170+
Debug,
171+
Clone,
172+
Serialize,
173+
Deserialize,
174+
Encode,
175+
Decode,
176+
TreeHash,
177+
TestRandom,
178+
Derivative,
179+
arbitrary::Arbitrary,
180+
)]
181+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
182+
#[arbitrary(bound = "E: EthSpec")]
183+
#[serde(bound = "E: EthSpec")]
184+
pub struct IpaProof<E: EthSpec> {
185+
pub cl: FixedVector<BanderwagonGroupElement<E>, E::IpaProofDepth>,
186+
pub cr: FixedVector<BanderwagonGroupElement<E>, E::IpaProofDepth>,
187+
pub final_evaluation: BanderwagonFieldElement<E>,
188+
}
189+
190+
#[derive(
191+
Default,
192+
Debug,
193+
Clone,
194+
Serialize,
195+
Deserialize,
196+
Encode,
197+
Decode,
198+
TreeHash,
199+
TestRandom,
200+
Derivative,
201+
arbitrary::Arbitrary,
202+
)]
203+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
204+
#[arbitrary(bound = "E: EthSpec")]
205+
#[serde(bound = "E: EthSpec")]
206+
#[ssz(struct_behaviour = "transparent")]
207+
#[serde(transparent)]
208+
pub struct StemValue<E: EthSpec> {
209+
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
210+
inner: FixedVector<u8, E::MaxStemLength>,
211+
}
212+
213+
#[derive(
214+
Default,
215+
Debug,
216+
Clone,
217+
Serialize,
218+
Deserialize,
219+
Encode,
220+
Decode,
221+
TreeHash,
222+
TestRandom,
223+
Derivative,
224+
arbitrary::Arbitrary,
225+
)]
226+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
227+
#[arbitrary(bound = "E: EthSpec")]
228+
#[serde(bound = "E: EthSpec")]
229+
pub struct VerkleProof<E: EthSpec> {
230+
pub other_stems: VariableList<StemValue<E>, E::MaxStems>,
231+
#[serde(with = "ssz_types::serde_utils::hex_var_list")]
232+
pub depth_extension_present: VariableList<u8, E::MaxStems>,
233+
pub commitments_by_path: VariableList<BanderwagonGroupElement<E>, E::MaxCommittments>,
234+
pub d: BanderwagonGroupElement<E>,
235+
pub ipa_proof: IpaProof<E>,
236+
}
237+
238+
#[derive(
239+
Default,
240+
Debug,
241+
Clone,
242+
Serialize,
243+
Deserialize,
244+
Encode,
245+
Decode,
246+
TreeHash,
247+
TestRandom,
248+
Derivative,
249+
arbitrary::Arbitrary,
250+
)]
251+
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
252+
#[arbitrary(bound = "E: EthSpec")]
253+
#[serde(bound = "E: EthSpec")]
254+
pub struct ExecutionWitness<E: EthSpec> {
255+
pub state_diff: StateDiff<E>,
256+
pub verkle_proof: VerkleProof<E>,
257+
}

0 commit comments

Comments
 (0)