From f67efe81e8fff0648d3ddb67bd9eabb2e8da35f8 Mon Sep 17 00:00:00 2001 From: ec2 Date: Fri, 2 Feb 2024 07:50:27 +0000 Subject: [PATCH] fix the rest of pr review --- lightclient-circuits/src/witness/multiproof.rs | 3 ++- lightclient-circuits/src/witness/rotation.rs | 5 +---- lightclient-circuits/src/witness/step.rs | 10 ++-------- preprocessor/src/rotation.rs | 5 +---- preprocessor/src/step.rs | 10 ++-------- preprocessor/src/unit_test_gen.rs | 10 ++-------- test-utils/src/lib.rs | 10 ++-------- 7 files changed, 12 insertions(+), 41 deletions(-) diff --git a/lightclient-circuits/src/witness/multiproof.rs b/lightclient-circuits/src/witness/multiproof.rs index 968b2ca..1ffaacc 100644 --- a/lightclient-circuits/src/witness/multiproof.rs +++ b/lightclient-circuits/src/witness/multiproof.rs @@ -202,7 +202,7 @@ pub fn block_header_to_leaves( pub fn beacon_header_multiproof_and_helper_indices( header: &mut BeaconBlockHeader, gindices: &[usize], -) -> (Vec, Vec) { +) -> (Vec>, Vec) { let header_leaves = block_header_to_leaves(header).unwrap(); let merkle_tree = merkle_tree(&header_leaves); let helper_indices = get_helper_indices(gindices); @@ -210,6 +210,7 @@ pub fn beacon_header_multiproof_and_helper_indices( .iter() .copied() .map(|i| merkle_tree[i]) + .map(|n| n.as_ref().to_vec()) .collect::>(); assert_eq!(proof.len(), helper_indices.len()); (proof, helper_indices) diff --git a/lightclient-circuits/src/witness/rotation.rs b/lightclient-circuits/src/witness/rotation.rs index 9933025..75d4d61 100644 --- a/lightclient-circuits/src/witness/rotation.rs +++ b/lightclient-circuits/src/witness/rotation.rs @@ -81,10 +81,7 @@ impl Default for CommitteeUpdateArgs { sync_committee_branch, finalized_header, _spec: PhantomData, - finalized_header_multiproof: finalized_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices, } } diff --git a/lightclient-circuits/src/witness/step.rs b/lightclient-circuits/src/witness/step.rs index 78225e2..ba5354e 100644 --- a/lightclient-circuits/src/witness/step.rs +++ b/lightclient-circuits/src/witness/step.rs @@ -139,15 +139,9 @@ impl Default for SyncStepArgs { execution_payload_root: execution_root, _spec: PhantomData, - attested_header_multiproof: attested_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + attested_header_multiproof, attested_header_helper_indices, - finalized_header_multiproof: finalized_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices, } } diff --git a/preprocessor/src/rotation.rs b/preprocessor/src/rotation.rs index a06864b..5f35854 100644 --- a/preprocessor/src/rotation.rs +++ b/preprocessor/src/rotation.rs @@ -109,10 +109,7 @@ where .map(|n| n.to_vec()) .collect_vec(), _spec: PhantomData, - finalized_header_multiproof: finalized_header_multiproof - .into_iter() - .map(|n| n.to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices, }; Ok(args) diff --git a/preprocessor/src/step.rs b/preprocessor/src/step.rs index 9eda5fd..2e55aab 100644 --- a/preprocessor/src/step.rs +++ b/preprocessor/src/step.rs @@ -167,15 +167,9 @@ pub async fn step_args_from_finality_update( .collect_vec(), domain, _spec: PhantomData, - attested_header_multiproof: attested_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + attested_header_multiproof, attested_header_helper_indices, - finalized_header_multiproof: finalized_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices, }) } diff --git a/preprocessor/src/unit_test_gen.rs b/preprocessor/src/unit_test_gen.rs index 42d88e4..e22aa64 100644 --- a/preprocessor/src/unit_test_gen.rs +++ b/preprocessor/src/unit_test_gen.rs @@ -205,10 +205,7 @@ fn main() { .map(|n| n.as_ref().to_vec()) .collect_vec(), attested_header_helper_indices, - finalized_header_multiproof: finalized_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices, }; @@ -226,10 +223,7 @@ fn main() { .map(|x| x.to_vec()) .collect_vec(), _spec: std::marker::PhantomData, - finalized_header_multiproof: attested_header_multiproof - .into_iter() - .map(|n| n.as_ref().to_vec()) - .collect_vec(), + finalized_header_multiproof, finalized_header_helper_indices: attested_header_helper_indices, }; diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 1252a45..ee371ea 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -269,15 +269,9 @@ fn to_sync_ciruit_witness( &[Minimal::HEADER_SLOT_INDEX, Minimal::HEADER_BODY_ROOT_INDEX], ); - args.finalized_header_multiproof = finalized_header_multiproof - .into_iter() - .map(|n| n.to_vec()) - .collect_vec(); + args.finalized_header_multiproof = finalized_header_multiproof; args.finalized_header_helper_indices = finalized_header_helper_indices; - args.attested_header_multiproof = attested_header_multiproof - .into_iter() - .map(|n| n.to_vec()) - .collect_vec(); + args.attested_header_multiproof = attested_header_multiproof; args.attested_header_helper_indices = attested_header_helper_indices; args