Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 committed Sep 11, 2023
1 parent 4215f39 commit 3951053
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ impl SyncCommitteeProver {
debug_target: &str,
) -> Result<Option<LightClientUpdate>, anyhow::Error> {
if finality_checkpoint.root == Node::default() ||
finality_checkpoint.epoch <= client_state.latest_finalized_epoch ||
finality_checkpoint.root == client_state.finalized_header.clone().hash_tree_root()?
finality_checkpoint.epoch <= client_state.latest_finalized_epoch
{
return Ok(None)
}
Expand Down
10 changes: 6 additions & 4 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ pub fn verify_sync_committee_attestation(

// Verify update is valid
let is_valid_update = update.signature_slot > update.attested_header.slot &&
update.attested_header.slot >= update.finalized_header.slot;
update.attested_header.slot > update.finalized_header.slot;
if !is_valid_update {
Err(Error::InvalidUpdate("Update slot does not follow the required pattern".into()))?
Err(Error::InvalidUpdate(
"relationship between slots does not meet the requirements".into(),
))?
}

if should_get_sync_committee_update(update.attested_header.slot) &&
update.sync_committee_update.is_none()
{
Err(Error::InvalidUpdate("Sync committee update missing".into()))?
Err(Error::InvalidUpdate("Sync committee update is required".into()))?
}

let state_period = compute_sync_committee_period_at_slot(trusted_state.finalized_header.slot);
Expand All @@ -72,7 +74,7 @@ pub fn verify_sync_committee_attestation(
}

if update.attested_header.slot <= trusted_state.finalized_header.slot {
Err(Error::InvalidUpdate("Update is irrelevant".into()))?
Err(Error::InvalidUpdate("Update is expired".into()))?
}

// Verify sync committee aggregate signature
Expand Down

0 comments on commit 3951053

Please sign in to comment.