mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
Update Snowbridge versions and prep for publishing (#2894)
- updates snowbridge crates to `0.9.0` - updates Cargo.toml files in preparation for publishing to crates.io - adds Kusama and Polkadot Snowbridge runtime config crates - moves runtime tests from the Snowbridge subtree into the bridge hub tests dir --------- Co-authored-by: claravanstaden <Cats 4 life!> Co-authored-by: Ron <yrong1997@gmail.com>
This commit is contained in:
Generated
+75
-89
@@ -907,7 +907,6 @@ dependencies = [
|
||||
"rococo-runtime-constants",
|
||||
"scale-info",
|
||||
"smallvec",
|
||||
"snowbridge-rococo-common",
|
||||
"snowbridge-router-primitives",
|
||||
"sp-api",
|
||||
"sp-block-builder",
|
||||
@@ -1952,10 +1951,10 @@ dependencies = [
|
||||
"parachains-common",
|
||||
"serde_json",
|
||||
"snowbridge-core",
|
||||
"snowbridge-inbound-queue",
|
||||
"snowbridge-outbound-queue",
|
||||
"snowbridge-pallet-inbound-queue",
|
||||
"snowbridge-pallet-outbound-queue",
|
||||
"snowbridge-pallet-system",
|
||||
"snowbridge-router-primitives",
|
||||
"snowbridge-system",
|
||||
"sp-core",
|
||||
"sp-runtime",
|
||||
]
|
||||
@@ -1986,11 +1985,10 @@ dependencies = [
|
||||
"rococo-westend-system-emulated-network",
|
||||
"scale-info",
|
||||
"snowbridge-core",
|
||||
"snowbridge-inbound-queue",
|
||||
"snowbridge-outbound-queue",
|
||||
"snowbridge-rococo-common",
|
||||
"snowbridge-pallet-inbound-queue",
|
||||
"snowbridge-pallet-outbound-queue",
|
||||
"snowbridge-pallet-system",
|
||||
"snowbridge-router-primitives",
|
||||
"snowbridge-system",
|
||||
"sp-core",
|
||||
"sp-runtime",
|
||||
"staging-xcm",
|
||||
@@ -2063,14 +2061,14 @@ dependencies = [
|
||||
"smallvec",
|
||||
"snowbridge-beacon-primitives",
|
||||
"snowbridge-core",
|
||||
"snowbridge-ethereum-beacon-client",
|
||||
"snowbridge-inbound-queue",
|
||||
"snowbridge-outbound-queue",
|
||||
"snowbridge-outbound-queue-runtime-api",
|
||||
"snowbridge-rococo-common",
|
||||
"snowbridge-pallet-ethereum-client",
|
||||
"snowbridge-pallet-inbound-queue",
|
||||
"snowbridge-pallet-outbound-queue",
|
||||
"snowbridge-pallet-system",
|
||||
"snowbridge-router-primitives",
|
||||
"snowbridge-runtime-common",
|
||||
"snowbridge-system",
|
||||
"snowbridge-runtime-test-common",
|
||||
"snowbridge-system-runtime-api",
|
||||
"sp-api",
|
||||
"sp-block-builder",
|
||||
@@ -11677,7 +11675,6 @@ dependencies = [
|
||||
"polkadot-runtime-common",
|
||||
"scale-info",
|
||||
"smallvec",
|
||||
"snowbridge-rococo-common",
|
||||
"sp-api",
|
||||
"sp-block-builder",
|
||||
"sp-consensus-aura",
|
||||
@@ -17564,7 +17561,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-beacon-primitives"
|
||||
version = "0.0.1"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"byte-slice-cast",
|
||||
"frame-support",
|
||||
@@ -17588,7 +17585,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-core"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"ethabi-decode",
|
||||
"frame-support",
|
||||
@@ -17611,7 +17608,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-ethereum"
|
||||
version = "0.1.0"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"ethabi-decode",
|
||||
"ethbloom",
|
||||
@@ -17634,8 +17631,36 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-ethereum-beacon-client"
|
||||
version = "0.0.1"
|
||||
name = "snowbridge-outbound-queue-merkle-tree"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"array-bytes 4.2.0",
|
||||
"env_logger 0.9.3",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-core",
|
||||
"sp-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-outbound-queue-runtime-api"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"parity-scale-codec",
|
||||
"snowbridge-core",
|
||||
"snowbridge-outbound-queue-merkle-tree",
|
||||
"sp-api",
|
||||
"sp-core",
|
||||
"sp-std 8.0.0",
|
||||
"staging-xcm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-pallet-ethereum-client"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"bp-runtime",
|
||||
"byte-slice-cast",
|
||||
@@ -17665,8 +17690,8 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-inbound-queue"
|
||||
version = "0.1.1"
|
||||
name = "snowbridge-pallet-inbound-queue"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
@@ -17684,7 +17709,7 @@ dependencies = [
|
||||
"snowbridge-beacon-primitives",
|
||||
"snowbridge-core",
|
||||
"snowbridge-ethereum",
|
||||
"snowbridge-ethereum-beacon-client",
|
||||
"snowbridge-pallet-ethereum-client",
|
||||
"snowbridge-router-primitives",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
@@ -17693,11 +17718,12 @@ dependencies = [
|
||||
"sp-std 8.0.0",
|
||||
"staging-xcm",
|
||||
"staging-xcm-builder",
|
||||
"staging-xcm-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-outbound-queue"
|
||||
version = "0.1.1"
|
||||
name = "snowbridge-pallet-outbound-queue"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"bridge-hub-common",
|
||||
"ethabi-decode",
|
||||
@@ -17721,45 +17747,36 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-outbound-queue-merkle-tree"
|
||||
version = "0.1.1"
|
||||
name = "snowbridge-pallet-system"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"array-bytes 4.2.0",
|
||||
"env_logger 0.9.3",
|
||||
"ethabi-decode",
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"log",
|
||||
"pallet-balances",
|
||||
"pallet-message-queue",
|
||||
"parity-scale-codec",
|
||||
"polkadot-primitives",
|
||||
"scale-info",
|
||||
"sp-core",
|
||||
"sp-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-outbound-queue-runtime-api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"parity-scale-codec",
|
||||
"snowbridge-core",
|
||||
"snowbridge-outbound-queue-merkle-tree",
|
||||
"sp-api",
|
||||
"snowbridge-pallet-outbound-queue",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
"sp-keyring",
|
||||
"sp-runtime",
|
||||
"sp-std 8.0.0",
|
||||
"staging-xcm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-rococo-common"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"log",
|
||||
"staging-xcm",
|
||||
"staging-xcm-builder",
|
||||
"staging-xcm-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-router-primitives"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"ethabi-decode",
|
||||
"frame-support",
|
||||
@@ -17782,7 +17799,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-runtime-common"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
@@ -17795,12 +17812,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-runtime-tests"
|
||||
version = "0.1.0"
|
||||
name = "snowbridge-runtime-test-common"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"asset-hub-rococo-runtime",
|
||||
"assets-common",
|
||||
"bridge-hub-rococo-runtime",
|
||||
"bridge-hub-test-utils",
|
||||
"bridge-runtime-common",
|
||||
"cumulus-pallet-aura-ext",
|
||||
@@ -17839,18 +17854,17 @@ dependencies = [
|
||||
"polkadot-core-primitives",
|
||||
"polkadot-parachain-primitives",
|
||||
"polkadot-runtime-common",
|
||||
"rococo-runtime-constants",
|
||||
"scale-info",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"snowbridge-beacon-primitives",
|
||||
"snowbridge-core",
|
||||
"snowbridge-ethereum-beacon-client",
|
||||
"snowbridge-inbound-queue",
|
||||
"snowbridge-outbound-queue",
|
||||
"snowbridge-outbound-queue-runtime-api",
|
||||
"snowbridge-pallet-ethereum-client",
|
||||
"snowbridge-pallet-inbound-queue",
|
||||
"snowbridge-pallet-outbound-queue",
|
||||
"snowbridge-pallet-system",
|
||||
"snowbridge-router-primitives",
|
||||
"snowbridge-system",
|
||||
"snowbridge-system-runtime-api",
|
||||
"sp-api",
|
||||
"sp-block-builder",
|
||||
@@ -17874,37 +17888,9 @@ dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-system"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"ethabi-decode",
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"log",
|
||||
"pallet-balances",
|
||||
"pallet-message-queue",
|
||||
"parity-scale-codec",
|
||||
"polkadot-primitives",
|
||||
"scale-info",
|
||||
"snowbridge-core",
|
||||
"snowbridge-outbound-queue",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
"sp-keyring",
|
||||
"sp-runtime",
|
||||
"sp-std 8.0.0",
|
||||
"staging-xcm",
|
||||
"staging-xcm-builder",
|
||||
"staging-xcm-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snowbridge-system-runtime-api"
|
||||
version = "0.1.0"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"parity-scale-codec",
|
||||
"snowbridge-core",
|
||||
|
||||
+2
-3
@@ -36,7 +36,7 @@ members = [
|
||||
"bridges/primitives/test-utils",
|
||||
"bridges/primitives/xcm-bridge-hub",
|
||||
"bridges/primitives/xcm-bridge-hub-router",
|
||||
"bridges/snowbridge/parachain/pallets/ethereum-beacon-client",
|
||||
"bridges/snowbridge/parachain/pallets/ethereum-client",
|
||||
"bridges/snowbridge/parachain/pallets/inbound-queue",
|
||||
"bridges/snowbridge/parachain/pallets/outbound-queue",
|
||||
"bridges/snowbridge/parachain/pallets/outbound-queue/merkle-tree",
|
||||
@@ -47,9 +47,8 @@ members = [
|
||||
"bridges/snowbridge/parachain/primitives/core",
|
||||
"bridges/snowbridge/parachain/primitives/ethereum",
|
||||
"bridges/snowbridge/parachain/primitives/router",
|
||||
"bridges/snowbridge/parachain/runtime/rococo-common",
|
||||
"bridges/snowbridge/parachain/runtime/runtime-common",
|
||||
"bridges/snowbridge/parachain/runtime/tests",
|
||||
"bridges/snowbridge/parachain/runtime/test-common",
|
||||
"cumulus/client/cli",
|
||||
"cumulus/client/collator",
|
||||
"cumulus/client/consensus/aura",
|
||||
|
||||
+9
-5
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-ethereum-beacon-client"
|
||||
description = "Snowbridge Beacon Client Pallet"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
name = "snowbridge-pallet-ethereum-client"
|
||||
description = "Snowbridge Ethereum Client Pallet"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -0,0 +1,3 @@
|
||||
# Ethereum Beacon Client
|
||||
|
||||
The Ethereum Beacon Client is an on-chain light client that tracks Ethereum consensus using the beacon chain.
|
||||
+8
-8
@@ -7,15 +7,15 @@ for it is super helpful.
|
||||
|
||||
# Benchmark
|
||||
We add several benchmarks
|
||||
[here](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-beacon-client/src/benchmarking/mod.rs#L98-L124)
|
||||
[here](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-client/src/benchmarking/mod.rs#L98-L124)
|
||||
as following to demonstrate
|
||||
[bls_fast_aggregate_verify](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-beacon-client/src/lib.rs#L764)
|
||||
[bls_fast_aggregate_verify](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-client/src/lib.rs#L764)
|
||||
is the main bottleneck. Test data
|
||||
[here](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-beacon-client/src/benchmarking/data_mainnet.rs#L553-L1120)
|
||||
[here](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-client/src/benchmarking/data_mainnet.rs#L553-L1120)
|
||||
is real from goerli network which contains 512 public keys from sync committee.
|
||||
|
||||
## sync_committee_period_update
|
||||
Base line benchmark for extrinsic [sync_committee_period_update](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-beacon-client/src/lib.rs#L233)
|
||||
Base line benchmark for extrinsic [sync_committee_period_update](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-client/src/lib.rs#L233)
|
||||
|
||||
## bls_fast_aggregate_verify
|
||||
Subfunction of extrinsic `sync_committee_period_update` which does what
|
||||
@@ -59,14 +59,14 @@ cargo run --release --bin polkadot-parachain \
|
||||
benchmark pallet \
|
||||
--base-path /mnt/scratch/benchmark \
|
||||
--chain=bridge-hub-rococo-dev \
|
||||
--pallet=snowbridge_ethereum_beacon_client \
|
||||
--pallet=snowbridge_pallet_ethereum_client \
|
||||
--extrinsic="*" \
|
||||
--execution=wasm --wasm-execution=compiled \
|
||||
--steps 50 --repeat 20 \
|
||||
--output ./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_ethereum_beacon_client.rs
|
||||
--output ./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_pallet_ethereum_client.rs
|
||||
```
|
||||
|
||||
### [Weights](https://github.com/Snowfork/cumulus/blob/ron/benchmark-beacon-bridge/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_ethereum_beacon_client.rs)
|
||||
### [Weights](https://github.com/Snowfork/cumulus/blob/ron/benchmark-beacon-bridge/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_pallet_ethereum_client.rs)
|
||||
|
||||
|extrinsic | minimum execution time benchmarked(us) |
|
||||
| --------------------------------------- |----------------------------------------|
|
||||
@@ -84,5 +84,5 @@ benchmark pallet \
|
||||
# Conclusion
|
||||
|
||||
A high level host function specific for
|
||||
[bls_fast_aggregate_verify](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-beacon-client/src/lib.rs#L764)
|
||||
[bls_fast_aggregate_verify](https://github.com/Snowfork/snowbridge/blob/8891ca3cdcf2e04d8118c206588c956541ae4710/parachain/pallets/ethereum-client/src/lib.rs#L764)
|
||||
is super helpful.
|
||||
+6
-6
@@ -15,7 +15,7 @@ impl<T: Config> Verifier for Pallet<T> {
|
||||
/// ancestor of a finalized beacon block.
|
||||
fn verify(event_log: &Log, proof: &Proof) -> Result<(), VerificationError> {
|
||||
log::info!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Verifying message with block hash {}",
|
||||
proof.block_hash,
|
||||
);
|
||||
@@ -26,7 +26,7 @@ impl<T: Config> Verifier for Pallet<T> {
|
||||
Ok(receipt) => receipt,
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Verification of receipt inclusion failed for block {}: {:?}",
|
||||
proof.block_hash,
|
||||
err
|
||||
@@ -36,7 +36,7 @@ impl<T: Config> Verifier for Pallet<T> {
|
||||
};
|
||||
|
||||
log::trace!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Verified receipt inclusion for transaction at index {} in block {}",
|
||||
proof.tx_index, proof.block_hash,
|
||||
);
|
||||
@@ -52,7 +52,7 @@ impl<T: Config> Verifier for Pallet<T> {
|
||||
|
||||
if !receipt.contains_log(&event_log) {
|
||||
log::error!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Event log not found in receipt for transaction at index {} in block {}",
|
||||
proof.tx_index, proof.block_hash,
|
||||
);
|
||||
@@ -60,7 +60,7 @@ impl<T: Config> Verifier for Pallet<T> {
|
||||
}
|
||||
|
||||
log::info!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Receipt verification successful for {}",
|
||||
proof.block_hash,
|
||||
);
|
||||
@@ -82,7 +82,7 @@ impl<T: Config> Pallet<T> {
|
||||
Ok(receipt) => Ok(receipt),
|
||||
Err(err) => {
|
||||
log::trace!(
|
||||
target: "ethereum-beacon-client",
|
||||
target: "ethereum-client",
|
||||
"💫 Failed to decode transaction receipt: {}",
|
||||
err
|
||||
);
|
||||
+2
-2
@@ -61,7 +61,7 @@ pub use pallet::*;
|
||||
|
||||
pub use config::SLOTS_PER_HISTORICAL_ROOT;
|
||||
|
||||
pub const LOG_TARGET: &str = "ethereum-beacon-client";
|
||||
pub const LOG_TARGET: &str = "ethereum-client";
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
@@ -692,7 +692,7 @@ pub mod pallet {
|
||||
/// Stores the provided execution header in pallet storage. The header is stored
|
||||
/// in a ring buffer map, with the block hash as map key. The last imported execution
|
||||
/// header is also kept in storage, for the relayer to check import progress.
|
||||
pub(crate) fn store_execution_header(
|
||||
pub fn store_execution_header(
|
||||
block_hash: H256,
|
||||
header: CompactExecutionHeader,
|
||||
beacon_slot: u64,
|
||||
+5
-24
@@ -11,6 +11,11 @@ use sp_core::H256;
|
||||
use sp_runtime::traits::{BlakeTwo256, IdentityLookup};
|
||||
use std::{fs::File, path::PathBuf};
|
||||
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
|
||||
fn load_fixture<T>(basename: String) -> Result<T, serde_json::Error>
|
||||
where
|
||||
T: for<'de> serde::Deserialize<'de>,
|
||||
@@ -21,60 +26,36 @@ where
|
||||
}
|
||||
|
||||
pub fn load_execution_header_update_fixture() -> primitives::ExecutionHeaderUpdate {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("execution-header-update.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_checkpoint_update_fixture(
|
||||
) -> primitives::CheckpointUpdate<{ config::SYNC_COMMITTEE_SIZE }> {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("initial-checkpoint.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_sync_committee_update_fixture(
|
||||
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("sync-committee-update.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_finalized_header_update_fixture(
|
||||
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("finalized-header-update.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_next_sync_committee_update_fixture(
|
||||
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("next-sync-committee-update.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_next_finalized_header_update_fixture(
|
||||
) -> primitives::Update<{ config::SYNC_COMMITTEE_SIZE }, { config::SYNC_COMMITTEE_BITS_SIZE }> {
|
||||
#[cfg(feature = "beacon-spec-minimal")]
|
||||
const SPEC: &str = "minimal";
|
||||
#[cfg(not(feature = "beacon-spec-minimal"))]
|
||||
const SPEC: &str = "mainnet";
|
||||
let basename = format!("next-finalized-header-update.{}.json", SPEC);
|
||||
load_fixture(basename).unwrap()
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
// --repeat
|
||||
// 10
|
||||
// --output
|
||||
// pallets/ethereum-beacon-client/src/weights.rs
|
||||
// pallets/ethereum-client/src/weights.rs
|
||||
// --template
|
||||
// templates/module-weight-template.hbs
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-inbound-queue"
|
||||
description = "Snowbridge Inbound Queue"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
name = "snowbridge-pallet-inbound-queue"
|
||||
description = "Snowbridge Inbound Queue Pallet"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -32,6 +36,7 @@ sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-fea
|
||||
|
||||
xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false }
|
||||
xcm-builder = { package = "staging-xcm-builder", path = "../../../../../polkadot/xcm/xcm-builder", default-features = false }
|
||||
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false }
|
||||
|
||||
snowbridge-core = { path = "../../primitives/core", default-features = false }
|
||||
snowbridge-ethereum = { path = "../../primitives/ethereum", default-features = false }
|
||||
@@ -42,7 +47,7 @@ snowbridge-beacon-primitives = { path = "../../primitives/beacon", default-featu
|
||||
frame-benchmarking = { path = "../../../../../substrate/frame/benchmarking" }
|
||||
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
|
||||
snowbridge-beacon-primitives = { path = "../../primitives/beacon" }
|
||||
snowbridge-ethereum-beacon-client = { path = "../../pallets/ethereum-beacon-client" }
|
||||
snowbridge-pallet-ethereum-client = { path = "../../pallets/ethereum-client" }
|
||||
hex-literal = { version = "0.4.1" }
|
||||
|
||||
[features]
|
||||
@@ -68,6 +73,7 @@ std = [
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
@@ -79,15 +85,16 @@ runtime-benchmarks = [
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"snowbridge-beacon-primitives",
|
||||
"snowbridge-core/runtime-benchmarks",
|
||||
"snowbridge-ethereum-beacon-client/runtime-benchmarks",
|
||||
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
|
||||
"snowbridge-router-primitives/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-support/try-runtime",
|
||||
"frame-system/try-runtime",
|
||||
"pallet-balances/try-runtime",
|
||||
"snowbridge-ethereum-beacon-client/try-runtime",
|
||||
"snowbridge-pallet-ethereum-client/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Ethereum Inbound Queue
|
||||
|
||||
Reads messages from Ethereum and sends it to intended destination on Polkadot, using XCM.
|
||||
@@ -44,7 +44,7 @@ use envelope::Envelope;
|
||||
use frame_support::{
|
||||
traits::{
|
||||
fungible::{Inspect, Mutate},
|
||||
tokens::{Fortitude, Precision, Preservation},
|
||||
tokens::Preservation,
|
||||
},
|
||||
weights::WeightToFee,
|
||||
PalletError,
|
||||
@@ -55,18 +55,20 @@ use sp_core::{H160, H256};
|
||||
use sp_std::{convert::TryFrom, vec};
|
||||
use xcm::prelude::{
|
||||
send_xcm, Instruction::SetTopic, Junction::*, Junctions::*, MultiLocation,
|
||||
SendError as XcmpSendError, SendXcm, Xcm, XcmHash,
|
||||
SendError as XcmpSendError, SendXcm, Xcm, XcmContext, XcmHash,
|
||||
};
|
||||
use xcm_executor::traits::TransactAsset;
|
||||
|
||||
use snowbridge_core::{
|
||||
inbound::{Message, VerificationError, Verifier},
|
||||
sibling_sovereign_account, BasicOperatingMode, Channel, ChannelId, ParaId, StaticLookup,
|
||||
sibling_sovereign_account, BasicOperatingMode, Channel, ChannelId, ParaId, PricingParameters,
|
||||
StaticLookup,
|
||||
};
|
||||
use snowbridge_router_primitives::{
|
||||
inbound,
|
||||
inbound::{ConvertMessage, ConvertMessageError},
|
||||
};
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_runtime::{traits::Saturating, SaturatedConversion, TokenError};
|
||||
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
@@ -83,7 +85,6 @@ pub mod pallet {
|
||||
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_system::pallet_prelude::*;
|
||||
use snowbridge_core::PricingParameters;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -135,6 +136,9 @@ pub mod pallet {
|
||||
|
||||
/// The upper limit here only used to estimate delivery cost
|
||||
type MaxMessageSize: Get<u32>;
|
||||
|
||||
/// To withdraw and deposit an asset.
|
||||
type AssetTransactor: TransactAsset;
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
@@ -142,7 +146,7 @@ pub mod pallet {
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T> {
|
||||
pub enum Event<T: Config> {
|
||||
/// A message was received from Ethereum
|
||||
MessageReceived {
|
||||
/// The message channel
|
||||
@@ -151,6 +155,8 @@ pub mod pallet {
|
||||
nonce: u64,
|
||||
/// ID of the XCM message which was forwarded to the final destination parachain
|
||||
message_id: [u8; 32],
|
||||
/// Fee burned for the teleport
|
||||
fee_burned: BalanceOf<T>,
|
||||
},
|
||||
/// Set OperatingMode
|
||||
OperatingModeChanged { mode: BasicOperatingMode },
|
||||
@@ -268,17 +274,16 @@ pub mod pallet {
|
||||
Err(_) => return Err(Error::<T>::InvalidPayload.into()),
|
||||
};
|
||||
|
||||
// We embed fees for xcm execution inside the xcm program using teleports
|
||||
// so we must burn the amount of the fee embedded into the XCM script.
|
||||
T::Token::burn_from(&sovereign_account, fee, Precision::Exact, Fortitude::Polite)?;
|
||||
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"💫 xcm {:?} sent with fee {:?}",
|
||||
"💫 xcm decoded as {:?} with fee {:?}",
|
||||
xcm,
|
||||
fee
|
||||
);
|
||||
|
||||
// Burning fees for teleport
|
||||
Self::burn_fees(channel.para_id, fee)?;
|
||||
|
||||
// Attempt to send XCM to a dest parachain
|
||||
let message_id = Self::send_xcm(xcm, channel.para_id)?;
|
||||
|
||||
@@ -286,6 +291,7 @@ pub mod pallet {
|
||||
channel_id: envelope.channel_id,
|
||||
nonce: envelope.nonce,
|
||||
message_id,
|
||||
fee_burned: fee,
|
||||
});
|
||||
|
||||
Ok(())
|
||||
@@ -330,6 +336,30 @@ pub mod pallet {
|
||||
.saturating_add(len_fee)
|
||||
.saturating_add(T::PricingParameters::get().rewards.local)
|
||||
}
|
||||
|
||||
/// Burn the amount of the fee embedded into the XCM for teleports
|
||||
pub fn burn_fees(para_id: ParaId, fee: BalanceOf<T>) -> DispatchResult {
|
||||
let dummy_context =
|
||||
XcmContext { origin: None, message_id: Default::default(), topic: None };
|
||||
let dest = MultiLocation { parents: 1, interior: X1(Parachain(para_id.into())) };
|
||||
let fees = (MultiLocation::parent(), fee.saturated_into::<u128>()).into();
|
||||
T::AssetTransactor::can_check_out(&dest, &fees, &dummy_context).map_err(|error| {
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
"XCM asset check out failed with error {:?}", error
|
||||
);
|
||||
TokenError::FundsUnavailable
|
||||
})?;
|
||||
T::AssetTransactor::check_out(&dest, &fees, &dummy_context);
|
||||
T::AssetTransactor::withdraw_asset(&fees, &dest, None).map_err(|error| {
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
"XCM asset withdraw failed with error {:?}", error
|
||||
);
|
||||
TokenError::FundsUnavailable
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// API for accessing the delivery cost of a message
|
||||
|
||||
@@ -22,6 +22,7 @@ use sp_runtime::{
|
||||
};
|
||||
use sp_std::convert::From;
|
||||
use xcm::v3::{prelude::*, MultiAssets, SendXcm};
|
||||
use xcm_executor::Assets;
|
||||
|
||||
use crate::{self as inbound_queue};
|
||||
|
||||
@@ -32,7 +33,7 @@ frame_support::construct_runtime!(
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
EthereumBeaconClient: snowbridge_ethereum_beacon_client::{Pallet, Call, Storage, Event<T>},
|
||||
EthereumBeaconClient: snowbridge_pallet_ethereum_client::{Pallet, Call, Storage, Event<T>},
|
||||
InboundQueue: inbound_queue::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -112,7 +113,7 @@ parameter_types! {
|
||||
};
|
||||
}
|
||||
|
||||
impl snowbridge_ethereum_beacon_client::Config for Test {
|
||||
impl snowbridge_pallet_ethereum_client::Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ForkVersions = ChainForkVersions;
|
||||
type MaxExecutionHeadersToKeep = ExecutionHeadersPruneThreshold;
|
||||
@@ -142,7 +143,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl<T: snowbridge_ethereum_beacon_client::Config> BenchmarkHelper<T> for Test {
|
||||
impl<T: snowbridge_pallet_ethereum_client::Config> BenchmarkHelper<T> for Test {
|
||||
// not implemented since the MockVerifier is used for tests
|
||||
fn initialize_storage(_: H256, _: CompactExecutionHeader) {}
|
||||
}
|
||||
@@ -200,6 +201,50 @@ impl StaticLookup for MockChannelLookup {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SuccessfulTransactor;
|
||||
impl TransactAsset for SuccessfulTransactor {
|
||||
fn can_check_in(
|
||||
_origin: &MultiLocation,
|
||||
_what: &MultiAsset,
|
||||
_context: &XcmContext,
|
||||
) -> XcmResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn can_check_out(
|
||||
_dest: &MultiLocation,
|
||||
_what: &MultiAsset,
|
||||
_context: &XcmContext,
|
||||
) -> XcmResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn deposit_asset(
|
||||
_what: &MultiAsset,
|
||||
_who: &MultiLocation,
|
||||
_context: Option<&XcmContext>,
|
||||
) -> XcmResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn withdraw_asset(
|
||||
_what: &MultiAsset,
|
||||
_who: &MultiLocation,
|
||||
_context: Option<&XcmContext>,
|
||||
) -> Result<Assets, XcmError> {
|
||||
Ok(Assets::default())
|
||||
}
|
||||
|
||||
fn internal_transfer_asset(
|
||||
_what: &MultiAsset,
|
||||
_from: &MultiLocation,
|
||||
_to: &MultiLocation,
|
||||
_context: &XcmContext,
|
||||
) -> Result<Assets, XcmError> {
|
||||
Ok(Assets::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl inbound_queue::Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Verifier = MockVerifier;
|
||||
@@ -221,6 +266,7 @@ impl inbound_queue::Config for Test {
|
||||
type WeightToFee = IdentityFee<u128>;
|
||||
type LengthToFee = IdentityFee<u128>;
|
||||
type MaxMessageSize = ConstU32<1024>;
|
||||
type AssetTransactor = SuccessfulTransactor;
|
||||
}
|
||||
|
||||
pub fn last_events(n: usize) -> Vec<RuntimeEvent> {
|
||||
|
||||
@@ -44,6 +44,7 @@ fn test_submit_happy_path() {
|
||||
27, 217, 88, 127, 46, 143, 199, 70, 236, 66, 212, 244, 85, 221, 153, 104, 175, 37,
|
||||
224, 20, 140, 95, 140, 7, 27, 74, 182, 199, 77, 12, 194, 236,
|
||||
],
|
||||
fee_burned: 110000000000,
|
||||
}
|
||||
.into()]);
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-outbound-queue"
|
||||
description = "Snowbridge Outbound Queue"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
name = "snowbridge-pallet-outbound-queue"
|
||||
description = "Snowbridge Outbound Queue Pallet"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Ethereum Outbound Queue
|
||||
|
||||
Sends messages from an origin in the Polkadot ecosystem to Ethereum.
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-outbound-queue-merkle-tree"
|
||||
description = "Snowbridge Outbound Queue Merkle Tree"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Snowbridge Outbound Queue Merkle Tree
|
||||
|
||||
This crate implements a simple binary Merkle Tree utilities required for inter-op with Ethereum
|
||||
bridge & Solidity contract.
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-outbound-queue-runtime-api"
|
||||
description = "Snowbridge Outbound Queue Runtime API"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Ethereum Outbound Queue Runtime API
|
||||
|
||||
Provides an API:
|
||||
|
||||
- to generate merkle proofs for outbound messages
|
||||
- calculate delivery fee for delivering messages to Ethereum
|
||||
@@ -5,10 +5,10 @@
|
||||
//! # Overview
|
||||
//!
|
||||
//! Messages come either from sibling parachains via XCM, or BridgeHub itself
|
||||
//! via the `snowbridge-system` pallet:
|
||||
//! via the `snowbridge-pallet-system`:
|
||||
//!
|
||||
//! 1. `snowbridge_router_primitives::outbound::EthereumBlobExporter::deliver`
|
||||
//! 2. `snowbridge_system::Pallet::send`
|
||||
//! 2. `snowbridge_pallet_system::Pallet::send`
|
||||
//!
|
||||
//! The message submission pipeline works like this:
|
||||
//! 1. The message is first validated via the implementation for
|
||||
|
||||
@@ -110,7 +110,7 @@ fn process_message_fails_on_max_nonce_reached() {
|
||||
channel_id,
|
||||
command: mock_message(sibling_id).command,
|
||||
};
|
||||
let versioned_queued_message: VersionedQueuedMessage = message.into();
|
||||
let versioned_queued_message: VersionedQueuedMessage = message.try_into().unwrap();
|
||||
let encoded = versioned_queued_message.encode();
|
||||
let mut meter = WeightMeter::with_limit(Weight::MAX);
|
||||
|
||||
@@ -134,7 +134,7 @@ fn process_message_fails_on_overweight_message() {
|
||||
channel_id,
|
||||
command: mock_message(sibling_id).command,
|
||||
};
|
||||
let versioned_queued_message: VersionedQueuedMessage = message.into();
|
||||
let versioned_queued_message: VersionedQueuedMessage = message.try_into().unwrap();
|
||||
let encoded = versioned_queued_message.encode();
|
||||
let mut meter = WeightMeter::with_limit(Weight::from_parts(1, 1));
|
||||
assert_noop!(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
//! Autogenerated weights for `snowbridge_outbound_queue`
|
||||
//! Autogenerated weights for `snowbridge-pallet-outbound-queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-10-19, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
@@ -12,7 +12,7 @@
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=bridge-hub-rococo-dev
|
||||
// --pallet=snowbridge_outbound_queue
|
||||
// --pallet=snowbridge-pallet-outbound-queue
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
@@ -29,7 +29,7 @@
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for `snowbridge_outbound_queue`.
|
||||
/// Weight functions needed for `snowbridge-pallet-outbound-queue`.
|
||||
pub trait WeightInfo {
|
||||
fn do_process_message() -> Weight;
|
||||
fn commit() -> Weight;
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-system"
|
||||
description = "Snowbridge System"
|
||||
version = "0.1.1"
|
||||
name = "snowbridge-pallet-system"
|
||||
description = "Snowbridge System Pallet"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -39,7 +43,7 @@ pallet-balances = { path = "../../../../../substrate/frame/balances" }
|
||||
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
|
||||
polkadot-primitives = { path = "../../../../../polkadot/primitives" }
|
||||
pallet-message-queue = { path = "../../../../../substrate/frame/message-queue" }
|
||||
snowbridge-outbound-queue = { path = "../outbound-queue" }
|
||||
snowbridge-pallet-outbound-queue = { path = "../outbound-queue" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -68,7 +72,7 @@ runtime-benchmarks = [
|
||||
"pallet-message-queue/runtime-benchmarks",
|
||||
"polkadot-primitives/runtime-benchmarks",
|
||||
"snowbridge-core/runtime-benchmarks",
|
||||
"snowbridge-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-outbound-queue/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
@@ -78,6 +82,6 @@ try-runtime = [
|
||||
"frame-system/try-runtime",
|
||||
"pallet-balances/try-runtime",
|
||||
"pallet-message-queue/try-runtime",
|
||||
"snowbridge-outbound-queue/try-runtime",
|
||||
"snowbridge-pallet-outbound-queue/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
License: MIT-0
|
||||
# Ethereum System
|
||||
|
||||
Contains management functions to manage functions on Ethereum. For example, creating agents and channels.
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-system-runtime-api"
|
||||
description = "Snowbridge System Runtime API"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
repository = "https://github.com/Snowfork/snowbridge"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Ethereum System Runtime API
|
||||
|
||||
Provides an API for looking up an agent ID on Ethereum.
|
||||
@@ -79,6 +79,8 @@ use xcm_executor::traits::ConvertLocation;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use frame_support::traits::OriginTrait;
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
pub type BalanceOf<T> =
|
||||
<<T as pallet::Config>::Token as Inspect<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
|
||||
|
||||
@@ -89,7 +89,7 @@ frame_support::construct_runtime!(
|
||||
System: frame_system,
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
XcmOrigin: pallet_xcm_origin::{Pallet, Origin},
|
||||
OutboundQueue: snowbridge_outbound_queue::{Pallet, Call, Storage, Event<T>},
|
||||
OutboundQueue: snowbridge_pallet_outbound_queue::{Pallet, Call, Storage, Event<T>},
|
||||
EthereumSystem: snowbridge_system,
|
||||
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ parameter_types! {
|
||||
pub const OwnParaId: ParaId = ParaId::new(1013);
|
||||
}
|
||||
|
||||
impl snowbridge_outbound_queue::Config for Test {
|
||||
impl snowbridge_pallet_outbound_queue::Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Hashing = Keccak256;
|
||||
type MessageQueue = MessageQueue;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-beacon-primitives"
|
||||
description = "Snowbridge Beacon Primitives"
|
||||
version = "0.0.1"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.195", optional = true, features = ["derive"] }
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Beacon Primitives
|
||||
|
||||
Crate with low-level supporting functions for the beacon client, including:
|
||||
|
||||
- bls12-381 signature handling to verify signatures on the beacon chain
|
||||
- merkle proofs
|
||||
- receipt verification
|
||||
- ssz types
|
||||
|
||||
The code in this crate relates to the Ethereum consensus chain, commonly referred to as the beacon chain.
|
||||
@@ -1,10 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-core"
|
||||
description = "Snowbridge Core"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.195", optional = true, features = ["alloc", "derive"], default-features = false }
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Core Primitives
|
||||
|
||||
Contains common code core to Snowbridge, such as inbound and outbound queue types, pricing structs, ringbuffer data
|
||||
types (used in the beacon client).
|
||||
@@ -1,10 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-ethereum"
|
||||
description = "Snowbridge Ethereum"
|
||||
version = "0.1.0"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.195", optional = true, features = ["derive"] }
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ethereum Primitives
|
||||
|
||||
Contains code necessary to decode RLP encoded data (like the Ethereum log), structs for Ethereum execution headers. The
|
||||
code in this crate relates to the Ethereum execution chain.
|
||||
@@ -1,10 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-router-primitives"
|
||||
description = "Snowbridge Router Primitives"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.195", optional = true, features = ["derive"] }
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Router Primitives
|
||||
|
||||
Inbound and outbound router logic. Does XCM conversion to a lowered, simpler format the Ethereum contracts can
|
||||
understand.
|
||||
@@ -1,26 +0,0 @@
|
||||
[package]
|
||||
name = "snowbridge-rococo-common"
|
||||
description = "Snowbridge Rococo Common"
|
||||
version = "0.0.1"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
log = { version = "0.4.20", default-features = false }
|
||||
|
||||
frame-support = { path = "../../../../../substrate/frame/support", default-features = false }
|
||||
xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"frame-support/std",
|
||||
"log/std",
|
||||
"xcm/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"frame-support/runtime-benchmarks",
|
||||
]
|
||||
@@ -1,16 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
||||
//! # Rococo Common
|
||||
//!
|
||||
//! Config used for the Rococo asset hub and bridge hub runtimes.
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use frame_support::parameter_types;
|
||||
use xcm::opaque::lts::NetworkId;
|
||||
|
||||
pub const INBOUND_QUEUE_MESSAGES_PALLET_INDEX: u8 = 80;
|
||||
|
||||
parameter_types! {
|
||||
// Network and location for the Ethereum chain.
|
||||
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 };
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
[package]
|
||||
name = "snowbridge-runtime-common"
|
||||
description = "Snowbridge Runtime Common"
|
||||
version = "0.1.1"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
log = { version = "0.4.20", default-features = false }
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Snowbridge Runtime Common
|
||||
|
||||
Common crate to contain runtime related structs and implementations for Snowbridge.
|
||||
+18
-63
@@ -1,10 +1,14 @@
|
||||
[package]
|
||||
name = "snowbridge-runtime-tests"
|
||||
name = "snowbridge-runtime-test-common"
|
||||
description = "Snowbridge Runtime Tests"
|
||||
version = "0.1.0"
|
||||
version = "0.9.0"
|
||||
authors = ["Snowfork <contact@snowfork.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
categories = ["cryptography::cryptocurrencies"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
@@ -48,7 +52,6 @@ sp-transaction-pool = { path = "../../../../../substrate/primitives/transaction-
|
||||
sp-version = { path = "../../../../../substrate/primitives/version", default-features = false }
|
||||
|
||||
# Polkadot
|
||||
rococo-runtime-constants = { path = "../../../../../polkadot/runtime/rococo/constants", default-features = false }
|
||||
pallet-xcm = { path = "../../../../../polkadot/xcm/pallet-xcm", default-features = false }
|
||||
pallet-xcm-benchmarks = { path = "../../../../../polkadot/xcm/pallet-xcm-benchmarks", default-features = false, optional = true }
|
||||
polkadot-core-primitives = { path = "../../../../../polkadot/core-primitives", default-features = false }
|
||||
@@ -71,19 +74,17 @@ pallet-collator-selection = { path = "../../../../../cumulus/pallets/collator-se
|
||||
parachain-info = { package = "staging-parachain-info", path = "../../../../../cumulus/parachains/pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../../../cumulus/parachains/common", default-features = false }
|
||||
parachains-runtimes-test-utils = { path = "../../../../../cumulus/parachains/runtimes/test-utils", default-features = false }
|
||||
bridge-hub-rococo-runtime = { path = "../../../../../cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo", default-features = false }
|
||||
asset-hub-rococo-runtime = { path = "../../../../../cumulus/parachains/runtimes/assets/asset-hub-rococo", default-features = false }
|
||||
assets-common = { path = "../../../../../cumulus/parachains/runtimes/assets/common", default-features = false }
|
||||
|
||||
# Ethereum Bridge (Snowbridge)
|
||||
snowbridge-core = { path = "../../primitives/core", default-features = false }
|
||||
snowbridge-beacon-primitives = { path = "../../primitives/beacon", default-features = false }
|
||||
snowbridge-router-primitives = { path = "../../primitives/router", default-features = false }
|
||||
snowbridge-ethereum-beacon-client = { path = "../../pallets/ethereum-beacon-client", default-features = false }
|
||||
snowbridge-inbound-queue = { path = "../../pallets/inbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue = { path = "../../pallets/outbound-queue", default-features = false }
|
||||
snowbridge-pallet-ethereum-client = { path = "../../pallets/ethereum-client", default-features = false }
|
||||
snowbridge-pallet-inbound-queue = { path = "../../pallets/inbound-queue", default-features = false }
|
||||
snowbridge-pallet-outbound-queue = { path = "../../pallets/outbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue-runtime-api = { path = "../../pallets/outbound-queue/runtime-api", default-features = false }
|
||||
snowbridge-system = { path = "../../pallets/system", default-features = false }
|
||||
snowbridge-pallet-system = { path = "../../pallets/system", default-features = false }
|
||||
snowbridge-system-runtime-api = { path = "../../pallets/system/runtime-api", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -95,9 +96,7 @@ sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"asset-hub-rococo-runtime/std",
|
||||
"assets-common/std",
|
||||
"bridge-hub-rococo-runtime/std",
|
||||
"codec/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-dmp-queue/std",
|
||||
@@ -134,18 +133,17 @@ std = [
|
||||
"polkadot-core-primitives/std",
|
||||
"polkadot-parachain-primitives/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"rococo-runtime-constants/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"snowbridge-beacon-primitives/std",
|
||||
"snowbridge-core/std",
|
||||
"snowbridge-ethereum-beacon-client/std",
|
||||
"snowbridge-inbound-queue/std",
|
||||
"snowbridge-outbound-queue-runtime-api/std",
|
||||
"snowbridge-outbound-queue/std",
|
||||
"snowbridge-pallet-ethereum-client/std",
|
||||
"snowbridge-pallet-inbound-queue/std",
|
||||
"snowbridge-pallet-outbound-queue/std",
|
||||
"snowbridge-pallet-system/std",
|
||||
"snowbridge-router-primitives/std",
|
||||
"snowbridge-system-runtime-api/std",
|
||||
"snowbridge-system/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
@@ -166,9 +164,7 @@ std = [
|
||||
]
|
||||
|
||||
runtime-benchmarks = [
|
||||
"asset-hub-rococo-runtime/runtime-benchmarks",
|
||||
"assets-common/runtime-benchmarks",
|
||||
"bridge-hub-rococo-runtime/runtime-benchmarks",
|
||||
"bridge-runtime-common/runtime-benchmarks",
|
||||
"cumulus-pallet-dmp-queue/runtime-benchmarks",
|
||||
"cumulus-pallet-parachain-system/runtime-benchmarks",
|
||||
@@ -192,53 +188,12 @@ runtime-benchmarks = [
|
||||
"polkadot-parachain-primitives/runtime-benchmarks",
|
||||
"polkadot-runtime-common/runtime-benchmarks",
|
||||
"snowbridge-core/runtime-benchmarks",
|
||||
"snowbridge-ethereum-beacon-client/runtime-benchmarks",
|
||||
"snowbridge-inbound-queue/runtime-benchmarks",
|
||||
"snowbridge-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
|
||||
"snowbridge-pallet-inbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-system/runtime-benchmarks",
|
||||
"snowbridge-router-primitives/runtime-benchmarks",
|
||||
"snowbridge-system/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
]
|
||||
|
||||
try-runtime = [
|
||||
"asset-hub-rococo-runtime/try-runtime",
|
||||
"bridge-hub-rococo-runtime/try-runtime",
|
||||
"cumulus-pallet-aura-ext/try-runtime",
|
||||
"cumulus-pallet-dmp-queue/try-runtime",
|
||||
"cumulus-pallet-parachain-system/try-runtime",
|
||||
"cumulus-pallet-xcm/try-runtime",
|
||||
"cumulus-pallet-xcmp-queue/try-runtime",
|
||||
"frame-executive/try-runtime",
|
||||
"frame-support/try-runtime",
|
||||
"frame-system/try-runtime",
|
||||
"frame-try-runtime/try-runtime",
|
||||
"pallet-aura/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",
|
||||
"pallet-transaction-payment/try-runtime",
|
||||
"pallet-utility/try-runtime",
|
||||
"pallet-xcm/try-runtime",
|
||||
"parachain-info/try-runtime",
|
||||
"polkadot-runtime-common/try-runtime",
|
||||
"snowbridge-ethereum-beacon-client/try-runtime",
|
||||
"snowbridge-inbound-queue/try-runtime",
|
||||
"snowbridge-outbound-queue/try-runtime",
|
||||
"snowbridge-system/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
fast-runtime = [
|
||||
"bridge-hub-rococo-runtime/fast-runtime",
|
||||
]
|
||||
experimental = ["pallet-aura/experimental"]
|
||||
|
||||
# A feature that should be enabled when the runtime should be built for on-chain
|
||||
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
|
||||
# to make it smaller like logging for example.
|
||||
on-chain-release-build = ["sp-api/disable-logging"]
|
||||
@@ -0,0 +1,3 @@
|
||||
# Runtime Tests
|
||||
|
||||
Tests runtime config and bridge functionality in the boundaries of a runtime.
|
||||
+25
-24
@@ -1,12 +1,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
||||
|
||||
//! Module contains predefined test-case scenarios for `Runtime` with bridging capabilities.
|
||||
|
||||
use asset_hub_rococo_runtime::xcm_config::bridging::to_ethereum::DefaultBridgeHubEthereumBaseFee;
|
||||
use bridge_hub_rococo_runtime::EthereumSystem;
|
||||
use codec::Encode;
|
||||
use frame_support::{assert_err, assert_ok, traits::fungible::Mutate};
|
||||
pub use parachains_runtimes_test_utils::test_cases::change_storage_constant_by_governance_works;
|
||||
use parachains_runtimes_test_utils::{
|
||||
AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, ValidatorIdOf, XcmReceivedFrom,
|
||||
};
|
||||
@@ -49,7 +46,7 @@ where
|
||||
+ parachain_info::Config
|
||||
+ pallet_collator_selection::Config
|
||||
+ cumulus_pallet_parachain_system::Config
|
||||
+ snowbridge_outbound_queue::Config,
|
||||
+ snowbridge_pallet_outbound_queue::Config,
|
||||
XcmConfig: xcm_executor::Config,
|
||||
{
|
||||
let assethub_parachain_location = MultiLocation::new(1, Parachain(assethub_parachain_id));
|
||||
@@ -109,8 +106,8 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
|
||||
weth_contract_address: H160,
|
||||
destination_address: H160,
|
||||
fee_amount: u128,
|
||||
snowbridge_outbound_queue: Box<
|
||||
dyn Fn(Vec<u8>) -> Option<snowbridge_outbound_queue::Event<Runtime>>,
|
||||
snowbridge_pallet_outbound_queue: Box<
|
||||
dyn Fn(Vec<u8>) -> Option<snowbridge_pallet_outbound_queue::Event<Runtime>>,
|
||||
>,
|
||||
) where
|
||||
Runtime: frame_system::Config
|
||||
@@ -120,8 +117,8 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
|
||||
+ parachain_info::Config
|
||||
+ pallet_collator_selection::Config
|
||||
+ cumulus_pallet_parachain_system::Config
|
||||
+ snowbridge_outbound_queue::Config
|
||||
+ snowbridge_system::Config,
|
||||
+ snowbridge_pallet_outbound_queue::Config
|
||||
+ snowbridge_pallet_system::Config,
|
||||
XcmConfig: xcm_executor::Config,
|
||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||
{
|
||||
@@ -132,14 +129,14 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
|
||||
.with_tracing()
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
EthereumSystem::initialize(runtime_para_id.into(), assethub_parachain_id.into())
|
||||
.unwrap();
|
||||
<snowbridge_pallet_system::Pallet<Runtime>>::initialize(
|
||||
runtime_para_id.into(),
|
||||
assethub_parachain_id.into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// fund asset hub sovereign account enough so it can pay fees
|
||||
initial_fund::<Runtime>(
|
||||
assethub_parachain_id,
|
||||
DefaultBridgeHubEthereumBaseFee::get() + 1_000_000_000,
|
||||
);
|
||||
initial_fund::<Runtime>(assethub_parachain_id, 5_000_000_000_000);
|
||||
|
||||
let outcome = send_transfer_token_message::<Runtime, XcmConfig>(
|
||||
assethub_parachain_id,
|
||||
@@ -153,10 +150,11 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
|
||||
// check events
|
||||
let mut events = <frame_system::Pallet<Runtime>>::events()
|
||||
.into_iter()
|
||||
.filter_map(|e| snowbridge_outbound_queue(e.event.encode()));
|
||||
assert!(
|
||||
events.any(|e| matches!(e, snowbridge_outbound_queue::Event::MessageQueued { .. }))
|
||||
);
|
||||
.filter_map(|e| snowbridge_pallet_outbound_queue(e.event.encode()));
|
||||
assert!(events.any(|e| matches!(
|
||||
e,
|
||||
snowbridge_pallet_outbound_queue::Event::MessageQueued { .. }
|
||||
)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -174,7 +172,7 @@ pub fn send_unpaid_transfer_token_message<Runtime, XcmConfig>(
|
||||
+ parachain_info::Config
|
||||
+ pallet_collator_selection::Config
|
||||
+ cumulus_pallet_parachain_system::Config
|
||||
+ snowbridge_outbound_queue::Config,
|
||||
+ snowbridge_pallet_outbound_queue::Config,
|
||||
XcmConfig: xcm_executor::Config,
|
||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||
{
|
||||
@@ -263,8 +261,8 @@ pub fn send_transfer_token_message_failure<Runtime, XcmConfig>(
|
||||
+ parachain_info::Config
|
||||
+ pallet_collator_selection::Config
|
||||
+ cumulus_pallet_parachain_system::Config
|
||||
+ snowbridge_outbound_queue::Config
|
||||
+ snowbridge_system::Config,
|
||||
+ snowbridge_pallet_outbound_queue::Config
|
||||
+ snowbridge_pallet_system::Config,
|
||||
XcmConfig: xcm_executor::Config,
|
||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||
{
|
||||
@@ -275,8 +273,11 @@ pub fn send_transfer_token_message_failure<Runtime, XcmConfig>(
|
||||
.with_tracing()
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
EthereumSystem::initialize(runtime_para_id.into(), assethub_parachain_id.into())
|
||||
.unwrap();
|
||||
<snowbridge_pallet_system::Pallet<Runtime>>::initialize(
|
||||
runtime_para_id.into(),
|
||||
assethub_parachain_id.into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// fund asset hub sovereign account enough so it can pay fees
|
||||
initial_fund::<Runtime>(assethub_parachain_id, initial_amount);
|
||||
@@ -7,9 +7,9 @@ cargo run --release --bin polkadot-parachain \
|
||||
-- \
|
||||
benchmark pallet \
|
||||
--chain=bridge-hub-rococo-dev \
|
||||
--pallet=snowbridge_ethereum_beacon_client \
|
||||
--pallet=snowbridge_pallet_ethereum_client \
|
||||
--extrinsic="*" \
|
||||
--execution=wasm --wasm-execution=compiled \
|
||||
--steps 50 --repeat 20 \
|
||||
--output ./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_ethereum_beacon_client.rs
|
||||
--output ./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_pallet_ethereum_client.rs
|
||||
popd
|
||||
|
||||
@@ -78,7 +78,7 @@ rm -rf $SNOWBRIDGE_FOLDER/parachain/.gitignore
|
||||
rm -rf $SNOWBRIDGE_FOLDER/parachain/templates
|
||||
rm -rf $SNOWBRIDGE_FOLDER/parachain/.cargo
|
||||
rm -rf $SNOWBRIDGE_FOLDER/parachain/.config
|
||||
rm -rf $SNOWBRIDGE_FOLDER/parachain/pallets/ethereum-beacon-client/fuzz
|
||||
rm -rf $SNOWBRIDGE_FOLDER/parachain/pallets/ethereum-client/fuzz
|
||||
|
||||
cd bridges/snowbridge/parachain
|
||||
|
||||
@@ -93,18 +93,18 @@ find "." -name 'Cargo.toml' | while read -r file; do
|
||||
done
|
||||
|
||||
# let's test if everything we need compiles
|
||||
cargo check -p snowbridge-ethereum-beacon-client
|
||||
cargo check -p snowbridge-ethereum-beacon-client --features runtime-benchmarks
|
||||
cargo check -p snowbridge-ethereum-beacon-client --features try-runtime
|
||||
cargo check -p snowbridge-inbound-queue
|
||||
cargo check -p snowbridge-inbound-queue --features runtime-benchmarks
|
||||
cargo check -p snowbridge-inbound-queue --features try-runtime
|
||||
cargo check -p snowbridge-outbound-queue
|
||||
cargo check -p snowbridge-outbound-queue --features runtime-benchmarks
|
||||
cargo check -p snowbridge-outbound-queue --features try-runtime
|
||||
cargo check -p snowbridge-system
|
||||
cargo check -p snowbridge-system --features runtime-benchmarks
|
||||
cargo check -p snowbridge-system --features try-runtime
|
||||
cargo check -p snowbridge-pallet-ethereum-client
|
||||
cargo check -p snowbridge-pallet-ethereum-client --features runtime-benchmarks
|
||||
cargo check -p snowbridge-pallet-ethereum-client --features try-runtime
|
||||
cargo check -p snowbridge-pallet-inbound-queue
|
||||
cargo check -p snowbridge-pallet-inbound-queue --features runtime-benchmarks
|
||||
cargo check -p snowbridge-pallet-inbound-queue --features try-runtime
|
||||
cargo check -p snowbridge-pallet-outbound-queue
|
||||
cargo check -p snowbridge-pallet-outbound-queue --features runtime-benchmarks
|
||||
cargo check -p snowbridge-pallet-outbound-queue --features try-runtime
|
||||
cargo check -p snowbridge-pallet-system
|
||||
cargo check -p snowbridge-pallet-system --features runtime-benchmarks
|
||||
cargo check -p snowbridge-pallet-system --features try-runtime
|
||||
|
||||
cd -
|
||||
|
||||
|
||||
@@ -117,3 +117,19 @@ pub mod consensus {
|
||||
/// Relay chain slot duration, in milliseconds.
|
||||
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
|
||||
}
|
||||
|
||||
pub mod snowbridge {
|
||||
use frame_support::parameter_types;
|
||||
use xcm::opaque::lts::NetworkId;
|
||||
|
||||
/// The pallet index of the Ethereum inbound queue pallet in the bridge hub runtime.
|
||||
pub const INBOUND_QUEUE_PALLET_INDEX: u8 = 80;
|
||||
|
||||
parameter_types! {
|
||||
/// Network and location for the Ethereum chain. On Rococo, the Ethereum chain bridged
|
||||
/// to is the Sepolia Ethereum testnet, with chain ID 11155111.
|
||||
/// <https://chainlist.org/chain/11155111>
|
||||
/// <https://ethereum.org/en/developers/docs/apis/json-rpc/#net_version>
|
||||
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 };
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -30,6 +30,6 @@ bridge-hub-common = { path = "../../../../../../runtimes/bridge-hubs/common", de
|
||||
# Snowbridge
|
||||
snowbridge-core = { path = "../../../../../../../../bridges/snowbridge/parachain/primitives/core", default-features = false }
|
||||
snowbridge-router-primitives = { path = "../../../../../../../../bridges/snowbridge/parachain/primitives/router", default-features = false }
|
||||
snowbridge-system = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-inbound-queue = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
snowbridge-pallet-system = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-pallet-inbound-queue = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-pallet-outbound-queue = { path = "../../../../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
|
||||
+3
-4
@@ -48,7 +48,6 @@ asset-hub-rococo-runtime = { path = "../../../../../runtimes/assets/asset-hub-ro
|
||||
# Snowbridge
|
||||
snowbridge-core = { path = "../../../../../../../bridges/snowbridge/parachain/primitives/core", default-features = false }
|
||||
snowbridge-router-primitives = { path = "../../../../../../../bridges/snowbridge/parachain/primitives/router", default-features = false }
|
||||
snowbridge-system = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-inbound-queue = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
snowbridge-rococo-common = { path = "../../../../../../../bridges/snowbridge/parachain/runtime/rococo-common", default-features = false }
|
||||
snowbridge-pallet-system = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-pallet-inbound-queue = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-pallet-outbound-queue = { path = "../../../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
|
||||
+9
-6
@@ -17,12 +17,12 @@ use codec::{Decode, Encode};
|
||||
use emulated_integration_tests_common::xcm_emulator::ConvertLocation;
|
||||
use frame_support::pallet_prelude::TypeInfo;
|
||||
use hex_literal::hex;
|
||||
use parachains_common::rococo::snowbridge::EthereumNetwork;
|
||||
use snowbridge_core::outbound::OperatingMode;
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use snowbridge_pallet_system;
|
||||
use snowbridge_router_primitives::inbound::{
|
||||
Command, Destination, GlobalConsensusEthereumConvertsFor, MessageV1, VersionedMessage,
|
||||
};
|
||||
use snowbridge_system;
|
||||
use sp_core::H256;
|
||||
|
||||
const INITIAL_FUND: u128 = 5_000_000_000 * ROCOCO_ED;
|
||||
@@ -94,7 +94,7 @@ fn create_agent() {
|
||||
assert_expected_events!(
|
||||
BridgeHubRococo,
|
||||
vec![
|
||||
RuntimeEvent::EthereumSystem(snowbridge_system::Event::CreateAgent {
|
||||
RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateAgent {
|
||||
..
|
||||
}) => {},
|
||||
]
|
||||
@@ -168,7 +168,7 @@ fn create_channel() {
|
||||
assert_expected_events!(
|
||||
BridgeHubRococo,
|
||||
vec![
|
||||
RuntimeEvent::EthereumSystem(snowbridge_system::Event::CreateChannel {
|
||||
RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateChannel {
|
||||
..
|
||||
}) => {},
|
||||
]
|
||||
@@ -190,7 +190,10 @@ fn register_weth_token_from_ethereum_to_asset_hub() {
|
||||
chain_id: CHAIN_ID,
|
||||
command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE },
|
||||
});
|
||||
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
|
||||
let (xcm, fee) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
|
||||
|
||||
assert_ok!(EthereumInboundQueue::burn_fees(AssetHubRococo::para_id().into(), fee));
|
||||
|
||||
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();
|
||||
|
||||
assert_expected_events!(
|
||||
@@ -481,7 +484,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
|
||||
assert_expected_events!(
|
||||
BridgeHubRococo,
|
||||
vec![
|
||||
RuntimeEvent::EthereumOutboundQueue(snowbridge_outbound_queue::Event::MessageQueued {..}) => {},
|
||||
RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {},
|
||||
]
|
||||
);
|
||||
let events = BridgeHubRococo::events();
|
||||
|
||||
@@ -91,7 +91,6 @@ bp-asset-hub-westend = { path = "../../../../../bridges/primitives/chain-asset-h
|
||||
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
|
||||
bp-bridge-hub-westend = { path = "../../../../../bridges/primitives/chain-bridge-hub-westend", default-features = false }
|
||||
snowbridge-router-primitives = { path = "../../../../../bridges/snowbridge/parachain/primitives/router", default-features = false }
|
||||
snowbridge-rococo-common = { path = "../../../../../bridges/snowbridge/parachain/runtime/rococo-common", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
asset-test-utils = { path = "../test-utils" }
|
||||
@@ -139,7 +138,6 @@ runtime-benchmarks = [
|
||||
"parachains-common/runtime-benchmarks",
|
||||
"polkadot-parachain-primitives/runtime-benchmarks",
|
||||
"polkadot-runtime-common/runtime-benchmarks",
|
||||
"snowbridge-rococo-common/runtime-benchmarks",
|
||||
"snowbridge-router-primitives/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
@@ -231,7 +229,6 @@ std = [
|
||||
"primitive-types/std",
|
||||
"rococo-runtime-constants/std",
|
||||
"scale-info/std",
|
||||
"snowbridge-rococo-common/std",
|
||||
"snowbridge-router-primitives/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
|
||||
@@ -35,7 +35,7 @@ use assets_common::{
|
||||
};
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use cumulus_primitives_core::AggregateMessageOrigin;
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use parachains_common::rococo::snowbridge::EthereumNetwork;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
|
||||
@@ -31,6 +31,7 @@ use frame_system::EnsureRoot;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::{
|
||||
impls::ToStakingPot,
|
||||
rococo::snowbridge::EthereumNetwork,
|
||||
xcm_config::{
|
||||
AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier,
|
||||
ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains,
|
||||
@@ -39,7 +40,6 @@ use parachains_common::{
|
||||
};
|
||||
use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use snowbridge_router_primitives::inbound::GlobalConsensusEthereumConvertsFor;
|
||||
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
|
||||
use xcm::latest::prelude::*;
|
||||
@@ -817,7 +817,7 @@ pub mod bridging {
|
||||
1,
|
||||
X2(
|
||||
Parachain(SiblingBridgeHubParaId::get()),
|
||||
PalletInstance(snowbridge_rococo_common::INBOUND_QUEUE_MESSAGES_PALLET_INDEX)
|
||||
PalletInstance(parachains_common::rococo::snowbridge::INBOUND_QUEUE_PALLET_INDEX)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -108,16 +108,15 @@ bridge-runtime-common = { path = "../../../../../bridges/bin/runtime-common", de
|
||||
|
||||
# Ethereum Bridge (Snowbridge)
|
||||
snowbridge-beacon-primitives = { path = "../../../../../bridges/snowbridge/parachain/primitives/beacon", default-features = false }
|
||||
snowbridge-system = { path = "../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-pallet-system = { path = "../../../../../bridges/snowbridge/parachain/pallets/system", default-features = false }
|
||||
snowbridge-system-runtime-api = { path = "../../../../../bridges/snowbridge/parachain/pallets/system/runtime-api", default-features = false }
|
||||
snowbridge-core = { path = "../../../../../bridges/snowbridge/parachain/primitives/core", default-features = false }
|
||||
snowbridge-ethereum-beacon-client = { path = "../../../../../bridges/snowbridge/parachain/pallets/ethereum-beacon-client", default-features = false }
|
||||
snowbridge-inbound-queue = { path = "../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue = { path = "../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
snowbridge-pallet-ethereum-client = { path = "../../../../../bridges/snowbridge/parachain/pallets/ethereum-client", default-features = false }
|
||||
snowbridge-pallet-inbound-queue = { path = "../../../../../bridges/snowbridge/parachain/pallets/inbound-queue", default-features = false }
|
||||
snowbridge-pallet-outbound-queue = { path = "../../../../../bridges/snowbridge/parachain/pallets/outbound-queue", default-features = false }
|
||||
snowbridge-outbound-queue-runtime-api = { path = "../../../../../bridges/snowbridge/parachain/pallets/outbound-queue/runtime-api", default-features = false }
|
||||
snowbridge-router-primitives = { path = "../../../../../bridges/snowbridge/parachain/primitives/router", default-features = false }
|
||||
snowbridge-runtime-common = { path = "../../../../../bridges/snowbridge/parachain/runtime/runtime-common", default-features = false }
|
||||
snowbridge-rococo-common = { path = "../../../../../bridges/snowbridge/parachain/runtime/rococo-common", default-features = false }
|
||||
|
||||
bridge-hub-common = { path = "../common", default-features = false }
|
||||
|
||||
@@ -128,6 +127,7 @@ bridge-runtime-common = { path = "../../../../../bridges/bin/runtime-common", fe
|
||||
"integrity-test",
|
||||
] }
|
||||
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
|
||||
snowbridge-runtime-test-common = { path = "../../../../../bridges/snowbridge/parachain/runtime/test-common" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -192,15 +192,14 @@ std = [
|
||||
"serde",
|
||||
"snowbridge-beacon-primitives/std",
|
||||
"snowbridge-core/std",
|
||||
"snowbridge-ethereum-beacon-client/std",
|
||||
"snowbridge-inbound-queue/std",
|
||||
"snowbridge-outbound-queue-runtime-api/std",
|
||||
"snowbridge-outbound-queue/std",
|
||||
"snowbridge-rococo-common/std",
|
||||
"snowbridge-pallet-ethereum-client/std",
|
||||
"snowbridge-pallet-inbound-queue/std",
|
||||
"snowbridge-pallet-outbound-queue/std",
|
||||
"snowbridge-pallet-system/std",
|
||||
"snowbridge-router-primitives/std",
|
||||
"snowbridge-runtime-common/std",
|
||||
"snowbridge-system-runtime-api/std",
|
||||
"snowbridge-system/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
@@ -251,13 +250,13 @@ runtime-benchmarks = [
|
||||
"polkadot-parachain-primitives/runtime-benchmarks",
|
||||
"polkadot-runtime-common/runtime-benchmarks",
|
||||
"snowbridge-core/runtime-benchmarks",
|
||||
"snowbridge-ethereum-beacon-client/runtime-benchmarks",
|
||||
"snowbridge-inbound-queue/runtime-benchmarks",
|
||||
"snowbridge-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-rococo-common/runtime-benchmarks",
|
||||
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
|
||||
"snowbridge-pallet-inbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pallet-system/runtime-benchmarks",
|
||||
"snowbridge-router-primitives/runtime-benchmarks",
|
||||
"snowbridge-runtime-common/runtime-benchmarks",
|
||||
"snowbridge-system/runtime-benchmarks",
|
||||
"snowbridge-runtime-test-common/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
@@ -290,16 +289,16 @@ try-runtime = [
|
||||
"pallet-xcm/try-runtime",
|
||||
"parachain-info/try-runtime",
|
||||
"polkadot-runtime-common/try-runtime",
|
||||
"snowbridge-ethereum-beacon-client/try-runtime",
|
||||
"snowbridge-inbound-queue/try-runtime",
|
||||
"snowbridge-outbound-queue/try-runtime",
|
||||
"snowbridge-system/try-runtime",
|
||||
"snowbridge-pallet-ethereum-client/try-runtime",
|
||||
"snowbridge-pallet-inbound-queue/try-runtime",
|
||||
"snowbridge-pallet-outbound-queue/try-runtime",
|
||||
"snowbridge-pallet-system/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
experimental = ["pallet-aura/experimental"]
|
||||
fast-runtime = [
|
||||
"snowbridge-ethereum-beacon-client/beacon-spec-minimal",
|
||||
"snowbridge-pallet-ethereum-client/beacon-spec-minimal",
|
||||
]
|
||||
|
||||
# A feature that should be enabled when the runtime should be built for on-chain
|
||||
|
||||
+2
-2
@@ -15,13 +15,13 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{xcm_config::UniversalLocation, Runtime};
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use parachains_common::rococo::snowbridge::EthereumNetwork;
|
||||
use snowbridge_router_primitives::outbound::EthereumBlobExporter;
|
||||
|
||||
/// Exports message to the Ethereum Gateway contract.
|
||||
pub type SnowbridgeExporter = EthereumBlobExporter<
|
||||
UniversalLocation,
|
||||
EthereumNetwork,
|
||||
snowbridge_outbound_queue::Pallet<Runtime>,
|
||||
snowbridge_pallet_outbound_queue::Pallet<Runtime>,
|
||||
snowbridge_core::AgentIdOf,
|
||||
>;
|
||||
|
||||
@@ -71,8 +71,6 @@ use frame_system::{
|
||||
};
|
||||
|
||||
use bp_runtime::HeaderId;
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
use bridge_hub_common::BridgeHubMessageRouter;
|
||||
use bridge_hub_common::{
|
||||
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
|
||||
AggregateMessageOrigin,
|
||||
@@ -102,17 +100,9 @@ use parachains_common::{
|
||||
use polkadot_runtime_common::prod_or_fast;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use crate::xcm_config::benchmark_helpers::DoNothingRouter;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use snowbridge_beacon_primitives::CompactExecutionHeader;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use snowbridge_core::RingBufferMap;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub use snowbridge_ethereum_beacon_client::ExecutionHeaderBuffer;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use snowbridge_inbound_queue::BenchmarkHelper;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use sp_core::H256;
|
||||
use benchmark_helpers::DoNothingRouter;
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
use bridge_hub_common::BridgeHubMessageRouter;
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = MultiAddress<AccountId, ()>;
|
||||
@@ -154,7 +144,7 @@ pub type Migrations = (
|
||||
InitStorageVersions,
|
||||
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
|
||||
// unreleased
|
||||
snowbridge_system::migration::v0::InitializeOnUpgrade<
|
||||
snowbridge_pallet_system::migration::v0::InitializeOnUpgrade<
|
||||
Runtime,
|
||||
ConstU32<BRIDGE_HUB_ID>,
|
||||
ConstU32<ASSET_HUB_ID>,
|
||||
@@ -512,7 +502,7 @@ parameter_types! {
|
||||
parameter_types! {
|
||||
pub const CreateAssetCall: [u8;2] = [53, 0];
|
||||
pub const CreateAssetDeposit: u128 = (UNITS / 10) + EXISTENTIAL_DEPOSIT;
|
||||
pub const InboundQueuePalletInstance: u8 = snowbridge_rococo_common::INBOUND_QUEUE_MESSAGES_PALLET_INDEX;
|
||||
pub const InboundQueuePalletInstance: u8 = parachains_common::rococo::snowbridge::INBOUND_QUEUE_PALLET_INDEX;
|
||||
pub Parameters: PricingParameters<u128> = PricingParameters {
|
||||
exchange_rate: FixedU128::from_rational(1, 400),
|
||||
fee_per_gas: gwei(20),
|
||||
@@ -521,15 +511,46 @@ parameter_types! {
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl<T: snowbridge_ethereum_beacon_client::Config> BenchmarkHelper<T> for Runtime {
|
||||
fn initialize_storage(block_hash: H256, header: CompactExecutionHeader) {
|
||||
<ExecutionHeaderBuffer<T>>::insert(block_hash, header);
|
||||
pub mod benchmark_helpers {
|
||||
use crate::{EthereumBeaconClient, Runtime, RuntimeOrigin};
|
||||
use codec::Encode;
|
||||
use snowbridge_beacon_primitives::CompactExecutionHeader;
|
||||
use snowbridge_pallet_inbound_queue::BenchmarkHelper;
|
||||
use sp_core::H256;
|
||||
use xcm::latest::{MultiAssets, MultiLocation, SendError, SendResult, SendXcm, Xcm, XcmHash};
|
||||
|
||||
impl<T: snowbridge_pallet_ethereum_client::Config> BenchmarkHelper<T> for Runtime {
|
||||
fn initialize_storage(block_hash: H256, header: CompactExecutionHeader) {
|
||||
EthereumBeaconClient::store_execution_header(block_hash, header, 0, H256::default())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DoNothingRouter;
|
||||
impl SendXcm for DoNothingRouter {
|
||||
type Ticket = Xcm<()>;
|
||||
|
||||
fn validate(
|
||||
_dest: &mut Option<MultiLocation>,
|
||||
xcm: &mut Option<Xcm<()>>,
|
||||
) -> SendResult<Self::Ticket> {
|
||||
Ok((xcm.clone().unwrap(), MultiAssets::new()))
|
||||
}
|
||||
fn deliver(xcm: Xcm<()>) -> Result<XcmHash, SendError> {
|
||||
let hash = xcm.using_encoded(sp_io::hashing::blake2_256);
|
||||
Ok(hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl snowbridge_pallet_system::BenchmarkHelper<RuntimeOrigin> for () {
|
||||
fn make_xcm_origin(location: MultiLocation) -> RuntimeOrigin {
|
||||
RuntimeOrigin::from(pallet_xcm::Origin::Xcm(location))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl snowbridge_inbound_queue::Config for Runtime {
|
||||
impl snowbridge_pallet_inbound_queue::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Verifier = snowbridge_ethereum_beacon_client::Pallet<Runtime>;
|
||||
type Verifier = snowbridge_pallet_ethereum_client::Pallet<Runtime>;
|
||||
type Token = Balances;
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type XcmSender = XcmRouter;
|
||||
@@ -549,11 +570,12 @@ impl snowbridge_inbound_queue::Config for Runtime {
|
||||
type WeightToFee = WeightToFee;
|
||||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
|
||||
type MaxMessageSize = ConstU32<2048>;
|
||||
type WeightInfo = weights::snowbridge_inbound_queue::WeightInfo<Runtime>;
|
||||
type WeightInfo = weights::snowbridge_pallet_inbound_queue::WeightInfo<Runtime>;
|
||||
type PricingParameters = EthereumSystem;
|
||||
type AssetTransactor = <xcm_config::XcmConfig as xcm_executor::Config>::AssetTransactor;
|
||||
}
|
||||
|
||||
impl snowbridge_outbound_queue::Config for Runtime {
|
||||
impl snowbridge_pallet_outbound_queue::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Hashing = Keccak256;
|
||||
type MessageQueue = MessageQueue;
|
||||
@@ -563,7 +585,7 @@ impl snowbridge_outbound_queue::Config for Runtime {
|
||||
type GasMeter = snowbridge_core::outbound::ConstantGasMeter;
|
||||
type Balance = Balance;
|
||||
type WeightToFee = WeightToFee;
|
||||
type WeightInfo = weights::snowbridge_outbound_queue::WeightInfo<Runtime>;
|
||||
type WeightInfo = weights::snowbridge_pallet_outbound_queue::WeightInfo<Runtime>;
|
||||
type PricingParameters = EthereumSystem;
|
||||
type Channels = EthereumSystem;
|
||||
}
|
||||
@@ -616,28 +638,21 @@ parameter_types! {
|
||||
pub const MaxExecutionHeadersToKeep: u32 = prod_or_fast!(8192 * 2, 1000);
|
||||
}
|
||||
|
||||
impl snowbridge_ethereum_beacon_client::Config for Runtime {
|
||||
impl snowbridge_pallet_ethereum_client::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ForkVersions = ChainForkVersions;
|
||||
type MaxExecutionHeadersToKeep = MaxExecutionHeadersToKeep;
|
||||
type WeightInfo = weights::snowbridge_ethereum_beacon_client::WeightInfo<Runtime>;
|
||||
type WeightInfo = weights::snowbridge_pallet_ethereum_client::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl snowbridge_system::BenchmarkHelper<RuntimeOrigin> for () {
|
||||
fn make_xcm_origin(location: xcm::latest::MultiLocation) -> RuntimeOrigin {
|
||||
RuntimeOrigin::from(pallet_xcm::Origin::Xcm(location))
|
||||
}
|
||||
}
|
||||
|
||||
impl snowbridge_system::Config for Runtime {
|
||||
impl snowbridge_pallet_system::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type OutboundQueue = EthereumOutboundQueue;
|
||||
type SiblingOrigin = EnsureXcm<AllowSiblingsOnly>;
|
||||
type AgentIdOf = snowbridge_core::AgentIdOf;
|
||||
type TreasuryAccount = TreasuryAccount;
|
||||
type Token = Balances;
|
||||
type WeightInfo = weights::snowbridge_system::WeightInfo<Runtime>;
|
||||
type WeightInfo = weights::snowbridge_pallet_system::WeightInfo<Runtime>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Helper = ();
|
||||
type DefaultPricingParameters = Parameters;
|
||||
@@ -703,10 +718,10 @@ construct_runtime!(
|
||||
// With-Rococo Bulletin bridge hub pallet.
|
||||
XcmOverPolkadotBulletin: pallet_xcm_bridge_hub::<Instance2>::{Pallet} = 62,
|
||||
|
||||
EthereumInboundQueue: snowbridge_inbound_queue::{Pallet, Call, Storage, Event<T>} = 80,
|
||||
EthereumOutboundQueue: snowbridge_outbound_queue::{Pallet, Call, Storage, Event<T>} = 81,
|
||||
EthereumBeaconClient: snowbridge_ethereum_beacon_client::{Pallet, Call, Storage, Event<T>} = 82,
|
||||
EthereumSystem: snowbridge_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 83,
|
||||
EthereumInboundQueue: snowbridge_pallet_inbound_queue::{Pallet, Call, Storage, Event<T>} = 80,
|
||||
EthereumOutboundQueue: snowbridge_pallet_outbound_queue::{Pallet, Call, Storage, Event<T>} = 81,
|
||||
EthereumBeaconClient: snowbridge_pallet_ethereum_client::{Pallet, Call, Storage, Event<T>} = 82,
|
||||
EthereumSystem: snowbridge_pallet_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 83,
|
||||
|
||||
// Message Queue. Importantly, is registered last so that messages are processed after
|
||||
// the `on_initialize` hooks of bridging pallets.
|
||||
@@ -758,10 +773,10 @@ mod benches {
|
||||
[pallet_bridge_messages, RococoToRococoBulletin]
|
||||
[pallet_bridge_relayers, BridgeRelayersBench::<Runtime>]
|
||||
// Ethereum Bridge
|
||||
[snowbridge_inbound_queue, EthereumInboundQueue]
|
||||
[snowbridge_outbound_queue, EthereumOutboundQueue]
|
||||
[snowbridge_system, EthereumSystem]
|
||||
[snowbridge_ethereum_beacon_client, EthereumBeaconClient]
|
||||
[snowbridge_pallet_inbound_queue, EthereumInboundQueue]
|
||||
[snowbridge_pallet_outbound_queue, EthereumOutboundQueue]
|
||||
[snowbridge_pallet_system, EthereumSystem]
|
||||
[snowbridge_pallet_ethereum_client, EthereumBeaconClient]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -991,18 +1006,18 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
impl snowbridge_outbound_queue_runtime_api::OutboundQueueApi<Block, Balance> for Runtime {
|
||||
fn prove_message(leaf_index: u64) -> Option<snowbridge_outbound_queue::MerkleProof> {
|
||||
snowbridge_outbound_queue::api::prove_message::<Runtime>(leaf_index)
|
||||
fn prove_message(leaf_index: u64) -> Option<snowbridge_pallet_outbound_queue::MerkleProof> {
|
||||
snowbridge_pallet_outbound_queue::api::prove_message::<Runtime>(leaf_index)
|
||||
}
|
||||
|
||||
fn calculate_fee(message: Message) -> Option<Balance> {
|
||||
snowbridge_outbound_queue::api::calculate_fee::<Runtime>(message)
|
||||
snowbridge_pallet_outbound_queue::api::calculate_fee::<Runtime>(message)
|
||||
}
|
||||
}
|
||||
|
||||
impl snowbridge_system_runtime_api::ControlApi<Block> for Runtime {
|
||||
fn agent_id(location: VersionedMultiLocation) -> Option<AgentId> {
|
||||
snowbridge_system::api::agent_id::<Runtime>(location)
|
||||
snowbridge_pallet_system::api::agent_id::<Runtime>(location)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ pub mod pallet_utility;
|
||||
pub mod pallet_xcm;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
pub mod snowbridge_ethereum_beacon_client;
|
||||
pub mod snowbridge_inbound_queue;
|
||||
pub mod snowbridge_outbound_queue;
|
||||
pub mod snowbridge_system;
|
||||
pub mod snowbridge_pallet_ethereum_client;
|
||||
pub mod snowbridge_pallet_inbound_queue;
|
||||
pub mod snowbridge_pallet_outbound_queue;
|
||||
pub mod snowbridge_pallet_system;
|
||||
pub mod xcm;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Autogenerated weights for `snowbridge_ethereum_beacon_client`
|
||||
//! Autogenerated weights for `snowbridge_pallet_ethereum_client`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-06-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
@@ -47,9 +47,9 @@
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `snowbridge_ethereum_beacon_client`.
|
||||
/// Weight functions for `snowbridge_pallet_ethereum_client`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> snowbridge_ethereum_beacon_client::WeightInfo for WeightInfo<T> {
|
||||
impl<T: frame_system::Config> snowbridge_pallet_ethereum_client::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: EthereumBeaconClient FinalizedBeaconStateIndex (r:1 w:1)
|
||||
/// Proof: EthereumBeaconClient FinalizedBeaconStateIndex (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: EthereumBeaconClient FinalizedBeaconStateMapping (r:1 w:1)
|
||||
+3
-3
@@ -13,7 +13,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Autogenerated weights for `snowbridge_inbound_queue`
|
||||
//! Autogenerated weights for `snowbridge_pallet_inbound_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-09-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
@@ -45,9 +45,9 @@
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `snowbridge_inbound_queue`.
|
||||
/// Weight functions for `snowbridge_pallet_inbound_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> snowbridge_inbound_queue::WeightInfo for WeightInfo<T> {
|
||||
impl<T: frame_system::Config> snowbridge_pallet_inbound_queue::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: EthereumInboundQueue PalletOperatingMode (r:1 w:0)
|
||||
/// Proof: EthereumInboundQueue PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
|
||||
/// Storage: EthereumBeaconClient ExecutionHeaders (r:1 w:0)
|
||||
+1
-1
@@ -43,7 +43,7 @@ use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `snowbridge_outbound_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> snowbridge_outbound_queue::WeightInfo for WeightInfo<T> {
|
||||
impl<T: frame_system::Config> snowbridge_pallet_outbound_queue::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: EthereumOutboundQueue MessageLeaves (r:1 w:1)
|
||||
/// Proof Skipped: EthereumOutboundQueue MessageLeaves (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: EthereumOutboundQueue PendingHighPriorityMessageCount (r:1 w:1)
|
||||
+3
-3
@@ -27,12 +27,12 @@
|
||||
// pallet
|
||||
// --chain
|
||||
// bridge-hub-rococo-dev
|
||||
// --pallet=snowbridge_system
|
||||
// --pallet=snowbridge_pallet_system
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --output
|
||||
// parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_system.rs
|
||||
// parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_pallet_system.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
@@ -44,7 +44,7 @@ use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `snowbridge_system`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> snowbridge_system::WeightInfo for WeightInfo<T> {
|
||||
impl<T: frame_system::Config> snowbridge_pallet_system::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
/// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: EthereumOutboundQueue PalletOperatingMode (r:1 w:0)
|
||||
@@ -39,6 +39,7 @@ use frame_system::EnsureRoot;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::{
|
||||
impls::ToStakingPot,
|
||||
rococo::snowbridge::EthereumNetwork,
|
||||
xcm_config::{
|
||||
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
|
||||
RelayOrOtherSystemParachains,
|
||||
@@ -47,7 +48,6 @@ use parachains_common::{
|
||||
};
|
||||
use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use snowbridge_runtime_common::XcmExportFeeToSibling;
|
||||
use sp_core::Get;
|
||||
use sp_runtime::traits::AccountIdConversion;
|
||||
@@ -216,12 +216,12 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
||||
WithRococoBulletinMessagesInstance,
|
||||
>::set_operating_mode { .. }) |
|
||||
RuntimeCall::EthereumBeaconClient(
|
||||
snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. } |
|
||||
snowbridge_ethereum_beacon_client::Call::set_operating_mode { .. },
|
||||
snowbridge_pallet_ethereum_client::Call::force_checkpoint { .. } |
|
||||
snowbridge_pallet_ethereum_client::Call::set_operating_mode { .. },
|
||||
) | RuntimeCall::EthereumInboundQueue(
|
||||
snowbridge_inbound_queue::Call::set_operating_mode { .. },
|
||||
snowbridge_pallet_inbound_queue::Call::set_operating_mode { .. },
|
||||
) | RuntimeCall::EthereumOutboundQueue(
|
||||
snowbridge_outbound_queue::Call::set_operating_mode { .. },
|
||||
snowbridge_pallet_outbound_queue::Call::set_operating_mode { .. },
|
||||
) | RuntimeCall::EthereumSystem(..)
|
||||
)
|
||||
}
|
||||
@@ -492,22 +492,3 @@ impl<WaivedLocations: Contains<MultiLocation>, FeeHandler: HandleFee> FeeManager
|
||||
FeeHandler::handle_fee(fee, context, reason);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub mod benchmark_helpers {
|
||||
use crate::{MultiAssets, MultiLocation, SendError, SendResult, SendXcm, Xcm, XcmHash};
|
||||
|
||||
pub struct DoNothingRouter;
|
||||
impl SendXcm for DoNothingRouter {
|
||||
type Ticket = ();
|
||||
fn validate(
|
||||
_dest: &mut Option<MultiLocation>,
|
||||
_msg: &mut Option<Xcm<()>>,
|
||||
) -> SendResult<()> {
|
||||
Ok(((), MultiAssets::new()))
|
||||
}
|
||||
fn deliver(_: ()) -> Result<XcmHash, SendError> {
|
||||
Ok([0; 32])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-14
@@ -1,22 +1,37 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
mod test_cases;
|
||||
|
||||
use asset_hub_rococo_runtime::xcm_config::bridging::to_ethereum::DefaultBridgeHubEthereumBaseFee;
|
||||
use bridge_hub_rococo_runtime::{
|
||||
xcm_config::XcmConfig, MessageQueueServiceWeight, Runtime, RuntimeEvent, SessionKeys,
|
||||
};
|
||||
use codec::Decode;
|
||||
use cumulus_primitives_core::XcmError::{FailedToTransactAsset, NotHoldingFees};
|
||||
use parachains_common::{AccountId, AuraId};
|
||||
use snowbridge_ethereum_beacon_client::WeightInfo;
|
||||
use frame_support::parameter_types;
|
||||
use parachains_common::{AccountId, AuraId, Balance};
|
||||
use snowbridge_pallet_ethereum_client::WeightInfo;
|
||||
use sp_core::H160;
|
||||
use sp_keyring::AccountKeyring::Alice;
|
||||
|
||||
pub fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime> {
|
||||
parameter_types! {
|
||||
pub const DefaultBridgeHubEthereumBaseFee: Balance = 2_750_872_500_000;
|
||||
}
|
||||
|
||||
fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime> {
|
||||
bridge_hub_test_utils::CollatorSessionKeys::new(
|
||||
AccountId::from(Alice),
|
||||
AccountId::from(Alice),
|
||||
@@ -26,7 +41,7 @@ pub fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Run
|
||||
|
||||
#[test]
|
||||
pub fn transfer_token_to_ethereum_works() {
|
||||
test_cases::send_transfer_token_message_success::<Runtime, XcmConfig>(
|
||||
snowbridge_runtime_test_common::send_transfer_token_message_success::<Runtime, XcmConfig>(
|
||||
collator_session_keys(),
|
||||
1013,
|
||||
1000,
|
||||
@@ -44,7 +59,7 @@ pub fn transfer_token_to_ethereum_works() {
|
||||
|
||||
#[test]
|
||||
pub fn unpaid_transfer_token_to_ethereum_fails_with_barrier() {
|
||||
test_cases::send_unpaid_transfer_token_message::<Runtime, XcmConfig>(
|
||||
snowbridge_runtime_test_common::send_unpaid_transfer_token_message::<Runtime, XcmConfig>(
|
||||
collator_session_keys(),
|
||||
1013,
|
||||
1000,
|
||||
@@ -55,7 +70,7 @@ pub fn unpaid_transfer_token_to_ethereum_fails_with_barrier() {
|
||||
|
||||
#[test]
|
||||
pub fn transfer_token_to_ethereum_fee_not_enough() {
|
||||
test_cases::send_transfer_token_message_failure::<Runtime, XcmConfig>(
|
||||
snowbridge_runtime_test_common::send_transfer_token_message_failure::<Runtime, XcmConfig>(
|
||||
collator_session_keys(),
|
||||
1013,
|
||||
1000,
|
||||
@@ -70,7 +85,7 @@ pub fn transfer_token_to_ethereum_fee_not_enough() {
|
||||
|
||||
#[test]
|
||||
pub fn transfer_token_to_ethereum_insufficient_fund() {
|
||||
test_cases::send_transfer_token_message_failure::<Runtime, XcmConfig>(
|
||||
snowbridge_runtime_test_common::send_transfer_token_message_failure::<Runtime, XcmConfig>(
|
||||
collator_session_keys(),
|
||||
1013,
|
||||
1000,
|
||||
@@ -86,9 +101,9 @@ pub fn transfer_token_to_ethereum_insufficient_fund() {
|
||||
fn max_message_queue_service_weight_is_more_than_beacon_extrinsic_weights() {
|
||||
let max_message_queue_weight = MessageQueueServiceWeight::get();
|
||||
let force_checkpoint =
|
||||
<Runtime as snowbridge_ethereum_beacon_client::Config>::WeightInfo::force_checkpoint();
|
||||
<Runtime as snowbridge_pallet_ethereum_client::Config>::WeightInfo::force_checkpoint();
|
||||
let submit_checkpoint =
|
||||
<Runtime as snowbridge_ethereum_beacon_client::Config>::WeightInfo::submit();
|
||||
<Runtime as snowbridge_pallet_ethereum_client::Config>::WeightInfo::submit();
|
||||
max_message_queue_weight.all_gt(force_checkpoint);
|
||||
max_message_queue_weight.all_gt(submit_checkpoint);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ use sp_std::{marker::PhantomData, prelude::*};
|
||||
use xcm::v3::{Junction, MultiLocation};
|
||||
|
||||
/// The aggregate origin of an inbound message.
|
||||
/// This is specialized for BridgeHub, as the snowbridge-outbound-queue pallet is also using
|
||||
/// This is specialized for BridgeHub, as the snowbridge-outbound-queue-pallet is also using
|
||||
/// the shared MessageQueue pallet.
|
||||
#[derive(Encode, Decode, Copy, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug)]
|
||||
pub enum AggregateMessageOrigin {
|
||||
|
||||
@@ -79,7 +79,6 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d
|
||||
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
assets-common = { path = "../../assets/common", default-features = false }
|
||||
snowbridge-rococo-common = { path = "../../../../../bridges/snowbridge/parachain/runtime/rococo-common", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -121,7 +120,6 @@ std = [
|
||||
"polkadot-primitives/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"scale-info/std",
|
||||
"snowbridge-rococo-common/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
@@ -166,7 +164,6 @@ runtime-benchmarks = [
|
||||
"polkadot-parachain-primitives/runtime-benchmarks",
|
||||
"polkadot-primitives/runtime-benchmarks",
|
||||
"polkadot-runtime-common/runtime-benchmarks",
|
||||
"snowbridge-rococo-common/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
|
||||
@@ -40,9 +40,9 @@ use frame_system::EnsureRoot;
|
||||
use pallet_asset_tx_payment::HandleCredit;
|
||||
use pallet_assets::Instance1;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::rococo::snowbridge::EthereumNetwork;
|
||||
use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_common::impls::ToAuthor;
|
||||
use snowbridge_rococo_common::EthereumNetwork;
|
||||
use sp_runtime::traits::Zero;
|
||||
use xcm::latest::prelude::*;
|
||||
#[allow(deprecated)]
|
||||
|
||||
Reference in New Issue
Block a user