Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Bridge hub kusama polkadot with dynamic fees #3001

Open
wants to merge 19 commits into
base: bridge-hub-kusama-polkadot
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
02e00e6
Squashed 'bridges/' changes from edf33a2c85..8f86ec78b7
bkontur Aug 10, 2023
4d60d09
Merge commit '02e00e6411c56bc44497bcd05104b17cdfdc0862' into bridge-h…
bkontur Aug 10, 2023
e5ac886
[dynfees] Rococo/Wococo does not need congestion and dynamic fees (fo…
bkontur Aug 11, 2023
76115f6
[dynfees] Implemented `XcmChannelStatusProvider` for `XcmpQueue`
bkontur Aug 11, 2023
ebc0ed1
Update to new version with dynamic fees
bkontur Aug 12, 2023
a701215
Test for calculating base delivery fee on BridgeHubs
bkontur Aug 14, 2023
3a5dfe2
Adjusted test `handle_export_message_from_system_parachain_to_outboun…
bkontur Aug 14, 2023
983eb8d
Disabled `UnpaidExecution` for system parachains
bkontur Aug 14, 2023
9daeb8b
Extended script for local run BHK/P
bkontur Aug 14, 2023
307654e
Added XcmBridgeHubRouterCall::report_bridge_status encodings for AHK/P
bkontur Aug 15, 2023
16ac9a1
Add impl for `CongestedMessage/UncongestedMessage` for BridgeHubs
bkontur Aug 15, 2023
a9b4637
Added const for `XcmBridgeHubRouterTransactCallMaxWeight`
bkontur Aug 15, 2023
4c5e054
Adjusted `require_max_weight` with XcmBridgeHubRouterTransactCallMaxW…
bkontur Aug 15, 2023
5931a57
Introduced base delivery fee constants
bkontur Aug 16, 2023
ad6f236
Congestion messages as Optional to turn on/off `supports_congestion_d…
bkontur Aug 16, 2023
47addc3
Fix for BHRo/Wo
bkontur Aug 16, 2023
7824adb
Added consts for base fee with sanity check
bkontur Aug 16, 2023
ca28825
Merge remote-tracking branch 'origin/bridge-hub-kusama-polkadot' into…
bkontur Aug 16, 2023
8e21f41
Merge remote-tracking branch 'origin/bridge-hub-kusama-polkadot' into…
bkontur Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"bridges/modules/messages",
"bridges/modules/parachains",
"bridges/modules/relayers",
"bridges/modules/xcm-bridge-hub-router",
"client/cli",
"client/collator",
"client/consensus/aura",
Expand Down
2 changes: 2 additions & 0 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bp-parachains = { path = "../../primitives/parachains", default-features = false
bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false }
bp-relayers = { path = "../../primitives/relayers", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false }
pallet-bridge-grandpa = { path = "../../modules/grandpa", default-features = false }
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
pallet-bridge-parachains = { path = "../../modules/parachains", default-features = false }
Expand Down Expand Up @@ -55,6 +56,7 @@ std = [
"bp-parachains/std",
"bp-polkadot-core/std",
"bp-runtime/std",
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"frame-system/std",
Expand Down
29 changes: 24 additions & 5 deletions bridges/bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use crate::messages::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
};
use bp_messages::{InboundLaneData, LaneId, MessageNonce};
use bp_messages::{target_chain::MessageDispatch, InboundLaneData, LaneId, MessageNonce};
use frame_support::{
dispatch::CallableCallFor,
traits::{Get, IsSubType},
Expand Down Expand Up @@ -77,7 +77,12 @@ impl ReceiveMessagesProofInfo {
///
/// - or there are no bundled messages, but the inbound lane is blocked by too many unconfirmed
/// messages and/or unrewarded relayers.
fn is_obsolete(&self) -> bool {
fn is_obsolete(&self, is_dispatcher_active: bool) -> bool {
// if dispatcher is inactive, we don't accept any delivery transactions
if !is_dispatcher_active {
return true
}

// transactions with zero bundled nonces are not allowed, unless they're message
// delivery transactions, which brings reward confirmations required to unblock
// the lane
Expand Down Expand Up @@ -275,7 +280,9 @@ impl<

fn check_obsolete_call(&self) -> TransactionValidity {
match self.call_info() {
Some(CallInfo::ReceiveMessagesProof(proof_info)) if proof_info.is_obsolete() => {
Some(CallInfo::ReceiveMessagesProof(proof_info))
if proof_info.is_obsolete(T::MessageDispatch::is_active()) =>
{
log::trace!(
target: pallet_bridge_messages::LOG_TARGET,
"Rejecting obsolete messages delivery transaction: {:?}",
Expand Down Expand Up @@ -327,8 +334,8 @@ mod tests {
},
messages_call_ext::MessagesCallSubType,
mock::{
MaxUnconfirmedMessagesAtInboundLane, MaxUnrewardedRelayerEntriesAtInboundLane,
TestRuntime, ThisChainRuntimeCall,
DummyMessageDispatch, MaxUnconfirmedMessagesAtInboundLane,
MaxUnrewardedRelayerEntriesAtInboundLane, TestRuntime, ThisChainRuntimeCall,
},
};
use bp_messages::{DeliveredMessages, UnrewardedRelayer, UnrewardedRelayersState};
Expand Down Expand Up @@ -435,6 +442,18 @@ mod tests {
});
}

#[test]
fn extension_reject_call_when_dispatcher_is_inactive() {
sp_io::TestExternalities::new(Default::default()).execute_with(|| {
// when current best delivered is message#10 and we're trying to deliver message 11..=15
// => tx is accepted, but we have inactive dispatcher, so...
deliver_message_10();

DummyMessageDispatch::deactivate();
assert!(!validate_message_delivery(11, 15));
});
}

#[test]
fn extension_rejects_empty_delivery_with_rewards_confirmations_if_there_are_free_relayer_and_message_slots(
) {
Expand Down
Loading