Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 31 additions & 9 deletions Cargo.lock

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

13 changes: 11 additions & 2 deletions parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pallet-aura = { git = "https://github.com/paritytech/substrate", default-feature
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-message-queue = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
Expand Down Expand Up @@ -89,11 +90,14 @@ bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", defau

# Ethereum Bridge (Snowbridge)
snowbridge-core = { path = "../../../../../parachain/primitives/core", default-features = false }
snowbridge-beacon-primitives = { path = "../../../../../parachain/primitives/beacon", default-features = false }
snowbridge-router-primitives = { path = "../../../../../parachain/primitives/router", default-features = false }
snowbridge-beacon-primitives = { path = "../../../../../parachain/primitives/beacon", default-features = false }
snowbridge-inbound-queue = { path = "../../../../../parachain/pallets/inbound-queue", default-features = false }
snowbridge-outbound-queue = { path = "../../../../../parachain/pallets/outbound-queue", default-features = false }
snowbridge-outbound-queue-runtime-api = { path = "../../../../../parachain/pallets/outbound-queue/runtime-api", default-features = false }
snowbridge-ethereum-beacon-client = { path = "../../../../../parachain/pallets/ethereum-beacon-client", default-features = false }
snowbridge-control = { path = "../../../../../parachain/pallets/control", default-features = false }


[dev-dependencies]
static_assertions = "1.1"
Expand Down Expand Up @@ -141,6 +145,7 @@ std = [
"pallet-bridge-parachains/std",
"pallet-bridge-relayers/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-multisig/std",
"pallet-session/std",
"pallet-timestamp/std",
Expand Down Expand Up @@ -170,11 +175,13 @@ std = [
"xcm-executor/std",
"xcm/std",
"snowbridge-core/std",
"snowbridge-beacon-primitives/std",
"snowbridge-router-primitives/std",
"snowbridge-beacon-primitives/std",
"snowbridge-inbound-queue/std",
"snowbridge-outbound-queue/std",
"snowbridge-outbound-queue-runtime-api/std",
"snowbridge-ethereum-beacon-client/std",
"snowbridge-control/std",
"substrate-wasm-builder",
]

Expand All @@ -190,6 +197,7 @@ runtime-benchmarks = [
"pallet-bridge-parachains/runtime-benchmarks",
"pallet-bridge-relayers/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
Expand Down Expand Up @@ -223,6 +231,7 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-multisig/try-runtime",
"pallet-session/try-runtime",
"pallet-timestamp/try-runtime",
Expand Down
53 changes: 47 additions & 6 deletions parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,24 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
}

parameter_types! {
/// Amount of weight that can be spent per block to service messages.
pub MessageQueueServiceWeight: Weight = Weight::from_parts(1_000_000_000, 1_000_000);
pub const MessageQueueHeapSize: u32 = 65_536;
pub const MessageQueueMaxStale: u32 = 16;
}

impl pallet_message_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Size = u32;
type HeapSize = MessageQueueHeapSize;
type MaxStale = MessageQueueMaxStale;
type ServiceWeight = MessageQueueServiceWeight;
type MessageProcessor = EthereumOutboundQueue;
type QueueChangeHandler = ();
type WeightInfo = ();
}

// Add bridge pallets (GPA)

/// Add GRANDPA bridge pallet to track Wococo relay chain on Rococo BridgeHub
Expand Down Expand Up @@ -549,8 +567,6 @@ impl pallet_bridge_relayers::Config for Runtime {

// Ethereum Bridge

use snowbridge_router_primitives::InboundMessageConverter;

parameter_types! {
pub const EthereumNetwork: xcm::v3::NetworkId = xcm::v3::NetworkId::Ethereum { chain_id: 1 };
}
Expand All @@ -564,21 +580,21 @@ impl snowbridge_inbound_queue::Config for Runtime {
type Token = Balances;
type Reward = Reward;
type Verifier = snowbridge_ethereum_beacon_client::Pallet<Runtime>;
type MessageConversion = InboundMessageConverter<EthereumNetwork>;
type XcmSender = XcmRouter;
type WeightInfo = ();
}

parameter_types! {
pub const MaxMessagePayloadSize: u32 = 256;
pub const MaxMessagesPerCommit: u32 = 20;
pub const MaxMessagesPerBlock: u32 = 32;
}

impl snowbridge_outbound_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Hashing = Keccak256;
type MessageQueue = MessageQueue;
type MaxMessagePayloadSize = MaxMessagePayloadSize;
type MaxMessagesPerCommit = MaxMessagesPerCommit;
type MaxMessagesPerBlock = MaxMessagesPerBlock;
type WeightInfo = ();
}

Expand Down Expand Up @@ -635,6 +651,19 @@ impl snowbridge_ethereum_beacon_client::Config for Runtime {
type WeightInfo = weights::snowbridge_ethereum_beacon_client::WeightInfo<Runtime>;
}

parameter_types! {
pub const GovernanceProxyContract: snowbridge_core::ContractId = snowbridge_core::ContractId::new(hex_literal::hex!("44bef07c29162ad04096f5cbe78ca2df62dffe97cea85825f08d13319e13f34a"));
}

impl snowbridge_control::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OwnParaId = ParachainInfo;
type OutboundQueue = EthereumOutboundQueue;
type GovernanceProxyContract = GovernanceProxyContract;
type MessageHasher = BlakeTwo256;
type WeightInfo = ();
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Expand Down Expand Up @@ -689,8 +718,13 @@ construct_runtime!(

// Ethereum Bridge
EthereumInboundQueue: snowbridge_inbound_queue::{Pallet, Call, Config, Storage, Event<T>} = 48,
EthereumOutboundQueue: snowbridge_outbound_queue::{Pallet, Config<T>, Storage, Event<T>} = 49,
EthereumOutboundQueue: snowbridge_outbound_queue::{Pallet, Storage, Event<T>} = 49,
EthereumBeaconClient: snowbridge_ethereum_beacon_client::{Pallet, Call, Storage, Event<T>} = 50,
EthereumControl: snowbridge_control::{Pallet, Call, Storage, Event<T>} = 51,

// Message Queue. Registered after EthereumOutboundQueue so that their `on_initialize` handlers
// run in the desired order.
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 60,
}
);

Expand All @@ -714,6 +748,7 @@ mod benches {
[frame_system, SystemBench::<Runtime>]
[pallet_balances, Balances]
[pallet_multisig, Multisig]
[pallet_message_queue, MessageQueue]
[pallet_session, SessionBench::<Runtime>]
[pallet_utility, Utility]
[pallet_timestamp, Timestamp]
Expand Down Expand Up @@ -969,6 +1004,12 @@ impl_runtime_apis! {
}
}

impl snowbridge_outbound_queue_runtime_api::OutboundQueueApi<Block> for Runtime {
fn prove_message(leaf_index: u64) -> Option<snowbridge_outbound_queue::MerkleProof> {
snowbridge_outbound_queue::api::prove_message::<Runtime>(leaf_index)
}
}

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use super::{
};
use crate::{
bridge_hub_rococo_config::ToBridgeHubWococoHaulBlobExporter,
bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter,
EthereumNetwork,
bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter, EthereumNetwork,
};
use frame_support::{
match_types, parameter_types,
Expand All @@ -34,7 +33,7 @@ use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom};
use polkadot_parachain::primitives::Sibling;
use snowbridge_outbound_queue;
use snowbridge_router_primitives::export::EthereumBlobExporter;
use snowbridge_router_primitives::outbound::EthereumBlobExporter;
use sp_core::Get;
use xcm::latest::prelude::*;
use xcm_builder::{
Expand Down
3 changes: 0 additions & 3 deletions polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ cumulus-primitives-parachain-inherent = { path = "../primitives/parachain-inhere
cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" }
color-print = "0.3.4"

# Ethereum Bridge
snowbridge-outbound-queue-rpc = { path = "../../parachain/pallets/outbound-queue/rpc" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }

Expand Down
3 changes: 0 additions & 3 deletions polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ pub mod rococo {
ethereum_inbound_queue: bridge_hub_rococo_runtime::EthereumInboundQueueConfig {
allowlist: Default::default(),
},
ethereum_outbound_queue: bridge_hub_rococo_runtime::EthereumOutboundQueueConfig {
interval: 1,
},
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions polkadot-parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ where
{
use frame_rpc_system::{System, SystemApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use snowbridge_outbound_queue_rpc::{OutboundQueue, OutboundQueueApiServer};
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};

let mut module = RpcExtension::new(());
Expand All @@ -73,13 +72,6 @@ where
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client, backend.clone(), deny_unsafe).into_rpc())?;

if let Some(outbound_queue_rpc) = backend
.offchain_storage()
.map(|storage| OutboundQueue::<B::OffchainStorage>::new(storage).into_rpc())
{
module.merge(outbound_queue_rpc)?;
}

Ok(module)
}

Expand Down