Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sync bp-pangoro
  • Loading branch information
aurexav committed Sep 15, 2022
commit 76b46b5842b2361225f533bb146d5c999eb91feb
58 changes: 58 additions & 0 deletions primitives/chain-pangoro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
mod copy_paste_from_darwinia {
// --- darwinia-network ---
use bp_darwinia_core::*;
// --- paritytech ---
use sp_version::RuntimeVersion;

pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Pangoro"),
impl_name: sp_runtime::create_runtime_str!("Pangoro"),
authoring_version: 0,
#[allow(clippy::inconsistent_digit_grouping)]
spec_version: 2_8_06_0,
impl_version: 0,
apis: sp_version::create_apis_vec![[]],
transaction_version: 0,
state_version: 0,
};

pub const EXISTENTIAL_DEPOSIT: Balance = 0;

Expand All @@ -30,5 +44,49 @@ pub use copy_paste_from_darwinia::*;

pub use bp_darwinia_core::*;

// --- paritytech ---
use bp_messages::{LaneId, MessageDetails, MessageNonce};
use frame_support::Parameter;
use sp_std::prelude::*;

/// Pangoro Chain.
pub type Pangoro = DarwiniaLike;

/// Name of the With-Pangoro GRANDPA pallet instance that is deployed at bridged chains.
pub const WITH_PANGORO_GRANDPA_PALLET_NAME: &str = "BridgePangoroGrandpa";
/// Name of the With-Pangoro messages pallet instance that is deployed at bridged chains.
pub const WITH_PANGORO_MESSAGES_PALLET_NAME: &str = "BridgePangoroMessages";

/// Name of the `PangoroFinalityApi::best_finalized` runtime method.
pub const BEST_FINALIZED_PANGORO_HEADER_METHOD: &str = "PangoroFinalityApi_best_finalized";

/// Name of the `ToPangoroOutboundLaneApi::message_details` runtime method.
pub const TO_PANGORO_MESSAGE_DETAILS_METHOD: &str = "ToPangoroOutboundLaneApi_message_details";

sp_api::decl_runtime_apis! {
/// API for querying information about the finalized Pangoro headers.
///
/// This API is implemented by runtimes that are bridging with the Pangoro chain, not the
/// Pangoro runtime itself.
pub trait PangoroFinalityApi {
/// Returns number and hash of the best finalized header known to the bridge module.
fn best_finalized() -> (BlockNumber, Hash);
}

/// Outbound message lane API for messages that are sent to Pangoro chain.
///
/// This API is implemented by runtimes that are sending messages to Pangoro chain, not the
/// Pangoro runtime itself.
pub trait ToPangoroOutboundLaneApi<OutboundMessageFee: Parameter, OutboundPayload: Parameter> {
/// Returns dispatch weight, encoded payload size and delivery+dispatch fee of all
/// messages in given inclusive range.
///
/// If some (or all) messages are missing from the storage, they'll also will
/// be missing from the resulting vector. The vector is ordered by the nonce.
fn message_details(
lane: LaneId,
begin: MessageNonce,
end: MessageNonce,
) -> Vec<MessageDetails<OutboundMessageFee>>;
}
}