Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic fees for bridges-v1 #2294

Merged
merged 33 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
74b48e2
impl backpressure in the XcmBlobHaulerAdapter
svyatonik Jul 14, 2023
65787da
LocalXcmQueueManager + more adapters
svyatonik Jul 21, 2023
3c98c24
OnMessageDelviered callback
svyatonik Jul 21, 2023
1fdac85
forbid mesage delivery transactions when the channel between target b…
svyatonik Jul 21, 2023
eea610a
pallet-xcm-bridge-hub-router
svyatonik Jul 24, 2023
c243013
removed commented code
svyatonik Jul 24, 2023
d9a0c2e
improvements and tests for palle-xcm-bridge-router
svyatonik Jul 27, 2023
d9515f7
use LocalXcmChannel in XcmBlobMessageDispatch
svyatonik Jul 27, 2023
084f551
new tests for logic changes in messages pallet
svyatonik Jul 27, 2023
d99420e
tests for LocalXcmQueueSuspender
svyatonik Jul 27, 2023
4c74171
tests for LocalXcmQueueMessageProcessor
svyatonik Jul 27, 2023
b75e64f
tests for new logic in the XcmBlobHaulerAdapter
svyatonik Jul 27, 2023
38cd8f3
fix other tests in the bridge-runtime-common
svyatonik Jul 27, 2023
9582435
extension_reject_call_when_dispatcher_is_inactive
svyatonik Jul 27, 2023
522bbc7
benchmarks for pallet-xcm-bridge-hub-router
svyatonik Jul 28, 2023
ed72ebe
get rid of redundant storage value
svyatonik Jul 28, 2023
c467911
add new pallet to verify-pallets-build.sh
svyatonik Jul 28, 2023
b26aa98
fixing spellcheck, clippy and rustdoc
svyatonik Jul 28, 2023
48f1ba0
trigger CI
svyatonik Jul 28, 2023
773f932
Revert "trigger CI"
svyatonik Jul 28, 2023
8d7a38a
change log target for xcm bridge router pallet
svyatonik Jul 31, 2023
7cc1470
Update modules/xcm-bridge-hub-router/src/lib.rs
svyatonik Aug 2, 2023
5d76f25
use saturated_len where possible
svyatonik Aug 2, 2023
c68467b
fmt
svyatonik Aug 2, 2023
e7cab6a
(Suggestion) Ability to externalize configuration for `ExporterFor` (…
bkontur Aug 3, 2023
dc3618a
Clippy
bkontur Aug 3, 2023
569a80f
Rename LocalXcmChannel to XcmChannelStatusProvider (#2319)
bkontur Aug 3, 2023
add9fb1
added/fixed some docs
svyatonik Aug 4, 2023
f822ebc
Dynamic fees v1: report congestion status to sending chain (#2318)
svyatonik Aug 4, 2023
ccf2f94
Merge remote-tracking branch 'origin/polkadot-staging' into dynamic-f…
bkontur Aug 10, 2023
8f86ec7
".git/.scripts/commands/fmt/fmt.sh"
Aug 10, 2023
91bf164
Added `XcmBridgeHubRouterCall::report_bridge_status` encodings for AH…
bkontur Aug 16, 2023
6dc0f60
Merge remote-tracking branch 'origin/polkadot-staging' into dynamic-f…
bkontur Aug 16, 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
19 changes: 19 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"modules/parachains",
"modules/relayers",
"modules/shift-session-manager",
"modules/xcm-bridge-hub-router",
"primitives/beefy",
"primitives/chain-bridge-hub-cumulus",
"primitives/chain-bridge-hub-kusama",
Expand All @@ -37,6 +38,7 @@ members = [
"primitives/relayers",
"primitives/runtime",
"primitives/test-utils",
"primitives/xcm-bridge-hub-router",
"relays/bin-substrate",
"relays/client-bridge-hub-kusama",
"relays/client-bridge-hub-polkadot",
Expand Down
2 changes: 2 additions & 0 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
WithRialtoMessagesInstance,
frame_support::traits::ConstU64<100_000>,
>;
type OnMessagesDelivered = ();

type SourceHeaderChain = crate::rialto_messages::RialtoAsSourceHeaderChain;
type MessageDispatch = crate::rialto_messages::FromRialtoMessageDispatch;
Expand Down Expand Up @@ -495,6 +496,7 @@ impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Run
WithRialtoParachainMessagesInstance,
frame_support::traits::ConstU64<100_000>,
>;
type OnMessagesDelivered = ();

type SourceHeaderChain = crate::rialto_parachain_messages::RialtoParachainAsSourceHeaderChain;
type MessageDispatch = crate::rialto_parachain_messages::FromRialtoParachainMessageDispatch;
Expand Down
7 changes: 6 additions & 1 deletion bin/millau/runtime/src/rialto_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use bridge_runtime_common::{
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
};
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
use frame_support::{parameter_types, traits::ConstBool, weights::Weight, RuntimeDebug};
use pallet_bridge_relayers::WeightInfoExt as _;
use xcm::latest::prelude::*;
use xcm_builder::HaulBlobExporter;
Expand Down Expand Up @@ -67,6 +67,7 @@ pub type FromRialtoMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
crate::xcm_config::OnMillauBlobDispatcher,
(),
ConstBool<true>,
>;

/// Maximal outbound payload size of Millau -> Rialto messages.
Expand Down Expand Up @@ -131,6 +132,10 @@ impl XcmBlobHauler for ToRialtoXcmBlobHauler {
.into()
}

fn sending_chain_location() -> MultiLocation {
Here.into()
}

fn xcm_lane() -> LaneId {
XCM_LANE
}
Expand Down
7 changes: 6 additions & 1 deletion bin/millau/runtime/src/rialto_parachain_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use bridge_runtime_common::{
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
};
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
use frame_support::{parameter_types, traits::ConstBool, weights::Weight, RuntimeDebug};
use pallet_bridge_relayers::WeightInfoExt as _;
use xcm::latest::prelude::*;
use xcm_builder::HaulBlobExporter;
Expand Down Expand Up @@ -62,6 +62,7 @@ pub type FromRialtoParachainMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
crate::xcm_config::OnMillauBlobDispatcher,
(),
ConstBool<true>,
>;

/// Maximal outbound payload size of Millau -> RialtoParachain messages.
Expand Down Expand Up @@ -132,6 +133,10 @@ impl XcmBlobHauler for ToRialtoParachainXcmBlobHauler {
.into()
}

fn sending_chain_location() -> MultiLocation {
Here.into()
}

fn xcm_lane() -> LaneId {
XCM_LANE
}
Expand Down
1 change: 1 addition & 0 deletions bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion bin/rialto-parachain/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use bridge_runtime_common::{
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
};
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
use frame_support::{parameter_types, traits::ConstBool, weights::Weight, RuntimeDebug};
use xcm::latest::prelude::*;
use xcm_builder::HaulBlobExporter;

Expand Down Expand Up @@ -62,6 +62,7 @@ pub type FromMillauMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
crate::OnRialtoParachainBlobDispatcher,
(),
ConstBool<true>,
>;

/// Messages proof for Millau -> RialtoParachain messages.
Expand Down Expand Up @@ -130,6 +131,10 @@ impl XcmBlobHauler for ToMillauXcmBlobHauler {
pallet_xcm::Origin::from(MultiLocation::new(1, crate::UniversalLocation::get())).into()
}

fn sending_chain_location() -> MultiLocation {
Here.into()
}

fn xcm_lane() -> LaneId {
XCM_LANE
}
Expand Down
1 change: 1 addition & 0 deletions bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,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;
Expand Down
7 changes: 6 additions & 1 deletion bin/rialto/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use bridge_runtime_common::{
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
};
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
use frame_support::{parameter_types, traits::ConstBool, weights::Weight, RuntimeDebug};
use xcm::latest::prelude::*;
use xcm_builder::HaulBlobExporter;

Expand Down Expand Up @@ -59,6 +59,7 @@ pub type FromMillauMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
crate::xcm_config::OnRialtoBlobDispatcher,
(),
ConstBool<true>,
>;

/// Messages proof for Millau -> Rialto messages.
Expand Down Expand Up @@ -130,6 +131,10 @@ impl XcmBlobHauler for ToMillauXcmBlobHauler {
.into()
}

fn sending_chain_location() -> MultiLocation {
Here.into()
}

fn xcm_lane() -> LaneId {
XCM_LANE
}
Expand Down
16 changes: 13 additions & 3 deletions 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,15 @@ 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 {
// TODO: maybe rename method to `is_accepted`, because it isn't about **obsolete** messages
// anymore

// 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 +283,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
Loading