Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e19c82a
added backoff mechanism to inbound bridge queue
svyatonik Jul 13, 2023
30cb294
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Jul 13, 2023
6714576
impl backpressure in the XcmBlobHaulerAdapter
svyatonik Jul 14, 2023
519de78
leave TODOs
svyatonik Jul 14, 2023
921d21e
BridgeMessageProcessor prototype
svyatonik Jul 14, 2023
6aaae89
another TODO
svyatonik Jul 14, 2023
321b9ae
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Jul 17, 2023
e89f119
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Jul 20, 2023
5efb5e0
Revert "also temporary (?) remove BridgesByLocalOrigin because the st…
svyatonik Jul 20, 2023
a007337
prototype for QueuePausedQuery
svyatonik Jul 20, 2023
dd65e9b
implement ExportXcm and MessageDispatch for pallet-xcm-bridge-hub
svyatonik Jul 20, 2023
ffbd4b2
spelling
svyatonik Jul 20, 2023
dd7eeea
flush
svyatonik Jul 20, 2023
5c88d28
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Aug 1, 2023
7e93841
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Aug 1, 2023
a3324ff
small comments to myself
svyatonik Aug 1, 2023
3202065
more backports from dynamic-fees-v1
svyatonik Aug 1, 2023
7444047
use new pallet as exporter and dispatcher in Millau
svyatonik Aug 2, 2023
b836c41
use new pallet as exporter and dispatcher in Rialto
svyatonik Aug 2, 2023
694f133
use new pallet as exporter and dispatcher in RialtoParachain
svyatonik Aug 2, 2023
66ec0f4
flush
svyatonik Aug 2, 2023
ba3ad38
fix remaining compilation issues
svyatonik Aug 16, 2023
5a60dad
warnings + fmt
svyatonik Aug 16, 2023
b843f13
fix tests
svyatonik Aug 16, 2023
d88a43e
LocalXcmChannelManager
svyatonik Aug 21, 2023
5cb5dee
change lane ids
svyatonik Aug 21, 2023
9f757ab
it works!
svyatonik Aug 21, 2023
3516fcb
remove bp-xcm-bridge-hub-router and use LocalXcmChannelManager everyw…
svyatonik Aug 21, 2023
41321b6
removed commented code
svyatonik Aug 22, 2023
0d46366
cleaning up
svyatonik Aug 22, 2023
985a721
cleaning up
svyatonik Aug 22, 2023
ebe5be7
cleaning up
svyatonik Aug 22, 2023
d38fbca
- separated BridgeId and LaneId
svyatonik Aug 22, 2023
fe5f4b1
OnMessagesDelivered is back
svyatonik Aug 3, 2023
8753e37
start using bp-xcm-bridge-hub as OnMessagesDelivered
svyatonik Aug 22, 2023
e087a4e
cleaning up
svyatonik Aug 22, 2023
ac5d8ac
Merge branch 'master' into xcm-dynamic-fees-using-backoff-mechanism
svyatonik Aug 22, 2023
7577a43
spelling
svyatonik Aug 22, 2023
6e174a0
fix stupid issues
svyatonik Aug 23, 2023
d091824
Backport latest relevant dynamic fees changes from v1 to v2 (#2372)
svyatonik Aug 23, 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: 13 additions & 6 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ members = [
"primitives/runtime",
"primitives/test-utils",
"primitives/xcm-bridge-hub",
"primitives/xcm-bridge-hub-router",
"relays/bin-substrate",
"relays/client-bridge-hub-kusama",
"relays/client-bridge-hub-polkadot",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ You will also see the message lane relayers listening for new messages.

```
# Message Relayer Logs
[Millau_to_Rialto_MessageLane_0x52011894c856c0c613a2ad2395dfbb509090f6b7a6aef9359adb75aa26a586c7] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about best message nonces
[Millau_to_Rialto_MessageLane_0xefed785b626e94da3969257012f506524bcec78867420e26ff8c55ddcdb0f7b7] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about best message nonces
[...] [date] INFO bridge Synced Some(2) of Some(3) nonces in Millau::MessagesDelivery -> Rialto::MessagesDelivery race
[...] [date] DEBUG bridge Asking Millau::MessagesDelivery about message nonces
[...] [date] DEBUG bridge Received best nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces { latest_nonce: 0, nonces_data: () }
Expand Down
4 changes: 4 additions & 0 deletions bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "mast
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }

# Polkadot Dependencies

xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
28 changes: 21 additions & 7 deletions bin/millau/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

use bridge_runtime_common::messages_xcm_extension::XcmBlobHauler;
use millau_runtime::{
AccountId, AuraConfig, BalancesConfig, BeefyConfig, BridgeRialtoMessagesConfig,
BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GrandpaConfig,
RuntimeGenesisConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
WASM_BINARY,
XcmRialtoBridgeHubConfig, XcmRialtoParachainBridgeHubConfig, WASM_BINARY,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_beefy::crypto::AuthorityId as BeefyId;
Expand Down Expand Up @@ -225,19 +224,34 @@ fn testnet_genesis(
},
bridge_rialto_messages: BridgeRialtoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(RIALTO_MESSAGES_PALLET_OWNER)),
opened_lanes: vec![millau_runtime::rialto_messages::ToRialtoXcmBlobHauler::xcm_lane()],
opened_lanes: vec![millau_runtime::rialto_messages::Bridge::get().lane_id()],
..Default::default()
},
bridge_rialto_parachain_messages: BridgeRialtoParachainMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(
RIALTO_PARACHAIN_MESSAGES_PALLET_OWNER,
)),
opened_lanes: vec![
millau_runtime::rialto_parachain_messages::ToRialtoParachainXcmBlobHauler::xcm_lane(
),
],
opened_lanes: vec![millau_runtime::rialto_parachain_messages::Bridge::get().lane_id()],
..Default::default()
},
xcm_pallet: Default::default(),
xcm_rialto_bridge_hub: XcmRialtoBridgeHubConfig {
opened_bridges: vec![(
xcm::latest::Junctions::Here.into(),
xcm::latest::InteriorMultiLocation::from(
millau_runtime::xcm_config::RialtoNetwork::get(),
),
)],
..Default::default()
},
xcm_rialto_parachain_bridge_hub: XcmRialtoParachainBridgeHubConfig {
opened_bridges: vec![(
xcm::latest::Junctions::Here.into(),
xcm::latest::InteriorMultiLocation::from(
millau_runtime::xcm_config::RialtoParachainNetwork::get(),
),
)],
..Default::default()
},
}
}
7 changes: 5 additions & 2 deletions bin/millau/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ bp-rialto = { path = "../../../primitives/chain-rialto", default-features = fals
bp-rialto-parachain = { path = "../../../primitives/chain-rialto-parachain", default-features = false }
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
bp-westend = { path = "../../../primitives/chain-westend", default-features = false }
bp-xcm-bridge-hub-router = { path = "../../../primitives/xcm-bridge-hub-router", default-features = false }
bp-xcm-bridge-hub = { path = "../../../primitives/xcm-bridge-hub", default-features = false }
bridge-runtime-common = { path = "../../runtime-common", 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 }
pallet-bridge-relayers = { path = "../../../modules/relayers", default-features = false }
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
pallet-xcm-bridge-hub = { path = "../../../modules/xcm-bridge-hub", default-features = false }
pallet-xcm-bridge-hub-router = { path = "../../../modules/xcm-bridge-hub-router", default-features = false }

# Substrate Dependencies
Expand Down Expand Up @@ -92,7 +93,7 @@ std = [
"bp-rialto-parachain/std",
"bp-runtime/std",
"bp-westend/std",
"bp-xcm-bridge-hub-router/std",
"bp-xcm-bridge-hub/std",
"bridge-runtime-common/std",
"codec/std",
"frame-executive/std",
Expand All @@ -117,6 +118,7 @@ std = [
"pallet-transaction-payment/std",
"pallet-utility/std",
"pallet-xcm/std",
"pallet-xcm-bridge-hub/std",
"pallet-xcm-bridge-hub-router/std",
"scale-info/std",
"sp-api/std",
Expand Down Expand Up @@ -144,6 +146,7 @@ runtime-benchmarks = [
"pallet-bridge-parachains/runtime-benchmarks",
"pallet-bridge-relayers/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"pallet-xcm-bridge-hub/runtime-benchmarks",
"pallet-xcm-bridge-hub-router/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
Expand Down
81 changes: 72 additions & 9 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use xcm_builder::NetworkExportTable;

// to be able to use Millau runtime in `bridge-runtime-common` tests
pub use bridge_runtime_common;
Expand Down Expand Up @@ -442,17 +443,18 @@ impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
type BridgedChain = bp_rialto::Rialto;
type BridgedHeaderChain = BridgeRialtoGrandpa;

type OutboundPayload = bridge_runtime_common::messages_xcm_extension::XcmAsPlainPayload;
type InboundPayload = bridge_runtime_common::messages_xcm_extension::XcmAsPlainPayload;
type OutboundPayload = bp_xcm_bridge_hub::XcmAsPlainPayload;
type InboundPayload = bp_xcm_bridge_hub::XcmAsPlainPayload;

type DeliveryPayments = ();
type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
Runtime,
WithRialtoMessagesInstance,
frame_support::traits::ConstU64<100_000>,
>;
type OnMessagesDelivered = XcmRialtoBridgeHub;

type MessageDispatch = crate::rialto_messages::FromRialtoMessageDispatch;
type MessageDispatch = XcmRialtoBridgeHub;
}

/// Instance of the messages pallet used to relay messages to/from RialtoParachain chain.
Expand All @@ -470,17 +472,18 @@ impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Run
bp_rialto_parachain::RialtoParachain,
>;

type OutboundPayload = bridge_runtime_common::messages_xcm_extension::XcmAsPlainPayload;
type InboundPayload = bridge_runtime_common::messages_xcm_extension::XcmAsPlainPayload;
type OutboundPayload = bp_xcm_bridge_hub::XcmAsPlainPayload;
type InboundPayload = bp_xcm_bridge_hub::XcmAsPlainPayload;

type DeliveryPayments = ();
type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
Runtime,
WithRialtoParachainMessagesInstance,
frame_support::traits::ConstU64<100_000>,
>;
type OnMessagesDelivered = XcmRialtoParachainBridgeHub;

type MessageDispatch = crate::rialto_parachain_messages::FromRialtoParachainMessageDispatch;
type MessageDispatch = XcmRialtoParachainBridgeHub;
}

parameter_types! {
Expand Down Expand Up @@ -527,21 +530,75 @@ impl pallet_utility::Config for Runtime {

// this config is totally incorrect - the pallet is not actually used at this runtime. We need
// it only to be able to run benchmarks and make required traits (and default weights for tests).

parameter_types! {
pub BridgeTable: Vec<(xcm::prelude::NetworkId, xcm::prelude::MultiLocation, Option<xcm::prelude::MultiAsset>)>
= vec![(
xcm_config::RialtoNetwork::get(),
xcm_config::TokenLocation::get(),
Some((xcm_config::TokenAssetId::get(), 1_000_000_000_u128).into()),
)];
}

impl pallet_xcm_bridge_hub_router::Config for Runtime {
type WeightInfo = ();

type UniversalLocation = xcm_config::UniversalLocation;
type SiblingBridgeHubLocation = xcm_config::TokenLocation;
type BridgedNetworkId = xcm_config::RialtoNetwork;
type Bridges = NetworkExportTable<BridgeTable>;

type ToBridgeHubSender = xcm_config::XcmRouter;
type WithBridgeHubChannel = xcm_config::EmulatedSiblingXcmpChannel;
type LocalXcmChannelManager = xcm_config::EmulatedSiblingXcmpChannel;

type BaseFee = ConstU128<1_000_000_000>;
type ByteFee = ConstU128<1_000>;
type FeeAsset = xcm_config::TokenAssetId;
}

/// Instance of the XCM bridge hub pallet used to relay messages to/from Rialto chain.
pub type WithRialtoXcmBridgeHubInstance = ();

impl pallet_xcm_bridge_hub::Config<WithRialtoXcmBridgeHubInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;

type UniversalLocation = xcm_config::UniversalLocation;
type BridgedNetworkId = xcm_config::RialtoNetwork;
type BridgeMessagesPalletInstance = WithRialtoMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = xcm_config::SovereignAccountOf;

type BridgeReserve = ConstU64<1_000_000_000>;
type NativeCurrency = Balances;

type LocalXcmChannelManager = ();
type BlobDispatcher = xcm_config::OnMillauBlobDispatcher;
type MessageExportPrice = ();
}

/// Instance of the XCM bridge hub pallet used to relay messages to/from RialtoParachain chain.
pub type WithRialtoParachainXcmBridgeHubInstance = pallet_xcm_bridge_hub::Instance1;

impl pallet_xcm_bridge_hub::Config<WithRialtoParachainXcmBridgeHubInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;

type UniversalLocation = xcm_config::UniversalLocation;
type BridgedNetworkId = xcm_config::RialtoParachainNetwork;
type BridgeMessagesPalletInstance = WithRialtoParachainMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = xcm_config::SovereignAccountOf;

type BridgeReserve = ConstU64<1_000_000_000>;
type NativeCurrency = Balances;

type LocalXcmChannelManager = ();
type BlobDispatcher = xcm_config::OnMillauBlobDispatcher;
type MessageExportPrice = ();
}

construct_runtime!(
pub enum Runtime {
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Expand Down Expand Up @@ -569,6 +626,7 @@ construct_runtime!(
BridgeRelayers: pallet_bridge_relayers::{Pallet, Call, Storage, Event<T>},
BridgeRialtoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage, Event<T>},
BridgeRialtoMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event<T>, Config<T>},
XcmRialtoBridgeHub: pallet_xcm_bridge_hub::{Pallet, Call, Storage, Event<T>, Config<T>},

// Westend bridge modules.
BridgeWestendGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>},
Expand All @@ -577,6 +635,7 @@ construct_runtime!(
// RialtoParachain bridge modules.
BridgeRialtoParachains: pallet_bridge_parachains::{Pallet, Call, Storage, Event<T>},
BridgeRialtoParachainMessages: pallet_bridge_messages::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>},
XcmRialtoParachainBridgeHub: pallet_xcm_bridge_hub::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>},

// Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
Expand All @@ -602,7 +661,11 @@ pub type PriorityBoostPerMessage = ConstU64<351_343_108>;
pub type BridgeRefundRialtoParachainMessages = RefundBridgedParachainMessages<
Runtime,
RefundableParachain<WithRialtoParachainsInstance, bp_rialto_parachain::RialtoParachain>,
RefundableMessagesLane<Runtime, WithRialtoParachainMessagesInstance>,
RefundableMessagesLane<
Runtime,
WithRialtoParachainMessagesInstance,
rialto_parachain_messages::Lane,
>,
ActualFeeRefund<Runtime>,
PriorityBoostPerMessage,
StrBridgeRefundRialtoPara2000Lane0Msgs,
Expand Down
Loading