Introduce bridge relayers pallet (#1513)

* introduce relayers pallet

* add MessageDeliveryAndDispatchPaymentAdapter

* plug in pallet into test runtimes

* tests prototype

* tests for the relayers pallet

* tests for payment adapter

* mint_reward_payment_procedure_actually_mints_tokens

* benchmarks

* remove irrelevant todo

* remove redundant clone
This commit is contained in:
Svyatoslav Nikolsky
2022-07-20 13:10:59 +03:00
committed by Bastian Köcher
parent 1e0c2a6e02
commit 7590abd1a3
17 changed files with 862 additions and 43 deletions
+40 -39
View File
@@ -17,7 +17,7 @@
//! Autogenerated weights for `pallet_bridge_messages`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-07-07, STEPS: 50, REPEAT: 20
//! DATE: 2022-07-20, STEPS: 50, REPEAT: 20
//! LOW RANGE: [], HIGH RANGE: []
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
//! CHAIN: Some("dev"), DB CACHE: 1024
@@ -40,6 +40,7 @@
#![allow(clippy::all)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
traits::Get,
@@ -69,22 +70,22 @@ pub trait WeightInfo {
pub struct MillauWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
fn send_minimal_message_worst_case() -> Weight {
(37_948_000 as Weight)
(38_822_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(10 as Weight))
}
fn send_1_kb_message_worst_case() -> Weight {
(39_158_000 as Weight)
(39_799_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(10 as Weight))
}
fn send_16_kb_message_worst_case() -> Weight {
(48_698_000 as Weight)
(47_772_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(10 as Weight))
}
fn maximal_increase_message_fee() -> Weight {
(2_919_864_000 as Weight)
(3_081_804_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -95,71 +96,71 @@ impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn receive_single_message_proof() -> Weight {
(25_992_000 as Weight)
(26_523_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_two_messages_proof() -> Weight {
(37_016_000 as Weight)
(39_278_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
(31_589_000 as Weight)
(32_416_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_single_message_proof_1_kb() -> Weight {
(25_962_000 as Weight)
(27_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn receive_single_message_proof_16_kb() -> Weight {
(74_385_000 as Weight)
(78_235_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn receive_single_prepaid_message_proof() -> Weight {
(26_159_000 as Weight)
(27_635_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_single_message() -> Weight {
(27_590_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
(34_576_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
(27_354_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
(37_318_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
(27_652_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
(41_245_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn send_minimal_message_worst_case() -> Weight {
(37_948_000 as Weight)
(38_822_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
}
fn send_1_kb_message_worst_case() -> Weight {
(39_158_000 as Weight)
(39_799_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
}
fn send_16_kb_message_worst_case() -> Weight {
(48_698_000 as Weight)
(47_772_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
}
fn maximal_increase_message_fee() -> Weight {
(2_919_864_000 as Weight)
(3_081_804_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -170,48 +171,48 @@ impl WeightInfo for () {
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn receive_single_message_proof() -> Weight {
(25_992_000 as Weight)
(26_523_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_two_messages_proof() -> Weight {
(37_016_000 as Weight)
(39_278_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
(31_589_000 as Weight)
(32_416_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_single_message_proof_1_kb() -> Weight {
(25_962_000 as Weight)
(27_078_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn receive_single_message_proof_16_kb() -> Weight {
(74_385_000 as Weight)
(78_235_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn receive_single_prepaid_message_proof() -> Weight {
(26_159_000 as Weight)
(27_635_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_single_message() -> Weight {
(27_590_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
(34_576_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
(27_354_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
(37_318_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
(27_652_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
(41_245_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
}