mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Rename Finality Verifier and Call Dispatch Pallets (#838)
* Rename `pallet-finality-verifier` to `pallet-bridge-grandpa` * Missed some CamelCase ones * Update logging target in GRANDPA pallet * Rename `pallet-bridge-call-dispatch` to `pallet-bridge-dispatch` * Rename the dispatch pallet folder * Update logging target in Dispatch pallet * Missed a couple * Format the repo * Stop listing individual pallets in Compose logs * Use correct pallet name in module doc comments * Add `pallet-bridge-dispatch` to README project layout * Sort crate names in TOML files * Rename `pallet-bridge-grandpa` runtime Call alias
This commit is contained in:
committed by
Bastian Köcher
parent
acb872fbb0
commit
8d122b03f1
+2
-1
@@ -86,8 +86,9 @@ the `relays` which are used to pass messages between chains.
|
|||||||
│ └── ...
|
│ └── ...
|
||||||
├── modules // Substrate Runtime Modules (a.k.a Pallets)
|
├── modules // Substrate Runtime Modules (a.k.a Pallets)
|
||||||
│ ├── ethereum // Ethereum PoA Header Sync Module
|
│ ├── ethereum // Ethereum PoA Header Sync Module
|
||||||
│ ├── substrate // Substrate Based Chain Header Sync Module
|
│ ├── grandpa // On-Chain GRANDPA Light Client
|
||||||
│ ├── messages // Cross Chain Message Passing
|
│ ├── messages // Cross Chain Message Passing
|
||||||
|
│ ├── dispatch // Target Chain Message Execution
|
||||||
│ └── ...
|
│ └── ...
|
||||||
├── primitives // Code shared between modules, runtimes, and relays
|
├── primitives // Code shared between modules, runtimes, and relays
|
||||||
│ └── ...
|
│ └── ...
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use bp_millau::derive_account_from_rialto_id;
|
use bp_millau::derive_account_from_rialto_id;
|
||||||
use millau_runtime::{
|
use millau_runtime::{
|
||||||
AccountId, AuraConfig, BalancesConfig, BridgeRialtoConfig, BridgeWestendFinalityVerifierConfig, GenesisConfig,
|
AccountId, AuraConfig, BalancesConfig, BridgeRialtoConfig, BridgeWestendGrandpaConfig, GenesisConfig,
|
||||||
GrandpaConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
|
GrandpaConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
|
||||||
};
|
};
|
||||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||||
@@ -179,7 +179,7 @@ fn testnet_genesis(
|
|||||||
.map(|x| (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone())))
|
.map(|x| (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone())))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
}),
|
}),
|
||||||
pallet_finality_verifier_Instance1: Some(BridgeWestendFinalityVerifierConfig {
|
pallet_bridge_grandpa_Instance1: Some(BridgeWestendGrandpaConfig {
|
||||||
// for our deployments to avoid multiple same-nonces transactions:
|
// for our deployments to avoid multiple same-nonces transactions:
|
||||||
// //Alice is already used to initialize Rialto<->Millau bridge
|
// //Alice is already used to initialize Rialto<->Millau bridge
|
||||||
// => let's use //George to initialize Westend->Millau bridge
|
// => let's use //George to initialize Westend->Millau bridge
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ bp-rialto = { path = "../../../primitives/chain-rialto", default-features = fals
|
|||||||
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||||
bp-westend = { path = "../../../primitives/chain-westend", default-features = false }
|
bp-westend = { path = "../../../primitives/chain-westend", default-features = false }
|
||||||
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
|
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
|
||||||
pallet-bridge-call-dispatch = { path = "../../../modules/call-dispatch", default-features = false }
|
pallet-bridge-dispatch = { path = "../../../modules/dispatch", default-features = false }
|
||||||
|
pallet-bridge-grandpa = { path = "../../../modules/grandpa", default-features = false }
|
||||||
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
|
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
|
||||||
pallet-finality-verifier = { path = "../../../modules/finality-verifier", default-features = false }
|
|
||||||
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
|
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
|
||||||
pallet-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
pallet-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
||||||
|
|
||||||
@@ -46,8 +46,8 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" ,
|
|||||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
|
||||||
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||||
@@ -72,29 +72,29 @@ std = [
|
|||||||
"codec/std",
|
"codec/std",
|
||||||
"frame-executive/std",
|
"frame-executive/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
|
||||||
"frame-system-rpc-runtime-api/std",
|
"frame-system-rpc-runtime-api/std",
|
||||||
|
"frame-system/std",
|
||||||
"pallet-aura/std",
|
"pallet-aura/std",
|
||||||
"pallet-balances/std",
|
"pallet-balances/std",
|
||||||
"pallet-bridge-call-dispatch/std",
|
"pallet-bridge-dispatch/std",
|
||||||
"pallet-finality-verifier/std",
|
"pallet-bridge-grandpa/std",
|
||||||
"pallet-grandpa/std",
|
|
||||||
"pallet-bridge-messages/std",
|
"pallet-bridge-messages/std",
|
||||||
|
"pallet-grandpa/std",
|
||||||
"pallet-randomness-collective-flip/std",
|
"pallet-randomness-collective-flip/std",
|
||||||
"pallet-shift-session-manager/std",
|
|
||||||
"pallet-session/std",
|
"pallet-session/std",
|
||||||
|
"pallet-shift-session-manager/std",
|
||||||
"pallet-substrate-bridge/std",
|
"pallet-substrate-bridge/std",
|
||||||
"pallet-sudo/std",
|
"pallet-sudo/std",
|
||||||
"pallet-timestamp/std",
|
"pallet-timestamp/std",
|
||||||
"pallet-transaction-payment/std",
|
|
||||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||||
|
"pallet-transaction-payment/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
"sp-consensus-aura/std",
|
"sp-consensus-aura/std",
|
||||||
"sp-core/std",
|
"sp-core/std",
|
||||||
"sp-inherents/std",
|
|
||||||
"sp-finality-grandpa/std",
|
"sp-finality-grandpa/std",
|
||||||
|
"sp-inherents/std",
|
||||||
"sp-offchain/std",
|
"sp-offchain/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
"sp-session/std",
|
"sp-session/std",
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ pub use frame_support::{
|
|||||||
|
|
||||||
pub use frame_system::Call as SystemCall;
|
pub use frame_system::Call as SystemCall;
|
||||||
pub use pallet_balances::Call as BalancesCall;
|
pub use pallet_balances::Call as BalancesCall;
|
||||||
|
pub use pallet_bridge_grandpa::Call as BridgeGrandpaRialtoCall;
|
||||||
|
pub use pallet_bridge_grandpa::Call as BridgeGrandpaWestendCall;
|
||||||
pub use pallet_bridge_messages::Call as MessagesCall;
|
pub use pallet_bridge_messages::Call as MessagesCall;
|
||||||
pub use pallet_finality_verifier::Call as FinalityBridgeRialtoCall;
|
|
||||||
pub use pallet_finality_verifier::Call as FinalityBridgeWestendCall;
|
|
||||||
pub use pallet_substrate_bridge::Call as BridgeRialtoCall;
|
pub use pallet_substrate_bridge::Call as BridgeRialtoCall;
|
||||||
pub use pallet_sudo::Call as SudoCall;
|
pub use pallet_sudo::Call as SudoCall;
|
||||||
pub use pallet_timestamp::Call as TimestampCall;
|
pub use pallet_timestamp::Call as TimestampCall;
|
||||||
@@ -207,7 +207,7 @@ impl frame_system::Config for Runtime {
|
|||||||
impl pallet_aura::Config for Runtime {
|
impl pallet_aura::Config for Runtime {
|
||||||
type AuthorityId = AuraId;
|
type AuthorityId = AuraId;
|
||||||
}
|
}
|
||||||
impl pallet_bridge_call_dispatch::Config for Runtime {
|
impl pallet_bridge_dispatch::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
@@ -313,14 +313,14 @@ parameter_types! {
|
|||||||
pub const MaxRequests: u32 = 50;
|
pub const MaxRequests: u32 = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type RialtoFinalityVerifierInstance = ();
|
pub type RialtoGrandpaInstance = ();
|
||||||
impl pallet_finality_verifier::Config for Runtime {
|
impl pallet_bridge_grandpa::Config for Runtime {
|
||||||
type BridgedChain = bp_rialto::Rialto;
|
type BridgedChain = bp_rialto::Rialto;
|
||||||
type MaxRequests = MaxRequests;
|
type MaxRequests = MaxRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type WestendFinalityVerifierInstance = pallet_finality_verifier::Instance1;
|
pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
|
||||||
impl pallet_finality_verifier::Config<WestendFinalityVerifierInstance> for Runtime {
|
impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime {
|
||||||
type BridgedChain = bp_westend::Westend;
|
type BridgedChain = bp_westend::Westend;
|
||||||
type MaxRequests = MaxRequests;
|
type MaxRequests = MaxRequests;
|
||||||
}
|
}
|
||||||
@@ -378,9 +378,9 @@ construct_runtime!(
|
|||||||
{
|
{
|
||||||
BridgeRialto: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
BridgeRialto: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
||||||
BridgeRialtoMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
BridgeRialtoMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
||||||
BridgeCallDispatch: pallet_bridge_call_dispatch::{Module, Event<T>},
|
BridgeDispatch: pallet_bridge_dispatch::{Module, Event<T>},
|
||||||
BridgeRialtoFinalityVerifier: pallet_finality_verifier::{Module, Call},
|
BridgeRialtoGrandpa: pallet_bridge_grandpa::{Module, Call},
|
||||||
BridgeWestendFinalityVerifier: pallet_finality_verifier::<Instance1>::{Module, Call, Config<T>},
|
BridgeWestendGrandpa: pallet_bridge_grandpa::<Instance1>::{Module, Call, Config<T>},
|
||||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||||
@@ -581,23 +581,23 @@ impl_runtime_apis! {
|
|||||||
|
|
||||||
impl bp_rialto::RialtoFinalityApi<Block> for Runtime {
|
impl bp_rialto::RialtoFinalityApi<Block> for Runtime {
|
||||||
fn best_finalized() -> (bp_rialto::BlockNumber, bp_rialto::Hash) {
|
fn best_finalized() -> (bp_rialto::BlockNumber, bp_rialto::Hash) {
|
||||||
let header = BridgeRialtoFinalityVerifier::best_finalized();
|
let header = BridgeRialtoGrandpa::best_finalized();
|
||||||
(header.number, header.hash())
|
(header.number, header.hash())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_known_header(hash: bp_rialto::Hash) -> bool {
|
fn is_known_header(hash: bp_rialto::Hash) -> bool {
|
||||||
BridgeRialtoFinalityVerifier::is_known_header(hash)
|
BridgeRialtoGrandpa::is_known_header(hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl bp_westend::WestendFinalityApi<Block> for Runtime {
|
impl bp_westend::WestendFinalityApi<Block> for Runtime {
|
||||||
fn best_finalized() -> (bp_westend::BlockNumber, bp_westend::Hash) {
|
fn best_finalized() -> (bp_westend::BlockNumber, bp_westend::Hash) {
|
||||||
let header = BridgeWestendFinalityVerifier::best_finalized();
|
let header = BridgeWestendGrandpa::best_finalized();
|
||||||
(header.number, header.hash())
|
(header.number, header.hash())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_known_header(hash: bp_westend::Hash) -> bool {
|
fn is_known_header(hash: bp_westend::Hash) -> bool {
|
||||||
BridgeWestendFinalityVerifier::is_known_header(hash)
|
BridgeWestendGrandpa::is_known_header(hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,7 +666,7 @@ where
|
|||||||
AccountId: codec::Encode,
|
AccountId: codec::Encode,
|
||||||
SpecVersion: codec::Encode,
|
SpecVersion: codec::Encode,
|
||||||
{
|
{
|
||||||
pallet_bridge_call_dispatch::account_ownership_digest(
|
pallet_bridge_dispatch::account_ownership_digest(
|
||||||
rialto_call,
|
rialto_call,
|
||||||
millau_account_id,
|
millau_account_id,
|
||||||
rialto_spec_version,
|
rialto_spec_version,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ type ToRialtoMessagesDeliveryProof = messages::source::FromBridgedChainMessagesD
|
|||||||
pub type FromRialtoMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
|
pub type FromRialtoMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
|
||||||
WithRialtoMessageBridge,
|
WithRialtoMessageBridge,
|
||||||
crate::Runtime,
|
crate::Runtime,
|
||||||
pallet_bridge_call_dispatch::DefaultInstance,
|
pallet_bridge_dispatch::DefaultInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// Millau <-> Rialto message bridge.
|
/// Millau <-> Rialto message bridge.
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ bp-millau = { path = "../../../primitives/chain-millau", default-features = fals
|
|||||||
bp-rialto = { path = "../../../primitives/chain-rialto", default-features = false }
|
bp-rialto = { path = "../../../primitives/chain-rialto", default-features = false }
|
||||||
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||||
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
|
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
|
||||||
pallet-bridge-eth-poa = { path = "../../../modules/ethereum", default-features = false }
|
|
||||||
pallet-bridge-call-dispatch = { path = "../../../modules/call-dispatch", default-features = false }
|
|
||||||
pallet-bridge-currency-exchange = { path = "../../../modules/currency-exchange", default-features = false }
|
pallet-bridge-currency-exchange = { path = "../../../modules/currency-exchange", default-features = false }
|
||||||
pallet-finality-verifier = { path = "../../../modules/finality-verifier", default-features = false }
|
pallet-bridge-dispatch = { path = "../../../modules/dispatch", default-features = false }
|
||||||
pallet-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
pallet-bridge-eth-poa = { path = "../../../modules/ethereum", default-features = false }
|
||||||
|
pallet-bridge-grandpa = { path = "../../../modules/grandpa", default-features = false }
|
||||||
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
|
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
|
||||||
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
|
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
|
||||||
|
pallet-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
||||||
|
|
||||||
# Substrate Dependencies
|
# Substrate Dependencies
|
||||||
|
|
||||||
@@ -92,19 +92,19 @@ std = [
|
|||||||
"log/std",
|
"log/std",
|
||||||
"pallet-aura/std",
|
"pallet-aura/std",
|
||||||
"pallet-balances/std",
|
"pallet-balances/std",
|
||||||
"pallet-bridge-eth-poa/std",
|
|
||||||
"pallet-bridge-call-dispatch/std",
|
|
||||||
"pallet-bridge-currency-exchange/std",
|
"pallet-bridge-currency-exchange/std",
|
||||||
"pallet-finality-verifier/std",
|
"pallet-bridge-dispatch/std",
|
||||||
"pallet-grandpa/std",
|
"pallet-bridge-eth-poa/std",
|
||||||
|
"pallet-bridge-grandpa/std",
|
||||||
"pallet-bridge-messages/std",
|
"pallet-bridge-messages/std",
|
||||||
|
"pallet-grandpa/std",
|
||||||
"pallet-randomness-collective-flip/std",
|
"pallet-randomness-collective-flip/std",
|
||||||
"pallet-shift-session-manager/std",
|
"pallet-shift-session-manager/std",
|
||||||
"pallet-substrate-bridge/std",
|
"pallet-substrate-bridge/std",
|
||||||
"pallet-sudo/std",
|
"pallet-sudo/std",
|
||||||
"pallet-timestamp/std",
|
"pallet-timestamp/std",
|
||||||
"pallet-transaction-payment/std",
|
|
||||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||||
|
"pallet-transaction-payment/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ pub use frame_system::Call as SystemCall;
|
|||||||
pub use pallet_balances::Call as BalancesCall;
|
pub use pallet_balances::Call as BalancesCall;
|
||||||
pub use pallet_bridge_currency_exchange::Call as BridgeCurrencyExchangeCall;
|
pub use pallet_bridge_currency_exchange::Call as BridgeCurrencyExchangeCall;
|
||||||
pub use pallet_bridge_eth_poa::Call as BridgeEthPoACall;
|
pub use pallet_bridge_eth_poa::Call as BridgeEthPoACall;
|
||||||
|
pub use pallet_bridge_grandpa::Call as BridgeGrandpaMillauCall;
|
||||||
pub use pallet_bridge_messages::Call as MessagesCall;
|
pub use pallet_bridge_messages::Call as MessagesCall;
|
||||||
pub use pallet_finality_verifier::Call as FinalityBridgeMillauCall;
|
|
||||||
pub use pallet_substrate_bridge::Call as BridgeMillauCall;
|
pub use pallet_substrate_bridge::Call as BridgeMillauCall;
|
||||||
pub use pallet_sudo::Call as SudoCall;
|
pub use pallet_sudo::Call as SudoCall;
|
||||||
pub use pallet_timestamp::Call as TimestampCall;
|
pub use pallet_timestamp::Call as TimestampCall;
|
||||||
@@ -257,7 +257,7 @@ impl pallet_bridge_currency_exchange::Config<KovanCurrencyExchange> for Runtime
|
|||||||
type DepositInto = DepositInto;
|
type DepositInto = DepositInto;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_bridge_call_dispatch::Config for Runtime {
|
impl pallet_bridge_dispatch::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
@@ -419,7 +419,7 @@ parameter_types! {
|
|||||||
pub const MaxRequests: u32 = 50;
|
pub const MaxRequests: u32 = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_finality_verifier::Config for Runtime {
|
impl pallet_bridge_grandpa::Config for Runtime {
|
||||||
type BridgedChain = bp_millau::Millau;
|
type BridgedChain = bp_millau::Millau;
|
||||||
type MaxRequests = MaxRequests;
|
type MaxRequests = MaxRequests;
|
||||||
}
|
}
|
||||||
@@ -480,8 +480,8 @@ construct_runtime!(
|
|||||||
BridgeRialtoCurrencyExchange: pallet_bridge_currency_exchange::<Instance1>::{Module, Call},
|
BridgeRialtoCurrencyExchange: pallet_bridge_currency_exchange::<Instance1>::{Module, Call},
|
||||||
BridgeKovanCurrencyExchange: pallet_bridge_currency_exchange::<Instance2>::{Module, Call},
|
BridgeKovanCurrencyExchange: pallet_bridge_currency_exchange::<Instance2>::{Module, Call},
|
||||||
BridgeMillau: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
BridgeMillau: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
||||||
BridgeFinalityVerifier: pallet_finality_verifier::{Module, Call},
|
BridgeGrandpa: pallet_bridge_grandpa::{Module, Call},
|
||||||
BridgeCallDispatch: pallet_bridge_call_dispatch::{Module, Event<T>},
|
BridgeDispatch: pallet_bridge_dispatch::{Module, Event<T>},
|
||||||
BridgeMillauMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
BridgeMillauMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
||||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||||
@@ -643,12 +643,12 @@ impl_runtime_apis! {
|
|||||||
|
|
||||||
impl bp_millau::MillauFinalityApi<Block> for Runtime {
|
impl bp_millau::MillauFinalityApi<Block> for Runtime {
|
||||||
fn best_finalized() -> (bp_millau::BlockNumber, bp_millau::Hash) {
|
fn best_finalized() -> (bp_millau::BlockNumber, bp_millau::Hash) {
|
||||||
let header = BridgeFinalityVerifier::best_finalized();
|
let header = BridgeGrandpa::best_finalized();
|
||||||
(header.number, header.hash())
|
(header.number, header.hash())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_known_header(hash: bp_millau::Hash) -> bool {
|
fn is_known_header(hash: bp_millau::Hash) -> bool {
|
||||||
BridgeFinalityVerifier::is_known_header(hash)
|
BridgeGrandpa::is_known_header(hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ impl_runtime_apis! {
|
|||||||
params: MessageParams<Self::AccountId>,
|
params: MessageParams<Self::AccountId>,
|
||||||
) -> (millau_messages::ToMillauMessagePayload, Balance) {
|
) -> (millau_messages::ToMillauMessagePayload, Balance) {
|
||||||
let message_payload = vec![0; params.size as usize];
|
let message_payload = vec![0; params.size as usize];
|
||||||
let dispatch_origin = pallet_bridge_call_dispatch::CallOrigin::SourceAccount(
|
let dispatch_origin = pallet_bridge_dispatch::CallOrigin::SourceAccount(
|
||||||
params.sender_account,
|
params.sender_account,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -959,10 +959,10 @@ impl_runtime_apis! {
|
|||||||
make_millau_outbound_lane_data_key,
|
make_millau_outbound_lane_data_key,
|
||||||
make_millau_header,
|
make_millau_header,
|
||||||
call_weight,
|
call_weight,
|
||||||
pallet_bridge_call_dispatch::MessagePayload {
|
pallet_bridge_dispatch::MessagePayload {
|
||||||
spec_version: VERSION.spec_version,
|
spec_version: VERSION.spec_version,
|
||||||
weight: call_weight,
|
weight: call_weight,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::<
|
origin: pallet_bridge_dispatch::CallOrigin::<
|
||||||
bp_millau::AccountId,
|
bp_millau::AccountId,
|
||||||
MultiSigner,
|
MultiSigner,
|
||||||
Signature,
|
Signature,
|
||||||
@@ -1040,7 +1040,7 @@ where
|
|||||||
AccountId: codec::Encode,
|
AccountId: codec::Encode,
|
||||||
SpecVersion: codec::Encode,
|
SpecVersion: codec::Encode,
|
||||||
{
|
{
|
||||||
pallet_bridge_call_dispatch::account_ownership_digest(
|
pallet_bridge_dispatch::account_ownership_digest(
|
||||||
millau_call,
|
millau_call,
|
||||||
rialto_account_id,
|
rialto_account_id,
|
||||||
millau_spec_version,
|
millau_spec_version,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ pub type FromMillauEncodedCall = messages::target::FromBridgedChainEncodedMessag
|
|||||||
pub type FromMillauMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
|
pub type FromMillauMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
|
||||||
WithMillauMessageBridge,
|
WithMillauMessageBridge,
|
||||||
crate::Runtime,
|
crate::Runtime,
|
||||||
pallet_bridge_call_dispatch::DefaultInstance,
|
pallet_bridge_dispatch::DefaultInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// Messages proof for Millau -> Rialto messages.
|
/// Messages proof for Millau -> Rialto messages.
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ hash-db = { version = "0.15.2", default-features = false }
|
|||||||
bp-message-dispatch = { path = "../../primitives/message-dispatch", default-features = false }
|
bp-message-dispatch = { path = "../../primitives/message-dispatch", default-features = false }
|
||||||
bp-messages = { path = "../../primitives/messages", default-features = false }
|
bp-messages = { path = "../../primitives/messages", default-features = false }
|
||||||
bp-runtime = { path = "../../primitives/runtime", default-features = false }
|
bp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||||
pallet-bridge-call-dispatch = { path = "../../modules/call-dispatch", default-features = false }
|
pallet-bridge-dispatch = { path = "../../modules/dispatch", default-features = false }
|
||||||
|
pallet-bridge-grandpa = { path = "../../modules/grandpa", default-features = false }
|
||||||
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
|
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
|
||||||
pallet-finality-verifier = { path = "../../modules/finality-verifier", default-features = false }
|
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@ std = [
|
|||||||
"codec/std",
|
"codec/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"hash-db/std",
|
"hash-db/std",
|
||||||
"pallet-bridge-call-dispatch/std",
|
"pallet-bridge-dispatch/std",
|
||||||
"pallet-finality-verifier/std",
|
"pallet-bridge-grandpa/std",
|
||||||
"pallet-bridge-messages/std",
|
"pallet-bridge-messages/std",
|
||||||
"sp-core/std",
|
"sp-core/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
@@ -50,7 +50,7 @@ std = [
|
|||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"ed25519-dalek/u64_backend",
|
"ed25519-dalek/u64_backend",
|
||||||
"pallet-finality-verifier/runtime-benchmarks",
|
"pallet-bridge-grandpa/runtime-benchmarks",
|
||||||
"pallet-bridge-messages/runtime-benchmarks",
|
"pallet-bridge-messages/runtime-benchmarks",
|
||||||
"sp-state-machine",
|
"sp-state-machine",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ The [`messages`](./src/messages.rs) module of this crate contains a bunch of hel
|
|||||||
messages module into your runtime. Basic prerequisites of these helpers are:
|
messages module into your runtime. Basic prerequisites of these helpers are:
|
||||||
- we're going to bridge Substrate-based chain with another Substrate-based chain;
|
- we're going to bridge Substrate-based chain with another Substrate-based chain;
|
||||||
- both chains have [messages module](../../modules/messages/README.md), Substrate bridge
|
- both chains have [messages module](../../modules/messages/README.md), Substrate bridge
|
||||||
module and the [call dispatch module](../../modules/call-dispatch/README.md);
|
module and the [call dispatch module](../../modules/dispatch/README.md);
|
||||||
- all message lanes are identical and may be used to transfer the same messages;
|
- all message lanes are identical and may be used to transfer the same messages;
|
||||||
- the messages sent over the bridge are dispatched using
|
- the messages sent over the bridge are dispatched using
|
||||||
[call dispatch module](../../modules/call-dispatch/README.md);
|
[call dispatch module](../../modules/dispatch/README.md);
|
||||||
- the messages are `pallet_bridge_call_dispatch::MessagePayload` structures, where `call` field is
|
- the messages are `pallet_bridge_dispatch::MessagePayload` structures, where `call` field is
|
||||||
encoded `Call` of the target chain. This means that the `Call` is opaque to the
|
encoded `Call` of the target chain. This means that the `Call` is opaque to the
|
||||||
[messages module](../../modules/messages/README.md) instance at the source chain.
|
[messages module](../../modules/messages/README.md) instance at the source chain.
|
||||||
It is pre-encoded by the message submitter;
|
It is pre-encoded by the message submitter;
|
||||||
@@ -118,7 +118,7 @@ are: `maximal_message_size`, `verify_chain_message`, `verify_messages_delivery_p
|
|||||||
`estimate_message_dispatch_and_delivery_fee`.
|
`estimate_message_dispatch_and_delivery_fee`.
|
||||||
|
|
||||||
`FromThisChainMessagePayload` is a message that the sender sends through our bridge. It is the
|
`FromThisChainMessagePayload` is a message that the sender sends through our bridge. It is the
|
||||||
`pallet_bridge_call_dispatch::MessagePayload`, where `call` field is encoded target chain call. So
|
`pallet_bridge_dispatch::MessagePayload`, where `call` field is encoded target chain call. So
|
||||||
at this chain we don't see internals of this call - we just know its size.
|
at this chain we don't see internals of this call - we just know its size.
|
||||||
|
|
||||||
`FromThisChainMessageVerifier` is an implementation of `bp_messages::LaneMessageVerifier`. It
|
`FromThisChainMessageVerifier` is an implementation of `bp_messages::LaneMessageVerifier`. It
|
||||||
@@ -131,8 +131,8 @@ has following checks in its `verify_message` method:
|
|||||||
|
|
||||||
1. it'll reject a message if it has the wrong dispatch origin declared. Like if the submitter is not
|
1. it'll reject a message if it has the wrong dispatch origin declared. Like if the submitter is not
|
||||||
the root of this chain, but it tries to dispatch the message at the target chain using
|
the root of this chain, but it tries to dispatch the message at the target chain using
|
||||||
`pallet_bridge_call_dispatch::CallOrigin::SourceRoot` origin. Or he has provided wrong signature
|
`pallet_bridge_dispatch::CallOrigin::SourceRoot` origin. Or he has provided wrong signature
|
||||||
in the `pallet_bridge_call_dispatch::CallOrigin::TargetAccount` origin;
|
in the `pallet_bridge_dispatch::CallOrigin::TargetAccount` origin;
|
||||||
|
|
||||||
1. it'll reject a message if the delivery and dispatch fee that the submitter wants to pay is lesser
|
1. it'll reject a message if the delivery and dispatch fee that the submitter wants to pay is lesser
|
||||||
than the fee that is computed using the `estimate_message_dispatch_and_delivery_fee` function.
|
than the fee that is computed using the `estimate_message_dispatch_and_delivery_fee` function.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ pub trait MessageBridge {
|
|||||||
fn bridged_balance_to_this_balance(bridged_balance: BalanceOf<BridgedChain<Self>>) -> BalanceOf<ThisChain<Self>>;
|
fn bridged_balance_to_this_balance(bridged_balance: BalanceOf<BridgedChain<Self>>) -> BalanceOf<ThisChain<Self>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
/// Chain that has `pallet-bridge-messages` and `dispatch` modules.
|
||||||
pub trait ChainWithMessages {
|
pub trait ChainWithMessages {
|
||||||
/// Hash used in the chain.
|
/// Hash used in the chain.
|
||||||
type Hash: Decode;
|
type Hash: Decode;
|
||||||
@@ -85,7 +85,7 @@ pub struct MessageTransaction<Weight> {
|
|||||||
pub size: u32,
|
pub size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
/// This chain that has `pallet-bridge-messages` and `dispatch` modules.
|
||||||
pub trait ThisChainWithMessages: ChainWithMessages {
|
pub trait ThisChainWithMessages: ChainWithMessages {
|
||||||
/// Call type on the chain.
|
/// Call type on the chain.
|
||||||
type Call: Encode + Decode;
|
type Call: Encode + Decode;
|
||||||
@@ -105,7 +105,7 @@ pub trait ThisChainWithMessages: ChainWithMessages {
|
|||||||
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bridged chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
/// Bridged chain that has `pallet-bridge-messages` and `dispatch` modules.
|
||||||
pub trait BridgedChainWithMessages: ChainWithMessages {
|
pub trait BridgedChainWithMessages: ChainWithMessages {
|
||||||
/// Maximal extrinsic size at Bridged chain.
|
/// Maximal extrinsic size at Bridged chain.
|
||||||
fn maximal_extrinsic_size() -> u32;
|
fn maximal_extrinsic_size() -> u32;
|
||||||
@@ -180,7 +180,7 @@ pub mod source {
|
|||||||
pub type BridgedChainOpaqueCall = Vec<u8>;
|
pub type BridgedChainOpaqueCall = Vec<u8>;
|
||||||
|
|
||||||
/// Message payload for This -> Bridged chain messages.
|
/// Message payload for This -> Bridged chain messages.
|
||||||
pub type FromThisChainMessagePayload<B> = pallet_bridge_call_dispatch::MessagePayload<
|
pub type FromThisChainMessagePayload<B> = pallet_bridge_dispatch::MessagePayload<
|
||||||
AccountIdOf<ThisChain<B>>,
|
AccountIdOf<ThisChain<B>>,
|
||||||
SignerOf<BridgedChain<B>>,
|
SignerOf<BridgedChain<B>>,
|
||||||
SignatureOf<BridgedChain<B>>,
|
SignatureOf<BridgedChain<B>>,
|
||||||
@@ -221,7 +221,7 @@ pub mod source {
|
|||||||
/// This verifier assumes following:
|
/// This verifier assumes following:
|
||||||
///
|
///
|
||||||
/// - all message lanes are equivalent, so all checks are the same;
|
/// - all message lanes are equivalent, so all checks are the same;
|
||||||
/// - messages are being dispatched using `pallet-bridge-call-dispatch` pallet on the target chain.
|
/// - messages are being dispatched using `pallet-bridge-dispatch` pallet on the target chain.
|
||||||
///
|
///
|
||||||
/// Following checks are made:
|
/// Following checks are made:
|
||||||
///
|
///
|
||||||
@@ -267,8 +267,8 @@ pub mod source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do the dispatch-specific check. We assume that the target chain uses
|
// Do the dispatch-specific check. We assume that the target chain uses
|
||||||
// `CallDispatch`, so we verify the message accordingly.
|
// `Dispatch`, so we verify the message accordingly.
|
||||||
pallet_bridge_call_dispatch::verify_message_origin(submitter, payload).map_err(|_| BAD_ORIGIN)?;
|
pallet_bridge_dispatch::verify_message_origin(submitter, payload).map_err(|_| BAD_ORIGIN)?;
|
||||||
|
|
||||||
let minimal_fee_in_this_tokens =
|
let minimal_fee_in_this_tokens =
|
||||||
estimate_message_dispatch_and_delivery_fee::<B>(payload, B::RELAYER_FEE_PERCENT)?;
|
estimate_message_dispatch_and_delivery_fee::<B>(payload, B::RELAYER_FEE_PERCENT)?;
|
||||||
@@ -356,17 +356,16 @@ pub mod source {
|
|||||||
proof: FromBridgedChainMessagesDeliveryProof<HashOf<BridgedChain<B>>>,
|
proof: FromBridgedChainMessagesDeliveryProof<HashOf<BridgedChain<B>>>,
|
||||||
) -> Result<ParsedMessagesDeliveryProofFromBridgedChain<B>, &'static str>
|
) -> Result<ParsedMessagesDeliveryProofFromBridgedChain<B>, &'static str>
|
||||||
where
|
where
|
||||||
ThisRuntime: pallet_finality_verifier::Config,
|
ThisRuntime: pallet_bridge_grandpa::Config,
|
||||||
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
||||||
HashOf<BridgedChain<B>>:
|
HashOf<BridgedChain<B>>: Into<bp_runtime::HashOf<<ThisRuntime as pallet_bridge_grandpa::Config>::BridgedChain>>,
|
||||||
Into<bp_runtime::HashOf<<ThisRuntime as pallet_finality_verifier::Config>::BridgedChain>>,
|
|
||||||
{
|
{
|
||||||
let FromBridgedChainMessagesDeliveryProof {
|
let FromBridgedChainMessagesDeliveryProof {
|
||||||
bridged_header_hash,
|
bridged_header_hash,
|
||||||
storage_proof,
|
storage_proof,
|
||||||
lane,
|
lane,
|
||||||
} = proof;
|
} = proof;
|
||||||
pallet_finality_verifier::Module::<ThisRuntime>::parse_finalized_storage_proof(
|
pallet_bridge_grandpa::Module::<ThisRuntime>::parse_finalized_storage_proof(
|
||||||
bridged_header_hash.into(),
|
bridged_header_hash.into(),
|
||||||
StorageProof::new(storage_proof),
|
StorageProof::new(storage_proof),
|
||||||
|storage| {
|
|storage| {
|
||||||
@@ -395,14 +394,14 @@ pub mod target {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Call origin for Bridged -> This chain messages.
|
/// Call origin for Bridged -> This chain messages.
|
||||||
pub type FromBridgedChainMessageCallOrigin<B> = pallet_bridge_call_dispatch::CallOrigin<
|
pub type FromBridgedChainMessageCallOrigin<B> = pallet_bridge_dispatch::CallOrigin<
|
||||||
AccountIdOf<BridgedChain<B>>,
|
AccountIdOf<BridgedChain<B>>,
|
||||||
SignerOf<ThisChain<B>>,
|
SignerOf<ThisChain<B>>,
|
||||||
SignatureOf<ThisChain<B>>,
|
SignatureOf<ThisChain<B>>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// Decoded Bridged -> This message payload.
|
/// Decoded Bridged -> This message payload.
|
||||||
pub type FromBridgedChainMessagePayload<B> = pallet_bridge_call_dispatch::MessagePayload<
|
pub type FromBridgedChainMessagePayload<B> = pallet_bridge_dispatch::MessagePayload<
|
||||||
AccountIdOf<BridgedChain<B>>,
|
AccountIdOf<BridgedChain<B>>,
|
||||||
SignerOf<ThisChain<B>>,
|
SignerOf<ThisChain<B>>,
|
||||||
SignatureOf<ThisChain<B>>,
|
SignatureOf<ThisChain<B>>,
|
||||||
@@ -457,19 +456,19 @@ pub mod target {
|
|||||||
|
|
||||||
/// Dispatching Bridged -> This chain messages.
|
/// Dispatching Bridged -> This chain messages.
|
||||||
#[derive(RuntimeDebug, Clone, Copy)]
|
#[derive(RuntimeDebug, Clone, Copy)]
|
||||||
pub struct FromBridgedChainMessageDispatch<B, ThisRuntime, ThisCallDispatchInstance> {
|
pub struct FromBridgedChainMessageDispatch<B, ThisRuntime, ThisDispatchInstance> {
|
||||||
_marker: PhantomData<(B, ThisRuntime, ThisCallDispatchInstance)>,
|
_marker: PhantomData<(B, ThisRuntime, ThisDispatchInstance)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B: MessageBridge, ThisRuntime, ThisCallDispatchInstance>
|
impl<B: MessageBridge, ThisRuntime, ThisDispatchInstance>
|
||||||
MessageDispatch<<BridgedChain<B> as ChainWithMessages>::Balance>
|
MessageDispatch<<BridgedChain<B> as ChainWithMessages>::Balance>
|
||||||
for FromBridgedChainMessageDispatch<B, ThisRuntime, ThisCallDispatchInstance>
|
for FromBridgedChainMessageDispatch<B, ThisRuntime, ThisDispatchInstance>
|
||||||
where
|
where
|
||||||
ThisCallDispatchInstance: frame_support::traits::Instance,
|
ThisDispatchInstance: frame_support::traits::Instance,
|
||||||
ThisRuntime: pallet_bridge_call_dispatch::Config<ThisCallDispatchInstance, MessageId = (LaneId, MessageNonce)>,
|
ThisRuntime: pallet_bridge_dispatch::Config<ThisDispatchInstance, MessageId = (LaneId, MessageNonce)>,
|
||||||
<ThisRuntime as pallet_bridge_call_dispatch::Config<ThisCallDispatchInstance>>::Event:
|
<ThisRuntime as pallet_bridge_dispatch::Config<ThisDispatchInstance>>::Event:
|
||||||
From<pallet_bridge_call_dispatch::RawEvent<(LaneId, MessageNonce), ThisCallDispatchInstance>>,
|
From<pallet_bridge_dispatch::RawEvent<(LaneId, MessageNonce), ThisDispatchInstance>>,
|
||||||
pallet_bridge_call_dispatch::Module<ThisRuntime, ThisCallDispatchInstance>:
|
pallet_bridge_dispatch::Module<ThisRuntime, ThisDispatchInstance>:
|
||||||
bp_message_dispatch::MessageDispatch<(LaneId, MessageNonce), Message = FromBridgedChainMessagePayload<B>>,
|
bp_message_dispatch::MessageDispatch<(LaneId, MessageNonce), Message = FromBridgedChainMessagePayload<B>>,
|
||||||
{
|
{
|
||||||
type DispatchPayload = FromBridgedChainMessagePayload<B>;
|
type DispatchPayload = FromBridgedChainMessagePayload<B>;
|
||||||
@@ -482,7 +481,7 @@ pub mod target {
|
|||||||
|
|
||||||
fn dispatch(message: DispatchMessage<Self::DispatchPayload, BalanceOf<BridgedChain<B>>>) {
|
fn dispatch(message: DispatchMessage<Self::DispatchPayload, BalanceOf<BridgedChain<B>>>) {
|
||||||
let message_id = (message.key.lane_id, message.key.nonce);
|
let message_id = (message.key.lane_id, message.key.nonce);
|
||||||
pallet_bridge_call_dispatch::Module::<ThisRuntime, ThisCallDispatchInstance>::dispatch(
|
pallet_bridge_dispatch::Module::<ThisRuntime, ThisDispatchInstance>::dispatch(
|
||||||
B::INSTANCE,
|
B::INSTANCE,
|
||||||
message_id,
|
message_id,
|
||||||
message.data.payload.map_err(drop),
|
message.data.payload.map_err(drop),
|
||||||
@@ -510,16 +509,15 @@ pub mod target {
|
|||||||
messages_count: u32,
|
messages_count: u32,
|
||||||
) -> Result<ProvedMessages<Message<BalanceOf<BridgedChain<B>>>>, &'static str>
|
) -> Result<ProvedMessages<Message<BalanceOf<BridgedChain<B>>>>, &'static str>
|
||||||
where
|
where
|
||||||
ThisRuntime: pallet_finality_verifier::Config,
|
ThisRuntime: pallet_bridge_grandpa::Config,
|
||||||
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
||||||
HashOf<BridgedChain<B>>:
|
HashOf<BridgedChain<B>>: Into<bp_runtime::HashOf<<ThisRuntime as pallet_bridge_grandpa::Config>::BridgedChain>>,
|
||||||
Into<bp_runtime::HashOf<<ThisRuntime as pallet_finality_verifier::Config>::BridgedChain>>,
|
|
||||||
{
|
{
|
||||||
verify_messages_proof_with_parser::<B, _, _>(
|
verify_messages_proof_with_parser::<B, _, _>(
|
||||||
proof,
|
proof,
|
||||||
messages_count,
|
messages_count,
|
||||||
|bridged_header_hash, bridged_storage_proof| {
|
|bridged_header_hash, bridged_storage_proof| {
|
||||||
pallet_finality_verifier::Module::<ThisRuntime>::parse_finalized_storage_proof(
|
pallet_bridge_grandpa::Module::<ThisRuntime>::parse_finalized_storage_proof(
|
||||||
bridged_header_hash.into(),
|
bridged_header_hash.into(),
|
||||||
StorageProof::new(bridged_storage_proof),
|
StorageProof::new(bridged_storage_proof),
|
||||||
|storage_adapter| storage_adapter,
|
|storage_adapter| storage_adapter,
|
||||||
@@ -931,7 +929,7 @@ mod tests {
|
|||||||
let message_on_bridged_chain = source::FromThisChainMessagePayload::<OnBridgedChainBridge> {
|
let message_on_bridged_chain = source::FromThisChainMessagePayload::<OnBridgedChainBridge> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 100,
|
weight: 100,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: ThisChainCall::Transfer.encode(),
|
call: ThisChainCall::Transfer.encode(),
|
||||||
}
|
}
|
||||||
.encode();
|
.encode();
|
||||||
@@ -945,7 +943,7 @@ mod tests {
|
|||||||
target::FromBridgedChainMessagePayload::<OnThisChainBridge> {
|
target::FromBridgedChainMessagePayload::<OnThisChainBridge> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 100,
|
weight: 100,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: target::FromBridgedChainEncodedMessageCall::<OnThisChainBridge> {
|
call: target::FromBridgedChainEncodedMessageCall::<OnThisChainBridge> {
|
||||||
encoded_call: ThisChainCall::Transfer.encode(),
|
encoded_call: ThisChainCall::Transfer.encode(),
|
||||||
_marker: PhantomData::default(),
|
_marker: PhantomData::default(),
|
||||||
@@ -962,7 +960,7 @@ mod tests {
|
|||||||
source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 100,
|
weight: 100,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![42],
|
call: vec![42],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1012,7 +1010,7 @@ mod tests {
|
|||||||
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 100,
|
weight: 100,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![42],
|
call: vec![42],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1055,7 +1053,7 @@ mod tests {
|
|||||||
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 100,
|
weight: 100,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceAccount(ThisChainAccountId(1)),
|
origin: pallet_bridge_dispatch::CallOrigin::SourceAccount(ThisChainAccountId(1)),
|
||||||
call: vec![42],
|
call: vec![42],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1122,7 +1120,7 @@ mod tests {
|
|||||||
> {
|
> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: 5,
|
weight: 5,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![1, 2, 3, 4, 5, 6],
|
call: vec![1, 2, 3, 4, 5, 6],
|
||||||
},)
|
},)
|
||||||
.is_err()
|
.is_err()
|
||||||
@@ -1137,7 +1135,7 @@ mod tests {
|
|||||||
> {
|
> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT + 1,
|
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT + 1,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![1, 2, 3, 4, 5, 6],
|
call: vec![1, 2, 3, 4, 5, 6],
|
||||||
},)
|
},)
|
||||||
.is_err()
|
.is_err()
|
||||||
@@ -1152,7 +1150,7 @@ mod tests {
|
|||||||
> {
|
> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as usize + 1],
|
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as usize + 1],
|
||||||
},)
|
},)
|
||||||
.is_err()
|
.is_err()
|
||||||
@@ -1167,7 +1165,7 @@ mod tests {
|
|||||||
> {
|
> {
|
||||||
spec_version: 1,
|
spec_version: 1,
|
||||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
||||||
origin: pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as _],
|
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as _],
|
||||||
},),
|
},),
|
||||||
Ok(()),
|
Ok(()),
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ pub fn prepare_message_proof<B, H, R, FI, MM, ML, MH>(
|
|||||||
where
|
where
|
||||||
B: MessageBridge,
|
B: MessageBridge,
|
||||||
H: Hasher,
|
H: Hasher,
|
||||||
R: pallet_finality_verifier::Config<FI>,
|
R: pallet_bridge_grandpa::Config<FI>,
|
||||||
FI: 'static,
|
FI: 'static,
|
||||||
<R::BridgedChain as bp_runtime::Chain>::Hash: Into<HashOf<BridgedChain<B>>>,
|
<R::BridgedChain as bp_runtime::Chain>::Hash: Into<HashOf<BridgedChain<B>>>,
|
||||||
MM: Fn(MessageKey) -> Vec<u8>,
|
MM: Fn(MessageKey) -> Vec<u8>,
|
||||||
@@ -130,7 +130,7 @@ where
|
|||||||
// prepare Bridged chain header and insert it into the Substrate pallet
|
// prepare Bridged chain header and insert it into the Substrate pallet
|
||||||
let bridged_header = make_bridged_header(root);
|
let bridged_header = make_bridged_header(root);
|
||||||
let bridged_header_hash = bridged_header.hash();
|
let bridged_header_hash = bridged_header.hash();
|
||||||
pallet_finality_verifier::initialize_for_benchmarks::<R, FI>(bridged_header);
|
pallet_bridge_grandpa::initialize_for_benchmarks::<R, FI>(bridged_header);
|
||||||
|
|
||||||
(
|
(
|
||||||
FromBridgedChainMessagesProof {
|
FromBridgedChainMessagesProof {
|
||||||
@@ -155,7 +155,7 @@ pub fn prepare_message_delivery_proof<B, H, R, FI, ML, MH>(
|
|||||||
where
|
where
|
||||||
B: MessageBridge,
|
B: MessageBridge,
|
||||||
H: Hasher,
|
H: Hasher,
|
||||||
R: pallet_finality_verifier::Config<FI>,
|
R: pallet_bridge_grandpa::Config<FI>,
|
||||||
FI: 'static,
|
FI: 'static,
|
||||||
<R::BridgedChain as bp_runtime::Chain>::Hash: Into<HashOf<BridgedChain<B>>>,
|
<R::BridgedChain as bp_runtime::Chain>::Hash: Into<HashOf<BridgedChain<B>>>,
|
||||||
ML: Fn(LaneId) -> Vec<u8>,
|
ML: Fn(LaneId) -> Vec<u8>,
|
||||||
@@ -183,7 +183,7 @@ where
|
|||||||
// prepare Bridged chain header and insert it into the Substrate pallet
|
// prepare Bridged chain header and insert it into the Substrate pallet
|
||||||
let bridged_header = make_bridged_header(root);
|
let bridged_header = make_bridged_header(root);
|
||||||
let bridged_header_hash = bridged_header.hash();
|
let bridged_header_hash = bridged_header.hash();
|
||||||
pallet_finality_verifier::initialize_for_benchmarks::<R, FI>(bridged_header);
|
pallet_bridge_grandpa::initialize_for_benchmarks::<R, FI>(bridged_header);
|
||||||
|
|
||||||
FromBridgedChainMessagesDeliveryProof {
|
FromBridgedChainMessagesDeliveryProof {
|
||||||
bridged_header_hash: bridged_header_hash.into(),
|
bridged_header_hash: bridged_header_hash.into(),
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ require bi-directional header sync (i.e. you can't use message delivery with one
|
|||||||
|
|
||||||
#### Dispatching Messages
|
#### Dispatching Messages
|
||||||
|
|
||||||
The [Message dispatch pallet](../modules/call-dispatch/src/lib.rs) is used to perform the actions
|
The [Message dispatch pallet](../modules/dispatch/src/lib.rs) is used to perform the actions
|
||||||
specified by messages which have come over the bridge. For Substrate-based chains this means
|
specified by messages which have come over the bridge. For Substrate-based chains this means
|
||||||
interpreting the source chain's message as a `Call` on the target chain.
|
interpreting the source chain's message as a `Call` on the target chain.
|
||||||
|
|
||||||
@@ -172,6 +172,6 @@ source chain needs to prove ownership of this account by using their target chai
|
|||||||
sign: `(Call, SourceChainAccountId).encode()`. This will be included in the message payload and
|
sign: `(Call, SourceChainAccountId).encode()`. This will be included in the message payload and
|
||||||
verified by the target chain before dispatch.
|
verified by the target chain before dispatch.
|
||||||
|
|
||||||
See [`CallOrigin` documentation](../modules/call-dispatch/src/lib.rs) for more details.
|
See [`CallOrigin` documentation](../modules/dispatch/src/lib.rs) for more details.
|
||||||
|
|
||||||
#### Message Relayers Strategy
|
#### Message Relayers Strategy
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pallet-bridge-call-dispatch"
|
name = "pallet-bridge-dispatch"
|
||||||
description = "A Substrate Runtime module that dispatches a bridge message, treating it simply as encoded Call"
|
description = "A Substrate Runtime module that dispatches a bridge message, treating it simply as encoded Call"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Call Dispatch Module
|
# Call Dispatch Module
|
||||||
|
|
||||||
The call dispatch module has a single internal (only callable by other runtime modules) entry point
|
The call dispatch module has a single internal (only callable by other runtime modules) entry point
|
||||||
for dispatching encoded calls (`pallet_bridge_call_dispatch::Module::dispatch`). Every dispatch
|
for dispatching encoded calls (`pallet_bridge_dispatch::Module::dispatch`). Every dispatch
|
||||||
(successful or not) emits a corresponding module event. The module doesn't have any call-related
|
(successful or not) emits a corresponding module event. The module doesn't have any call-related
|
||||||
requirements - they may come from the bridged chain over some message lane, or they may be crafted
|
requirements - they may come from the bridged chain over some message lane, or they may be crafted
|
||||||
locally. But in this document we'll mostly talk about this module in the context of bridges.
|
locally. But in this document we'll mostly talk about this module in the context of bridges.
|
||||||
@@ -13,7 +13,7 @@ Every message that is being dispatched has three main characteristics:
|
|||||||
- `id` is the unique id of the message within the given bridge. For messages coming from the
|
- `id` is the unique id of the message within the given bridge. For messages coming from the
|
||||||
[messages module](../messages/README.md), it may worth to use a tuple
|
[messages module](../messages/README.md), it may worth to use a tuple
|
||||||
`(LaneId, MessageNonce)` to identify a message;
|
`(LaneId, MessageNonce)` to identify a message;
|
||||||
- `message` is the `pallet_bridge_call_dispatch::MessagePayload` structure. The `call` field is set
|
- `message` is the `pallet_bridge_dispatch::MessagePayload` structure. The `call` field is set
|
||||||
to the (potentially) encoded `Call` of this chain.
|
to the (potentially) encoded `Call` of this chain.
|
||||||
|
|
||||||
The easiest way to understand what is happening when a `Call` is being dispatched, is to look at the
|
The easiest way to understand what is happening when a `Call` is being dispatched, is to look at the
|
||||||
@@ -33,7 +33,7 @@ module events set:
|
|||||||
chain storage has been corrupted. The `Call` is decoded after `spec_version` check, so we'll never
|
chain storage has been corrupted. The `Call` is decoded after `spec_version` check, so we'll never
|
||||||
try to decode `Call` from other runtime version;
|
try to decode `Call` from other runtime version;
|
||||||
- `MessageSignatureMismatch` event is emitted if submitter has chose to dispatch message using
|
- `MessageSignatureMismatch` event is emitted if submitter has chose to dispatch message using
|
||||||
specified this chain account (`pallet_bridge_call_dispatch::CallOrigin::TargetAccount` origin),
|
specified this chain account (`pallet_bridge_dispatch::CallOrigin::TargetAccount` origin),
|
||||||
but he has failed to prove that he owns the private key for this account;
|
but he has failed to prove that he owns the private key for this account;
|
||||||
- `MessageCallRejected` event is emitted if the module has been deployed with some call filter and
|
- `MessageCallRejected` event is emitted if the module has been deployed with some call filter and
|
||||||
this filter has rejected the `Call`. In your bridge you may choose to reject all messages except
|
this filter has rejected the `Call`. In your bridge you may choose to reject all messages except
|
||||||
@@ -89,7 +89,7 @@ pub enum CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainS
|
|||||||
SourceAccount(SourceChainAccountId),
|
SourceAccount(SourceChainAccountId),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Message payload type used by call-dispatch module.
|
/// Message payload type used by dispatch module.
|
||||||
#[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq)]
|
#[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq)]
|
||||||
pub struct MessagePayload<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature, Call> {
|
pub struct MessagePayload<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature, Call> {
|
||||||
/// Runtime specification version. We only dispatch messages that have the same
|
/// Runtime specification version. We only dispatch messages that have the same
|
||||||
@@ -153,7 +153,7 @@ pub trait Config<I = DefaultInstance>: frame_system::Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
decl_storage! {
|
decl_storage! {
|
||||||
trait Store for Module<T: Config<I>, I: Instance = DefaultInstance> as CallDispatch {}
|
trait Store for Module<T: Config<I>, I: Instance = DefaultInstance> as Dispatch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_event!(
|
decl_event!(
|
||||||
@@ -202,7 +202,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
let message = match message {
|
let message = match message {
|
||||||
Ok(message) => message,
|
Ok(message) => message,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
log::trace!("Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
|
log::trace!(target: "runtime::bridge-dispatch", "Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
|
||||||
Self::deposit_event(RawEvent::MessageRejected(bridge, id));
|
Self::deposit_event(RawEvent::MessageRejected(bridge, id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
let call = match message.call.into() {
|
let call = match message.call.into() {
|
||||||
Ok(call) => call,
|
Ok(call) => call,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
log::trace!("Failed to decode Call from message {:?}/{:?}", bridge, id,);
|
log::trace!(target: "runtime::bridge-dispatch", "Failed to decode Call from message {:?}/{:?}", bridge, id,);
|
||||||
Self::deposit_event(RawEvent::MessageCallDecodeFailed(bridge, id));
|
Self::deposit_event(RawEvent::MessageCallDecodeFailed(bridge, id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
CallOrigin::SourceRoot => {
|
CallOrigin::SourceRoot => {
|
||||||
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
|
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
|
||||||
let target_id = T::AccountIdConverter::convert(hex_id);
|
let target_id = T::AccountIdConverter::convert(hex_id);
|
||||||
log::trace!("Root Account: {:?}", &target_id);
|
log::trace!(target: "runtime::bridge-dispatch", "Root Account: {:?}", &target_id);
|
||||||
target_id
|
target_id
|
||||||
}
|
}
|
||||||
CallOrigin::TargetAccount(source_account_id, target_public, target_signature) => {
|
CallOrigin::TargetAccount(source_account_id, target_public, target_signature) => {
|
||||||
@@ -252,6 +252,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
let target_account = target_public.into_account();
|
let target_account = target_public.into_account();
|
||||||
if !target_signature.verify(&digest[..], &target_account) {
|
if !target_signature.verify(&digest[..], &target_account) {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
|
target: "runtime::bridge-dispatch",
|
||||||
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
|
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -262,13 +263,13 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log::trace!("Target Account: {:?}", &target_account);
|
log::trace!(target: "runtime::bridge-dispatch", "Target Account: {:?}", &target_account);
|
||||||
target_account
|
target_account
|
||||||
}
|
}
|
||||||
CallOrigin::SourceAccount(source_account_id) => {
|
CallOrigin::SourceAccount(source_account_id) => {
|
||||||
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
|
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
|
||||||
let target_id = T::AccountIdConverter::convert(hex_id);
|
let target_id = T::AccountIdConverter::convert(hex_id);
|
||||||
log::trace!("Source Account: {:?}", &target_id);
|
log::trace!(target: "runtime::bridge-dispatch", "Source Account: {:?}", &target_id);
|
||||||
target_id
|
target_id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -276,6 +277,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
// filter the call
|
// filter the call
|
||||||
if !T::CallFilter::filter(&call) {
|
if !T::CallFilter::filter(&call) {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
|
target: "runtime::bridge-dispatch",
|
||||||
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
|
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -292,6 +294,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
let expected_weight = dispatch_info.weight;
|
let expected_weight = dispatch_info.weight;
|
||||||
if message.weight < expected_weight {
|
if message.weight < expected_weight {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
|
target: "runtime::bridge-dispatch",
|
||||||
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
|
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -310,11 +313,12 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
// finally dispatch message
|
// finally dispatch message
|
||||||
let origin = RawOrigin::Signed(origin_account).into();
|
let origin = RawOrigin::Signed(origin_account).into();
|
||||||
|
|
||||||
log::trace!("Message being dispatched is: {:?}", &call);
|
log::trace!(target: "runtime::bridge-dispatch", "Message being dispatched is: {:?}", &call);
|
||||||
let dispatch_result = call.dispatch(origin);
|
let dispatch_result = call.dispatch(origin);
|
||||||
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
|
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
|
||||||
|
|
||||||
log::trace!(
|
log::trace!(
|
||||||
|
target: "runtime::bridge-dispatch",
|
||||||
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
|
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -452,7 +456,7 @@ mod tests {
|
|||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||||
{
|
{
|
||||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||||
CallDispatch: call_dispatch::{Module, Call, Event<T>},
|
Dispatch: call_dispatch::{Module, Call, Event<T>},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +575,7 @@ mod tests {
|
|||||||
message.spec_version = BAD_SPEC_VERSION;
|
message.spec_version = BAD_SPEC_VERSION;
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -599,7 +603,7 @@ mod tests {
|
|||||||
message.weight = 0;
|
message.weight = 0;
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -627,7 +631,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -649,7 +653,7 @@ mod tests {
|
|||||||
let id = [0; 4];
|
let id = [0; 4];
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Err(()));
|
Dispatch::dispatch(bridge, id, Err(()));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -673,7 +677,7 @@ mod tests {
|
|||||||
message.call.0 = vec![];
|
message.call.0 = vec![];
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -700,7 +704,7 @@ mod tests {
|
|||||||
message.weight = weight;
|
message.weight = weight;
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -721,7 +725,7 @@ mod tests {
|
|||||||
let message = prepare_root_message(Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3])));
|
let message = prepare_root_message(Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3])));
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -748,7 +752,7 @@ mod tests {
|
|||||||
let message = prepare_target_message(call);
|
let message = prepare_target_message(call);
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -775,7 +779,7 @@ mod tests {
|
|||||||
let message = prepare_source_message(call);
|
let message = prepare_source_message(call);
|
||||||
|
|
||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
CallDispatch::dispatch(bridge, id, Ok(message));
|
Dispatch::dispatch(bridge, id, Ok(message));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
System::events(),
|
System::events(),
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pallet-finality-verifier"
|
name = "pallet-bridge-grandpa"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Substrate Finality Verifier Pallet
|
//! Substrate GRANDPA Pallet
|
||||||
//!
|
//!
|
||||||
//! This pallet is an on-chain GRANDPA light client for Substrate based chains.
|
//! This pallet is an on-chain GRANDPA light client for Substrate based chains.
|
||||||
//!
|
//!
|
||||||
@@ -122,7 +122,7 @@ pub mod pallet {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let (hash, number) = (finality_target.hash(), finality_target.number());
|
let (hash, number) = (finality_target.hash(), finality_target.number());
|
||||||
log::trace!("Going to try and finalize header {:?}", finality_target);
|
log::trace!(target: "runtime::bridge-grandpa", "Going to try and finalize header {:?}", finality_target);
|
||||||
|
|
||||||
let best_finalized = <ImportedHeaders<T, I>>::get(<BestFinalized<T, I>>::get()).expect(
|
let best_finalized = <ImportedHeaders<T, I>>::get(<BestFinalized<T, I>>::get()).expect(
|
||||||
"In order to reach this point the bridge must have been initialized. Afterwards,
|
"In order to reach this point the bridge must have been initialized. Afterwards,
|
||||||
@@ -141,7 +141,7 @@ pub mod pallet {
|
|||||||
<ImportedHeaders<T, I>>::insert(hash, finality_target);
|
<ImportedHeaders<T, I>>::insert(hash, finality_target);
|
||||||
<RequestCount<T, I>>::mutate(|count| *count += 1);
|
<RequestCount<T, I>>::mutate(|count| *count += 1);
|
||||||
|
|
||||||
log::info!("Succesfully imported finalized header with hash {:?}!", hash);
|
log::info!(target: "runtime::bridge-grandpa", "Succesfully imported finalized header with hash {:?}!", hash);
|
||||||
|
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
@@ -167,6 +167,7 @@ pub mod pallet {
|
|||||||
initialize_bridge::<T, I>(init_data.clone());
|
initialize_bridge::<T, I>(init_data.clone());
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
|
target: "runtime::bridge-grandpa",
|
||||||
"Pallet has been initialized with the following parameters: {:?}",
|
"Pallet has been initialized with the following parameters: {:?}",
|
||||||
init_data
|
init_data
|
||||||
);
|
);
|
||||||
@@ -183,11 +184,11 @@ pub mod pallet {
|
|||||||
match new_owner {
|
match new_owner {
|
||||||
Some(new_owner) => {
|
Some(new_owner) => {
|
||||||
ModuleOwner::<T, I>::put(&new_owner);
|
ModuleOwner::<T, I>::put(&new_owner);
|
||||||
log::info!("Setting pallet Owner to: {:?}", new_owner);
|
log::info!(target: "runtime::bridge-grandpa", "Setting pallet Owner to: {:?}", new_owner);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
ModuleOwner::<T, I>::kill();
|
ModuleOwner::<T, I>::kill();
|
||||||
log::info!("Removed Owner of pallet.");
|
log::info!(target: "runtime::bridge-grandpa", "Removed Owner of pallet.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,9 +204,9 @@ pub mod pallet {
|
|||||||
<IsHalted<T, I>>::put(operational);
|
<IsHalted<T, I>>::put(operational);
|
||||||
|
|
||||||
if operational {
|
if operational {
|
||||||
log::info!("Resuming pallet operations.");
|
log::info!(target: "runtime::bridge-grandpa", "Resuming pallet operations.");
|
||||||
} else {
|
} else {
|
||||||
log::warn!("Stopping pallet operations.");
|
log::warn!(target: "runtime::bridge-grandpa", "Stopping pallet operations.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
@@ -343,6 +344,7 @@ pub mod pallet {
|
|||||||
<CurrentAuthoritySet<T, I>>::put(&next_authorities);
|
<CurrentAuthoritySet<T, I>>::put(&next_authorities);
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
|
target: "runtime::bridge-grandpa",
|
||||||
"Transitioned from authority set {} to {}! New authorities are: {:?}",
|
"Transitioned from authority set {} to {}! New authorities are: {:?}",
|
||||||
current_set_id,
|
current_set_id,
|
||||||
current_set_id + 1,
|
current_set_id + 1,
|
||||||
@@ -370,7 +372,7 @@ pub mod pallet {
|
|||||||
Ok(
|
Ok(
|
||||||
verify_justification::<BridgedHeader<T, I>>((hash, number), set_id, &voter_set, &justification).map_err(
|
verify_justification::<BridgedHeader<T, I>>((hash, number), set_id, &voter_set, &justification).map_err(
|
||||||
|e| {
|
|e| {
|
||||||
log::error!("Received invalid justification for {:?}: {:?}", hash, e);
|
log::error!(target: "runtime::bridge-grandpa", "Received invalid justification for {:?}: {:?}", hash, e);
|
||||||
<Error<T, I>>::InvalidJustification
|
<Error<T, I>>::InvalidJustification
|
||||||
},
|
},
|
||||||
)?,
|
)?,
|
||||||
@@ -33,7 +33,7 @@ pub type TestHash = crate::BridgedBlockHash<TestRuntime, ()>;
|
|||||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
||||||
|
|
||||||
use crate as finality_verifier;
|
use crate as grandpa;
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime where
|
||||||
@@ -42,7 +42,7 @@ construct_runtime! {
|
|||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||||
{
|
{
|
||||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||||
FinalityVerifier: finality_verifier::{Module},
|
Grandpa: grandpa::{Module},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ parameter_types! {
|
|||||||
pub const MaxRequests: u32 = 2;
|
pub const MaxRequests: u32 = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl finality_verifier::Config for TestRuntime {
|
impl grandpa::Config for TestRuntime {
|
||||||
type BridgedChain = TestBridgedChain;
|
type BridgedChain = TestBridgedChain;
|
||||||
type MaxRequests = MaxRequests;
|
type MaxRequests = MaxRequests;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ pub const ROCOCO_BRIDGE_INSTANCE: InstanceId = *b"roco";
|
|||||||
pub const WESTEND_BRIDGE_INSTANCE: InstanceId = *b"wend";
|
pub const WESTEND_BRIDGE_INSTANCE: InstanceId = *b"wend";
|
||||||
|
|
||||||
/// Call-dispatch module prefix.
|
/// Call-dispatch module prefix.
|
||||||
pub const CALL_DISPATCH_MODULE_PREFIX: &[u8] = b"pallet-bridge/call-dispatch";
|
pub const CALL_DISPATCH_MODULE_PREFIX: &[u8] = b"pallet-bridge/dispatch";
|
||||||
|
|
||||||
/// A unique prefix for entropy when generating cross-chain account IDs.
|
/// A unique prefix for entropy when generating cross-chain account IDs.
|
||||||
pub const ACCOUNT_DERIVATION_PREFIX: &[u8] = b"pallet-bridge/account-derivation/account";
|
pub const ACCOUNT_DERIVATION_PREFIX: &[u8] = b"pallet-bridge/account-derivation/account";
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ finality-relay = { path = "../finality" }
|
|||||||
headers-relay = { path = "../headers" }
|
headers-relay = { path = "../headers" }
|
||||||
messages-relay = { path = "../messages" }
|
messages-relay = { path = "../messages" }
|
||||||
millau-runtime = { path = "../../bin/millau/runtime" }
|
millau-runtime = { path = "../../bin/millau/runtime" }
|
||||||
pallet-bridge-call-dispatch = { path = "../../modules/call-dispatch" }
|
pallet-bridge-dispatch = { path = "../../modules/dispatch" }
|
||||||
|
pallet-bridge-grandpa = { path = "../../modules/grandpa" }
|
||||||
pallet-bridge-messages = { path = "../../modules/messages" }
|
pallet-bridge-messages = { path = "../../modules/messages" }
|
||||||
pallet-finality-verifier = { path = "../../modules/finality-verifier" }
|
|
||||||
relay-kusama-client = { path = "../client-kusama" }
|
relay-kusama-client = { path = "../client-kusama" }
|
||||||
relay-millau-client = { path = "../client-millau" }
|
relay-millau-client = { path = "../client-millau" }
|
||||||
relay-polkadot-client = { path = "../client-polkadot" }
|
relay-polkadot-client = { path = "../client-polkadot" }
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
//! Initialize Substrate -> Substrate headers bridge.
|
//! Initialize Substrate -> Substrate headers bridge.
|
||||||
//!
|
//!
|
||||||
//! Initialization is a transaction that calls `initialize()` function of the
|
//! Initialization is a transaction that calls `initialize()` function of the
|
||||||
//! `pallet-finality-verifier` pallet. This transaction brings initial header
|
//! `pallet-bridge-grandpa` pallet. This transaction brings initial header
|
||||||
//! and authorities set from source to target chain. The headers sync starts
|
//! and authorities set from source to target chain. The headers sync starts
|
||||||
//! with this header.
|
//! with this header.
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ use bp_header_chain::{
|
|||||||
use codec::Decode;
|
use codec::Decode;
|
||||||
use finality_grandpa::voter_set::VoterSet;
|
use finality_grandpa::voter_set::VoterSet;
|
||||||
use num_traits::{One, Zero};
|
use num_traits::{One, Zero};
|
||||||
use pallet_finality_verifier::InitializationData;
|
use pallet_bridge_grandpa::InitializationData;
|
||||||
use relay_substrate_client::{Chain, Client};
|
use relay_substrate_client::{Chain, Client};
|
||||||
use sp_core::Bytes;
|
use sp_core::Bytes;
|
||||||
use sp_finality_grandpa::AuthorityList as GrandpaAuthoritiesSet;
|
use sp_finality_grandpa::AuthorityList as GrandpaAuthoritiesSet;
|
||||||
@@ -83,7 +83,7 @@ async fn do_initialize<SourceChain: Chain, TargetChain: Chain>(
|
|||||||
Ok(initialization_tx_hash)
|
Ok(initialization_tx_hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prepare initialization data for the finality-verifier pallet.
|
/// Prepare initialization data for the GRANDPA verifier pallet.
|
||||||
async fn prepare_initialization_data<SourceChain: Chain>(
|
async fn prepare_initialization_data<SourceChain: Chain>(
|
||||||
source_client: Client<SourceChain>,
|
source_client: Client<SourceChain>,
|
||||||
) -> Result<InitializationData<SourceChain::Header>, String> {
|
) -> Result<InitializationData<SourceChain::Header>, String> {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ impl SubstrateFinalitySyncPipeline for MillauFinalityToRialto {
|
|||||||
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
||||||
let nonce = self.target_client.next_account_index(account_id).await?;
|
let nonce = self.target_client.next_account_index(account_id).await?;
|
||||||
let call =
|
let call =
|
||||||
rialto_runtime::FinalityBridgeMillauCall::submit_finality_proof(header.into_inner(), proof.into_inner())
|
rialto_runtime::BridgeGrandpaMillauCall::submit_finality_proof(header.into_inner(), proof.into_inner())
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
let genesis_hash = *self.target_client.genesis_hash();
|
let genesis_hash = *self.target_client.genesis_hash();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ pub type WestendClient = relay_substrate_client::Client<Westend>;
|
|||||||
use crate::cli::{ExplicitOrMaximal, HexBytes, Origins};
|
use crate::cli::{ExplicitOrMaximal, HexBytes, Origins};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_support::weights::{GetDispatchInfo, Weight};
|
use frame_support::weights::{GetDispatchInfo, Weight};
|
||||||
use pallet_bridge_call_dispatch::{CallOrigin, MessagePayload};
|
use pallet_bridge_dispatch::{CallOrigin, MessagePayload};
|
||||||
use relay_millau_client::{Millau, SigningParams as MillauSigningParams};
|
use relay_millau_client::{Millau, SigningParams as MillauSigningParams};
|
||||||
use relay_rialto_client::{Rialto, SigningParams as RialtoSigningParams};
|
use relay_rialto_client::{Rialto, SigningParams as RialtoSigningParams};
|
||||||
use relay_substrate_client::{Chain, ConnectionParams, TransactionSignScheme};
|
use relay_substrate_client::{Chain, ConnectionParams, TransactionSignScheme};
|
||||||
@@ -64,7 +64,7 @@ async fn run_init_bridge(command: cli::InitBridge) -> Result<(), String> {
|
|||||||
&rialto_sign.signer,
|
&rialto_sign.signer,
|
||||||
rialto_signer_next_index,
|
rialto_signer_next_index,
|
||||||
rialto_runtime::SudoCall::sudo(Box::new(
|
rialto_runtime::SudoCall::sudo(Box::new(
|
||||||
rialto_runtime::FinalityBridgeMillauCall::initialize(initialization_data).into(),
|
rialto_runtime::BridgeGrandpaMillauCall::initialize(initialization_data).into(),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
)
|
)
|
||||||
@@ -86,9 +86,9 @@ async fn run_init_bridge(command: cli::InitBridge) -> Result<(), String> {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
crate::headers_initialize::initialize(rialto_client, millau_client.clone(), move |initialization_data| {
|
crate::headers_initialize::initialize(rialto_client, millau_client.clone(), move |initialization_data| {
|
||||||
let initialize_call = millau_runtime::FinalityBridgeRialtoCall::<
|
let initialize_call = millau_runtime::BridgeGrandpaRialtoCall::<
|
||||||
millau_runtime::Runtime,
|
millau_runtime::Runtime,
|
||||||
millau_runtime::RialtoFinalityVerifierInstance,
|
millau_runtime::RialtoGrandpaInstance,
|
||||||
>::initialize(initialization_data);
|
>::initialize(initialization_data);
|
||||||
|
|
||||||
Ok(Bytes(
|
Ok(Bytes(
|
||||||
@@ -119,9 +119,9 @@ async fn run_init_bridge(command: cli::InitBridge) -> Result<(), String> {
|
|||||||
// may fail, because we need to initialize both Rialto -> Millau and Westend -> Millau bridge.
|
// may fail, because we need to initialize both Rialto -> Millau and Westend -> Millau bridge.
|
||||||
// => since there's single possible sudo account, one of transaction may fail with duplicate nonce error
|
// => since there's single possible sudo account, one of transaction may fail with duplicate nonce error
|
||||||
crate::headers_initialize::initialize(westend_client, millau_client.clone(), move |initialization_data| {
|
crate::headers_initialize::initialize(westend_client, millau_client.clone(), move |initialization_data| {
|
||||||
let initialize_call = millau_runtime::FinalityBridgeWestendCall::<
|
let initialize_call = millau_runtime::BridgeGrandpaWestendCall::<
|
||||||
millau_runtime::Runtime,
|
millau_runtime::Runtime,
|
||||||
millau_runtime::WestendFinalityVerifierInstance,
|
millau_runtime::WestendGrandpaInstance,
|
||||||
>::initialize(initialization_data);
|
>::initialize(initialization_data);
|
||||||
|
|
||||||
Ok(Bytes(
|
Ok(Bytes(
|
||||||
@@ -861,7 +861,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
call.get_dispatch_info().weight,
|
call.get_dispatch_info().weight,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert_eq!(Millau::verify_message(&payload), Ok(()));
|
assert_eq!(Millau::verify_message(&payload), Ok(()));
|
||||||
@@ -871,7 +871,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
call.get_dispatch_info().weight,
|
call.get_dispatch_info().weight,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert!(Millau::verify_message(&payload).is_err());
|
assert!(Millau::verify_message(&payload).is_err());
|
||||||
@@ -897,7 +897,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
maximal_dispatch_weight,
|
maximal_dispatch_weight,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert_eq!(Millau::verify_message(&payload), Ok(()));
|
assert_eq!(Millau::verify_message(&payload), Ok(()));
|
||||||
@@ -905,7 +905,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
maximal_dispatch_weight + 1,
|
maximal_dispatch_weight + 1,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert!(Millau::verify_message(&payload).is_err());
|
assert!(Millau::verify_message(&payload).is_err());
|
||||||
@@ -921,7 +921,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
maximal_dispatch_weight,
|
maximal_dispatch_weight,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert_eq!(Rialto::verify_message(&payload), Ok(()));
|
assert_eq!(Rialto::verify_message(&payload), Ok(()));
|
||||||
@@ -929,7 +929,7 @@ mod tests {
|
|||||||
let payload = message_payload(
|
let payload = message_payload(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
maximal_dispatch_weight + 1,
|
maximal_dispatch_weight + 1,
|
||||||
pallet_bridge_call_dispatch::CallOrigin::SourceRoot,
|
pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||||
&call,
|
&call,
|
||||||
);
|
);
|
||||||
assert!(Rialto::verify_message(&payload).is_err());
|
assert!(Rialto::verify_message(&payload).is_err());
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ impl SubstrateFinalitySyncPipeline for RialtoFinalityToMillau {
|
|||||||
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
||||||
let nonce = self.target_client.next_account_index(account_id).await?;
|
let nonce = self.target_client.next_account_index(account_id).await?;
|
||||||
|
|
||||||
let call = millau_runtime::FinalityBridgeRialtoCall::<
|
let call = millau_runtime::BridgeGrandpaRialtoCall::<
|
||||||
millau_runtime::Runtime,
|
millau_runtime::Runtime,
|
||||||
millau_runtime::RialtoFinalityVerifierInstance,
|
millau_runtime::RialtoGrandpaInstance,
|
||||||
>::submit_finality_proof(header.into_inner(), proof.into_inner())
|
>::submit_finality_proof(header.into_inner(), proof.into_inner())
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
|
|||||||
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
let account_id = self.target_sign.signer.public().as_array_ref().clone().into();
|
||||||
let nonce = self.target_client.next_account_index(account_id).await?;
|
let nonce = self.target_client.next_account_index(account_id).await?;
|
||||||
|
|
||||||
let call = millau_runtime::FinalityBridgeWestendCall::<
|
let call = millau_runtime::BridgeGrandpaWestendCall::<
|
||||||
millau_runtime::Runtime,
|
millau_runtime::Runtime,
|
||||||
millau_runtime::WestendFinalityVerifierInstance,
|
millau_runtime::WestendGrandpaInstance,
|
||||||
>::submit_finality_proof(header.into_inner(), proof.into_inner())
|
>::submit_finality_proof(header.into_inner(), proof.into_inner())
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user