Skip to content

Commit

Permalink
More fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Jun 14, 2024
1 parent 2d56a0d commit 805d100
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 18 deletions.
3 changes: 1 addition & 2 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down
3 changes: 1 addition & 2 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,8 +1246,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ parameter_types! {
pub const RelayerStakeReserveId: [u8; 8] = *b"brdgrlrs";
/// Minimal period of relayer registration. Roughly, it is the 1 hour of real time.
pub const RelayerStakeLease: u32 = 300;
/// Priority boost that the registered relayer receives for every additional message in the message
/// delivery transaction.
///
/// It is determined semi-automatically - see `FEE_BOOST_PER_MESSAGE` constant to get the
/// meaning of this value

// see the `FEE_BOOST_PER_RELAY_HEADER` constant get the meaning of this value
pub PriorityBoostPerRelayHeader: u64 = 20_004_884_004_884;
// see the `FEE_BOOST_PER_PARACHAIN_HEADER` constant get the meaning of this value
pub PriorityBoostPerParachainHeader: u64 = 1_060_258_852_258_852;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
}

Expand Down Expand Up @@ -362,6 +363,10 @@ mod tests {
/// We want this tip to be large enough (delivery transactions with more messages = less
/// operational costs and a faster bridge), so this value should be significant.
const FEE_BOOST_PER_MESSAGE: Balance = 2 * constants::currency::UNITS;
// see `FEE_BOOST_PER_MESSAGE` comment
const FEE_BOOST_PER_RELAY_HEADER: Balance = 2 * constants::currency::UNITS;
// see `FEE_BOOST_PER_MESSAGE` comment
const FEE_BOOST_PER_PARACHAIN_HEADER: Balance = 2 * constants::currency::UNITS;

#[test]
fn ensure_bridge_hub_kusama_message_lane_weights_are_correct() {
Expand Down Expand Up @@ -415,8 +420,23 @@ mod tests {
},
});

// FAIL-CI @svyatonik please bring back the `ensure_priority_boost_is_sane` that was
// renamed.
bridge_runtime_common::extensions::priority_calculator::per_relay_header::ensure_priority_boost_is_sane::<
Runtime,
BridgeGrandpaPolkadotInstance,
PriorityBoostPerRelayHeader,
>(FEE_BOOST_PER_RELAY_HEADER);

bridge_runtime_common::extensions::priority_calculator::per_parachain_header::ensure_priority_boost_is_sane::<
Runtime,
RefundableParachain<WithBridgeHubPolkadotMessagesInstance, BridgeHubPolkadot>,
PriorityBoostPerParachainHeader,
>(FEE_BOOST_PER_PARACHAIN_HEADER);

bridge_runtime_common::extensions::priority_calculator::per_message::ensure_priority_boost_is_sane::<
Runtime,
WithBridgeHubPolkadotMessagesInstance,
PriorityBoostPerMessage,
>(FEE_BOOST_PER_MESSAGE);

assert_eq!(
BridgeKusamaToPolkadotMessagesPalletInstance::get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ parameter_types! {
pub const RelayerStakeReserveId: [u8; 8] = *b"brdgrlrs";
/// Minimal period of relayer registration. Roughly, it is the 1 hour of real time.
pub const RelayerStakeLease: u32 = 300;
/// Priority boost that the registered relayer receives for every additional message in the message
/// delivery transaction.
///
/// It is determined semi-automatically - see `FEE_BOOST_PER_MESSAGE` constant to get the
/// meaning of this value

// see the `FEE_BOOST_PER_RELAY_HEADER` constant get the meaning of this value
pub PriorityBoostPerRelayHeader: u64 = 200_048_840_048;
// see the `FEE_BOOST_PER_PARACHAIN_HEADER` constant get the meaning of this value
pub PriorityBoostPerParachainHeader: u64 = 10_602_588_522_588;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 1_820_444_444_444;
}

Expand Down Expand Up @@ -358,6 +359,10 @@ mod tests {
/// We want this tip to be large enough (delivery transactions with more messages = less
/// operational costs and a faster bridge), so this value should be significant.
const FEE_BOOST_PER_MESSAGE: Balance = 2 * constants::currency::UNITS;
// see `FEE_BOOST_PER_MESSAGE` comment
const FEE_BOOST_PER_RELAY_HEADER: Balance = 2 * constants::currency::UNITS;
// see `FEE_BOOST_PER_MESSAGE` comment
const FEE_BOOST_PER_PARACHAIN_HEADER: Balance = 2 * constants::currency::UNITS;

#[test]
fn ensure_bridge_hub_polkadot_message_lane_weights_are_correct() {
Expand Down Expand Up @@ -410,8 +415,23 @@ mod tests {
},
});

// FAIL-CI @svyatonik please bring back the `ensure_priority_boost_is_sane` that was
// renamed.
bridge_runtime_common::extensions::priority_calculator::per_relay_header::ensure_priority_boost_is_sane::<
Runtime,
BridgeGrandpaKusamaInstance,
PriorityBoostPerRelayHeader,
>(FEE_BOOST_PER_RELAY_HEADER);

bridge_runtime_common::extensions::priority_calculator::per_parachain_header::ensure_priority_boost_is_sane::<
Runtime,
RefundableParachain<WithBridgeHubKusamaMessagesInstance, BridgeHubKusama>,
PriorityBoostPerParachainHeader,
>(FEE_BOOST_PER_PARACHAIN_HEADER);

bridge_runtime_common::extensions::priority_calculator::per_message::ensure_priority_boost_is_sane::<
Runtime,
WithBridgeHubKusamaMessagesInstance,
PriorityBoostPerMessage,
>(FEE_BOOST_PER_MESSAGE);

assert_eq!(
BridgePolkadotToKusamaMessagesPalletInstance::get(),
Expand Down

0 comments on commit 805d100

Please sign in to comment.