Skip to content

Commit e093af3

Browse files
committed
fix:simpilify code
Signed-off-by: Chen Kai <[email protected]>
1 parent 5ac29c2 commit e093af3

File tree

1 file changed

+7
-43
lines changed

1 file changed

+7
-43
lines changed

Diff for: crates/beacon/src/blob_test_helper.rs

+7-43
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,12 @@ use eth2::types::{
77
};
88
use once_cell::sync::Lazy;
99

10-
pub static ORIGIN_BLOCK: Lazy<Hash256> = Lazy::new(|| {
11-
Hash256::from([
12-
0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14-
0x00, 0x00,
15-
])
16-
});
17-
pub static ONE: Lazy<Hash256> = Lazy::new(|| {
18-
Hash256::from([
19-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21-
0x00, 0x00,
22-
])
23-
});
24-
pub static TWO: Lazy<Hash256> = Lazy::new(|| {
25-
Hash256::from([
26-
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28-
0x00, 0x00,
29-
])
30-
});
31-
pub static THREE: Lazy<Hash256> = Lazy::new(|| {
32-
Hash256::from([
33-
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35-
0x00, 0x00,
36-
])
37-
});
38-
pub static FOUR: Lazy<Hash256> = Lazy::new(|| {
39-
Hash256::from([
40-
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42-
0x00, 0x00,
43-
])
44-
});
45-
pub static FIVE: Lazy<Hash256> = Lazy::new(|| {
46-
Hash256::from([
47-
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49-
0x00, 0x00,
50-
])
51-
});
10+
pub static ORIGIN_BLOCK: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x09; 5] + [0x00; 27]));
11+
pub static ONE: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x01] + [0x00; 31]));
12+
pub static TWO: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x02] + [0x00; 31]));
13+
pub static THREE: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x03] + [0x00; 31]));
14+
pub static FOUR: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x04] + [0x00; 31]));
15+
pub static FIVE: Lazy<Hash256> = Lazy::new(|| Hash256::from([0x05] + [0x00; 31]));
5216

5317
pub const START_SLOT: u64 = 10;
5418
#[allow(dead_code)]
@@ -74,4 +38,4 @@ pub fn new_blob_sidecars(n: usize) -> BlobSidecarList<MainnetEthSpec> {
7438
.expect("TODO: panic message");
7539
}
7640
blob_sidecars
77-
}
41+
}

0 commit comments

Comments
 (0)