mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 09:21:02 +00:00
Bridge: make some headers submissions free (#4102)
supersedes https://github.com/paritytech/parity-bridges-common/pull/2873 Draft because of couple of TODOs: - [x] fix remaining TODOs; - [x] double check that all changes from https://github.com/paritytech/parity-bridges-common/pull/2873 are correctly ported; - [x] create a separate PR (on top of that one or a follow up?) for https://github.com/paritytech/polkadot-sdk/tree/sv-try-new-bridge-fees; - [x] fix compilation issues (haven't checked, but there should be many). --------- Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
committed by
GitHub
parent
4f3d43a0c4
commit
a633e954f3
@@ -116,6 +116,10 @@ impl ParaStoredHeaderData {
|
||||
|
||||
/// Stored parachain head data builder.
|
||||
pub trait ParaStoredHeaderDataBuilder {
|
||||
/// Maximal parachain head size that we may accept for free. All heads above
|
||||
/// this limit are submitted for a regular fee.
|
||||
fn max_free_head_size() -> u32;
|
||||
|
||||
/// Return number of parachains that are supported by this builder.
|
||||
fn supported_parachains() -> u32;
|
||||
|
||||
@@ -127,6 +131,10 @@ pub trait ParaStoredHeaderDataBuilder {
|
||||
pub struct SingleParaStoredHeaderDataBuilder<C: Parachain>(PhantomData<C>);
|
||||
|
||||
impl<C: Parachain> ParaStoredHeaderDataBuilder for SingleParaStoredHeaderDataBuilder<C> {
|
||||
fn max_free_head_size() -> u32 {
|
||||
C::MAX_HEADER_SIZE
|
||||
}
|
||||
|
||||
fn supported_parachains() -> u32 {
|
||||
1
|
||||
}
|
||||
@@ -147,6 +155,17 @@ impl<C: Parachain> ParaStoredHeaderDataBuilder for SingleParaStoredHeaderDataBui
|
||||
#[impl_trait_for_tuples::impl_for_tuples(1, 30)]
|
||||
#[tuple_types_custom_trait_bound(Parachain)]
|
||||
impl ParaStoredHeaderDataBuilder for C {
|
||||
fn max_free_head_size() -> u32 {
|
||||
let mut result = 0_u32;
|
||||
for_tuples!( #(
|
||||
result = sp_std::cmp::max(
|
||||
result,
|
||||
SingleParaStoredHeaderDataBuilder::<C>::max_free_head_size(),
|
||||
);
|
||||
)* );
|
||||
result
|
||||
}
|
||||
|
||||
fn supported_parachains() -> u32 {
|
||||
let mut result = 0;
|
||||
for_tuples!( #(
|
||||
|
||||
Reference in New Issue
Block a user