From e093af32be1aa487cf737c69db6dd50ea837a7f3 Mon Sep 17 00:00:00 2001 From: Chen Kai <281165273grape@gmail.com> Date: Sat, 24 Aug 2024 22:32:16 +0800 Subject: [PATCH] fix:simpilify code Signed-off-by: Chen Kai <281165273grape@gmail.com> --- crates/beacon/src/blob_test_helper.rs | 50 ++++----------------------- 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/crates/beacon/src/blob_test_helper.rs b/crates/beacon/src/blob_test_helper.rs index 3a9df1a..f32fe13 100644 --- a/crates/beacon/src/blob_test_helper.rs +++ b/crates/beacon/src/blob_test_helper.rs @@ -7,48 +7,12 @@ use eth2::types::{ }; use once_cell::sync::Lazy; -pub static ORIGIN_BLOCK: Lazy = Lazy::new(|| { - Hash256::from([ - 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); -pub static ONE: Lazy = Lazy::new(|| { - Hash256::from([ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); -pub static TWO: Lazy = Lazy::new(|| { - Hash256::from([ - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); -pub static THREE: Lazy = Lazy::new(|| { - Hash256::from([ - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); -pub static FOUR: Lazy = Lazy::new(|| { - Hash256::from([ - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); -pub static FIVE: Lazy = Lazy::new(|| { - Hash256::from([ - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, - ]) -}); +pub static ORIGIN_BLOCK: Lazy = Lazy::new(|| Hash256::from([0x09; 5] + [0x00; 27])); +pub static ONE: Lazy = Lazy::new(|| Hash256::from([0x01] + [0x00; 31])); +pub static TWO: Lazy = Lazy::new(|| Hash256::from([0x02] + [0x00; 31])); +pub static THREE: Lazy = Lazy::new(|| Hash256::from([0x03] + [0x00; 31])); +pub static FOUR: Lazy = Lazy::new(|| Hash256::from([0x04] + [0x00; 31])); +pub static FIVE: Lazy = Lazy::new(|| Hash256::from([0x05] + [0x00; 31])); pub const START_SLOT: u64 = 10; #[allow(dead_code)] @@ -74,4 +38,4 @@ pub fn new_blob_sidecars(n: usize) -> BlobSidecarList { .expect("TODO: panic message"); } blob_sidecars -} +} \ No newline at end of file