Skip to content

Commit e9e31ab

Browse files
authored
chore(eth-verifier): next sync committee fix (#4239)
Make sure to do merkle validation when update includes a next sync committee
2 parents a7cc11a + 9b59eff commit e9e31ab

File tree

1 file changed

+7
-7
lines changed
  • lib/ethereum-sync-protocol/src

1 file changed

+7
-7
lines changed

lib/ethereum-sync-protocol/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,21 @@ pub fn validate_light_client_update<C: ChainSpec, V: BlsVerify>(
182182

183183
// Verify that if the update contains the next sync committee, and the signature periods do match,
184184
// next sync committees match too.
185-
if let (Some(next_sync_committee), Some(stored_next_sync_committee)) =
186-
(&update.next_sync_committee, &next_sync_committee)
187-
{
188-
if update_attested_period == stored_period {
185+
if let Some(update_next_sync_committee) = &update.next_sync_committee {
186+
if let Some(stored_next_sync_committee) = &next_sync_committee
187+
&& update_attested_period == stored_period
188+
{
189189
ensure(
190-
&next_sync_committee == stored_next_sync_committee,
190+
&update_next_sync_committee == stored_next_sync_committee,
191191
Error::NextSyncCommitteeMismatch {
192192
expected: stored_next_sync_committee.aggregate_pubkey,
193-
found: next_sync_committee.aggregate_pubkey,
193+
found: update_next_sync_committee.aggregate_pubkey,
194194
},
195195
)?;
196196
}
197197
// This validates the given next sync committee against the attested header's state root.
198198
validate_merkle_branch(
199-
&TryInto::<altair::SyncCommitteeSsz<C>>::try_into(next_sync_committee.clone())
199+
&TryInto::<altair::SyncCommitteeSsz<C>>::try_into(update_next_sync_committee.clone())
200200
.unwrap()
201201
.tree_hash_root(),
202202
update

0 commit comments

Comments
 (0)