Skip to content

Commit

Permalink
fix the rest of pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
ec2 committed Feb 2, 2024
1 parent 476a9b7 commit f67efe8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 41 deletions.
3 changes: 2 additions & 1 deletion lightclient-circuits/src/witness/multiproof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,15 @@ pub fn block_header_to_leaves(
pub fn beacon_header_multiproof_and_helper_indices(
header: &mut BeaconBlockHeader,
gindices: &[usize],
) -> (Vec<Node>, Vec<usize>) {
) -> (Vec<Vec<u8>>, Vec<usize>) {
let header_leaves = block_header_to_leaves(header).unwrap();
let merkle_tree = merkle_tree(&header_leaves);
let helper_indices = get_helper_indices(gindices);
let proof = helper_indices
.iter()
.copied()
.map(|i| merkle_tree[i])
.map(|n| n.as_ref().to_vec())
.collect::<Vec<_>>();
assert_eq!(proof.len(), helper_indices.len());
(proof, helper_indices)
Expand Down
5 changes: 1 addition & 4 deletions lightclient-circuits/src/witness/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ impl<S: Spec> Default for CommitteeUpdateArgs<S> {
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,
}
}
Expand Down
10 changes: 2 additions & 8 deletions lightclient-circuits/src/witness/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,9 @@ impl<S: Spec> Default for SyncStepArgs<S> {
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,
}
}
Expand Down
5 changes: 1 addition & 4 deletions preprocessor/src/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 2 additions & 8 deletions preprocessor/src/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,9 @@ pub async fn step_args_from_finality_update<S: Spec>(
.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,
})
}
Expand Down
10 changes: 2 additions & 8 deletions preprocessor/src/unit_test_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -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,
};

Expand Down
10 changes: 2 additions & 8 deletions test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,9 @@ fn to_sync_ciruit_witness<const SYNC_COMMITTEE_SIZE: usize>(
&[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
Expand Down

0 comments on commit f67efe8

Please sign in to comment.