-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
@@ -281,10 +285,9 @@ pub mod pallet { | |||
Ok(()) | |||
} | |||
|
|||
pub(crate) fn process_update(update: &Update) -> DispatchResult { | |||
pub(crate) fn process_update(update: &Update) -> DispatchResultWithPostInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: Do you think this function is even necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol maybe not! I think its just to much the Ethereum consensus spec, which has a pattern of a "process" method, that does a "verify" and an "apply".
// If free headers are allowed and the latest finalized header is larger than the | ||
// minimum slot interval, the header import transaction is free. | ||
if let Some(free_headers_interval) = T::FreeHeadersInterval::get() { | ||
if improved_by_slot >= latest_slot + free_headers_interval as u64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is basically saying you get a free update if the update is far enough in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, seems follow the same pattern for the P->K bridge here with free update at a minimal interval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. It will be set to every 32 slots (so basically all the finalized updates), but if we ever need to make it less frequent we can.
Maybe we can add a runtime test checking the balance of the relayer before and after the extrinsic, make sure that there is no fee charged actually. IIUC set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
@@ -83,6 +86,8 @@ pub mod pallet { | |||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>; | |||
#[pallet::constant] | |||
type ForkVersions: Get<ForkVersions>; | |||
#[pallet::constant] | |||
type FreeHeadersInterval: Get<Option<u32>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be optional? Can't we just make free headers the default?
if sync_committee_updated { | ||
return Pays::No; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively is just returning the parameter of sync_committee_updated
of mapped to Pays
, which seems redundant.
And given my other comment above, I would advise restructuring as follows:
fn check_refundable(update: &Update, latest_slot: u64) -> Pays
@@ -464,13 +469,24 @@ pub mod pallet { | |||
Self::deposit_event(Event::SyncCommitteeUpdated { | |||
period: update_finalized_period, | |||
}); | |||
sync_committee_updated = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sync_committee_updated
flag seems redundant. Following the code, when sync_committee_updated=True
, it follows that update.next_sync_committee_update == Some(...)
* free finalized updates * update comment * fix check * fixes * tests * fixes * fmt * finishing touches * comments * adds missing impl * adds test * fixes * fix
Allow free Snowbridge consensus updates, if the header interval is larger than the configured value (set to 32, so once a epoch). This PR also moves the Rococo Snowbridge pallet config into its own module. Original PR: Snowfork#159 --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Allow free Snowbridge consensus updates, if the header interval is larger than the configured value (set to 32, so once a epoch). This PR also moves the Rococo Snowbridge pallet config into its own module. Original PR: Snowfork#159 --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Allow free Snowbridge consensus updates, if the header interval is larger than the configured value (set to 32, so once a epoch). This PR also moves the Rococo Snowbridge pallet config into its own module. Original PR: Snowfork#159 ---------- Original `pr_5201.prdoc` is present but moved to release dir, ergo `R0-Silent` for this backport PR. --------- Co-authored-by: Clara van Staden <claravanstaden64@gmail.com> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Allow free Snowbridge consensus updates, if the header interval is larger than the configured value (set to 32, so once a epoch). This PR also moves the Rococo Snowbridge pallet config into its own module. Original PR: Snowfork#159 --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Allows free Ethereum finalized header updates if they larger or equal to the last interval within a certain interval.
FreeHeadersInterval
, to be set to32
.Resolves: https://linear.app/snowfork/issue/SNO-1053