mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Rename pallet-message-lane into pallet-bridge-messages (#834)
* use runtime:: prefix for message-lane pallet traces * renamed message-lane (module and primitives) folder into messages * replace "message lane" with "messages" where appropriate
This commit is contained in:
committed by
Bastian Köcher
parent
eb7c96ba14
commit
4105575794
+1
-1
@@ -87,7 +87,7 @@ the `relays` which are used to pass messages between chains.
|
||||
├── modules // Substrate Runtime Modules (a.k.a Pallets)
|
||||
│ ├── ethereum // Ethereum PoA Header Sync Module
|
||||
│ ├── substrate // Substrate Based Chain Header Sync Module
|
||||
│ ├── message-lane // Cross Chain Message Passing
|
||||
│ ├── messages // Cross Chain Message Passing
|
||||
│ └── ...
|
||||
├── primitives // Code shared between modules, runtimes, and relays
|
||||
│ └── ...
|
||||
|
||||
@@ -15,12 +15,12 @@ structopt = "0.3.21"
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
bp-message-lane = { path = "../../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../../primitives/messages" }
|
||||
bp-millau= { path = "../../../primitives/chains/millau" }
|
||||
bp-runtime = { path = "../../../primitives/runtime" }
|
||||
millau-runtime = { path = "../runtime" }
|
||||
pallet-message-lane = { path = "../../../modules/message-lane" }
|
||||
pallet-message-lane-rpc = { path = "../../../modules/message-lane/rpc" }
|
||||
pallet-bridge-messages = { path = "../../../modules/messages" }
|
||||
pallet-bridge-messages-rpc = { path = "../../../modules/messages/rpc" }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
|
||||
@@ -122,7 +122,10 @@ impl Alternative {
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("George//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Harry//stash"),
|
||||
pallet_message_lane::Module::<millau_runtime::Runtime, pallet_message_lane::DefaultInstance>::relayer_fund_account_id(),
|
||||
pallet_bridge_messages::Module::<
|
||||
millau_runtime::Runtime,
|
||||
pallet_bridge_messages::DefaultInstance,
|
||||
>::relayer_fund_account_id(),
|
||||
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
)),
|
||||
|
||||
@@ -190,17 +190,17 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{InstanceId, RIALTO_BRIDGE_INSTANCE};
|
||||
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
|
||||
use sp_core::storage::StorageKey;
|
||||
|
||||
// This struct is here to ease update process.
|
||||
|
||||
/// Millau runtime from message-lane RPC point of view.
|
||||
struct MillauMessageLaneKeys;
|
||||
/// Millau runtime from messages RPC point of view.
|
||||
struct MillauMessagesKeys;
|
||||
|
||||
impl pallet_message_lane_rpc::Runtime for MillauMessageLaneKeys {
|
||||
impl pallet_bridge_messages_rpc::Runtime for MillauMessagesKeys {
|
||||
fn message_key(&self, instance: &InstanceId, lane: &LaneId, nonce: MessageNonce) -> Option<StorageKey> {
|
||||
match *instance {
|
||||
RIALTO_BRIDGE_INSTANCE => Some(millau_runtime::rialto_messages::message_key(lane, nonce)),
|
||||
@@ -223,7 +223,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
}
|
||||
}
|
||||
|
||||
use pallet_message_lane_rpc::{MessageLaneApi, MessageLaneRpcHandler};
|
||||
use pallet_bridge_messages_rpc::{MessagesApi, MessagesRpcHandler};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
|
||||
use sc_rpc::DenyUnsafe;
|
||||
@@ -257,9 +257,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
subscription_executor,
|
||||
finality_proof_provider.clone(),
|
||||
)));
|
||||
io.extend_with(MessageLaneApi::to_delegate(MessageLaneRpcHandler::new(
|
||||
io.extend_with(MessagesApi::to_delegate(MessagesRpcHandler::new(
|
||||
backend.clone(),
|
||||
Arc::new(MillauMessageLaneKeys),
|
||||
Arc::new(MillauMessagesKeys),
|
||||
)));
|
||||
io
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ serde = { version = "1.0.124", optional = true, features = ["derive"] }
|
||||
# Bridge dependencies
|
||||
|
||||
bp-header-chain = { path = "../../../primitives/header-chain", default-features = false }
|
||||
bp-message-lane = { path = "../../../primitives/message-lane", default-features = false }
|
||||
bp-messages = { path = "../../../primitives/messages", default-features = false }
|
||||
bp-millau = { path = "../../../primitives/chains/millau", default-features = false }
|
||||
bp-rialto = { path = "../../../primitives/chains/rialto", default-features = false }
|
||||
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
@@ -23,7 +23,7 @@ bp-westend = { path = "../../../primitives/chains/westend", default-features = f
|
||||
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
|
||||
pallet-bridge-call-dispatch = { path = "../../../modules/call-dispatch", default-features = false }
|
||||
pallet-finality-verifier = { path = "../../../modules/finality-verifier", default-features = false }
|
||||
pallet-message-lane = { path = "../../../modules/message-lane", 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-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
||||
|
||||
@@ -63,7 +63,7 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "2.
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-header-chain/std",
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-millau/std",
|
||||
"bp-rialto/std",
|
||||
"bp-runtime/std",
|
||||
@@ -79,7 +79,7 @@ std = [
|
||||
"pallet-bridge-call-dispatch/std",
|
||||
"pallet-finality-verifier/std",
|
||||
"pallet-grandpa/std",
|
||||
"pallet-message-lane/std",
|
||||
"pallet-bridge-messages/std",
|
||||
"pallet-randomness-collective-flip/std",
|
||||
"pallet-shift-session-manager/std",
|
||||
"pallet-session/std",
|
||||
|
||||
@@ -62,9 +62,9 @@ pub use frame_support::{
|
||||
|
||||
pub use frame_system::Call as SystemCall;
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
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_message_lane::Call as MessageLaneCall;
|
||||
pub use pallet_substrate_bridge::Call as BridgeRialtoCall;
|
||||
pub use pallet_sudo::Call as SudoCall;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
@@ -209,7 +209,7 @@ impl pallet_aura::Config for Runtime {
|
||||
}
|
||||
impl pallet_bridge_call_dispatch::Config for Runtime {
|
||||
type Event = Event;
|
||||
type MessageId = (bp_message_lane::LaneId, bp_message_lane::MessageNonce);
|
||||
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||
type Call = Call;
|
||||
type CallFilter = ();
|
||||
type EncodedCall = crate::rialto_messages::FromRialtoEncodedCall;
|
||||
@@ -328,10 +328,10 @@ impl pallet_finality_verifier::Config<WestendFinalityVerifierInstance> for Runti
|
||||
impl pallet_shift_session_manager::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const MaxMessagesToPruneAtOnce: bp_message_lane::MessageNonce = 8;
|
||||
pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_message_lane::MessageNonce =
|
||||
pub const MaxMessagesToPruneAtOnce: bp_messages::MessageNonce = 8;
|
||||
pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE;
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_message_lane::MessageNonce =
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_millau::MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE;
|
||||
// `IdentityFee` is used by Millau => we may use weight directly
|
||||
pub const GetDeliveryConfirmationTransactionFee: Balance =
|
||||
@@ -339,11 +339,11 @@ parameter_types! {
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
}
|
||||
|
||||
impl pallet_message_lane::Config for Runtime {
|
||||
impl pallet_bridge_messages::Config for Runtime {
|
||||
type Event = Event;
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/390
|
||||
type WeightInfo = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||
type Parameter = rialto_messages::MillauToRialtoMessageLaneParameter;
|
||||
type WeightInfo = pallet_bridge_messages::weights::RialtoWeight<Runtime>;
|
||||
type Parameter = rialto_messages::MillauToRialtoMessagesParameter;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
@@ -359,7 +359,7 @@ impl pallet_message_lane::Config for Runtime {
|
||||
|
||||
type TargetHeaderChain = crate::rialto_messages::Rialto;
|
||||
type LaneMessageVerifier = crate::rialto_messages::ToRialtoMessageVerifier;
|
||||
type MessageDeliveryAndDispatchPayment = pallet_message_lane::instant_payments::InstantCurrencyPayments<
|
||||
type MessageDeliveryAndDispatchPayment = pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
|
||||
Runtime,
|
||||
pallet_balances::Module<Runtime>,
|
||||
GetDeliveryConfirmationTransactionFee,
|
||||
@@ -377,7 +377,7 @@ construct_runtime!(
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
BridgeRialto: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
||||
BridgeRialtoMessageLane: pallet_message_lane::{Module, Call, Storage, Event<T>},
|
||||
BridgeRialtoMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
||||
BridgeCallDispatch: pallet_bridge_call_dispatch::{Module, Event<T>},
|
||||
BridgeRialtoFinalityVerifier: pallet_finality_verifier::{Module, Call},
|
||||
BridgeWestendFinalityVerifier: pallet_finality_verifier::<Instance1>::{Module, Call},
|
||||
@@ -603,7 +603,7 @@ impl_runtime_apis! {
|
||||
|
||||
impl bp_rialto::ToRialtoOutboundLaneApi<Block, Balance, ToRialtoMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_message_lane::LaneId,
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: ToRialtoMessagePayload,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<WithRialtoMessageBridge>(
|
||||
@@ -613,12 +613,12 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn messages_dispatch_weight(
|
||||
lane: bp_message_lane::LaneId,
|
||||
begin: bp_message_lane::MessageNonce,
|
||||
end: bp_message_lane::MessageNonce,
|
||||
) -> Vec<(bp_message_lane::MessageNonce, Weight, u32)> {
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<(bp_messages::MessageNonce, Weight, u32)> {
|
||||
(begin..=end).filter_map(|nonce| {
|
||||
let encoded_payload = BridgeRialtoMessageLane::outbound_message_payload(lane, nonce)?;
|
||||
let encoded_payload = BridgeRialtoMessages::outbound_message_payload(lane, nonce)?;
|
||||
let decoded_payload = rialto_messages::ToRialtoMessagePayload::decode(
|
||||
&mut &encoded_payload[..]
|
||||
).ok()?;
|
||||
@@ -627,26 +627,26 @@ impl_runtime_apis! {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn latest_received_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeRialtoMessageLane::outbound_latest_received_nonce(lane)
|
||||
fn latest_received_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeRialtoMessages::outbound_latest_received_nonce(lane)
|
||||
}
|
||||
|
||||
fn latest_generated_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeRialtoMessageLane::outbound_latest_generated_nonce(lane)
|
||||
fn latest_generated_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeRialtoMessages::outbound_latest_generated_nonce(lane)
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rialto::FromRialtoInboundLaneApi<Block> for Runtime {
|
||||
fn latest_received_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeRialtoMessageLane::inbound_latest_received_nonce(lane)
|
||||
fn latest_received_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeRialtoMessages::inbound_latest_received_nonce(lane)
|
||||
}
|
||||
|
||||
fn latest_confirmed_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeRialtoMessageLane::inbound_latest_confirmed_nonce(lane)
|
||||
fn latest_confirmed_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeRialtoMessages::inbound_latest_confirmed_nonce(lane)
|
||||
}
|
||||
|
||||
fn unrewarded_relayers_state(lane: bp_message_lane::LaneId) -> bp_message_lane::UnrewardedRelayersState {
|
||||
BridgeRialtoMessageLane::inbound_unrewarded_relayers_state(lane)
|
||||
fn unrewarded_relayers_state(lane: bp_messages::LaneId) -> bp_messages::UnrewardedRelayersState {
|
||||
BridgeRialtoMessages::inbound_unrewarded_relayers_state(lane)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -682,9 +682,9 @@ mod tests {
|
||||
#[test]
|
||||
fn ensure_millau_message_lane_weights_are_correct() {
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/390
|
||||
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||
type Weights = pallet_bridge_messages::weights::RialtoWeight<Runtime>;
|
||||
|
||||
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
||||
pallet_bridge_messages::ensure_weights_are_correct::<Weights>(
|
||||
bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,
|
||||
bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT,
|
||||
bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||
@@ -693,19 +693,19 @@ mod tests {
|
||||
let max_incoming_message_proof_size = bp_rialto::EXTRA_STORAGE_PROOF_SIZE.saturating_add(
|
||||
messages::target::maximal_incoming_message_size(bp_millau::max_extrinsic_size()),
|
||||
);
|
||||
pallet_message_lane::ensure_able_to_receive_message::<Weights>(
|
||||
pallet_bridge_messages::ensure_able_to_receive_message::<Weights>(
|
||||
bp_millau::max_extrinsic_size(),
|
||||
bp_millau::max_extrinsic_weight(),
|
||||
max_incoming_message_proof_size,
|
||||
messages::target::maximal_incoming_message_dispatch_weight(bp_millau::max_extrinsic_weight()),
|
||||
);
|
||||
|
||||
let max_incoming_inbound_lane_data_proof_size = bp_message_lane::InboundLaneData::<()>::encoded_size_hint(
|
||||
let max_incoming_inbound_lane_data_proof_size = bp_messages::InboundLaneData::<()>::encoded_size_hint(
|
||||
bp_millau::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
|
||||
bp_rialto::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE as _,
|
||||
)
|
||||
.unwrap_or(u32::MAX);
|
||||
pallet_message_lane::ensure_able_to_receive_confirmation::<Weights>(
|
||||
pallet_bridge_messages::ensure_able_to_receive_confirmation::<Weights>(
|
||||
bp_millau::max_extrinsic_size(),
|
||||
bp_millau::max_extrinsic_weight(),
|
||||
max_incoming_inbound_lane_data_proof_size,
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
// 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/>.
|
||||
|
||||
//! Everything required to serve Millau <-> Rialto message lanes.
|
||||
//! Everything required to serve Millau <-> Rialto messages.
|
||||
|
||||
use crate::Runtime;
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::TargetHeaderChain,
|
||||
target_chain::{ProvedMessages, SourceHeaderChain},
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessageLaneParameter,
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
|
||||
};
|
||||
use bp_runtime::{InstanceId, RIALTO_BRIDGE_INSTANCE};
|
||||
use bridge_runtime_common::messages::{self, ChainWithMessageLanes, MessageBridge, MessageLaneTransaction};
|
||||
use bridge_runtime_common::messages::{self, ChainWithMessages, MessageBridge, MessageTransaction};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
@@ -42,23 +42,23 @@ parameter_types! {
|
||||
|
||||
/// Storage key of the Millau -> Rialto message in the runtime storage.
|
||||
pub fn message_key(lane: &LaneId, nonce: MessageNonce) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::message_key::<Runtime, <Millau as ChainWithMessageLanes>::MessageLaneInstance>(
|
||||
pallet_bridge_messages::storage_keys::message_key::<Runtime, <Millau as ChainWithMessages>::MessagesInstance>(
|
||||
lane, nonce,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Millau -> Rialto message lane state in the runtime storage.
|
||||
pub fn outbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::outbound_lane_data_key::<<Millau as ChainWithMessageLanes>::MessageLaneInstance>(
|
||||
pallet_bridge_messages::storage_keys::outbound_lane_data_key::<<Millau as ChainWithMessages>::MessagesInstance>(
|
||||
lane,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Rialto -> Millau message lane state in the runtime storage.
|
||||
pub fn inbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::inbound_lane_data_key::<
|
||||
pallet_bridge_messages::storage_keys::inbound_lane_data_key::<
|
||||
Runtime,
|
||||
<Millau as ChainWithMessageLanes>::MessageLaneInstance,
|
||||
<Millau as ChainWithMessages>::MessagesInstance,
|
||||
>(lane)
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ impl MessageBridge for WithRialtoMessageBridge {
|
||||
#[derive(RuntimeDebug, Clone, Copy)]
|
||||
pub struct Millau;
|
||||
|
||||
impl messages::ChainWithMessageLanes for Millau {
|
||||
impl messages::ChainWithMessages for Millau {
|
||||
type Hash = bp_millau::Hash;
|
||||
type AccountId = bp_millau::AccountId;
|
||||
type Signer = bp_millau::AccountSigner;
|
||||
@@ -117,10 +117,10 @@ impl messages::ChainWithMessageLanes for Millau {
|
||||
type Weight = Weight;
|
||||
type Balance = bp_millau::Balance;
|
||||
|
||||
type MessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
type MessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
}
|
||||
|
||||
impl messages::ThisChainWithMessageLanes for Millau {
|
||||
impl messages::ThisChainWithMessages for Millau {
|
||||
type Call = crate::Call;
|
||||
|
||||
fn is_outbound_lane_enabled(lane: &LaneId) -> bool {
|
||||
@@ -131,12 +131,12 @@ impl messages::ThisChainWithMessageLanes for Millau {
|
||||
MessageNonce::MAX
|
||||
}
|
||||
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageLaneTransaction<Weight> {
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> {
|
||||
let inbound_data_size =
|
||||
InboundLaneData::<bp_millau::AccountId>::encoded_size_hint(bp_millau::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE, 1)
|
||||
.unwrap_or(u32::MAX);
|
||||
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
dispatch_weight: bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||
size: inbound_data_size
|
||||
.saturating_add(bp_rialto::EXTRA_STORAGE_PROOF_SIZE)
|
||||
@@ -144,7 +144,7 @@ impl messages::ThisChainWithMessageLanes for Millau {
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<Weight>) -> bp_millau::Balance {
|
||||
fn transaction_payment(transaction: MessageTransaction<Weight>) -> bp_millau::Balance {
|
||||
// in our testnets, both per-byte fee and weight-to-fee are 1:1
|
||||
messages::transaction_payment(
|
||||
bp_millau::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
|
||||
@@ -160,7 +160,7 @@ impl messages::ThisChainWithMessageLanes for Millau {
|
||||
#[derive(RuntimeDebug, Clone, Copy)]
|
||||
pub struct Rialto;
|
||||
|
||||
impl messages::ChainWithMessageLanes for Rialto {
|
||||
impl messages::ChainWithMessages for Rialto {
|
||||
type Hash = bp_rialto::Hash;
|
||||
type AccountId = bp_rialto::AccountId;
|
||||
type Signer = bp_rialto::AccountSigner;
|
||||
@@ -168,10 +168,10 @@ impl messages::ChainWithMessageLanes for Rialto {
|
||||
type Weight = Weight;
|
||||
type Balance = bp_rialto::Balance;
|
||||
|
||||
type MessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
type MessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
}
|
||||
|
||||
impl messages::BridgedChainWithMessageLanes for Rialto {
|
||||
impl messages::BridgedChainWithMessages for Rialto {
|
||||
fn maximal_extrinsic_size() -> u32 {
|
||||
bp_rialto::max_extrinsic_size()
|
||||
}
|
||||
@@ -191,12 +191,12 @@ impl messages::BridgedChainWithMessageLanes for Rialto {
|
||||
fn estimate_delivery_transaction(
|
||||
message_payload: &[u8],
|
||||
message_dispatch_weight: Weight,
|
||||
) -> MessageLaneTransaction<Weight> {
|
||||
) -> MessageTransaction<Weight> {
|
||||
let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX);
|
||||
let extra_bytes_in_payload = Weight::from(message_payload_len)
|
||||
.saturating_sub(pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH.into());
|
||||
.saturating_sub(pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH.into());
|
||||
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
dispatch_weight: extra_bytes_in_payload
|
||||
.saturating_mul(bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
||||
.saturating_add(bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT)
|
||||
@@ -207,7 +207,7 @@ impl messages::BridgedChainWithMessageLanes for Rialto {
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<Weight>) -> bp_rialto::Balance {
|
||||
fn transaction_payment(transaction: MessageTransaction<Weight>) -> bp_rialto::Balance {
|
||||
// in our testnets, both per-byte fee and weight-to-fee are 1:1
|
||||
messages::transaction_payment(
|
||||
bp_rialto::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
|
||||
@@ -257,15 +257,15 @@ impl SourceHeaderChain<bp_rialto::Balance> for Rialto {
|
||||
|
||||
/// Millau -> Rialto message lane pallet parameters.
|
||||
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq)]
|
||||
pub enum MillauToRialtoMessageLaneParameter {
|
||||
pub enum MillauToRialtoMessagesParameter {
|
||||
/// The conversion formula we use is: `MillauTokens = RialtoTokens * conversion_rate`.
|
||||
RialtoToMillauConversionRate(FixedU128),
|
||||
}
|
||||
|
||||
impl MessageLaneParameter for MillauToRialtoMessageLaneParameter {
|
||||
impl MessagesParameter for MillauToRialtoMessagesParameter {
|
||||
fn save(&self) {
|
||||
match *self {
|
||||
MillauToRialtoMessageLaneParameter::RialtoToMillauConversionRate(ref conversion_rate) => {
|
||||
MillauToRialtoMessagesParameter::RialtoToMillauConversionRate(ref conversion_rate) => {
|
||||
RialtoToMillauConversionRate::set(conversion_rate)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ structopt = "0.3.21"
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
bp-message-lane = { path = "../../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../../primitives/messages" }
|
||||
bp-runtime = { path = "../../../primitives/runtime" }
|
||||
bp-rialto = { path = "../../../primitives/chains/rialto" }
|
||||
pallet-message-lane = { path = "../../../modules/message-lane" }
|
||||
pallet-message-lane-rpc = { path = "../../../modules/message-lane/rpc" }
|
||||
pallet-bridge-messages = { path = "../../../modules/messages" }
|
||||
pallet-bridge-messages-rpc = { path = "../../../modules/messages/rpc" }
|
||||
rialto-runtime = { path = "../runtime" }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
@@ -122,7 +122,10 @@ impl Alternative {
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("George//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Harry//stash"),
|
||||
pallet_message_lane::Module::<rialto_runtime::Runtime, pallet_message_lane::DefaultInstance>::relayer_fund_account_id(),
|
||||
pallet_bridge_messages::Module::<
|
||||
rialto_runtime::Runtime,
|
||||
pallet_bridge_messages::DefaultInstance,
|
||||
>::relayer_fund_account_id(),
|
||||
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
)),
|
||||
|
||||
@@ -190,17 +190,17 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{InstanceId, MILLAU_BRIDGE_INSTANCE};
|
||||
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
|
||||
use sp_core::storage::StorageKey;
|
||||
|
||||
// This struct is here to ease update process.
|
||||
|
||||
/// Rialto runtime from message-lane RPC point of view.
|
||||
struct RialtoMessageLaneKeys;
|
||||
/// Rialto runtime from messages RPC point of view.
|
||||
struct RialtoMessagesKeys;
|
||||
|
||||
impl pallet_message_lane_rpc::Runtime for RialtoMessageLaneKeys {
|
||||
impl pallet_bridge_messages_rpc::Runtime for RialtoMessagesKeys {
|
||||
fn message_key(&self, instance: &InstanceId, lane: &LaneId, nonce: MessageNonce) -> Option<StorageKey> {
|
||||
match *instance {
|
||||
MILLAU_BRIDGE_INSTANCE => Some(rialto_runtime::millau_messages::message_key(lane, nonce)),
|
||||
@@ -223,7 +223,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
}
|
||||
}
|
||||
|
||||
use pallet_message_lane_rpc::{MessageLaneApi, MessageLaneRpcHandler};
|
||||
use pallet_bridge_messages_rpc::{MessagesApi, MessagesRpcHandler};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
|
||||
use sc_rpc::DenyUnsafe;
|
||||
@@ -257,9 +257,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
subscription_executor,
|
||||
finality_proof_provider.clone(),
|
||||
)));
|
||||
io.extend_with(MessageLaneApi::to_delegate(MessageLaneRpcHandler::new(
|
||||
io.extend_with(MessagesApi::to_delegate(MessagesRpcHandler::new(
|
||||
backend.clone(),
|
||||
Arc::new(RialtoMessageLaneKeys),
|
||||
Arc::new(RialtoMessagesKeys),
|
||||
)));
|
||||
|
||||
io
|
||||
|
||||
@@ -20,7 +20,7 @@ bp-currency-exchange = { path = "../../../primitives/currency-exchange", default
|
||||
bp-eth-poa = { path = "../../../primitives/ethereum-poa", default-features = false }
|
||||
bp-header-chain = { path = "../../../primitives/header-chain", default-features = false }
|
||||
bp-message-dispatch = { path = "../../../primitives/message-dispatch", default-features = false }
|
||||
bp-message-lane = { path = "../../../primitives/message-lane", default-features = false }
|
||||
bp-messages = { path = "../../../primitives/messages", default-features = false }
|
||||
bp-millau = { path = "../../../primitives/chains/millau", default-features = false }
|
||||
bp-rialto = { path = "../../../primitives/chains/rialto", default-features = false }
|
||||
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
@@ -30,7 +30,7 @@ pallet-bridge-call-dispatch = { path = "../../../modules/call-dispatch", default
|
||||
pallet-bridge-currency-exchange = { path = "../../../modules/currency-exchange", default-features = false }
|
||||
pallet-finality-verifier = { path = "../../../modules/finality-verifier", default-features = false }
|
||||
pallet-substrate-bridge = { path = "../../../modules/substrate", default-features = false }
|
||||
pallet-message-lane = { path = "../../../modules/message-lane", default-features = false }
|
||||
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
|
||||
pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
|
||||
|
||||
# Substrate Dependencies
|
||||
@@ -78,7 +78,7 @@ std = [
|
||||
"bp-eth-poa/std",
|
||||
"bp-header-chain/std",
|
||||
"bp-message-dispatch/std",
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-millau/std",
|
||||
"bp-rialto/std",
|
||||
"bp-runtime/std",
|
||||
@@ -97,7 +97,7 @@ std = [
|
||||
"pallet-bridge-currency-exchange/std",
|
||||
"pallet-finality-verifier/std",
|
||||
"pallet-grandpa/std",
|
||||
"pallet-message-lane/std",
|
||||
"pallet-bridge-messages/std",
|
||||
"pallet-randomness-collective-flip/std",
|
||||
"pallet-shift-session-manager/std",
|
||||
"pallet-substrate-bridge/std",
|
||||
@@ -129,6 +129,6 @@ runtime-benchmarks = [
|
||||
"libsecp256k1",
|
||||
"pallet-bridge-currency-exchange/runtime-benchmarks",
|
||||
"pallet-bridge-eth-poa/runtime-benchmarks",
|
||||
"pallet-message-lane/runtime-benchmarks",
|
||||
"pallet-bridge-messages/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -70,8 +70,8 @@ pub use frame_system::Call as SystemCall;
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
pub use pallet_bridge_currency_exchange::Call as BridgeCurrencyExchangeCall;
|
||||
pub use pallet_bridge_eth_poa::Call as BridgeEthPoACall;
|
||||
pub use pallet_bridge_messages::Call as MessagesCall;
|
||||
pub use pallet_finality_verifier::Call as FinalityBridgeMillauCall;
|
||||
pub use pallet_message_lane::Call as MessageLaneCall;
|
||||
pub use pallet_substrate_bridge::Call as BridgeMillauCall;
|
||||
pub use pallet_sudo::Call as SudoCall;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
@@ -259,7 +259,7 @@ impl pallet_bridge_currency_exchange::Config<KovanCurrencyExchange> for Runtime
|
||||
|
||||
impl pallet_bridge_call_dispatch::Config for Runtime {
|
||||
type Event = Event;
|
||||
type MessageId = (bp_message_lane::LaneId, bp_message_lane::MessageNonce);
|
||||
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||
type Call = Call;
|
||||
type CallFilter = ();
|
||||
type EncodedCall = crate::millau_messages::FromMillauEncodedCall;
|
||||
@@ -427,10 +427,10 @@ impl pallet_finality_verifier::Config for Runtime {
|
||||
impl pallet_shift_session_manager::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const MaxMessagesToPruneAtOnce: bp_message_lane::MessageNonce = 8;
|
||||
pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_message_lane::MessageNonce =
|
||||
pub const MaxMessagesToPruneAtOnce: bp_messages::MessageNonce = 8;
|
||||
pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_rialto::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE;
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_message_lane::MessageNonce =
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_rialto::MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE;
|
||||
// `IdentityFee` is used by Rialto => we may use weight directly
|
||||
pub const GetDeliveryConfirmationTransactionFee: Balance =
|
||||
@@ -438,11 +438,11 @@ parameter_types! {
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
}
|
||||
|
||||
pub(crate) type WithMillauMessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
impl pallet_message_lane::Config for Runtime {
|
||||
pub(crate) type WithMillauMessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
impl pallet_bridge_messages::Config for Runtime {
|
||||
type Event = Event;
|
||||
type WeightInfo = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||
type Parameter = millau_messages::RialtoToMillauMessageLaneParameter;
|
||||
type WeightInfo = pallet_bridge_messages::weights::RialtoWeight<Runtime>;
|
||||
type Parameter = millau_messages::RialtoToMillauMessagesParameter;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
@@ -458,7 +458,7 @@ impl pallet_message_lane::Config for Runtime {
|
||||
|
||||
type TargetHeaderChain = crate::millau_messages::Millau;
|
||||
type LaneMessageVerifier = crate::millau_messages::ToMillauMessageVerifier;
|
||||
type MessageDeliveryAndDispatchPayment = pallet_message_lane::instant_payments::InstantCurrencyPayments<
|
||||
type MessageDeliveryAndDispatchPayment = pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
|
||||
Runtime,
|
||||
pallet_balances::Module<Runtime>,
|
||||
GetDeliveryConfirmationTransactionFee,
|
||||
@@ -482,7 +482,7 @@ construct_runtime!(
|
||||
BridgeMillau: pallet_substrate_bridge::{Module, Call, Storage, Config<T>},
|
||||
BridgeFinalityVerifier: pallet_finality_verifier::{Module, Call},
|
||||
BridgeCallDispatch: pallet_bridge_call_dispatch::{Module, Event<T>},
|
||||
BridgeMillauMessageLane: pallet_message_lane::{Module, Call, Storage, Event<T>},
|
||||
BridgeMillauMessages: pallet_bridge_messages::{Module, Call, Storage, Event<T>},
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||
@@ -746,7 +746,7 @@ impl_runtime_apis! {
|
||||
|
||||
impl bp_millau::ToMillauOutboundLaneApi<Block, Balance, ToMillauMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_message_lane::LaneId,
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: ToMillauMessagePayload,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<WithMillauMessageBridge>(
|
||||
@@ -756,12 +756,12 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn messages_dispatch_weight(
|
||||
lane: bp_message_lane::LaneId,
|
||||
begin: bp_message_lane::MessageNonce,
|
||||
end: bp_message_lane::MessageNonce,
|
||||
) -> Vec<(bp_message_lane::MessageNonce, Weight, u32)> {
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<(bp_messages::MessageNonce, Weight, u32)> {
|
||||
(begin..=end).filter_map(|nonce| {
|
||||
let encoded_payload = BridgeMillauMessageLane::outbound_message_payload(lane, nonce)?;
|
||||
let encoded_payload = BridgeMillauMessages::outbound_message_payload(lane, nonce)?;
|
||||
let decoded_payload = millau_messages::ToMillauMessagePayload::decode(
|
||||
&mut &encoded_payload[..]
|
||||
).ok()?;
|
||||
@@ -770,26 +770,26 @@ impl_runtime_apis! {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn latest_received_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeMillauMessageLane::outbound_latest_received_nonce(lane)
|
||||
fn latest_received_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeMillauMessages::outbound_latest_received_nonce(lane)
|
||||
}
|
||||
|
||||
fn latest_generated_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeMillauMessageLane::outbound_latest_generated_nonce(lane)
|
||||
fn latest_generated_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeMillauMessages::outbound_latest_generated_nonce(lane)
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_millau::FromMillauInboundLaneApi<Block> for Runtime {
|
||||
fn latest_received_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeMillauMessageLane::inbound_latest_received_nonce(lane)
|
||||
fn latest_received_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeMillauMessages::inbound_latest_received_nonce(lane)
|
||||
}
|
||||
|
||||
fn latest_confirmed_nonce(lane: bp_message_lane::LaneId) -> bp_message_lane::MessageNonce {
|
||||
BridgeMillauMessageLane::inbound_latest_confirmed_nonce(lane)
|
||||
fn latest_confirmed_nonce(lane: bp_messages::LaneId) -> bp_messages::MessageNonce {
|
||||
BridgeMillauMessages::inbound_latest_confirmed_nonce(lane)
|
||||
}
|
||||
|
||||
fn unrewarded_relayers_state(lane: bp_message_lane::LaneId) -> bp_message_lane::UnrewardedRelayersState {
|
||||
BridgeMillauMessageLane::inbound_unrewarded_relayers_state(lane)
|
||||
fn unrewarded_relayers_state(lane: bp_messages::LaneId) -> bp_messages::UnrewardedRelayersState {
|
||||
BridgeMillauMessages::inbound_unrewarded_relayers_state(lane)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,16 +857,16 @@ impl_runtime_apis! {
|
||||
|
||||
use crate::millau_messages::{ToMillauMessagePayload, WithMillauMessageBridge};
|
||||
use bridge_runtime_common::messages;
|
||||
use pallet_message_lane::benchmarking::{
|
||||
Module as MessageLaneBench,
|
||||
Config as MessageLaneConfig,
|
||||
MessageDeliveryProofParams as MessageLaneMessageDeliveryProofParams,
|
||||
MessageParams as MessageLaneMessageParams,
|
||||
MessageProofParams as MessageLaneMessageProofParams,
|
||||
ProofSize as MessageLaneProofSize,
|
||||
use pallet_bridge_messages::benchmarking::{
|
||||
Module as MessagesBench,
|
||||
Config as MessagesConfig,
|
||||
MessageDeliveryProofParams,
|
||||
MessageParams,
|
||||
MessageProofParams,
|
||||
ProofSize as MessagesProofSize,
|
||||
};
|
||||
|
||||
impl MessageLaneConfig<WithMillauMessageLaneInstance> for Runtime {
|
||||
impl MessagesConfig<WithMillauMessagesInstance> for Runtime {
|
||||
fn maximal_message_size() -> u32 {
|
||||
messages::source::maximal_message_size::<WithMillauMessageBridge>()
|
||||
}
|
||||
@@ -887,7 +887,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn prepare_outbound_message(
|
||||
params: MessageLaneMessageParams<Self::AccountId>,
|
||||
params: MessageParams<Self::AccountId>,
|
||||
) -> (millau_messages::ToMillauMessagePayload, Balance) {
|
||||
let message_payload = vec![0; params.size as usize];
|
||||
let dispatch_origin = pallet_bridge_call_dispatch::CallOrigin::SourceAccount(
|
||||
@@ -900,25 +900,25 @@ impl_runtime_apis! {
|
||||
origin: dispatch_origin,
|
||||
call: message_payload,
|
||||
};
|
||||
(message, pallet_message_lane::benchmarking::MESSAGE_FEE.into())
|
||||
(message, pallet_bridge_messages::benchmarking::MESSAGE_FEE.into())
|
||||
}
|
||||
|
||||
fn prepare_message_proof(
|
||||
params: MessageLaneMessageProofParams,
|
||||
params: MessageProofParams,
|
||||
) -> (millau_messages::FromMillauMessagesProof, Weight) {
|
||||
use crate::millau_messages::{Millau, WithMillauMessageBridge};
|
||||
use bp_message_lane::MessageKey;
|
||||
use bp_messages::MessageKey;
|
||||
use bridge_runtime_common::{
|
||||
messages::ChainWithMessageLanes,
|
||||
messages::ChainWithMessages,
|
||||
messages_benchmarking::{ed25519_sign, prepare_message_proof},
|
||||
};
|
||||
use codec::Encode;
|
||||
use frame_support::weights::GetDispatchInfo;
|
||||
use pallet_message_lane::storage_keys;
|
||||
use pallet_bridge_messages::storage_keys;
|
||||
use sp_runtime::traits::Header;
|
||||
|
||||
let remark = match params.size {
|
||||
MessageLaneProofSize::Minimal(ref size) => vec![0u8; *size as _],
|
||||
MessagesProofSize::Minimal(ref size) => vec![0u8; *size as _],
|
||||
_ => vec![],
|
||||
};
|
||||
let call = Call::System(SystemCall::remark(remark));
|
||||
@@ -936,12 +936,12 @@ impl_runtime_apis! {
|
||||
|
||||
let make_millau_message_key = |message_key: MessageKey| storage_keys::message_key::<
|
||||
Runtime,
|
||||
<Millau as ChainWithMessageLanes>::MessageLaneInstance,
|
||||
<Millau as ChainWithMessages>::MessagesInstance,
|
||||
>(
|
||||
&message_key.lane_id, message_key.nonce,
|
||||
).0;
|
||||
let make_millau_outbound_lane_data_key = |lane_id| storage_keys::outbound_lane_data_key::<
|
||||
<Millau as ChainWithMessageLanes>::MessageLaneInstance,
|
||||
<Millau as ChainWithMessages>::MessagesInstance,
|
||||
>(
|
||||
&lane_id,
|
||||
).0;
|
||||
@@ -977,20 +977,20 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn prepare_message_delivery_proof(
|
||||
params: MessageLaneMessageDeliveryProofParams<Self::AccountId>,
|
||||
params: MessageDeliveryProofParams<Self::AccountId>,
|
||||
) -> millau_messages::ToMillauMessagesDeliveryProof {
|
||||
use crate::millau_messages::{Millau, WithMillauMessageBridge};
|
||||
use bridge_runtime_common::{
|
||||
messages::ChainWithMessageLanes,
|
||||
messages::ChainWithMessages,
|
||||
messages_benchmarking::prepare_message_delivery_proof,
|
||||
};
|
||||
use sp_runtime::traits::Header;
|
||||
|
||||
prepare_message_delivery_proof::<WithMillauMessageBridge, bp_millau::Hasher, Runtime, (), _, _>(
|
||||
params,
|
||||
|lane_id| pallet_message_lane::storage_keys::inbound_lane_data_key::<
|
||||
|lane_id| pallet_bridge_messages::storage_keys::inbound_lane_data_key::<
|
||||
Runtime,
|
||||
<Millau as ChainWithMessageLanes>::MessageLaneInstance,
|
||||
<Millau as ChainWithMessages>::MessagesInstance,
|
||||
>(
|
||||
&lane_id,
|
||||
).0,
|
||||
@@ -1015,8 +1015,8 @@ impl_runtime_apis! {
|
||||
add_benchmark!(
|
||||
params,
|
||||
batches,
|
||||
pallet_message_lane,
|
||||
MessageLaneBench::<Runtime, WithMillauMessageLaneInstance>
|
||||
pallet_bridge_messages,
|
||||
MessagesBench::<Runtime, WithMillauMessagesInstance>
|
||||
);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
@@ -1091,9 +1091,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn ensure_rialto_message_lane_weights_are_correct() {
|
||||
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||
type Weights = pallet_bridge_messages::weights::RialtoWeight<Runtime>;
|
||||
|
||||
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
||||
pallet_bridge_messages::ensure_weights_are_correct::<Weights>(
|
||||
bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,
|
||||
bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT,
|
||||
bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||
@@ -1102,19 +1102,19 @@ mod tests {
|
||||
let max_incoming_message_proof_size = bp_millau::EXTRA_STORAGE_PROOF_SIZE.saturating_add(
|
||||
messages::target::maximal_incoming_message_size(bp_rialto::max_extrinsic_size()),
|
||||
);
|
||||
pallet_message_lane::ensure_able_to_receive_message::<Weights>(
|
||||
pallet_bridge_messages::ensure_able_to_receive_message::<Weights>(
|
||||
bp_rialto::max_extrinsic_size(),
|
||||
bp_rialto::max_extrinsic_weight(),
|
||||
max_incoming_message_proof_size,
|
||||
messages::target::maximal_incoming_message_dispatch_weight(bp_rialto::max_extrinsic_weight()),
|
||||
);
|
||||
|
||||
let max_incoming_inbound_lane_data_proof_size = bp_message_lane::InboundLaneData::<()>::encoded_size_hint(
|
||||
let max_incoming_inbound_lane_data_proof_size = bp_messages::InboundLaneData::<()>::encoded_size_hint(
|
||||
bp_rialto::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
|
||||
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE as _,
|
||||
)
|
||||
.unwrap_or(u32::MAX);
|
||||
pallet_message_lane::ensure_able_to_receive_confirmation::<Weights>(
|
||||
pallet_bridge_messages::ensure_able_to_receive_confirmation::<Weights>(
|
||||
bp_rialto::max_extrinsic_size(),
|
||||
bp_rialto::max_extrinsic_weight(),
|
||||
max_incoming_inbound_lane_data_proof_size,
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
// 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/>.
|
||||
|
||||
//! Everything required to serve Millau <-> Rialto message lanes.
|
||||
//! Everything required to serve Millau <-> Rialto messages.
|
||||
|
||||
use crate::Runtime;
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::TargetHeaderChain,
|
||||
target_chain::{ProvedMessages, SourceHeaderChain},
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessageLaneParameter,
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
|
||||
};
|
||||
use bp_runtime::{InstanceId, MILLAU_BRIDGE_INSTANCE};
|
||||
use bridge_runtime_common::messages::{self, ChainWithMessageLanes, MessageBridge, MessageLaneTransaction};
|
||||
use bridge_runtime_common::messages::{self, ChainWithMessages, MessageBridge, MessageTransaction};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
@@ -42,23 +42,23 @@ parameter_types! {
|
||||
|
||||
/// Storage key of the Rialto -> Millau message in the runtime storage.
|
||||
pub fn message_key(lane: &LaneId, nonce: MessageNonce) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::message_key::<Runtime, <Rialto as ChainWithMessageLanes>::MessageLaneInstance>(
|
||||
pallet_bridge_messages::storage_keys::message_key::<Runtime, <Rialto as ChainWithMessages>::MessagesInstance>(
|
||||
lane, nonce,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Rialto -> Millau message lane state in the runtime storage.
|
||||
pub fn outbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::outbound_lane_data_key::<<Rialto as ChainWithMessageLanes>::MessageLaneInstance>(
|
||||
pallet_bridge_messages::storage_keys::outbound_lane_data_key::<<Rialto as ChainWithMessages>::MessagesInstance>(
|
||||
lane,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Millau -> Rialto message lane state in the runtime storage.
|
||||
pub fn inbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_message_lane::storage_keys::inbound_lane_data_key::<
|
||||
pallet_bridge_messages::storage_keys::inbound_lane_data_key::<
|
||||
Runtime,
|
||||
<Rialto as ChainWithMessageLanes>::MessageLaneInstance,
|
||||
<Rialto as ChainWithMessages>::MessagesInstance,
|
||||
>(lane)
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ impl MessageBridge for WithMillauMessageBridge {
|
||||
#[derive(RuntimeDebug, Clone, Copy)]
|
||||
pub struct Rialto;
|
||||
|
||||
impl messages::ChainWithMessageLanes for Rialto {
|
||||
impl messages::ChainWithMessages for Rialto {
|
||||
type Hash = bp_rialto::Hash;
|
||||
type AccountId = bp_rialto::AccountId;
|
||||
type Signer = bp_rialto::AccountSigner;
|
||||
@@ -117,10 +117,10 @@ impl messages::ChainWithMessageLanes for Rialto {
|
||||
type Weight = Weight;
|
||||
type Balance = bp_rialto::Balance;
|
||||
|
||||
type MessageLaneInstance = crate::WithMillauMessageLaneInstance;
|
||||
type MessagesInstance = crate::WithMillauMessagesInstance;
|
||||
}
|
||||
|
||||
impl messages::ThisChainWithMessageLanes for Rialto {
|
||||
impl messages::ThisChainWithMessages for Rialto {
|
||||
type Call = crate::Call;
|
||||
|
||||
fn is_outbound_lane_enabled(lane: &LaneId) -> bool {
|
||||
@@ -131,12 +131,12 @@ impl messages::ThisChainWithMessageLanes for Rialto {
|
||||
MessageNonce::MAX
|
||||
}
|
||||
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageLaneTransaction<Weight> {
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> {
|
||||
let inbound_data_size =
|
||||
InboundLaneData::<bp_rialto::AccountId>::encoded_size_hint(bp_rialto::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE, 1)
|
||||
.unwrap_or(u32::MAX);
|
||||
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
dispatch_weight: bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||
size: inbound_data_size
|
||||
.saturating_add(bp_millau::EXTRA_STORAGE_PROOF_SIZE)
|
||||
@@ -144,7 +144,7 @@ impl messages::ThisChainWithMessageLanes for Rialto {
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<Weight>) -> bp_rialto::Balance {
|
||||
fn transaction_payment(transaction: MessageTransaction<Weight>) -> bp_rialto::Balance {
|
||||
// in our testnets, both per-byte fee and weight-to-fee are 1:1
|
||||
messages::transaction_payment(
|
||||
bp_rialto::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
|
||||
@@ -160,7 +160,7 @@ impl messages::ThisChainWithMessageLanes for Rialto {
|
||||
#[derive(RuntimeDebug, Clone, Copy)]
|
||||
pub struct Millau;
|
||||
|
||||
impl messages::ChainWithMessageLanes for Millau {
|
||||
impl messages::ChainWithMessages for Millau {
|
||||
type Hash = bp_millau::Hash;
|
||||
type AccountId = bp_millau::AccountId;
|
||||
type Signer = bp_millau::AccountSigner;
|
||||
@@ -168,10 +168,10 @@ impl messages::ChainWithMessageLanes for Millau {
|
||||
type Weight = Weight;
|
||||
type Balance = bp_millau::Balance;
|
||||
|
||||
type MessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
type MessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
}
|
||||
|
||||
impl messages::BridgedChainWithMessageLanes for Millau {
|
||||
impl messages::BridgedChainWithMessages for Millau {
|
||||
fn maximal_extrinsic_size() -> u32 {
|
||||
bp_millau::max_extrinsic_size()
|
||||
}
|
||||
@@ -191,12 +191,12 @@ impl messages::BridgedChainWithMessageLanes for Millau {
|
||||
fn estimate_delivery_transaction(
|
||||
message_payload: &[u8],
|
||||
message_dispatch_weight: Weight,
|
||||
) -> MessageLaneTransaction<Weight> {
|
||||
) -> MessageTransaction<Weight> {
|
||||
let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX);
|
||||
let extra_bytes_in_payload = Weight::from(message_payload_len)
|
||||
.saturating_sub(pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH.into());
|
||||
.saturating_sub(pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH.into());
|
||||
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
dispatch_weight: extra_bytes_in_payload
|
||||
.saturating_mul(bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
||||
.saturating_add(bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT)
|
||||
@@ -207,7 +207,7 @@ impl messages::BridgedChainWithMessageLanes for Millau {
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<Weight>) -> bp_millau::Balance {
|
||||
fn transaction_payment(transaction: MessageTransaction<Weight>) -> bp_millau::Balance {
|
||||
// in our testnets, both per-byte fee and weight-to-fee are 1:1
|
||||
messages::transaction_payment(
|
||||
bp_millau::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
|
||||
@@ -257,15 +257,15 @@ impl SourceHeaderChain<bp_millau::Balance> for Millau {
|
||||
|
||||
/// Rialto -> Millau message lane pallet parameters.
|
||||
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq)]
|
||||
pub enum RialtoToMillauMessageLaneParameter {
|
||||
pub enum RialtoToMillauMessagesParameter {
|
||||
/// The conversion formula we use is: `RialtoTokens = MillauTokens * conversion_rate`.
|
||||
MillauToRialtoConversionRate(FixedU128),
|
||||
}
|
||||
|
||||
impl MessageLaneParameter for RialtoToMillauMessageLaneParameter {
|
||||
impl MessagesParameter for RialtoToMillauMessagesParameter {
|
||||
fn save(&self) {
|
||||
match *self {
|
||||
RialtoToMillauMessageLaneParameter::MillauToRialtoConversionRate(ref conversion_rate) => {
|
||||
RialtoToMillauMessagesParameter::MillauToRialtoConversionRate(ref conversion_rate) => {
|
||||
MillauToRialtoConversionRate::set(conversion_rate)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ hash-db = { version = "0.15.2", default-features = false }
|
||||
# Bridge dependencies
|
||||
|
||||
bp-message-dispatch = { path = "../../primitives/message-dispatch", default-features = false }
|
||||
bp-message-lane = { path = "../../primitives/message-lane", default-features = false }
|
||||
bp-messages = { path = "../../primitives/messages", default-features = false }
|
||||
bp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
pallet-bridge-call-dispatch = { path = "../../modules/call-dispatch", default-features = false }
|
||||
pallet-message-lane = { path = "../../modules/message-lane", default-features = false }
|
||||
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
|
||||
pallet-finality-verifier = { path = "../../modules/finality-verifier", default-features = false }
|
||||
|
||||
# Substrate dependencies
|
||||
@@ -34,14 +34,14 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" ,
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-dispatch/std",
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"hash-db/std",
|
||||
"pallet-bridge-call-dispatch/std",
|
||||
"pallet-finality-verifier/std",
|
||||
"pallet-message-lane/std",
|
||||
"pallet-bridge-messages/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-state-machine/std",
|
||||
@@ -51,6 +51,6 @@ std = [
|
||||
runtime-benchmarks = [
|
||||
"ed25519-dalek/u64_backend",
|
||||
"pallet-finality-verifier/runtime-benchmarks",
|
||||
"pallet-message-lane/runtime-benchmarks",
|
||||
"pallet-bridge-messages/runtime-benchmarks",
|
||||
"sp-state-machine",
|
||||
]
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
# Helpers for Message Lane Module Integration
|
||||
# Helpers for Messages Module Integration
|
||||
|
||||
The [`messages`](./src/messages.rs) module of this crate contains a bunch of helpers for integrating
|
||||
message lane 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;
|
||||
- both chains have [message lane module](../../modules/message-lane/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);
|
||||
- all message lanes are identical and may be used to transfer the same messages;
|
||||
- the messages sent over the bridge are dispatched using
|
||||
[call dispatch module](../../modules/call-dispatch/README.md);
|
||||
- the messages are `pallet_bridge_call_dispatch::MessagePayload` structures, where `call` field is
|
||||
encoded `Call` of the target chain. This means that the `Call` is opaque to the
|
||||
[message lane module](../../modules/message-lane/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;
|
||||
- all proofs in the [message lane module](../../modules/message-lane/README.md) transactions are
|
||||
- all proofs in the [messages module](../../modules/messages/README.md) transactions are
|
||||
based on the storage proofs from the bridged chain: storage proof of the outbound message (value
|
||||
from the `pallet_message_lane::Store::MessagePayload` map), storage proof of the outbound lane
|
||||
state (value from the `pallet_message_lane::Store::OutboundLanes` map) and storage proof of the
|
||||
inbound lane state (value from the `pallet_message_lane::Store::InboundLanes` map);
|
||||
from the `pallet_bridge_messages::Store::MessagePayload` map), storage proof of the outbound lane
|
||||
state (value from the `pallet_bridge_messages::Store::OutboundLanes` map) and storage proof of the
|
||||
inbound lane state (value from the `pallet_bridge_messages::Store::InboundLanes` map);
|
||||
- storage proofs are built at the finalized headers of the corresponding chain. So all message lane
|
||||
transactions with proofs are verifying storage proofs against finalized chain headers from
|
||||
Substrate bridge module.
|
||||
@@ -27,7 +27,7 @@ message lane module into your runtime. Basic prerequisites of these helpers are:
|
||||
|
||||
## Contents
|
||||
- [`MessageBridge` Trait](#messagebridge-trait)
|
||||
- [`ChainWithMessageLanes` Trait ](#chainwithmessagelanes-trait)
|
||||
- [`ChainWithMessages` Trait ](#ChainWithMessages-trait)
|
||||
- [Helpers for the Source Chain](#helpers-for-the-source-chain)
|
||||
- [Helpers for the Target Chain](#helpers-for-the-target-chain)
|
||||
|
||||
@@ -40,41 +40,41 @@ tokens into this chain tokens. The bridge also requires two associated types to
|
||||
|
||||
Worth to say that if you're going to use hardcoded constant (conversion rate) in the
|
||||
`MessageBridge::bridged_balance_to_this_balance` method (or in any other method of
|
||||
`ThisChainWithMessageLanes` or `BridgedChainWithMessageLanes` traits), then you should take a
|
||||
`ThisChainWithMessages` or `BridgedChainWithMessages` traits), then you should take a
|
||||
look at the
|
||||
[message lane parameters functionality](../../modules/message-lane/README.md#Non-Essential-Functionality).
|
||||
[messages parameters functionality](../../modules/messages/README.md#Non-Essential-Functionality).
|
||||
They allow pallet owner to update constants more frequently than runtime upgrade happens.
|
||||
|
||||
## `ChainWithMessageLanes` Trait
|
||||
## `ChainWithMessages` Trait
|
||||
|
||||
The trait is quite simple and can easily be implemented - you just need to specify types used at the
|
||||
corresponding chain. There is single exception, though (it may be changed in the future):
|
||||
|
||||
- `ChainWithMessageLanes::MessageLaneInstance`: this is used to compute runtime storage keys. There
|
||||
may be several instances of message lane pallet, included in the Runtime. Every instance stores
|
||||
- `ChainWithMessages::MessagesInstance`: this is used to compute runtime storage keys. There
|
||||
may be several instances of messages pallet, included in the Runtime. Every instance stores
|
||||
messages and these messages stored under different keys. When we are verifying storage proofs from
|
||||
the bridged chain, we should know which instance we're talking to. This is fine, but there's
|
||||
significant inconvenience with that - this chain runtime must have the same message lane pallet
|
||||
significant inconvenience with that - this chain runtime must have the same messages pallet
|
||||
instance. This does not necessarily mean that we should use the same instance on both chains -
|
||||
this instance may be used to bridge with another chain/instance, or may not be used at all.
|
||||
|
||||
## `ThisChainWithMessageLanes` Trait
|
||||
## `ThisChainWithMessages` Trait
|
||||
|
||||
This trait represents this chain from bridge point of view. Let's review every method of this trait:
|
||||
|
||||
- `ThisChainWithMessageLanes::is_outbound_lane_enabled`: is used to check whether given lane accepts
|
||||
- `ThisChainWithMessages::is_outbound_lane_enabled`: is used to check whether given lane accepts
|
||||
outbound messages.
|
||||
|
||||
- `ThisChainWithMessageLanes::maximal_pending_messages_at_outbound_lane`: you should return maximal
|
||||
- `ThisChainWithMessages::maximal_pending_messages_at_outbound_lane`: you should return maximal
|
||||
number of pending (undelivered) messages from this function. Returning small values would require
|
||||
relayers to operate faster and could make message sending logic more complicated. On the other
|
||||
hand, returning large values could lead to chain state growth.
|
||||
|
||||
- `ThisChainWithMessageLanes::estimate_delivery_confirmation_transaction`: you'll need to return
|
||||
- `ThisChainWithMessages::estimate_delivery_confirmation_transaction`: you'll need to return
|
||||
estimated size and dispatch weight of the delivery confirmation transaction (that happens on
|
||||
this chain) from this function.
|
||||
|
||||
- `ThisChainWithMessageLanes::transaction_payment`: you'll need to return fee that the submitter
|
||||
- `ThisChainWithMessages::transaction_payment`: you'll need to return fee that the submitter
|
||||
must pay for given transaction on this chain. Normally, you would use transaction payment pallet
|
||||
for this. However, if your chain has non-zero fee multiplier set, this would mean that the
|
||||
payment will be computed using current value of this multiplier. But since this transaction
|
||||
@@ -82,11 +82,11 @@ This trait represents this chain from bridge point of view. Let's review every m
|
||||
non-altruistic relayer may choose not to submit this transaction until number of transactions
|
||||
will decrease.
|
||||
|
||||
## `BridgedChainWithMessageLanes` Trait
|
||||
## `BridgedChainWithMessages` Trait
|
||||
|
||||
This trait represents this chain from bridge point of view. Let's review every method of this trait:
|
||||
|
||||
- `BridgedChainWithMessageLanes::maximal_extrinsic_size`: you will need to return the maximal
|
||||
- `BridgedChainWithMessages::maximal_extrinsic_size`: you will need to return the maximal
|
||||
extrinsic size of the target chain from this function.
|
||||
|
||||
- `MessageBridge::message_weight_limits`: you'll need to return a range of
|
||||
@@ -106,7 +106,7 @@ This trait represents this chain from bridge point of view. Let's review every m
|
||||
|
||||
- `MessageBridge::transaction_payment`: you'll need to return fee that the submitter
|
||||
must pay for given transaction on bridged chain. The best case is when you have the same conversion
|
||||
formula on both chains - then you may just reuse the `ThisChainWithMessageLanes::transaction_payment`
|
||||
formula on both chains - then you may just reuse the `ThisChainWithMessages::transaction_payment`
|
||||
implementation. Otherwise, you'll need to hardcode this formula into your runtime.
|
||||
|
||||
## Helpers for the Source Chain
|
||||
@@ -121,7 +121,7 @@ are: `maximal_message_size`, `verify_chain_message`, `verify_messages_delivery_p
|
||||
`pallet_bridge_call_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.
|
||||
|
||||
`FromThisChainMessageVerifier` is an implementation of `bp_message_lane::LaneMessageVerifier`. It
|
||||
`FromThisChainMessageVerifier` is an implementation of `bp_messages::LaneMessageVerifier`. It
|
||||
has following checks in its `verify_message` method:
|
||||
|
||||
1. it'll verify that the used outbound lane is enabled in our runtime;
|
||||
@@ -167,10 +167,10 @@ The helpers for the target chain reside in the `target` submodule of the
|
||||
|
||||
`FromBridgedChainMessagePayload` corresponds to the `FromThisChainMessagePayload` at the bridged
|
||||
chain. We expect that messages with this payload are stored in the `OutboundMessages` storage map of
|
||||
the [message lane module](../../modules/message-lane/README.md). This map is used to build
|
||||
the [messages module](../../modules/messages/README.md). This map is used to build
|
||||
`FromBridgedChainMessagesProof`. The proof holds the lane id, range of message nonces included in
|
||||
the proof, storage proof of `OutboundMessages` entries and the hash of bridged chain header that has
|
||||
been used to build the proof. Additionally, there's storage proof may contain the proof of outbound
|
||||
lane state. It may be required to prune `relayers` entries at this chain (see
|
||||
[message lane module documentation](../../modules/message-lane/README.md#What-about-other-Constants-in-the-Message-Lane-Module-Configuration-Trait)
|
||||
[messages module documentation](../../modules/messages/README.md#What-about-other-Constants-in-the-Messages-Module-Configuration-Trait)
|
||||
for details). This proof is verified by the `verify_messages_proof` function.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! of to elements - message lane id and message nonce.
|
||||
|
||||
use bp_message_dispatch::MessageDispatch as _;
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::{LaneMessageVerifier, Sender},
|
||||
target_chain::{DispatchMessage, MessageDispatch, ProvedLaneMessages, ProvedMessages},
|
||||
InboundLaneData, LaneId, Message, MessageData, MessageKey, MessageNonce, OutboundLaneData,
|
||||
@@ -46,16 +46,16 @@ pub trait MessageBridge {
|
||||
const RELAYER_FEE_PERCENT: u32;
|
||||
|
||||
/// This chain in context of message bridge.
|
||||
type ThisChain: ThisChainWithMessageLanes;
|
||||
type ThisChain: ThisChainWithMessages;
|
||||
/// Bridged chain in context of message bridge.
|
||||
type BridgedChain: BridgedChainWithMessageLanes;
|
||||
type BridgedChain: BridgedChainWithMessages;
|
||||
|
||||
/// Convert Bridged chain balance into This chain balance.
|
||||
fn bridged_balance_to_this_balance(bridged_balance: BalanceOf<BridgedChain<Self>>) -> BalanceOf<ThisChain<Self>>;
|
||||
}
|
||||
|
||||
/// Chain that has `message-lane` and `call-dispatch` modules.
|
||||
pub trait ChainWithMessageLanes {
|
||||
/// Chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
||||
pub trait ChainWithMessages {
|
||||
/// Hash used in the chain.
|
||||
type Hash: Decode;
|
||||
/// Accound id on the chain.
|
||||
@@ -72,21 +72,21 @@ pub trait ChainWithMessageLanes {
|
||||
/// Type of balances that is used on the chain.
|
||||
type Balance: Encode + Decode + CheckedAdd + CheckedDiv + CheckedMul + PartialOrd + From<u32> + Copy;
|
||||
|
||||
/// Instance of the message-lane pallet.
|
||||
type MessageLaneInstance: Instance;
|
||||
/// Instance of the `pallet-bridge-messages` pallet.
|
||||
type MessagesInstance: Instance;
|
||||
}
|
||||
|
||||
/// Message-lane related transaction parameters estimation.
|
||||
/// Message related transaction parameters estimation.
|
||||
#[derive(RuntimeDebug)]
|
||||
pub struct MessageLaneTransaction<Weight> {
|
||||
pub struct MessageTransaction<Weight> {
|
||||
/// The estimated dispatch weight of the transaction.
|
||||
pub dispatch_weight: Weight,
|
||||
/// The estimated size of the encoded transaction.
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
/// This chain that has `message-lane` and `call-dispatch` modules.
|
||||
pub trait ThisChainWithMessageLanes: ChainWithMessageLanes {
|
||||
/// This chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
||||
pub trait ThisChainWithMessages: ChainWithMessages {
|
||||
/// Call type on the chain.
|
||||
type Call: Encode + Decode;
|
||||
|
||||
@@ -99,14 +99,14 @@ pub trait ThisChainWithMessageLanes: ChainWithMessageLanes {
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce;
|
||||
|
||||
/// Estimate size and weight of single message delivery confirmation transaction at This chain.
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageLaneTransaction<WeightOf<Self>>;
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<WeightOf<Self>>;
|
||||
|
||||
/// Returns minimal transaction fee that must be paid for given transaction at This chain.
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
||||
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
||||
}
|
||||
|
||||
/// Bridged chain that has `message-lane` and `call-dispatch` modules.
|
||||
pub trait BridgedChainWithMessageLanes: ChainWithMessageLanes {
|
||||
/// Bridged chain that has `pallet-bridge-messages` and `call-dispatch` modules.
|
||||
pub trait BridgedChainWithMessages: ChainWithMessages {
|
||||
/// Maximal extrinsic size at Bridged chain.
|
||||
fn maximal_extrinsic_size() -> u32;
|
||||
|
||||
@@ -125,23 +125,23 @@ pub trait BridgedChainWithMessageLanes: ChainWithMessageLanes {
|
||||
fn estimate_delivery_transaction(
|
||||
message_payload: &[u8],
|
||||
message_dispatch_weight: WeightOf<Self>,
|
||||
) -> MessageLaneTransaction<WeightOf<Self>>;
|
||||
) -> MessageTransaction<WeightOf<Self>>;
|
||||
|
||||
/// Returns minimal transaction fee that must be paid for given transaction at the Bridged chain.
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
||||
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
|
||||
}
|
||||
|
||||
pub(crate) type ThisChain<B> = <B as MessageBridge>::ThisChain;
|
||||
pub(crate) type BridgedChain<B> = <B as MessageBridge>::BridgedChain;
|
||||
pub(crate) type HashOf<C> = <C as ChainWithMessageLanes>::Hash;
|
||||
pub(crate) type AccountIdOf<C> = <C as ChainWithMessageLanes>::AccountId;
|
||||
pub(crate) type SignerOf<C> = <C as ChainWithMessageLanes>::Signer;
|
||||
pub(crate) type SignatureOf<C> = <C as ChainWithMessageLanes>::Signature;
|
||||
pub(crate) type WeightOf<C> = <C as ChainWithMessageLanes>::Weight;
|
||||
pub(crate) type BalanceOf<C> = <C as ChainWithMessageLanes>::Balance;
|
||||
pub(crate) type MessageLaneInstanceOf<C> = <C as ChainWithMessageLanes>::MessageLaneInstance;
|
||||
pub(crate) type HashOf<C> = <C as ChainWithMessages>::Hash;
|
||||
pub(crate) type AccountIdOf<C> = <C as ChainWithMessages>::AccountId;
|
||||
pub(crate) type SignerOf<C> = <C as ChainWithMessages>::Signer;
|
||||
pub(crate) type SignatureOf<C> = <C as ChainWithMessages>::Signature;
|
||||
pub(crate) type WeightOf<C> = <C as ChainWithMessages>::Weight;
|
||||
pub(crate) type BalanceOf<C> = <C as ChainWithMessages>::Balance;
|
||||
pub(crate) type MessagesInstanceOf<C> = <C as ChainWithMessages>::MessagesInstance;
|
||||
|
||||
pub(crate) type CallOf<C> = <C as ThisChainWithMessageLanes>::Call;
|
||||
pub(crate) type CallOf<C> = <C as ThisChainWithMessages>::Call;
|
||||
|
||||
/// Raw storage proof type (just raw trie nodes).
|
||||
type RawStorageProof = Vec<Vec<u8>>;
|
||||
@@ -157,7 +157,7 @@ pub fn transaction_payment<Balance: AtLeast32BitUnsigned + FixedPointOperand>(
|
||||
per_byte_fee: Balance,
|
||||
multiplier: FixedU128,
|
||||
weight_to_fee: impl Fn(Weight) -> Balance,
|
||||
transaction: MessageLaneTransaction<Weight>,
|
||||
transaction: MessageTransaction<Weight>,
|
||||
) -> Balance {
|
||||
// base fee is charged for every tx
|
||||
let base_fee = weight_to_fee(base_extrinsic_weight);
|
||||
@@ -357,7 +357,7 @@ pub mod source {
|
||||
) -> Result<ParsedMessagesDeliveryProofFromBridgedChain<B>, &'static str>
|
||||
where
|
||||
ThisRuntime: pallet_finality_verifier::Config,
|
||||
ThisRuntime: pallet_message_lane::Config<MessageLaneInstanceOf<BridgedChain<B>>>,
|
||||
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
||||
HashOf<BridgedChain<B>>:
|
||||
Into<bp_runtime::HashOf<<ThisRuntime as pallet_finality_verifier::Config>::BridgedChain>>,
|
||||
{
|
||||
@@ -372,9 +372,9 @@ pub mod source {
|
||||
|storage| {
|
||||
// Messages delivery proof is just proof of single storage key read => any error
|
||||
// is fatal.
|
||||
let storage_inbound_lane_data_key = pallet_message_lane::storage_keys::inbound_lane_data_key::<
|
||||
let storage_inbound_lane_data_key = pallet_bridge_messages::storage_keys::inbound_lane_data_key::<
|
||||
ThisRuntime,
|
||||
MessageLaneInstanceOf<BridgedChain<B>>,
|
||||
MessagesInstanceOf<BridgedChain<B>>,
|
||||
>(&lane);
|
||||
let raw_inbound_lane_data = storage
|
||||
.read_value(storage_inbound_lane_data_key.0.as_ref())
|
||||
@@ -462,7 +462,7 @@ pub mod target {
|
||||
}
|
||||
|
||||
impl<B: MessageBridge, ThisRuntime, ThisCallDispatchInstance>
|
||||
MessageDispatch<<BridgedChain<B> as ChainWithMessageLanes>::Balance>
|
||||
MessageDispatch<<BridgedChain<B> as ChainWithMessages>::Balance>
|
||||
for FromBridgedChainMessageDispatch<B, ThisRuntime, ThisCallDispatchInstance>
|
||||
where
|
||||
ThisCallDispatchInstance: frame_support::traits::Instance,
|
||||
@@ -511,7 +511,7 @@ pub mod target {
|
||||
) -> Result<ProvedMessages<Message<BalanceOf<BridgedChain<B>>>>, &'static str>
|
||||
where
|
||||
ThisRuntime: pallet_finality_verifier::Config,
|
||||
ThisRuntime: pallet_message_lane::Config<MessageLaneInstanceOf<BridgedChain<B>>>,
|
||||
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
||||
HashOf<BridgedChain<B>>:
|
||||
Into<bp_runtime::HashOf<<ThisRuntime as pallet_finality_verifier::Config>::BridgedChain>>,
|
||||
{
|
||||
@@ -573,11 +573,11 @@ pub mod target {
|
||||
where
|
||||
H: Hasher,
|
||||
B: MessageBridge,
|
||||
ThisRuntime: pallet_message_lane::Config<MessageLaneInstanceOf<BridgedChain<B>>>,
|
||||
ThisRuntime: pallet_bridge_messages::Config<MessagesInstanceOf<BridgedChain<B>>>,
|
||||
{
|
||||
fn read_raw_outbound_lane_data(&self, lane_id: &LaneId) -> Option<Vec<u8>> {
|
||||
let storage_outbound_lane_data_key = pallet_message_lane::storage_keys::outbound_lane_data_key::<
|
||||
MessageLaneInstanceOf<BridgedChain<B>>,
|
||||
let storage_outbound_lane_data_key = pallet_bridge_messages::storage_keys::outbound_lane_data_key::<
|
||||
MessagesInstanceOf<BridgedChain<B>>,
|
||||
>(lane_id);
|
||||
self.storage
|
||||
.read_value(storage_outbound_lane_data_key.0.as_ref())
|
||||
@@ -585,9 +585,9 @@ pub mod target {
|
||||
}
|
||||
|
||||
fn read_raw_message(&self, message_key: &MessageKey) -> Option<Vec<u8>> {
|
||||
let storage_message_key = pallet_message_lane::storage_keys::message_key::<
|
||||
let storage_message_key = pallet_bridge_messages::storage_keys::message_key::<
|
||||
ThisRuntime,
|
||||
MessageLaneInstanceOf<BridgedChain<B>>,
|
||||
MessagesInstanceOf<BridgedChain<B>>,
|
||||
>(&message_key.lane_id, message_key.nonce);
|
||||
self.storage.read_value(storage_message_key.0.as_ref()).ok()?
|
||||
}
|
||||
@@ -808,7 +808,7 @@ mod tests {
|
||||
|
||||
struct ThisChain;
|
||||
|
||||
impl ChainWithMessageLanes for ThisChain {
|
||||
impl ChainWithMessages for ThisChain {
|
||||
type Hash = ();
|
||||
type AccountId = ThisChainAccountId;
|
||||
type Signer = ThisChainSigner;
|
||||
@@ -816,10 +816,10 @@ mod tests {
|
||||
type Weight = frame_support::weights::Weight;
|
||||
type Balance = ThisChainBalance;
|
||||
|
||||
type MessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
type MessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
}
|
||||
|
||||
impl ThisChainWithMessageLanes for ThisChain {
|
||||
impl ThisChainWithMessages for ThisChain {
|
||||
type Call = ThisChainCall;
|
||||
|
||||
fn is_outbound_lane_enabled(lane: &LaneId) -> bool {
|
||||
@@ -830,19 +830,19 @@ mod tests {
|
||||
MAXIMAL_PENDING_MESSAGES_AT_TEST_LANE
|
||||
}
|
||||
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageLaneTransaction<WeightOf<Self>> {
|
||||
MessageLaneTransaction {
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<WeightOf<Self>> {
|
||||
MessageTransaction {
|
||||
dispatch_weight: DELIVERY_CONFIRMATION_TRANSACTION_WEIGHT,
|
||||
size: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
ThisChainBalance(transaction.dispatch_weight as u32 * THIS_CHAIN_WEIGHT_TO_BALANCE_RATE as u32)
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgedChainWithMessageLanes for ThisChain {
|
||||
impl BridgedChainWithMessages for ThisChain {
|
||||
fn maximal_extrinsic_size() -> u32 {
|
||||
unreachable!()
|
||||
}
|
||||
@@ -854,18 +854,18 @@ mod tests {
|
||||
fn estimate_delivery_transaction(
|
||||
_message_payload: &[u8],
|
||||
_message_dispatch_weight: WeightOf<Self>,
|
||||
) -> MessageLaneTransaction<WeightOf<Self>> {
|
||||
) -> MessageTransaction<WeightOf<Self>> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn transaction_payment(_transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
fn transaction_payment(_transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
struct BridgedChain;
|
||||
|
||||
impl ChainWithMessageLanes for BridgedChain {
|
||||
impl ChainWithMessages for BridgedChain {
|
||||
type Hash = ();
|
||||
type AccountId = BridgedChainAccountId;
|
||||
type Signer = BridgedChainSigner;
|
||||
@@ -873,10 +873,10 @@ mod tests {
|
||||
type Weight = frame_support::weights::Weight;
|
||||
type Balance = BridgedChainBalance;
|
||||
|
||||
type MessageLaneInstance = pallet_message_lane::DefaultInstance;
|
||||
type MessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
}
|
||||
|
||||
impl ThisChainWithMessageLanes for BridgedChain {
|
||||
impl ThisChainWithMessages for BridgedChain {
|
||||
type Call = BridgedChainCall;
|
||||
|
||||
fn is_outbound_lane_enabled(_lane: &LaneId) -> bool {
|
||||
@@ -887,16 +887,16 @@ mod tests {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageLaneTransaction<WeightOf<Self>> {
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<WeightOf<Self>> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn transaction_payment(_transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
fn transaction_payment(_transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgedChainWithMessageLanes for BridgedChain {
|
||||
impl BridgedChainWithMessages for BridgedChain {
|
||||
fn maximal_extrinsic_size() -> u32 {
|
||||
BRIDGED_CHAIN_MAX_EXTRINSIC_SIZE
|
||||
}
|
||||
@@ -909,14 +909,14 @@ mod tests {
|
||||
fn estimate_delivery_transaction(
|
||||
_message_payload: &[u8],
|
||||
message_dispatch_weight: WeightOf<Self>,
|
||||
) -> MessageLaneTransaction<WeightOf<Self>> {
|
||||
MessageLaneTransaction {
|
||||
) -> MessageTransaction<WeightOf<Self>> {
|
||||
MessageTransaction {
|
||||
dispatch_weight: DELIVERY_TRANSACTION_WEIGHT + message_dispatch_weight,
|
||||
size: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageLaneTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self> {
|
||||
BridgedChainBalance(transaction.dispatch_weight as u32 * BRIDGED_CHAIN_WEIGHT_TO_BALANCE_RATE as u32)
|
||||
}
|
||||
}
|
||||
@@ -1415,7 +1415,7 @@ mod tests {
|
||||
10,
|
||||
FixedU128::zero(),
|
||||
|weight| weight,
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
size: 50,
|
||||
dispatch_weight: 777
|
||||
},
|
||||
@@ -1432,7 +1432,7 @@ mod tests {
|
||||
10,
|
||||
FixedU128::one(),
|
||||
|weight| weight,
|
||||
MessageLaneTransaction {
|
||||
MessageTransaction {
|
||||
size: 50,
|
||||
dispatch_weight: 777
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Everything required to run benchmarks of message-lanes, based on
|
||||
//! Everything required to run benchmarks of messages module, based on
|
||||
//! `bridge_runtime_common::messages` implementation.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
@@ -24,11 +24,11 @@ use crate::messages::{
|
||||
BridgedChain, HashOf, MessageBridge, ThisChain,
|
||||
};
|
||||
|
||||
use bp_message_lane::{LaneId, MessageData, MessageKey, MessagePayload};
|
||||
use bp_messages::{LaneId, MessageData, MessageKey, MessagePayload};
|
||||
use codec::Encode;
|
||||
use ed25519_dalek::{PublicKey, SecretKey, Signer, KEYPAIR_LENGTH, SECRET_KEY_LENGTH};
|
||||
use frame_support::weights::Weight;
|
||||
use pallet_message_lane::benchmarking::{MessageDeliveryProofParams, MessageProofParams, ProofSize};
|
||||
use pallet_bridge_messages::benchmarking::{MessageDeliveryProofParams, MessageProofParams, ProofSize};
|
||||
use sp_core::Hasher;
|
||||
use sp_runtime::traits::Header;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
@@ -90,7 +90,7 @@ message dispatch.
|
||||
|
||||
#### Message Lanes Delivery
|
||||
|
||||
The [Message delivery pallet](../modules/message-lane/src/lib.rs) is responsible for queueing up
|
||||
The [Message delivery pallet](../modules/messages/src/lib.rs) is responsible for queueing up
|
||||
messages and delivering them in order on the target chain. It also dispatches messages, but we will
|
||||
cover that in the next section.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Every message that is being dispatched has three main characteristics:
|
||||
identifier of the bridged chain (like `b"rlto"` for messages coming from `Rialto`), or the
|
||||
identifier of the bridge itself (`b"rimi"` for `Rialto` <-> `Millau` bridge);
|
||||
- `id` is the unique id of the message within the given bridge. For messages coming from the
|
||||
[message lane module](../message-lane/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;
|
||||
- `message` is the `pallet_bridge_call_dispatch::MessagePayload` structure. The `call` field is set
|
||||
to the (potentially) encoded `Call` of this chain.
|
||||
@@ -52,7 +52,7 @@ When we talk about module in context of bridges, these events are helping in fol
|
||||
|
||||
1. when the message submitter has access to the state of both chains and wants to monitor what has
|
||||
happened with his message. Then he could use the message id (that he gets from the
|
||||
[message lane module events](../message-lane/README.md#General-Information)) to filter events of
|
||||
[messages module events](../messages/README.md#General-Information)) to filter events of
|
||||
call dispatch module at the target chain and actually see what has happened with his message;
|
||||
|
||||
1. when the message submitter only has access to the source chain state (for example, when sender is
|
||||
|
||||
@@ -118,7 +118,7 @@ pub trait Config<I = DefaultInstance>: frame_system::Config {
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
||||
/// Id of the message. Whenever message is passed to the dispatch module, it emits
|
||||
/// event with this id + dispatch result. Could be e.g. (LaneId, MessageNonce) if
|
||||
/// it comes from message-lane module.
|
||||
/// it comes from the messages module.
|
||||
type MessageId: Parameter;
|
||||
/// Type of account ID on source chain.
|
||||
type SourceChainAccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord + Default;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "pallet-message-lane"
|
||||
name = "pallet-bridge-messages"
|
||||
description = "Module that allows bridged chains to exchange messages using lane concept."
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -14,7 +14,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
bp-message-lane = { path = "../../primitives/message-lane", default-features = false }
|
||||
bp-messages = { path = "../../primitives/messages", default-features = false }
|
||||
bp-rialto = { path = "../../primitives/chains/rialto", default-features = false }
|
||||
bp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
|
||||
@@ -28,6 +28,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
hex = "0.4"
|
||||
hex-literal = "0.3"
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
@@ -35,7 +36,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "m
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"bp-rialto/std",
|
||||
"codec/std",
|
||||
@@ -1,25 +1,25 @@
|
||||
# Message Lane Module
|
||||
# Messages Module
|
||||
|
||||
The message lane module is used to deliver messages from source chain to target chain. Message is
|
||||
The messages module is used to deliver messages from source chain to target chain. Message is
|
||||
(almost) opaque to the module and the final goal is to hand message to the message dispatch
|
||||
mechanism.
|
||||
|
||||
## Contents
|
||||
- [Overview](#overview)
|
||||
- [Message Workflow](#message-workflow)
|
||||
- [Integrating Message Lane Module into Runtime](#integrating-message-lane-module-into-runtime)
|
||||
- [Integrating Message Lane Module into Runtime](#integrating-messages-module-into-runtime)
|
||||
- [Non-Essential Functionality](#non-essential-functionality)
|
||||
- [Weights of Module Extrinsics](#weights-of-module-extrinsics)
|
||||
|
||||
## Overview
|
||||
|
||||
Message lane is an unidirectional channel, where messages are sent from source chain to the target
|
||||
chain. At the same time, a single instance of message lane module supports both outbound lanes and
|
||||
chain. At the same time, a single instance of messages module supports both outbound lanes and
|
||||
inbound lanes. So the chain where the module is deployed (this chain), may act as a source chain for
|
||||
outbound messages (heading to a bridged chain) and as a target chain for inbound messages (coming
|
||||
from a bridged chain).
|
||||
|
||||
Message lane module supports multiple message lanes. Every message lane is identified with a 4-byte
|
||||
Messages module supports multiple message lanes. Every message lane is identified with a 4-byte
|
||||
identifier. Messages sent through the lane are assigned unique (for this lane) increasing integer
|
||||
value that is known as nonce ("number that can only be used once"). Messages that are sent over the
|
||||
same lane are guaranteed to be delivered to the target chain in the same order they're sent from
|
||||
@@ -41,12 +41,12 @@ now.
|
||||
We assume that there are external, offchain actors, called relayers, that are submitting module
|
||||
related transactions to both target and source chains. The pallet itself has no assumptions about
|
||||
relayers incentivization scheme, but it has some callbacks for paying rewards. See
|
||||
[Integrating Message Lane Module into runtime](#Integrating-Message-Lane-Module-into-runtime)
|
||||
[Integrating Messages Module into runtime](#Integrating-Messages-Module-into-runtime)
|
||||
for details.
|
||||
|
||||
Eventually, some relayer would notice this message in the "undelivered" state and it would decide to
|
||||
deliver this message. Relayer then crafts `receive_messages_proof()` transaction (aka delivery
|
||||
transaction) for the message lane module instance, deployed at the target chain. Relayer provides
|
||||
transaction) for the messages module instance, deployed at the target chain. Relayer provides
|
||||
his account id at the source chain, the proof of message (or several messages), the number of
|
||||
messages in the transaction and their cumulative dispatch weight. Once a transaction is mined, the
|
||||
message is considered "delivered".
|
||||
@@ -54,12 +54,12 @@ message is considered "delivered".
|
||||
Once a message is delivered, the relayer may want to confirm delivery back to the source chain.
|
||||
There are two reasons why he would want to do that. The first is that we intentionally limit number
|
||||
of "delivered", but not yet "confirmed" messages at inbound lanes
|
||||
(see [What about other Constants in the Message Lane Module Configuration Trait](#What-about-other-Constants-in-the-Message-Lane-Module-Configuration-Trait) for explanation).
|
||||
(see [What about other Constants in the Messages Module Configuration Trait](#What-about-other-Constants-in-the-Messages-Module-Configuration-Trait) for explanation).
|
||||
So at some point, the target chain may stop accepting new messages until relayers confirm some of
|
||||
these. The second is that if the relayer wants to be rewarded for delivery, he must prove the fact
|
||||
that he has actually delivered the message. And this proof may only be generated after the delivery
|
||||
transaction is mined. So relayer crafts the `receive_messages_delivery_proof()` transaction (aka
|
||||
confirmation transaction) for the message lane module instance, deployed at the source chain. Once
|
||||
confirmation transaction) for the messages module instance, deployed at the source chain. Once
|
||||
this transaction is mined, the message is considered "confirmed".
|
||||
|
||||
The "confirmed" state is the final state of the message. But there's one last thing related to the
|
||||
@@ -69,21 +69,21 @@ the limit of "unconfirmed" messages at the target chain and it will stop accepti
|
||||
relayer sometimes includes a nonce of the latest "confirmed" message in the next
|
||||
`receive_messages_proof()` transaction, proving that some messages have been confirmed.
|
||||
|
||||
## Integrating Message Lane Module into Runtime
|
||||
## Integrating Messages Module into Runtime
|
||||
|
||||
As it has been said above, the message lane module supports both outbound and inbound message lanes.
|
||||
As it has been said above, the messages module supports both outbound and inbound message lanes.
|
||||
So if we will integrate a module in some runtime, it may act as the source chain runtime for
|
||||
outbound messages and as the target chain runtime for inbound messages. In this section, we'll
|
||||
sometimes refer to the chain we're currently integrating with, as this chain and the other chain as
|
||||
bridged chain.
|
||||
|
||||
Message lane module doesn't simply accept transactions that are claiming that the bridged chain has
|
||||
Messages module doesn't simply accept transactions that are claiming that the bridged chain has
|
||||
some updated data for us. Instead of this, the module assumes that the bridged chain is able to
|
||||
prove that updated data in some way. The proof is abstracted from the module and may be of any kind.
|
||||
In our Substrate-to-Substrate bridge we're using runtime storage proofs. Other bridges may use
|
||||
transaction proofs, Substrate header digests or anything else that may be proved.
|
||||
|
||||
**IMPORTANT NOTE**: everything below in this chapter describes details of the message lane module
|
||||
**IMPORTANT NOTE**: everything below in this chapter describes details of the messages module
|
||||
configuration. But if you interested in well-probed and relatively easy integration of two
|
||||
Substrate-based chains, you may want to look at the
|
||||
[bridge-runtime-common](../../bin/runtime-common/README.md) crate. This crate is providing a lot of
|
||||
@@ -92,7 +92,7 @@ to change something in this scheme, get back here for detailed information.
|
||||
|
||||
### General Information
|
||||
|
||||
The message lane module supports instances. Every module instance is supposed to bridge this chain
|
||||
The messages module supports instances. Every module instance is supposed to bridge this chain
|
||||
and some bridged chain. To bridge with another chain, using another instance is suggested (this
|
||||
isn't forced anywhere in the code, though).
|
||||
|
||||
@@ -103,10 +103,10 @@ to the target chain, the `MessagesDelivered` event is emitted from the
|
||||
`receive_messages_delivery_proof()` transaction. The `MessagesDelivered` contains the message lane
|
||||
identifier and inclusive range of delivered message nonces.
|
||||
|
||||
### How to plug-in Message Lane Module to Send Messages to the Bridged Chain?
|
||||
### How to plug-in Messages Module to Send Messages to the Bridged Chain?
|
||||
|
||||
The `pallet_message_lane::Config` trait has 3 main associated types that are used to work with
|
||||
outbound messages. The `pallet_message_lane::Config::TargetHeaderChain` defines how we see the
|
||||
The `pallet_bridge_messages::Config` trait has 3 main associated types that are used to work with
|
||||
outbound messages. The `pallet_bridge_messages::Config::TargetHeaderChain` defines how we see the
|
||||
bridged chain as the target for our outbound messages. It must be able to check that the bridged
|
||||
chain may accept our message - like that the message has size below maximal possible transaction
|
||||
size of the chain and so on. And when the relayer sends us a confirmation transaction, this
|
||||
@@ -114,7 +114,7 @@ implementation must be able to parse and verify the proof of messages delivery.
|
||||
reuse the same (configurable) type on all chains that are sending messages to the same bridged
|
||||
chain.
|
||||
|
||||
The `pallet_message_lane::Config::LaneMessageVerifier` defines a single callback to verify outbound
|
||||
The `pallet_bridge_messages::Config::LaneMessageVerifier` defines a single callback to verify outbound
|
||||
messages. The simplest callback may just accept all messages. But in this case you'll need to answer
|
||||
many questions first. Who will pay for the delivery and confirmation transaction? Are we sure that
|
||||
someone will ever deliver this message to the bridged chain? Are we sure that we don't bloat our
|
||||
@@ -123,15 +123,15 @@ fields set to invalid values? Answering all those (and similar) questions would
|
||||
implementation.
|
||||
|
||||
There's another thing to consider when implementing type for use in
|
||||
`pallet_message_lane::Config::LaneMessageVerifier`. It is whether we treat all message lanes
|
||||
`pallet_bridge_messages::Config::LaneMessageVerifier`. It is whether we treat all message lanes
|
||||
identically, or they'll have different sets of verification rules? For example, you may reserve
|
||||
lane#1 for messages coming from some 'wrapped-token' pallet - then you may verify in your
|
||||
implementation that the origin is associated with this pallet. Lane#2 may be reserved for 'system'
|
||||
messages and you may charge zero fee for such messages. You may have some rate limiting for messages
|
||||
sent over the lane#3. Or you may just verify the same rules set for all outbound messages - it is
|
||||
all up to the `pallet_message_lane::Config::LaneMessageVerifier` implementation.
|
||||
all up to the `pallet_bridge_messages::Config::LaneMessageVerifier` implementation.
|
||||
|
||||
The last type is the `pallet_message_lane::Config::MessageDeliveryAndDispatchPayment`. When all
|
||||
The last type is the `pallet_bridge_messages::Config::MessageDeliveryAndDispatchPayment`. When all
|
||||
checks are made and we have decided to accept the message, we're calling the
|
||||
`pay_delivery_and_dispatch_fee()` callback, passing the corresponding argument of the `send_message`
|
||||
function. Later, when message delivery is confirmed, we're calling `pay_relayers_rewards()`
|
||||
@@ -140,41 +140,41 @@ implementation of this trait is in the [`instant_payments.rs`](./src/instant_pay
|
||||
simply calls `Currency::transfer()` when those callbacks are called. So `Currency` units are
|
||||
transferred between submitter, 'relayers fund' and relayers accounts. Other implementations may use
|
||||
more or less sophisticated techniques - the whole relayers incentivization scheme is not a part of
|
||||
the message lane module.
|
||||
the messages module.
|
||||
|
||||
### I have a Message Lane Module in my Runtime, but I Want to Reject all Outbound Messages. What shall I do?
|
||||
### I have a Messages Module in my Runtime, but I Want to Reject all Outbound Messages. What shall I do?
|
||||
|
||||
You should be looking at the `bp_message_lane::source_chain::ForbidOutboundMessages` structure
|
||||
[`bp_message_lane::source_chain`](../../primitives/message-lane/src/source_chain.rs). It implements
|
||||
You should be looking at the `bp_messages::source_chain::ForbidOutboundMessages` structure
|
||||
[`bp_messages::source_chain`](../../primitives/messages/src/source_chain.rs). It implements
|
||||
all required traits and will simply reject all transactions, related to outbound messages.
|
||||
|
||||
### How to plug-in Message Lane Module to Receive Messages from the Bridged Chain?
|
||||
### How to plug-in Messages Module to Receive Messages from the Bridged Chain?
|
||||
|
||||
The `pallet_message_lane::Config` trait has 2 main associated types that are used to work with
|
||||
inbound messages. The `pallet_message_lane::Config::SourceHeaderChain` defines how we see the
|
||||
The `pallet_bridge_messages::Config` trait has 2 main associated types that are used to work with
|
||||
inbound messages. The `pallet_bridge_messages::Config::SourceHeaderChain` defines how we see the
|
||||
bridged chain as the source or our inbound messages. When relayer sends us a delivery transaction,
|
||||
this implementation must be able to parse and verify the proof of messages wrapped in this
|
||||
transaction. Normally, you would reuse the same (configurable) type on all chains that are sending
|
||||
messages to the same bridged chain.
|
||||
|
||||
The `pallet_message_lane::Config::MessageDispatch` defines a way on how to dispatch delivered
|
||||
The `pallet_bridge_messages::Config::MessageDispatch` defines a way on how to dispatch delivered
|
||||
messages. Apart from actually dispatching the message, the implementation must return the correct
|
||||
dispatch weight of the message before dispatch is called.
|
||||
|
||||
### I have a Message Lane Module in my Runtime, but I Want to Reject all Inbound Messages. What
|
||||
### I have a Messages Module in my Runtime, but I Want to Reject all Inbound Messages. What
|
||||
shall I do?
|
||||
|
||||
You should be looking at the `bp_message_lane::target_chain::ForbidInboundMessages` structure from
|
||||
the [`bp_message_lane::target_chain`](../../primitives/message-lane/src/target_chain.rs) module. It
|
||||
You should be looking at the `bp_messages::target_chain::ForbidInboundMessages` structure from
|
||||
the [`bp_messages::target_chain`](../../primitives/messages/src/target_chain.rs) module. It
|
||||
implements all required traits and will simply reject all transactions, related to inbound messages.
|
||||
|
||||
### What about other Constants in the Message Lane Module Configuration Trait?
|
||||
### What about other Constants in the Messages Module Configuration Trait?
|
||||
|
||||
Message is being stored in the source chain storage until its delivery will be confirmed. After
|
||||
that, we may safely remove the message from the storage. Lane messages are removed (pruned) when
|
||||
someone sends a new message using the same lane. So the message submitter pays for that pruning. To
|
||||
avoid pruning too many messages in a single transaction, there's
|
||||
`pallet_message_lane::Config::MaxMessagesToPruneAtOnce` configuration parameter. We will never prune
|
||||
`pallet_bridge_messages::Config::MaxMessagesToPruneAtOnce` configuration parameter. We will never prune
|
||||
more than this number of messages in the single transaction. That said, the value should not be too
|
||||
big to avoid waste of resources when there are no messages to prune.
|
||||
|
||||
@@ -186,10 +186,10 @@ chain to confirm delivery and pay rewards. So to make sure we are able to craft
|
||||
transaction, we need to: (1) keep the size of this map below a certain limit and (2) make sure that
|
||||
the weight of processing this map is below a certain limit. Both size and processing weight mostly
|
||||
depend on the number of entries. The number of entries is limited with the
|
||||
`pallet_message_lane::ConfigMaxUnrewardedRelayerEntriesAtInboundLane` parameter. Processing weight
|
||||
`pallet_bridge_messages::ConfigMaxUnrewardedRelayerEntriesAtInboundLane` parameter. Processing weight
|
||||
also depends on the total number of messages that are being confirmed, because every confirmed
|
||||
message needs to be read. So there's another
|
||||
`pallet_message_lane::Config::MaxUnconfirmedMessagesAtInboundLane` parameter for that.
|
||||
`pallet_bridge_messages::Config::MaxUnconfirmedMessagesAtInboundLane` parameter for that.
|
||||
|
||||
When choosing values for these parameters, you must also keep in mind that if proof in your scheme
|
||||
is based on finality of headers (and it is the most obvious option for Substrate-based chains with
|
||||
@@ -215,7 +215,7 @@ large maps, at the same time keeping reserve for future source chain upgrades.
|
||||
Apart from the message related calls, the module exposes a set of auxiliary calls. They fall in two
|
||||
groups, described in the next two paragraphs.
|
||||
|
||||
There may be a special account in every runtime where the message lane module is deployed. This
|
||||
There may be a special account in every runtime where the messages module is deployed. This
|
||||
account, named 'module owner', is like a module-level sudo account - he's able to halt all and
|
||||
result all module operations without requiring runtime upgrade. The module may have no message
|
||||
owner, but we suggest to use it at least for initial deployment. To calls that are related to this
|
||||
@@ -242,7 +242,7 @@ The main assumptions behind weight formulas is:
|
||||
- all possible costs are paid in advance by the message submitter;
|
||||
- whenever possible, relayer tries to minimize cost of its transactions. So e.g. even though sender
|
||||
always pays for delivering outbound lane state proof, relayer may not include it in the delivery
|
||||
transaction (unless message lane module on target chain requires that);
|
||||
transaction (unless messages module on target chain requires that);
|
||||
- weight formula should incentivize relayer to not to submit any redundant data in the extrinsics
|
||||
arguments;
|
||||
- the extrinsic shall never be executing slower (i.e. has larger actual weight) than defined by the
|
||||
@@ -343,8 +343,8 @@ hardcoded into runtime. Adequate relayer would only include required trie nodes
|
||||
if message size would be maximal (`2/3` of `MaximalExtrinsicSize`), then the extra proof size would
|
||||
be `MaximalExtrinsicSize / 3 * 2 - EXPECTED_DEFAULT_MESSAGE_LENGTH`.
|
||||
|
||||
Both conditions are verified by `pallet_message_lane::ensure_weights_are_correct` and
|
||||
`pallet_message_lane::ensure_able_to_receive_messages` functions, which must be called from every
|
||||
Both conditions are verified by `pallet_bridge_messages::ensure_weights_are_correct` and
|
||||
`pallet_bridge_messages::ensure_able_to_receive_messages` functions, which must be called from every
|
||||
runtime's tests.
|
||||
|
||||
### Weight of `receive_messages_delivery_proof` call
|
||||
@@ -381,11 +381,11 @@ Where:
|
||||
|
||||
#### Why we're always able to craft `receive_messages_delivery_proof` transaction?
|
||||
|
||||
There can be at most `<PeerRuntime as pallet_message_lane::Config>::MaxUnconfirmedMessagesAtInboundLane`
|
||||
There can be at most `<PeerRuntime as pallet_bridge_messages::Config>::MaxUnconfirmedMessagesAtInboundLane`
|
||||
messages and at most
|
||||
`<PeerRuntime as pallet_message_lane::Config>::MaxUnrewardedRelayerEntriesAtInboundLane` unrewarded
|
||||
`<PeerRuntime as pallet_bridge_messages::Config>::MaxUnrewardedRelayerEntriesAtInboundLane` unrewarded
|
||||
relayers in the single delivery confirmation transaction.
|
||||
|
||||
We're checking that this transaction may be crafted in the
|
||||
`pallet_message_lane::ensure_able_to_receive_confirmation` function, which must be called from every
|
||||
`pallet_bridge_messages::ensure_able_to_receive_confirmation` function, which must be called from every
|
||||
runtime' tests.
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pallet-message-lane-rpc"
|
||||
description = "Module that provides RPC methods specific to message-lane pallet."
|
||||
name = "pallet-bridge-messages-rpc"
|
||||
description = "Module that provides RPC methods specific to pallet-bridge-messages pallet."
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
@@ -17,7 +17,7 @@ log = "0.4.11"
|
||||
# Bridge dependencies
|
||||
|
||||
bp-runtime = { path = "../../../primitives/runtime" }
|
||||
bp-message-lane = { path = "../../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../../primitives/messages" }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Possible errors and results of message-lane RPC calls.
|
||||
//! Possible errors and results of messages pallet RPC calls.
|
||||
|
||||
/// Future Result type.
|
||||
pub type FutureResult<T> = jsonrpc_core::BoxFuture<T>;
|
||||
+10
-10
@@ -14,11 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Module that provides RPC methods specific to message-lane pallet.
|
||||
//! Module that provides RPC methods specific to messages pallet.
|
||||
|
||||
use crate::error::{Error, FutureResult};
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use futures::{FutureExt, TryFutureExt};
|
||||
use jsonrpc_core::futures::Future as _;
|
||||
@@ -51,12 +51,12 @@ pub trait Runtime: Send + Sync + 'static {
|
||||
fn inbound_lane_data_key(&self, instance: &InstanceId, lane: &LaneId) -> Option<StorageKey>;
|
||||
}
|
||||
|
||||
/// Provides RPC methods for interacting with message-lane pallet.
|
||||
/// Provides RPC methods for interacting with messages pallet.
|
||||
#[rpc]
|
||||
pub trait MessageLaneApi<BlockHash> {
|
||||
pub trait MessagesApi<BlockHash> {
|
||||
/// Returns storage proof of messages in given inclusive range. The state of outbound
|
||||
/// lane is included in the proof if `include_outbound_lane_state` is true.
|
||||
#[rpc(name = "messageLane_proveMessages")]
|
||||
#[rpc(name = "messages_proveMessages")]
|
||||
fn prove_messages(
|
||||
&self,
|
||||
instance: InstanceId,
|
||||
@@ -68,7 +68,7 @@ pub trait MessageLaneApi<BlockHash> {
|
||||
) -> FutureResult<MessagesProof>;
|
||||
|
||||
/// Returns proof-of-message(s) delivery.
|
||||
#[rpc(name = "messageLane_proveMessagesDelivery")]
|
||||
#[rpc(name = "messages_proveMessagesDelivery")]
|
||||
fn prove_messages_delivery(
|
||||
&self,
|
||||
instance: InstanceId,
|
||||
@@ -77,14 +77,14 @@ pub trait MessageLaneApi<BlockHash> {
|
||||
) -> FutureResult<MessagesDeliveryProof>;
|
||||
}
|
||||
|
||||
/// Implements the MessageLaneApi trait for interacting with message lanes.
|
||||
pub struct MessageLaneRpcHandler<Block, Backend, R> {
|
||||
/// Implements the MessagesApi trait for interacting with message lanes.
|
||||
pub struct MessagesRpcHandler<Block, Backend, R> {
|
||||
backend: Arc<Backend>,
|
||||
runtime: Arc<R>,
|
||||
_phantom: std::marker::PhantomData<Block>,
|
||||
}
|
||||
|
||||
impl<Block, Backend, R> MessageLaneRpcHandler<Block, Backend, R> {
|
||||
impl<Block, Backend, R> MessagesRpcHandler<Block, Backend, R> {
|
||||
/// Creates new mesage lane RPC handler.
|
||||
pub fn new(backend: Arc<Backend>, runtime: Arc<R>) -> Self {
|
||||
Self {
|
||||
@@ -95,7 +95,7 @@ impl<Block, Backend, R> MessageLaneRpcHandler<Block, Backend, R> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block, Backend, R> MessageLaneApi<Block::Hash> for MessageLaneRpcHandler<Block, Backend, R>
|
||||
impl<Block, Backend, R> MessagesApi<Block::Hash> for MessagesRpcHandler<Block, Backend, R>
|
||||
where
|
||||
Block: BlockT,
|
||||
Backend: BackendT<Block> + 'static,
|
||||
+2
-2
@@ -14,12 +14,12 @@
|
||||
// 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/>.
|
||||
|
||||
//! Message lane pallet benchmarking.
|
||||
//! Messages pallet benchmarking.
|
||||
|
||||
use crate::weights_ext::EXPECTED_DEFAULT_MESSAGE_LENGTH;
|
||||
use crate::{inbound_lane::InboundLaneStorage, inbound_lane_storage, outbound_lane, Call, Instance};
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, InboundLaneData, LaneId, MessageData,
|
||||
MessageNonce, OutboundLaneData, UnrewardedRelayersState,
|
||||
};
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Everything about incoming messages receival.
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch},
|
||||
InboundLaneData, LaneId, MessageKey, MessageNonce, OutboundLaneData,
|
||||
};
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
//! The payment is first transferred to a special `relayers-fund` account and only transferred
|
||||
//! to the actual relayer in case confirmation is received.
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::{MessageDeliveryAndDispatchPayment, RelayersRewards, Sender},
|
||||
MessageNonce,
|
||||
};
|
||||
@@ -168,13 +168,13 @@ fn pay_relayer_reward<Currency, AccountId>(
|
||||
|
||||
match pay_result {
|
||||
Ok(_) => log::trace!(
|
||||
target: "runtime",
|
||||
target: "runtime::bridge-messages",
|
||||
"Rewarded relayer {:?} with {:?}",
|
||||
relayer_account,
|
||||
reward,
|
||||
),
|
||||
Err(error) => log::trace!(
|
||||
target: "runtime",
|
||||
target: "runtime::bridge-messages",
|
||||
"Failed to pay relayer {:?} reward {:?}: {:?}",
|
||||
relayer_account,
|
||||
reward,
|
||||
@@ -187,7 +187,7 @@ fn pay_relayer_reward<Currency, AccountId>(
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mock::{run_test, AccountId as TestAccountId, Balance as TestBalance, TestRuntime};
|
||||
use bp_message_lane::source_chain::RelayerRewards;
|
||||
use bp_messages::source_chain::RelayerRewards;
|
||||
|
||||
type Balances = pallet_balances::Module<TestRuntime>;
|
||||
|
||||
@@ -44,11 +44,11 @@ use crate::inbound_lane::{InboundLane, InboundLaneStorage};
|
||||
use crate::outbound_lane::{OutboundLane, OutboundLaneStorage};
|
||||
use crate::weights::WeightInfo;
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::{LaneMessageVerifier, MessageDeliveryAndDispatchPayment, RelayersRewards, TargetHeaderChain},
|
||||
target_chain::{DispatchMessage, MessageDispatch, ProvedLaneMessages, ProvedMessages, SourceHeaderChain},
|
||||
total_unrewarded_messages, InboundLaneData, LaneId, MessageData, MessageKey, MessageNonce, MessagePayload,
|
||||
OutboundLaneData, Parameter as MessageLaneParameter, UnrewardedRelayersState,
|
||||
OutboundLaneData, Parameter as MessagesParameter, UnrewardedRelayersState,
|
||||
};
|
||||
use bp_runtime::Size;
|
||||
use codec::{Decode, Encode};
|
||||
@@ -88,7 +88,7 @@ pub trait Config<I = DefaultInstance>: frame_system::Config {
|
||||
/// for integrating the pallet.
|
||||
///
|
||||
/// All pallet parameters may only be updated either by the root, or by the pallet owner.
|
||||
type Parameter: MessageLaneParameter;
|
||||
type Parameter: MessagesParameter;
|
||||
|
||||
/// Maximal number of messages that may be pruned during maintenance. Maintenance occurs
|
||||
/// whenever new message is sent. The reason is that if you want to use lane, you should
|
||||
@@ -188,7 +188,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Config<I>, I: Instance = DefaultInstance> as MessageLane {
|
||||
trait Store for Module<T: Config<I>, I: Instance = DefaultInstance> as BridgeMessages {
|
||||
/// Optional pallet owner.
|
||||
///
|
||||
/// Pallet owner has a right to halt all pallet operations and then resume it. If it is
|
||||
@@ -255,11 +255,11 @@ decl_module! {
|
||||
match new_owner {
|
||||
Some(new_owner) => {
|
||||
ModuleOwner::<T, I>::put(&new_owner);
|
||||
log::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
log::info!(target: "runtime::bridge-messages", "Setting pallet Owner to: {:?}", new_owner);
|
||||
},
|
||||
None => {
|
||||
ModuleOwner::<T, I>::kill();
|
||||
log::info!("Removed Owner of pallet.");
|
||||
log::info!(target: "runtime::bridge-messages", "Removed Owner of pallet.");
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -273,9 +273,9 @@ decl_module! {
|
||||
<IsHalted<I>>::put(operational);
|
||||
|
||||
if operational {
|
||||
log::info!("Resuming pallet operations.");
|
||||
log::info!(target: "runtime::bridge-messages", "Resuming pallet operations.");
|
||||
} else {
|
||||
log::warn!("Stopping pallet operations.");
|
||||
log::warn!(target: "runtime::bridge-messages", "Stopping pallet operations.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,6 +306,7 @@ decl_module! {
|
||||
T::TargetHeaderChain::verify_message(&payload)
|
||||
.map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Message to lane {:?} is rejected by target chain: {:?}",
|
||||
lane_id,
|
||||
err,
|
||||
@@ -324,6 +325,7 @@ decl_module! {
|
||||
&payload,
|
||||
).map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Message to lane {:?} is rejected by lane verifier: {:?}",
|
||||
lane_id,
|
||||
err,
|
||||
@@ -339,6 +341,7 @@ decl_module! {
|
||||
&Self::relayer_fund_account_id(),
|
||||
).map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Message to lane {:?} is rejected because submitter {:?} is unable to pay fee {:?}: {:?}",
|
||||
lane_id,
|
||||
submitter,
|
||||
@@ -359,6 +362,7 @@ decl_module! {
|
||||
lane.prune_messages(T::MaxMessagesToPruneAtOnce::get());
|
||||
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Accepted message {} to lane {:?}. Message size: {:?}",
|
||||
nonce,
|
||||
lane_id,
|
||||
@@ -395,6 +399,7 @@ decl_module! {
|
||||
&Self::relayer_fund_account_id(),
|
||||
).map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Submitter {:?} can't pay additional fee {:?} for the message {:?}/{:?}: {:?}",
|
||||
submitter,
|
||||
additional_fee,
|
||||
@@ -451,6 +456,7 @@ decl_module! {
|
||||
>(proof, messages_count)
|
||||
.map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Rejecting invalid messages proof: {:?}",
|
||||
err,
|
||||
);
|
||||
@@ -470,6 +476,7 @@ decl_module! {
|
||||
.fold(0, |sum, weight| sum.saturating_add(weight));
|
||||
if dispatch_weight < actual_dispatch_weight {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Rejecting messages proof because of dispatch weight mismatch: declared={}, expected={}",
|
||||
dispatch_weight,
|
||||
actual_dispatch_weight,
|
||||
@@ -488,6 +495,7 @@ decl_module! {
|
||||
let updated_latest_confirmed_nonce = lane.receive_state_update(lane_state);
|
||||
if let Some(updated_latest_confirmed_nonce) = updated_latest_confirmed_nonce {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Received lane {:?} state update: latest_confirmed_nonce={}",
|
||||
lane_id,
|
||||
updated_latest_confirmed_nonce,
|
||||
@@ -506,6 +514,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Received messages: total={}, valid={}",
|
||||
total_messages,
|
||||
valid_messages,
|
||||
@@ -526,6 +535,7 @@ decl_module! {
|
||||
let confirmation_relayer = ensure_signed(origin)?;
|
||||
let (lane_id, lane_data) = T::TargetHeaderChain::verify_messages_delivery_proof(proof).map_err(|err| {
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Rejecting invalid messages delivery proof: {:?}",
|
||||
err,
|
||||
);
|
||||
@@ -581,6 +591,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
log::trace!(
|
||||
target: "runtime::bridge-messages",
|
||||
"Received messages delivery proof up to (and including) {} at lane {:?}",
|
||||
last_delivered_nonce,
|
||||
lane_id,
|
||||
@@ -618,11 +629,9 @@ impl<T: Config<I>, I: Instance> Module<T, I> {
|
||||
}
|
||||
|
||||
/// Get state of unrewarded relayers set.
|
||||
pub fn inbound_unrewarded_relayers_state(
|
||||
lane: bp_message_lane::LaneId,
|
||||
) -> bp_message_lane::UnrewardedRelayersState {
|
||||
pub fn inbound_unrewarded_relayers_state(lane: bp_messages::LaneId) -> bp_messages::UnrewardedRelayersState {
|
||||
let relayers = InboundLanes::<T, I>::get(&lane).relayers;
|
||||
bp_message_lane::UnrewardedRelayersState {
|
||||
bp_messages::UnrewardedRelayersState {
|
||||
unrewarded_relayer_entries: relayers.len() as _,
|
||||
messages_in_oldest_entry: relayers.front().map(|(begin, end, _)| 1 + end - begin).unwrap_or(0),
|
||||
total_messages: total_unrewarded_messages(&relayers).unwrap_or(MessageNonce::MAX),
|
||||
@@ -838,11 +847,12 @@ fn verify_and_decode_messages_proof<Chain: SourceHeaderChain<Fee>, Fee, Dispatch
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mock::{
|
||||
message, run_test, Event as TestEvent, Origin, TestMessageDeliveryAndDispatchPayment, TestMessageLaneParameter,
|
||||
TestMessagesDeliveryProof, TestMessagesProof, TestPayload, TestRuntime, TokenConversionRate,
|
||||
PAYLOAD_REJECTED_BY_TARGET_CHAIN, REGULAR_PAYLOAD, TEST_LANE_ID, TEST_RELAYER_A, TEST_RELAYER_B,
|
||||
message, run_test, Event as TestEvent, Origin, TestMessageDeliveryAndDispatchPayment,
|
||||
TestMessagesDeliveryProof, TestMessagesParameter, TestMessagesProof, TestPayload, TestRuntime,
|
||||
TokenConversionRate, PAYLOAD_REJECTED_BY_TARGET_CHAIN, REGULAR_PAYLOAD, TEST_LANE_ID, TEST_RELAYER_A,
|
||||
TEST_RELAYER_B,
|
||||
};
|
||||
use bp_message_lane::UnrewardedRelayersState;
|
||||
use bp_messages::UnrewardedRelayersState;
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
use frame_system::{EventRecord, Module as System, Phase};
|
||||
use hex_literal::hex;
|
||||
@@ -868,7 +878,7 @@ mod tests {
|
||||
System::<TestRuntime>::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: TestEvent::pallet_message_lane(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
|
||||
event: TestEvent::pallet_bridge_messages(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
|
||||
topics: vec![],
|
||||
}],
|
||||
);
|
||||
@@ -897,7 +907,7 @@ mod tests {
|
||||
System::<TestRuntime>::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: TestEvent::pallet_message_lane(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
|
||||
event: TestEvent::pallet_bridge_messages(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
|
||||
topics: vec![],
|
||||
}],
|
||||
);
|
||||
@@ -966,7 +976,7 @@ mod tests {
|
||||
run_test(|| {
|
||||
get_ready_for_events();
|
||||
|
||||
let parameter = TestMessageLaneParameter::TokenConversionRate(10.into());
|
||||
let parameter = TestMessagesParameter::TokenConversionRate(10.into());
|
||||
assert_ok!(Module::<TestRuntime>::update_pallet_parameter(
|
||||
Origin::root(),
|
||||
parameter.clone(),
|
||||
@@ -977,7 +987,7 @@ mod tests {
|
||||
System::<TestRuntime>::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: TestEvent::pallet_message_lane(RawEvent::ParameterUpdated(parameter)),
|
||||
event: TestEvent::pallet_bridge_messages(RawEvent::ParameterUpdated(parameter)),
|
||||
topics: vec![],
|
||||
}],
|
||||
);
|
||||
@@ -990,7 +1000,7 @@ mod tests {
|
||||
ModuleOwner::<TestRuntime>::put(2);
|
||||
get_ready_for_events();
|
||||
|
||||
let parameter = TestMessageLaneParameter::TokenConversionRate(10.into());
|
||||
let parameter = TestMessagesParameter::TokenConversionRate(10.into());
|
||||
assert_ok!(Module::<TestRuntime>::update_pallet_parameter(
|
||||
Origin::signed(2),
|
||||
parameter.clone(),
|
||||
@@ -1001,7 +1011,7 @@ mod tests {
|
||||
System::<TestRuntime>::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: TestEvent::pallet_message_lane(RawEvent::ParameterUpdated(parameter)),
|
||||
event: TestEvent::pallet_bridge_messages(RawEvent::ParameterUpdated(parameter)),
|
||||
topics: vec![],
|
||||
}],
|
||||
);
|
||||
@@ -1014,7 +1024,7 @@ mod tests {
|
||||
assert_noop!(
|
||||
Module::<TestRuntime>::update_pallet_parameter(
|
||||
Origin::signed(2),
|
||||
TestMessageLaneParameter::TokenConversionRate(10.into()),
|
||||
TestMessagesParameter::TokenConversionRate(10.into()),
|
||||
),
|
||||
DispatchError::BadOrigin,
|
||||
);
|
||||
@@ -1024,7 +1034,7 @@ mod tests {
|
||||
assert_noop!(
|
||||
Module::<TestRuntime>::update_pallet_parameter(
|
||||
Origin::signed(1),
|
||||
TestMessageLaneParameter::TokenConversionRate(10.into()),
|
||||
TestMessagesParameter::TokenConversionRate(10.into()),
|
||||
),
|
||||
DispatchError::BadOrigin,
|
||||
);
|
||||
@@ -1469,9 +1479,12 @@ mod tests {
|
||||
fn storage_message_key_computed_properly() {
|
||||
// If this test fails, then something has been changed in module storage that is breaking all
|
||||
// previously crafted messages proofs.
|
||||
let storage_key = storage_keys::message_key::<TestRuntime, DefaultInstance>(&*b"test", 42).0;
|
||||
assert_eq!(
|
||||
storage_keys::message_key::<TestRuntime, DefaultInstance>(&*b"test", 42).0,
|
||||
hex!("87f1ffe31b52878f09495ca7482df1a48a395e6242c6813b196ca31ed0547ea79446af0e09063bd4a7874aef8a997cec746573742a00000000000000").to_vec(),
|
||||
storage_key,
|
||||
hex!("dd16c784ebd3390a9bc0357c7511ed018a395e6242c6813b196ca31ed0547ea79446af0e09063bd4a7874aef8a997cec746573742a00000000000000").to_vec(),
|
||||
"Unexpected storage key: {}",
|
||||
hex::encode(&storage_key),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1479,9 +1492,12 @@ mod tests {
|
||||
fn outbound_lane_data_key_computed_properly() {
|
||||
// If this test fails, then something has been changed in module storage that is breaking all
|
||||
// previously crafted outbound lane state proofs.
|
||||
let storage_key = storage_keys::outbound_lane_data_key::<DefaultInstance>(&*b"test").0;
|
||||
assert_eq!(
|
||||
storage_keys::outbound_lane_data_key::<DefaultInstance>(&*b"test").0,
|
||||
hex!("87f1ffe31b52878f09495ca7482df1a496c246acb9b55077390e3ca723a0ca1f44a8995dd50b6657a037a7839304535b74657374").to_vec(),
|
||||
storage_key,
|
||||
hex!("dd16c784ebd3390a9bc0357c7511ed0196c246acb9b55077390e3ca723a0ca1f44a8995dd50b6657a037a7839304535b74657374").to_vec(),
|
||||
"Unexpected storage key: {}",
|
||||
hex::encode(&storage_key),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1489,9 +1505,12 @@ mod tests {
|
||||
fn inbound_lane_data_key_computed_properly() {
|
||||
// If this test fails, then something has been changed in module storage that is breaking all
|
||||
// previously crafted inbound lane state proofs.
|
||||
let storage_key = storage_keys::inbound_lane_data_key::<TestRuntime, DefaultInstance>(&*b"test").0;
|
||||
assert_eq!(
|
||||
storage_keys::inbound_lane_data_key::<TestRuntime, DefaultInstance>(&*b"test").0,
|
||||
hex!("87f1ffe31b52878f09495ca7482df1a4e5f83cf83f2127eb47afdc35d6e43fab44a8995dd50b6657a037a7839304535b74657374").to_vec(),
|
||||
storage_key,
|
||||
hex!("dd16c784ebd3390a9bc0357c7511ed01e5f83cf83f2127eb47afdc35d6e43fab44a8995dd50b6657a037a7839304535b74657374").to_vec(),
|
||||
"Unexpected storage key: {}",
|
||||
hex::encode(&storage_key),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
use crate::Config;
|
||||
|
||||
use bp_message_lane::{
|
||||
use bp_messages::{
|
||||
source_chain::{
|
||||
LaneMessageVerifier, MessageDeliveryAndDispatchPayment, RelayersRewards, Sender, TargetHeaderChain,
|
||||
},
|
||||
target_chain::{DispatchMessage, MessageDispatch, ProvedLaneMessages, ProvedMessages, SourceHeaderChain},
|
||||
InboundLaneData, LaneId, Message, MessageData, MessageKey, MessageNonce, OutboundLaneData,
|
||||
Parameter as MessageLaneParameter,
|
||||
Parameter as MessagesParameter,
|
||||
};
|
||||
use bp_runtime::Size;
|
||||
use codec::{Decode, Encode};
|
||||
@@ -56,7 +56,7 @@ impl sp_runtime::traits::Convert<H256, AccountId> for AccountIdConverter {
|
||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
||||
|
||||
use crate as pallet_message_lane;
|
||||
use crate as pallet_bridge_messages;
|
||||
|
||||
frame_support::construct_runtime! {
|
||||
pub enum TestRuntime where
|
||||
@@ -66,7 +66,7 @@ frame_support::construct_runtime! {
|
||||
{
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Module, Call, Event<T>},
|
||||
MessageLane: pallet_message_lane::{Module, Call, Event<T>},
|
||||
Messages: pallet_bridge_messages::{Module, Call, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,16 +124,14 @@ parameter_types! {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
|
||||
pub enum TestMessageLaneParameter {
|
||||
pub enum TestMessagesParameter {
|
||||
TokenConversionRate(FixedU128),
|
||||
}
|
||||
|
||||
impl MessageLaneParameter for TestMessageLaneParameter {
|
||||
impl MessagesParameter for TestMessagesParameter {
|
||||
fn save(&self) {
|
||||
match *self {
|
||||
TestMessageLaneParameter::TokenConversionRate(conversion_rate) => {
|
||||
TokenConversionRate::set(&conversion_rate)
|
||||
}
|
||||
TestMessagesParameter::TokenConversionRate(conversion_rate) => TokenConversionRate::set(&conversion_rate),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +139,7 @@ impl MessageLaneParameter for TestMessageLaneParameter {
|
||||
impl Config for TestRuntime {
|
||||
type Event = Event;
|
||||
type WeightInfo = ();
|
||||
type Parameter = TestMessageLaneParameter;
|
||||
type Parameter = TestMessagesParameter;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
@@ -390,7 +388,7 @@ pub fn message_data(payload: TestPayload) -> MessageData<TestMessageFee> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Run message lane test.
|
||||
/// Run pallet test.
|
||||
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
|
||||
let mut t = frame_system::GenesisConfig::default()
|
||||
.build_storage::<TestRuntime>()
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Everything about outgoing messages sending.
|
||||
|
||||
use bp_message_lane::{LaneId, MessageData, MessageNonce, OutboundLaneData};
|
||||
use bp_messages::{LaneId, MessageData, MessageNonce, OutboundLaneData};
|
||||
|
||||
/// Outbound lane storage.
|
||||
pub trait OutboundLaneStorage {
|
||||
+5
-5
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Autogenerated weights for pallet_message_lane
|
||||
//! Autogenerated weights for pallet_bridge_messages
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.1
|
||||
//! DATE: 2021-02-11, STEPS: [50, ], REPEAT: 20
|
||||
@@ -28,12 +28,12 @@
|
||||
// --chain=local
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet_message_lane
|
||||
// --pallet=pallet_bridge_messages
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=Compiled
|
||||
// --heap-pages=4096
|
||||
// --output=./modules/message-lane/src/weights.rs
|
||||
// --output=./modules/messages/src/weights.rs
|
||||
// --template=./.maintain/rialto-weight-template.hbs
|
||||
|
||||
#![allow(clippy::all)]
|
||||
@@ -46,7 +46,7 @@ use frame_support::{
|
||||
};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for pallet_message_lane.
|
||||
/// Weight functions needed for pallet_bridge_messages.
|
||||
pub trait WeightInfo {
|
||||
fn send_minimal_message_worst_case() -> Weight;
|
||||
fn send_1_kb_message_worst_case() -> Weight;
|
||||
@@ -69,7 +69,7 @@ pub trait WeightInfo {
|
||||
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for pallet_message_lane using the Rialto node and recommended hardware.
|
||||
/// Weights for pallet_bridge_messages using the Rialto node and recommended hardware.
|
||||
pub struct RialtoWeight<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
|
||||
fn send_minimal_message_worst_case() -> Weight {
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::weights::WeightInfo;
|
||||
|
||||
use bp_message_lane::{MessageNonce, UnrewardedRelayersState};
|
||||
use bp_messages::{MessageNonce, UnrewardedRelayersState};
|
||||
use bp_runtime::{PreComputedSize, Size};
|
||||
use frame_support::weights::Weight;
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
|
||||
# Bridge Dependencies
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-polkadot-core = { path = "../../polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
|
||||
@@ -20,7 +20,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-polkadot-core/std",
|
||||
"bp-runtime/std",
|
||||
"sp-api/std",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use bp_polkadot_core::*;
|
||||
|
||||
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
fixed-hash = { version = "0.7.0", default-features = false }
|
||||
hash256-std-hasher = { version = "0.15.2", default-features = false }
|
||||
@@ -33,7 +33,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" ,
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"fixed-hash/std",
|
||||
"frame-support/std",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
mod millau_hash;
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_runtime::Chain;
|
||||
use frame_support::{
|
||||
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight},
|
||||
@@ -76,21 +76,21 @@ pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 1024;
|
||||
|
||||
/// Weight of single regular message delivery transaction on Millau chain.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof_weight()` call
|
||||
/// for the case when single message of `pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||
/// This value is a result of `pallet_bridge_messages::Module::receive_messages_proof_weight()` call
|
||||
/// for the case when single message of `pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||
/// The message must have dispatch weight set to zero. The result then must be rounded up to account
|
||||
/// possible future runtime upgrades.
|
||||
pub const DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
||||
|
||||
/// Increase of delivery transaction weight on Millau chain with every additional message byte.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||
/// This value is a result of `pallet_bridge_messages::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||
/// result then must be rounded up to account possible future runtime upgrades.
|
||||
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 25_000;
|
||||
|
||||
/// Maximal weight of single message delivery confirmation transaction on Millau chain.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_delivery_proof` weight formula computation
|
||||
/// This value is a result of `pallet_bridge_messages::Module::receive_messages_delivery_proof` weight formula computation
|
||||
/// for the case when single message is confirmed. The result then must be rounded up to account possible future
|
||||
/// runtime upgrades.
|
||||
pub const MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT: Weight = 2_000_000_000;
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
|
||||
# Bridge Dependencies
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-polkadot-core = { path = "../../polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
|
||||
@@ -21,7 +21,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-polkadot-core/std",
|
||||
"bp-runtime/std",
|
||||
"sp-api/std",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use bp_polkadot_core::*;
|
||||
|
||||
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
@@ -25,7 +25,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" ,
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_runtime::Chain;
|
||||
use frame_support::{
|
||||
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight},
|
||||
@@ -67,21 +67,21 @@ pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 128;
|
||||
|
||||
/// Weight of single regular message delivery transaction on Rialto chain.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof_weight()` call
|
||||
/// for the case when single message of `pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||
/// This value is a result of `pallet_bridge_messages::Module::receive_messages_proof_weight()` call
|
||||
/// for the case when single message of `pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||
/// The message must have dispatch weight set to zero. The result then must be rounded up to account
|
||||
/// possible future runtime upgrades.
|
||||
pub const DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
||||
|
||||
/// Increase of delivery transaction weight on Rialto chain with every additional message byte.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||
/// This value is a result of `pallet_bridge_messages::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||
/// result then must be rounded up to account possible future runtime upgrades.
|
||||
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 25_000;
|
||||
|
||||
/// Maximal weight of single message delivery confirmation transaction on Rialto chain.
|
||||
///
|
||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_delivery_proof` weight formula computation
|
||||
/// This value is a result of `pallet_bridge_messages::Module::receive_messages_delivery_proof` weight formula computation
|
||||
/// for the case when single message is confirmed. The result then must be rounded up to account possible future
|
||||
/// runtime upgrades.
|
||||
pub const MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT: Weight = 2_000_000_000;
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
|
||||
# Bridge Dependencies
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-polkadot-core = { path = "../../polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
|
||||
@@ -20,7 +20,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-polkadot-core/std",
|
||||
"bp-runtime/std",
|
||||
"sp-api/std",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_message_lane::{LaneId, Weight, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_messages::{LaneId, Weight, MessageNonce, UnrewardedRelayersState};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use bp_polkadot_core::*;
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
|
||||
# Bridge Dependencies
|
||||
bp-message-lane = { path = "../../message-lane", default-features = false }
|
||||
bp-messages = { path = "../../messages", default-features = false }
|
||||
bp-polkadot-core = { path = "../../polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../../runtime", default-features = false }
|
||||
|
||||
@@ -20,7 +20,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-polkadot-core/std",
|
||||
"bp-runtime/std",
|
||||
"sp-api/std",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use bp_polkadot_core::*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bp-message-lane"
|
||||
description = "Primitives of message lane module."
|
||||
name = "bp-messages"
|
||||
description = "Primitives of messages module."
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Primitives of message lane module.
|
||||
//! Primitives of messages module.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// RuntimeApi generated functions
|
||||
@@ -29,10 +29,10 @@ use sp_std::{collections::vec_deque::VecDeque, prelude::*};
|
||||
pub mod source_chain;
|
||||
pub mod target_chain;
|
||||
|
||||
// Weight is reexported to avoid additional frame-support dependencies in message-lane related crates.
|
||||
// Weight is reexported to avoid additional frame-support dependencies in related crates.
|
||||
pub use frame_support::weights::Weight;
|
||||
|
||||
/// Message lane pallet parameter.
|
||||
/// Messages pallet parameter.
|
||||
pub trait Parameter: frame_support::Parameter {
|
||||
/// Save parameter value in the runtime storage.
|
||||
fn save(&self);
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Primitives of message lane module, that are used on the source chain.
|
||||
//! Primitives of messages module, that are used on the source chain.
|
||||
|
||||
use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData};
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Primitives of message lane module, that are used on the target chain.
|
||||
//! Primitives of messages module, that are used on the target chain.
|
||||
|
||||
use crate::{LaneId, Message, MessageData, MessageKey, OutboundLaneData};
|
||||
|
||||
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-message-lane = { path = "../message-lane", default-features = false }
|
||||
bp-messages = { path = "../messages", default-features = false }
|
||||
bp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
@@ -25,7 +25,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_runtime::Chain;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
|
||||
@@ -56,9 +56,6 @@ pub const WESTEND_BRIDGE_INSTANCE: InstanceId = *b"wend";
|
||||
/// Call-dispatch module prefix.
|
||||
pub const CALL_DISPATCH_MODULE_PREFIX: &[u8] = b"pallet-bridge/call-dispatch";
|
||||
|
||||
/// Message-lane module prefix.
|
||||
pub const MESSAGE_LANE_MODULE_PREFIX: &[u8] = b"pallet-bridge/message-lane";
|
||||
|
||||
/// A unique prefix for entropy when generating cross-chain account IDs.
|
||||
pub const ACCOUNT_DERIVATION_PREFIX: &[u8] = b"pallet-bridge/account-derivation/account";
|
||||
|
||||
@@ -66,7 +63,7 @@ pub const ACCOUNT_DERIVATION_PREFIX: &[u8] = b"pallet-bridge/account-derivation/
|
||||
pub const ROOT_ACCOUNT_DERIVATION_PREFIX: &[u8] = b"pallet-bridge/account-derivation/root";
|
||||
|
||||
/// Id of deployed module instance. We have a bunch of pallets that may be used in
|
||||
/// different bridges. E.g. message-lane pallet may be deployed twice in the same
|
||||
/// different bridges. E.g. messages pallet may be deployed twice in the same
|
||||
/// runtime to bridge ThisChain with Chain1 and Chain2. Sometimes we need to be able
|
||||
/// to identify deployed instance dynamically. This type is used for that.
|
||||
pub type InstanceId = [u8; 4];
|
||||
@@ -108,7 +105,7 @@ where
|
||||
///
|
||||
/// This account is used to collect fees for relayers that are passing messages across the bridge.
|
||||
///
|
||||
/// The account ID can be the same across different instances of `message-lane` if the same
|
||||
/// The account ID can be the same across different instances of `pallet-bridge-messages` if the same
|
||||
/// `bridge_id` is used.
|
||||
pub fn derive_relayer_fund_account_id(bridge_id: InstanceId) -> H256 {
|
||||
("relayer-fund-account", bridge_id).using_encoded(blake2_256).into()
|
||||
|
||||
@@ -19,7 +19,7 @@ rand = "0.7"
|
||||
# Bridge dependencies
|
||||
|
||||
bp-header-chain = { path = "../../../primitives/header-chain" }
|
||||
bp-message-lane = { path = "../../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../../primitives/messages" }
|
||||
bp-runtime = { path = "../../../primitives/runtime" }
|
||||
finality-relay = { path = "../../generic/finality" }
|
||||
headers-relay = { path = "../../generic/headers" }
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
//! Substrate node client.
|
||||
|
||||
use crate::chain::{Chain, ChainWithBalances};
|
||||
use crate::rpc::{Substrate, SubstrateMessageLane};
|
||||
use crate::rpc::{Substrate, SubstrateMessages};
|
||||
use crate::{ConnectionParams, Error, Result};
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use codec::Decode;
|
||||
use frame_system::AccountInfo;
|
||||
@@ -228,7 +228,7 @@ impl<C: Chain> Client<C> {
|
||||
include_outbound_lane_state: bool,
|
||||
at_block: C::Hash,
|
||||
) -> Result<StorageProof> {
|
||||
let encoded_trie_nodes = SubstrateMessageLane::<C>::prove_messages(
|
||||
let encoded_trie_nodes = SubstrateMessages::<C>::prove_messages(
|
||||
&self.client,
|
||||
instance,
|
||||
lane,
|
||||
@@ -252,7 +252,7 @@ impl<C: Chain> Client<C> {
|
||||
at_block: C::Hash,
|
||||
) -> Result<Vec<Vec<u8>>> {
|
||||
let encoded_trie_nodes =
|
||||
SubstrateMessageLane::<C>::prove_messages_delivery(&self.client, instance, lane, Some(at_block))
|
||||
SubstrateMessages::<C>::prove_messages_delivery(&self.client, instance, lane, Some(at_block))
|
||||
.await
|
||||
.map_err(Error::RpcError)?;
|
||||
let decoded_trie_nodes: Vec<Vec<u8>> =
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::chain::Chain;
|
||||
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use sc_rpc_api::system::Health;
|
||||
use sp_core::{
|
||||
@@ -51,8 +51,8 @@ jsonrpsee_proc_macros::rpc_client_api! {
|
||||
fn runtime_version() -> RuntimeVersion;
|
||||
}
|
||||
|
||||
pub(crate) SubstrateMessageLane<C: Chain> {
|
||||
#[rpc(method = "messageLane_proveMessages", positional_params)]
|
||||
pub(crate) SubstrateMessages<C: Chain> {
|
||||
#[rpc(method = "messages_proveMessages", positional_params)]
|
||||
fn prove_messages(
|
||||
instance: InstanceId,
|
||||
lane: LaneId,
|
||||
@@ -62,7 +62,7 @@ jsonrpsee_proc_macros::rpc_client_api! {
|
||||
block: Option<C::Hash>,
|
||||
) -> Bytes;
|
||||
|
||||
#[rpc(method = "messageLane_proveMessagesDelivery", positional_params)]
|
||||
#[rpc(method = "messages_proveMessagesDelivery", positional_params)]
|
||||
fn prove_messages_delivery(
|
||||
instance: InstanceId,
|
||||
lane: LaneId,
|
||||
|
||||
@@ -15,5 +15,5 @@ parking_lot = "0.11.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-message-lane = { path = "../../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../../primitives/messages" }
|
||||
relay-utils = { path = "../utils" }
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Relaying [`message-lane`](../pallet_message_lane/index.html) application specific
|
||||
//! Relaying [`pallet-bridge-messages`](../pallet_bridge_messages/index.html) application specific
|
||||
//! data. Message lane allows sending arbitrary messages between bridged chains. This
|
||||
//! module provides entrypoint that starts reading messages from given message lane
|
||||
//! of source chain and submits proof-of-message-at-source-chain transactions to the
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! Message delivery loop. Designed to work with message-lane pallet.
|
||||
//! Message delivery loop. Designed to work with messages pallet.
|
||||
//!
|
||||
//! Single relay instance delivers messages of single lane in single direction.
|
||||
//! To serve two-way lane, you would need two instances of relay.
|
||||
@@ -30,7 +30,7 @@ use crate::message_race_receiving::run as run_message_receiving_race;
|
||||
use crate::metrics::MessageLaneLoopMetrics;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use futures::{channel::mpsc::unbounded, future::FutureExt, stream::StreamExt};
|
||||
use relay_utils::{
|
||||
interval,
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::message_race_strategy::BasicStrategy;
|
||||
use crate::metrics::MessageLaneLoopMetrics;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use bp_messages::{MessageNonce, UnrewardedRelayersState, Weight};
|
||||
use futures::stream::FusedStream;
|
||||
use relay_utils::FailedClient;
|
||||
use std::{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
use crate::message_lane_loop::ClientState;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use futures::{
|
||||
future::FutureExt,
|
||||
stream::{FusedStream, StreamExt},
|
||||
|
||||
@@ -25,7 +25,7 @@ use crate::message_race_strategy::BasicStrategy;
|
||||
use crate::metrics::MessageLaneLoopMetrics;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use futures::stream::FusedStream;
|
||||
use relay_utils::FailedClient;
|
||||
use std::{marker::PhantomData, ops::RangeInclusive, time::Duration};
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use crate::message_race_loop::{NoncesRange, RaceState, RaceStrategy, SourceClientNonces, TargetClientNonces};
|
||||
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use relay_utils::HeaderId;
|
||||
use std::{collections::VecDeque, fmt::Debug, marker::PhantomData, ops::RangeInclusive};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use crate::message_lane::MessageLane;
|
||||
use crate::message_lane_loop::{SourceClientState, TargetClientState};
|
||||
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use relay_utils::metrics::{register, GaugeVec, Metrics, Opts, Registry, U64};
|
||||
|
||||
/// Message lane relay metrics.
|
||||
|
||||
@@ -21,7 +21,7 @@ structopt = "0.3"
|
||||
|
||||
bp-header-chain = { path = "../../primitives/header-chain" }
|
||||
bp-kusama = { path = "../../primitives/chains/kusama" }
|
||||
bp-message-lane = { path = "../../primitives/message-lane" }
|
||||
bp-messages = { path = "../../primitives/messages" }
|
||||
bp-millau = { path = "../../primitives/chains/millau" }
|
||||
bp-polkadot = { path = "../../primitives/chains/polkadot" }
|
||||
bp-runtime = { path = "../../primitives/runtime" }
|
||||
@@ -35,7 +35,7 @@ messages-relay = { path = "../generic/messages" }
|
||||
millau-runtime = { path = "../../bin/millau/runtime" }
|
||||
pallet-bridge-call-dispatch = { path = "../../modules/call-dispatch" }
|
||||
pallet-finality-verifier = { path = "../../modules/finality-verifier" }
|
||||
pallet-message-lane = { path = "../../modules/message-lane" }
|
||||
pallet-bridge-messages = { path = "../../modules/messages" }
|
||||
relay-kusama-client = { path = "../clients/kusama" }
|
||||
relay-millau-client = { path = "../clients/millau" }
|
||||
relay-polkadot-client = { path = "../clients/polkadot" }
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Deal with CLI args of substrate-to-substrate relay.
|
||||
|
||||
use bp_message_lane::LaneId;
|
||||
use bp_messages::LaneId;
|
||||
use codec::{Decode, Encode};
|
||||
use sp_runtime::app_crypto::Ss58Codec;
|
||||
use structopt::{clap::arg_enum, StructOpt};
|
||||
@@ -39,7 +39,7 @@ pub enum Command {
|
||||
RelayHeaders(RelayHeaders),
|
||||
/// Start messages relay between two chains.
|
||||
///
|
||||
/// Ties up to `MessageLane` pallets on both chains and starts relaying messages.
|
||||
/// Ties up to `Messages` pallets on both chains and starts relaying messages.
|
||||
/// Requires the header relay to be already running.
|
||||
RelayMessages(RelayMessages),
|
||||
/// Initialize on-chain bridge pallet with current header data.
|
||||
@@ -48,7 +48,7 @@ pub enum Command {
|
||||
InitBridge(InitBridge),
|
||||
/// Send custom message over the bridge.
|
||||
///
|
||||
/// Allows interacting with the bridge by sending messages over `MessageLane` component.
|
||||
/// Allows interacting with the bridge by sending messages over `Messages` component.
|
||||
/// The message is being sent to the source chain, delivered to the target chain and dispatched
|
||||
/// there.
|
||||
SendMessage(SendMessage),
|
||||
@@ -59,10 +59,10 @@ pub enum Command {
|
||||
EncodeCall(EncodeCall),
|
||||
/// Generate SCALE-encoded `MessagePayload` object that can be sent over selected bridge.
|
||||
///
|
||||
/// The `MessagePayload` can be then fed to `MessageLane::send_message` function and sent over
|
||||
/// The `MessagePayload` can be then fed to `Messages::send_message` function and sent over
|
||||
/// the bridge.
|
||||
EncodeMessagePayload(EncodeMessagePayload),
|
||||
/// Estimate Delivery and Dispatch Fee required for message submission to message lane.
|
||||
/// Estimate Delivery and Dispatch Fee required for message submission to messages pallet.
|
||||
EstimateFee(EstimateFee),
|
||||
/// Given a source chain `AccountId`, derive the corresponding `AccountId` for the target chain.
|
||||
DeriveAccount(DeriveAccount),
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::messages_source::SubstrateMessagesProof;
|
||||
use crate::messages_target::SubstrateMessagesReceivingProof;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::MessageNonce;
|
||||
use bp_messages::MessageNonce;
|
||||
use codec::Encode;
|
||||
use frame_support::weights::Weight;
|
||||
use messages_relay::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
|
||||
@@ -121,7 +121,7 @@ where
|
||||
|
||||
/// Returns maximal number of messages and their maximal cumulative dispatch weight, based
|
||||
/// on given chain parameters.
|
||||
pub fn select_delivery_transaction_limits<W: pallet_message_lane::WeightInfoExt>(
|
||||
pub fn select_delivery_transaction_limits<W: pallet_bridge_messages::WeightInfoExt>(
|
||||
max_extrinsic_weight: Weight,
|
||||
max_unconfirmed_messages_at_inbound_lane: MessageNonce,
|
||||
) -> (MessageNonce, Weight) {
|
||||
@@ -161,11 +161,11 @@ pub fn select_delivery_transaction_limits<W: pallet_message_lane::WeightInfoExt>
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
type RialtoToMillauMessageLaneWeights = pallet_message_lane::weights::RialtoWeight<rialto_runtime::Runtime>;
|
||||
type RialtoToMillauMessagesWeights = pallet_bridge_messages::weights::RialtoWeight<rialto_runtime::Runtime>;
|
||||
|
||||
#[test]
|
||||
fn select_delivery_transaction_limits_works() {
|
||||
let (max_count, max_weight) = select_delivery_transaction_limits::<RialtoToMillauMessageLaneWeights>(
|
||||
let (max_count, max_weight) = select_delivery_transaction_limits::<RialtoToMillauMessagesWeights>(
|
||||
bp_millau::max_extrinsic_weight(),
|
||||
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE,
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use crate::messages_lane::SubstrateMessageLane;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::InstanceId;
|
||||
use bridge_runtime_common::messages::target::FromBridgedChainMessagesProof;
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::messages_lane::SubstrateMessageLane;
|
||||
use crate::messages_source::read_client_state;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_messages::{LaneId, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_runtime::InstanceId;
|
||||
use bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof;
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
@@ -323,7 +323,7 @@ fn format_err(err: String) -> anyhow::Error {
|
||||
anyhow::anyhow!(err)
|
||||
}
|
||||
|
||||
/// MessagePayload that can be delivered to message lane pallet on Millau.
|
||||
/// MessagePayload that can be delivered to messages pallet on Millau.
|
||||
#[derive(StructOpt, Debug)]
|
||||
pub enum MillauToRialtoMessagePayload {
|
||||
/// Raw, SCALE-encoded `MessagePayload`.
|
||||
@@ -342,7 +342,7 @@ pub enum MillauToRialtoMessagePayload {
|
||||
},
|
||||
}
|
||||
|
||||
/// MessagePayload that can be delivered to message lane pallet on Rialto.
|
||||
/// MessagePayload that can be delivered to messages pallet on Rialto.
|
||||
#[derive(StructOpt, Debug)]
|
||||
pub enum RialtoToMillauMessagePayload {
|
||||
/// Raw, SCALE-encoded `MessagePayload`.
|
||||
@@ -384,12 +384,12 @@ pub enum ToRialtoMessage {
|
||||
#[structopt(long)]
|
||||
amount: bp_rialto::Balance,
|
||||
},
|
||||
/// A call to the Millau Bridge Message Lane pallet to send a message over the bridge.
|
||||
/// A call to the Millau Bridge Messages pallet to send a message over the bridge.
|
||||
MillauSendMessage {
|
||||
/// Hex-encoded lane id that should be served by the relay. Defaults to `00000000`.
|
||||
#[structopt(long, default_value = "00000000")]
|
||||
lane: HexLaneId,
|
||||
/// Raw SCALE-encoded Message Payload to submit to the message lane pallet.
|
||||
/// Raw SCALE-encoded Message Payload to submit to the messages pallet.
|
||||
#[structopt(long)]
|
||||
payload: HexBytes,
|
||||
/// Declared delivery and dispatch fee in base source-chain currency units.
|
||||
@@ -421,12 +421,12 @@ pub enum ToMillauMessage {
|
||||
#[structopt(long)]
|
||||
amount: bp_millau::Balance,
|
||||
},
|
||||
/// A call to the Rialto Bridge Message Lane pallet to send a message over the bridge.
|
||||
/// A call to the Rialto Bridge Messages pallet to send a message over the bridge.
|
||||
RialtoSendMessage {
|
||||
/// Hex-encoded lane id that should be served by the relay. Defaults to `00000000`.
|
||||
#[structopt(long, default_value = "00000000")]
|
||||
lane: HexLaneId,
|
||||
/// Raw SCALE-encoded Message Payload to submit to the message lane pallet.
|
||||
/// Raw SCALE-encoded Message Payload to submit to the messages pallet.
|
||||
#[structopt(long)]
|
||||
payload: HexBytes,
|
||||
/// Declared delivery and dispatch fee in base source-chain currency units.
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::messages_source::SubstrateMessagesSource;
|
||||
use crate::messages_target::SubstrateMessagesTarget;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{MILLAU_BRIDGE_INSTANCE, RIALTO_BRIDGE_INSTANCE};
|
||||
use bridge_runtime_common::messages::target::FromBridgedChainMessagesProof;
|
||||
use codec::Encode;
|
||||
@@ -66,7 +66,7 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
|
||||
let account_id = self.source_sign.signer.public().as_array_ref().clone().into();
|
||||
let nonce = self.source_client.next_account_index(account_id).await?;
|
||||
let call: millau_runtime::Call =
|
||||
millau_runtime::MessageLaneCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
millau_runtime::MessagesCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
let call_weight = call.get_dispatch_info().weight;
|
||||
let genesis_hash = *self.source_client.genesis_hash();
|
||||
let transaction = Millau::sign_transaction(genesis_hash, &self.source_sign.signer, nonce, call);
|
||||
@@ -96,7 +96,7 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
|
||||
let messages_count = nonces_end - nonces_start + 1;
|
||||
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 call: rialto_runtime::Call = rialto_runtime::MessageLaneCall::receive_messages_proof(
|
||||
let call: rialto_runtime::Call = rialto_runtime::MessagesCall::receive_messages_proof(
|
||||
self.relayer_id_at_source.clone(),
|
||||
proof,
|
||||
messages_count as _,
|
||||
@@ -148,7 +148,7 @@ pub async fn run(
|
||||
let max_messages_size_in_single_batch = bp_rialto::max_extrinsic_size() as usize / 3;
|
||||
// TODO: use Millau weights after https://github.com/paritytech/parity-bridges-common/issues/390
|
||||
let (max_messages_in_single_batch, max_messages_weight_in_single_batch) =
|
||||
select_delivery_transaction_limits::<pallet_message_lane::weights::RialtoWeight<millau_runtime::Runtime>>(
|
||||
select_delivery_transaction_limits::<pallet_bridge_messages::weights::RialtoWeight<millau_runtime::Runtime>>(
|
||||
bp_rialto::max_extrinsic_weight(),
|
||||
bp_rialto::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE,
|
||||
);
|
||||
|
||||
@@ -261,9 +261,9 @@ async fn run_send_message(command: cli::SendMessage) -> Result<(), String> {
|
||||
})
|
||||
.await?;
|
||||
|
||||
let millau_call = millau_runtime::Call::BridgeRialtoMessageLane(
|
||||
millau_runtime::MessageLaneCall::send_message(lane, payload, fee),
|
||||
);
|
||||
let millau_call = millau_runtime::Call::BridgeRialtoMessages(millau_runtime::MessagesCall::send_message(
|
||||
lane, payload, fee,
|
||||
));
|
||||
|
||||
let signed_millau_call = Millau::sign_transaction(
|
||||
*millau_client.genesis_hash(),
|
||||
@@ -317,9 +317,9 @@ async fn run_send_message(command: cli::SendMessage) -> Result<(), String> {
|
||||
})
|
||||
.await?;
|
||||
|
||||
let rialto_call = rialto_runtime::Call::BridgeMillauMessageLane(
|
||||
rialto_runtime::MessageLaneCall::send_message(lane, payload, fee),
|
||||
);
|
||||
let rialto_call = rialto_runtime::Call::BridgeMillauMessages(rialto_runtime::MessagesCall::send_message(
|
||||
lane, payload, fee,
|
||||
));
|
||||
|
||||
let signed_rialto_call = Rialto::sign_transaction(
|
||||
*rialto_client.genesis_hash(),
|
||||
@@ -442,7 +442,7 @@ async fn run_derive_account(cmd: cli::DeriveAccount) -> Result<(), String> {
|
||||
async fn estimate_message_delivery_and_dispatch_fee<Fee: Decode, C: Chain, P: Encode>(
|
||||
client: &relay_substrate_client::Client<C>,
|
||||
estimate_fee_method: &str,
|
||||
lane: bp_message_lane::LaneId,
|
||||
lane: bp_messages::LaneId,
|
||||
payload: P,
|
||||
) -> Result<Option<Fee>, relay_substrate_client::Error> {
|
||||
let encoded_response = client
|
||||
@@ -747,7 +747,7 @@ impl cli::ToRialtoMessage {
|
||||
cli::ToRialtoMessage::MillauSendMessage { lane, payload, fee } => {
|
||||
let payload = cli::RialtoToMillauMessagePayload::Raw { data: payload }.into_payload()?;
|
||||
let lane = lane.into();
|
||||
rialto_runtime::Call::BridgeMillauMessageLane(rialto_runtime::MessageLaneCall::send_message(
|
||||
rialto_runtime::Call::BridgeMillauMessages(rialto_runtime::MessagesCall::send_message(
|
||||
lane, payload, fee,
|
||||
))
|
||||
}
|
||||
@@ -784,7 +784,7 @@ impl cli::ToMillauMessage {
|
||||
cli::ToMillauMessage::RialtoSendMessage { lane, payload, fee } => {
|
||||
let payload = cli::MillauToRialtoMessagePayload::Raw { data: payload }.into_payload()?;
|
||||
let lane = lane.into();
|
||||
millau_runtime::Call::BridgeRialtoMessageLane(millau_runtime::MessageLaneCall::send_message(
|
||||
millau_runtime::Call::BridgeRialtoMessages(millau_runtime::MessagesCall::send_message(
|
||||
lane, payload, fee,
|
||||
))
|
||||
}
|
||||
@@ -801,7 +801,7 @@ impl cli::ToMillauMessage {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use bp_message_lane::source_chain::TargetHeaderChain;
|
||||
use bp_messages::source_chain::TargetHeaderChain;
|
||||
use sp_core::Pair;
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::messages_source::SubstrateMessagesSource;
|
||||
use crate::messages_target::SubstrateMessagesTarget;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bp_message_lane::{LaneId, MessageNonce};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{MILLAU_BRIDGE_INSTANCE, RIALTO_BRIDGE_INSTANCE};
|
||||
use bridge_runtime_common::messages::target::FromBridgedChainMessagesProof;
|
||||
use codec::Encode;
|
||||
@@ -66,7 +66,7 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
|
||||
let account_id = self.source_sign.signer.public().as_array_ref().clone().into();
|
||||
let nonce = self.source_client.next_account_index(account_id).await?;
|
||||
let call: rialto_runtime::Call =
|
||||
rialto_runtime::MessageLaneCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
rialto_runtime::MessagesCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
let call_weight = call.get_dispatch_info().weight;
|
||||
let genesis_hash = *self.source_client.genesis_hash();
|
||||
let transaction = Rialto::sign_transaction(genesis_hash, &self.source_sign.signer, nonce, call);
|
||||
@@ -96,7 +96,7 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
|
||||
let messages_count = nonces_end - nonces_start + 1;
|
||||
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 call: millau_runtime::Call = millau_runtime::MessageLaneCall::receive_messages_proof(
|
||||
let call: millau_runtime::Call = millau_runtime::MessagesCall::receive_messages_proof(
|
||||
self.relayer_id_at_source.clone(),
|
||||
proof,
|
||||
messages_count as _,
|
||||
@@ -147,7 +147,7 @@ pub async fn run(
|
||||
// 2/3 is reserved for proofs and tx overhead
|
||||
let max_messages_size_in_single_batch = bp_millau::max_extrinsic_size() as usize / 3;
|
||||
let (max_messages_in_single_batch, max_messages_weight_in_single_batch) =
|
||||
select_delivery_transaction_limits::<pallet_message_lane::weights::RialtoWeight<rialto_runtime::Runtime>>(
|
||||
select_delivery_transaction_limits::<pallet_bridge_messages::weights::RialtoWeight<rialto_runtime::Runtime>>(
|
||||
bp_millau::max_extrinsic_weight(),
|
||||
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user