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

Transfer asset via bridge pallet xcm with dynamic fees and back-pressure #2997

Open
wants to merge 31 commits into
base: bko-transfer-asset-via-bridge-pallet-xcm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
429d6b0
Squashed 'bridges/' changes from edf33a2c85..8f86ec78b7
bkontur Aug 10, 2023
6544a5c
Merge commit '429d6b09cab2379e1a118bc4d59dc8f935c5ae2d' into bko-tran…
bkontur Aug 10, 2023
18b425a
[dynfees] Rococo/Wococo does not need congestion and dynamic fees (fo…
bkontur Aug 11, 2023
a399514
Adding paid xcm bridge hub router
bkontur Aug 11, 2023
e5a03a3
[dynfees] Implemented `XcmChannelStatusProvider` for `XcmpQueue`
bkontur Aug 11, 2023
025f109
Allow to change `XcmBridgeHubRouterByteFee` by governance
bkontur Aug 14, 2023
d48d27e
Adding paid xcm bridge hub router to AssetHubPolkadot
bkontur Aug 14, 2023
8b92cd7
Extended script for local run BHK/P
bkontur Aug 14, 2023
43cda64
Docs nits
bkontur Aug 14, 2023
e86d89e
Added XcmBridgeHubRouterCall::report_bridge_status encodings for AHK/P
bkontur Aug 15, 2023
130646c
Added `test_report_bridge_status_call_compatibility` for encodings
bkontur Aug 15, 2023
c82f585
Allowed `xcm::Transact(pallet_xcm_bridge_hub_router::Call::report_bri…
bkontur Aug 15, 2023
05d504a
Added const for `XcmBridgeHubRouterTransactCallMaxWeight`
bkontur Aug 15, 2023
356969d
Added constant for base fee (with sanity check)
bkontur Aug 16, 2023
0a54659
Introduced base delivery fee constants
bkontur Aug 16, 2023
824a480
Congestion messages as Optional to turn on/off `supports_congestion_d…
bkontur Aug 16, 2023
6363103
Fix for BHRo/Wo
bkontur Aug 16, 2023
7fd6d26
Benchmarks for router
bkontur Aug 16, 2023
0f45881
Benchmarks setup for router
bkontur Aug 16, 2023
4bfd8d2
Fix origin for benchmarks
bkontur Aug 16, 2023
22a644e
More fix
bkontur Aug 16, 2023
08642bd
Fix for benchmarks
bkontur Aug 16, 2023
c624475
Fix for benchmarks - need hrmp opened
bkontur Aug 16, 2023
9b045f9
Removed WeightInfo TODO
bkontur Aug 16, 2023
5d7b413
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge-pa…
bkontur Aug 16, 2023
7c87577
Fmt
bkontur Aug 16, 2023
969a48f
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge-pa…
bkontur Aug 16, 2023
7dd0ea9
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge-pa…
bkontur Aug 17, 2023
3f7c7f7
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Aug 17, 2023
a5f04fe
Apply git patch from job: https://gitlab.parity.io/parity/mirrors/cum…
bkontur Aug 17, 2023
cbcfb6f
Apply suggestions from code review
acatangiu Aug 21, 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
32 changes: 32 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
Loading