Dynamic fees for bridges-v1 (#2294)

* impl backpressure in the XcmBlobHaulerAdapter

* LocalXcmQueueManager + more adapters

* OnMessageDelviered callback

* forbid mesage delivery transactions when the channel between target bridge hub and target asset hub is suspended

* pallet-xcm-bridge-hub-router

* removed commented code

* improvements and tests for palle-xcm-bridge-router

* use LocalXcmChannel in XcmBlobMessageDispatch

* new tests for logic changes in messages pallet

* tests for LocalXcmQueueSuspender

* tests for LocalXcmQueueMessageProcessor

* tests for new logic in the XcmBlobHaulerAdapter

* fix other tests in the bridge-runtime-common

* extension_reject_call_when_dispatcher_is_inactive

* benchmarks for pallet-xcm-bridge-hub-router

* get rid of redundant storage value

* add new pallet to verify-pallets-build.sh

* fixing spellcheck, clippy and rustdoc

* trigger CI

* Revert "trigger CI"

This reverts commit 48f1ba032334e3c6d8470436483736988aa060ac.

* change log target for xcm bridge router pallet

* Update modules/xcm-bridge-hub-router/src/lib.rs

Co-authored-by: Branislav Kontur <bkontur@gmail.com>

* use saturated_len where possible

* fmt

* (Suggestion) Ability to externalize configuration for `ExporterFor` (#2313)

* Ability to externalize configuration for `ExporterFor`
(Replaced `BridgedNetworkId/SiblingBridgeHubLocation` with `Bridges: ExporterFor`)

* Fix millau

* Compile fix

* Return back `BridgedNetworkId` but as optional filter

* Replaced `BaseFee` with fees from inner `Bridges: ExporterFor`

* typo

* Clippy

* Rename LocalXcmChannel to XcmChannelStatusProvider (#2319)

* Rename LocalXcmChannel to XcmChannelStatusProvider

* fmt

* added/fixed some docs

* Dynamic fees v1: report congestion status to sending chain (#2318)

* report congestion status: changes at the sending chain

* OnMessagesDelivered is back

* report congestion status: changes at the bridge hub

* moer logging

* fix? benchmarks

* spelling

* tests for XcmBlobHaulerAdapter and LocalXcmQueueManager

* tests for messages pallet

* fix typo

* rustdoc

* Update modules/messages/src/lib.rs

* apply review suggestions

* ".git/.scripts/commands/fmt/fmt.sh"

* Added `XcmBridgeHubRouterCall::report_bridge_status` encodings for AHK/P (#2350)

* Added `XcmBridgeHubRouterCall::report_bridge_status` encodings for AHK/P

* Spellcheck

* Added const for `XcmBridgeHubRouterTransactCallMaxWeight`

* Cargo.lock

* Introduced base delivery fee constants

* Congestion messages as Optional to turn on/off `supports_congestion_detection`

* Spellcheck

* Ability to externalize dest for benchmarks

* Ability to externalize dest for benchmarks

---------

Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: command-bot <>
This commit is contained in:
Svyatoslav Nikolsky
2023-08-16 16:49:11 +03:00
committed by Bastian Köcher
parent dc8aa5df7d
commit 31a6cbeafb
30 changed files with 2031 additions and 71 deletions
@@ -584,6 +584,7 @@ impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
WithMillauMessagesInstance,
frame_support::traits::ConstU128<100_000>,
>;
type OnMessagesDelivered = ();
type SourceHeaderChain = crate::millau_messages::MillauAsSourceHeaderChain;
type MessageDispatch = crate::millau_messages::FromMillauMessageDispatch;
@@ -26,9 +26,10 @@ use bridge_runtime_common::{
messages::{
self, source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter, MessageBridge,
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
messages_xcm_extension::{SenderAndLane, XcmBlobHauler, XcmBlobHaulerAdapter},
};
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
use xcm::latest::prelude::*;
use xcm_builder::HaulBlobExporter;
/// Default lane that is used to send messages to Millau.
@@ -44,6 +45,11 @@ parameter_types! {
/// 2 XCM instructions is for simple `Trap(42)` program, coming through bridge
/// (it is prepended with `UniversalOrigin` instruction).
pub const WeightCredit: Weight = BASE_XCM_WEIGHT_TWICE;
/// Lane used by the with-Millau bridge.
pub MullauSenderAndLane: SenderAndLane = SenderAndLane::new(Here.into(), XCM_LANE);
/// Dummy message used in configuration.
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}
/// Message payload for RialtoParachain -> Millau messages.
@@ -61,6 +67,7 @@ pub type FromMillauMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
crate::OnRialtoParachainBlobDispatcher,
(),
(),
>;
/// Messages proof for Millau -> RialtoParachain messages.
@@ -122,11 +129,13 @@ pub type ToMillauBlobExporter =
pub struct ToMillauXcmBlobHauler;
impl XcmBlobHauler for ToMillauXcmBlobHauler {
type MessageSender = pallet_bridge_messages::Pallet<Runtime, WithMillauMessagesInstance>;
type Runtime = Runtime;
type MessagesInstance = WithMillauMessagesInstance;
type SenderAndLane = MullauSenderAndLane;
fn xcm_lane() -> LaneId {
XCM_LANE
}
type ToSourceChainSender = crate::XcmRouter;
type CongestedMessage = DummyXcmMessage;
type UncongestedMessage = DummyXcmMessage;
}
#[cfg(test)]