Skip to content

Commit

Permalink
rename finalized_header in rotation args for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltea committed Dec 11, 2023
1 parent b79f9f6 commit d33dd7d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions lightclient-circuits/src/committee_update_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<S: Spec, F: Field> CommitteeUpdateCircuit<S, F> {

// Finalized header
let finalized_state_root = args
.finalized_header
.attested_header
.state_root
.as_ref()
.iter()
Expand All @@ -73,11 +73,11 @@ impl<S: Spec, F: Field> CommitteeUpdateCircuit<S, F> {
builder,
&sha256_chip,
[
args.finalized_header.slot.into_witness(),
args.finalized_header.proposer_index.into_witness(),
args.finalized_header.parent_root.as_ref().into_witness(),
args.attested_header.slot.into_witness(),
args.attested_header.proposer_index.into_witness(),
args.attested_header.parent_root.as_ref().into_witness(),
finalized_state_root.clone().into(),
args.finalized_header.body_root.as_ref().into_witness(),
args.attested_header.body_root.as_ref().into_witness(),
],
)?;

Expand Down Expand Up @@ -180,7 +180,7 @@ impl<S: Spec, F: Field> CommitteeUpdateCircuit<S, F> {

let ssz_root = pk_vector.hash_tree_root().unwrap();

let finalized_header_root = args.finalized_header.clone().hash_tree_root().unwrap();
let finalized_header_root = args.attested_header.clone().hash_tree_root().unwrap();

let instance_vec = iter::once(poseidon_commitment)
.chain(ssz_root.as_ref().iter().map(|b| bn256::Fr::from(*b as u64)))
Expand Down Expand Up @@ -278,7 +278,7 @@ mod tests {
CommitteeRotationArgs {
pubkeys_compressed,
_spec: PhantomData,
finalized_header,
attested_header: finalized_header,
sync_committee_branch: committee_root_branch,
}
}
Expand Down
4 changes: 1 addition & 3 deletions lightclient-circuits/src/sync_step_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,7 @@ mod tests {
use ark_std::{end_timer, start_timer};
use eth_types::Testnet;
use halo2_base::{
halo2_proofs::dev::MockProver,
halo2_proofs::{halo2curves::bn256::Fr, poly::commitment::Params},
utils::fs::gen_srs,
halo2_proofs::dev::MockProver, halo2_proofs::halo2curves::bn256::Fr, utils::fs::gen_srs,
};
use snark_verifier_sdk::{
evm::{evm_verify, gen_evm_proof_shplonk},
Expand Down
6 changes: 4 additions & 2 deletions lightclient-circuits/src/witness/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use std::{iter, marker::PhantomData};
pub struct CommitteeRotationArgs<S: Spec> {
pub pubkeys_compressed: Vec<Vec<u8>>,

pub finalized_header: BeaconBlockHeader,
// Attested header that containts the state root with new sync committee.
// This header going to become finilized in the adjacent step proof (that is submited along with this one in Spectre.sol::rotate).
pub attested_header: BeaconBlockHeader,

pub sync_committee_branch: Vec<Vec<u8>>,

Expand Down Expand Up @@ -57,7 +59,7 @@ impl<S: Spec> Default for CommitteeRotationArgs<S> {
.take(S::SYNC_COMMITTEE_SIZE)
.collect_vec(),
sync_committee_branch,
finalized_header: BeaconBlockHeader {
attested_header: BeaconBlockHeader {
state_root: state_root.as_slice().try_into().unwrap(),
..Default::default()
},
Expand Down
4 changes: 2 additions & 2 deletions preprocessor/src/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where

let args = CommitteeRotationArgs::<S> {
pubkeys_compressed,
finalized_header: update.attested_header.beacon.clone(),
attested_header: update.attested_header.beacon.clone(),
sync_committee_branch: sync_committee_branch
.into_iter()
.map(|n| n.to_vec())
Expand Down Expand Up @@ -120,7 +120,7 @@ pub async fn read_rotation_args<S: Spec>(path: String) -> eyre::Result<Committee

Ok(CommitteeRotationArgs::<S> {
pubkeys_compressed,
finalized_header,
attested_header: finalized_header,
sync_committee_branch: committee_root_branch,
_spec: PhantomData,
})
Expand Down

0 comments on commit d33dd7d

Please sign in to comment.