Skip to content

Commit

Permalink
Eth2OnNearClient: verify signature period (#839)
Browse files Browse the repository at this point in the history
Co-authored-by: Kirill <[email protected]>
  • Loading branch information
karim-en and sept-en authored Oct 14, 2022
1 parent fcab67c commit bc16598
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contracts/near/eth2-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,18 @@ impl Eth2Client {
) {
let config = NetworkConfig::new(&self.network);
let signature_period = compute_sync_committee_period(update.signature_slot);

// Verify signature period does not skip a sync committee period
require!(
signature_period == finalized_period || signature_period == finalized_period + 1,
format!(
"The acceptable signature periods are '{}' and '{}' but got {}",
finalized_period,
finalized_period + 1,
signature_period
)
);

// Verify sync committee aggregate signature
let sync_committee = if signature_period == finalized_period {
self.current_sync_committee.get().unwrap()
Expand Down
Binary file modified contracts/near/res/eth2_client.wasm
Binary file not shown.

0 comments on commit bc16598

Please sign in to comment.