Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
shuffle things around
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Sep 3, 2024
1 parent 25c83b5 commit 3997df7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ pub mod pallet {
"💫 SyncCommitteeUpdated at period {}.",
update_finalized_period
);
<LatestFreeSyncCommitteeUpdatePeriod<T>>::set(update_finalized_period);
Self::deposit_event(Event::SyncCommitteeUpdated {
period: update_finalized_period,
});
Expand Down Expand Up @@ -665,10 +666,12 @@ pub mod pallet {
// If the sync committee was successfully updated, the update may be free.
let update_period = compute_period(update.finalized_header.slot);
let latest_free_update_period = <LatestFreeSyncCommitteeUpdatePeriod<T>>::get();
let may_be_free =
// If the next sync committee is not known and this update sets it, the update is free.
// If the sync committee update is in a period that we have not received an update for,
// the update is free.
let refundable =
!<NextSyncCommittee<T>>::exists() || update_period > latest_free_update_period;
if update.next_sync_committee_update.is_some() && may_be_free {
<LatestFreeSyncCommitteeUpdatePeriod<T>>::set(update_period);
if update.next_sync_committee_update.is_some() && refundable {
return Pays::No;
}

Expand Down

0 comments on commit 3997df7

Please sign in to comment.