feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent e4778b4576
commit 379cb741ed
9082 changed files with 997824 additions and 997542 deletions
+29 -29
View File
@@ -1,7 +1,7 @@
[package]
name = "pallet-bridge-beefy"
name = "pezpallet-bridge-beefy"
version = "0.1.0"
description = "Module implementing BEEFY on-chain light client used for bridging consensus of substrate-based chains."
description = "Module implementing BEEFY on-chain light client used for bridging consensus of bizinikiwi-based chains."
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
@@ -21,21 +21,21 @@ tracing = { workspace = true }
bp-beefy = { workspace = true }
bp-runtime = { workspace = true }
# Substrate Dependencies
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# Bizinikiwi Dependencies
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-core = { workspace = true }
pezsp-runtime = { workspace = true }
pezsp-std = { workspace = true }
[dev-dependencies]
bp-test-utils = { workspace = true, default-features = true }
mmr-lib = { workspace = true, default-features = true }
pallet-beefy-mmr = { workspace = true, default-features = true }
pallet-mmr = { workspace = true, default-features = true }
pezpallet-beefy-mmr = { workspace = true, default-features = true }
pezpallet-mmr = { workspace = true, default-features = true }
rand = { workspace = true, default-features = true }
sp-consensus-beefy = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
pezsp-consensus-beefy = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
[features]
default = ["std"]
@@ -43,31 +43,31 @@ std = [
"bp-beefy/std",
"bp-runtime/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"pezframe-support/std",
"pezframe-system/std",
"scale-info/std",
"serde/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"pezsp-core/std",
"pezsp-runtime/std",
"pezsp-std/std",
"tracing/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-beefy-mmr/try-runtime",
"pallet-mmr/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-beefy-mmr/try-runtime",
"pezpallet-mmr/try-runtime",
"pezsp-runtime/try-runtime",
]
runtime-benchmarks = [
"bp-beefy/runtime-benchmarks",
"bp-runtime/runtime-benchmarks",
"bp-test-utils/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-beefy-mmr/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"sp-consensus-beefy/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-beefy-mmr/runtime-benchmarks",
"pezpallet-mmr/runtime-benchmarks",
"pezsp-consensus-beefy/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
+15 -15
View File
@@ -16,8 +16,8 @@
//! BEEFY bridge pallet.
//!
//! This pallet is an on-chain BEEFY light client for Substrate-based chains that are using the
//! following pallets bundle: `pallet-mmr`, `pallet-beefy` and `pallet-beefy-mmr`.
//! This pallet is an on-chain BEEFY light client for Bizinikiwi-based chains that are using the
//! following pallets bundle: `pezpallet-mmr`, `pezpallet-beefy` and `pezpallet-beefy-mmr`.
//!
//! The pallet is able to verify MMR leaf proofs and BEEFY commitments, so it has access
//! to the following data of the bridged chain:
@@ -33,7 +33,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use bp_beefy::{ChainWithBeefy, InitializationData};
use sp_std::{boxed::Box, prelude::*};
use pezsp_std::{boxed::Box, prelude::*};
// Re-export in crate namespace for `construct_runtime!`
pub use pallet::*;
@@ -95,15 +95,15 @@ pub struct ImportedCommitmentsInfoData<BlockNumber> {
next_block_number_index: u32,
}
#[frame_support::pallet(dev_mode)]
#[pezframe_support::pallet(dev_mode)]
pub mod pallet {
use super::*;
use bp_runtime::{BasicOperatingMode, OwnedBridgeModule};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// The upper bound on the number of requests allowed by the pallet.
///
/// A request refers to an action which writes a header to storage.
@@ -131,7 +131,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
fn on_initialize(_n: BlockNumberFor<T>) -> frame_support::weights::Weight {
fn on_initialize(_n: BlockNumberFor<T>) -> pezframe_support::weights::Weight {
<RequestCount<T, I>>::mutate(|count| *count = count.saturating_sub(1));
Weight::from_parts(0, 0)
@@ -328,7 +328,7 @@ pub mod pallet {
StorageValue<_, BasicOperatingMode, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Optional module owner account.
pub owner: Option<T::AccountId>,
@@ -417,17 +417,17 @@ mod tests {
use super::*;
use bp_runtime::{BasicOperatingMode, OwnedBridgeModuleError};
use bp_test_utils::generate_owned_bridge_module_tests;
use frame_support::{assert_noop, assert_ok, traits::Get};
use pezframe_support::{assert_noop, assert_ok, traits::Get};
use mock::*;
use mock_chain::*;
use sp_consensus_beefy::mmr::BeefyAuthoritySet;
use sp_runtime::DispatchError;
use pezsp_consensus_beefy::mmr::BeefyAuthoritySet;
use pezsp_runtime::DispatchError;
fn next_block() {
use frame_support::traits::OnInitialize;
use pezframe_support::traits::OnInitialize;
let current_number = frame_system::Pallet::<TestRuntime>::block_number();
frame_system::Pallet::<TestRuntime>::set_block_number(current_number + 1);
let current_number = pezframe_system::Pallet::<TestRuntime>::block_number();
pezframe_system::Pallet::<TestRuntime>::set_block_number(current_number + 1);
let _ = Pallet::<TestRuntime>::on_initialize(current_number);
}
+17 -17
View File
@@ -24,17 +24,17 @@ use crate::{
use bp_beefy::{BeefyValidatorSignatureOf, ChainWithBeefy, Commitment, MmrDataOrHash};
use bp_runtime::{BasicOperatingMode, Chain, ChainId};
use codec::Encode;
use frame_support::{construct_runtime, derive_impl, weights::Weight};
use sp_core::{sr25519::Signature, Pair};
use sp_runtime::{
use pezframe_support::{construct_runtime, derive_impl, weights::Weight};
use pezsp_core::{sr25519::Signature, Pair};
use pezsp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, Hash},
StateVersion,
};
pub use sp_consensus_beefy::ecdsa_crypto::{AuthorityId as BeefyId, Pair as BeefyPair};
use sp_core::crypto::Wraps;
use sp_runtime::traits::Keccak256;
pub use pezsp_consensus_beefy::ecdsa_crypto::{AuthorityId as BeefyId, Pair as BeefyPair};
use pezsp_core::crypto::Wraps;
use pezsp_runtime::traits::Keccak256;
pub type TestAccountId = u64;
pub type TestBridgedBlockNumber = u64;
@@ -49,7 +49,7 @@ pub type TestBridgedMmrHashing = BridgedMmrHashing<TestRuntime, ()>;
pub type TestBridgedMmrHash = BridgedMmrHash<TestRuntime, ()>;
pub type TestBridgedBeefyMmrLeafExtra = BridgedBeefyMmrLeafExtra<TestRuntime, ()>;
pub type TestBridgedMmrProof = BridgedMmrProof<TestRuntime, ()>;
pub type TestBridgedRawMmrLeaf = sp_consensus_beefy::mmr::MmrLeaf<
pub type TestBridgedRawMmrLeaf = pezsp_consensus_beefy::mmr::MmrLeaf<
TestBridgedBlockNumber,
TestBridgedBlockHash,
TestBridgedMmrHash,
@@ -57,25 +57,25 @@ pub type TestBridgedRawMmrLeaf = sp_consensus_beefy::mmr::MmrLeaf<
>;
pub type TestBridgedMmrNode = MmrDataOrHash<Keccak256, TestBridgedRawMmrLeaf>;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
construct_runtime! {
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Beefy: beefy::{Pallet},
}
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = Block;
}
impl beefy::Config for TestRuntime {
type MaxRequests = frame_support::traits::ConstU32<16>;
type MaxRequests = pezframe_support::traits::ConstU32<16>;
type BridgedChain = TestBridgedChain;
type CommitmentsToKeep = frame_support::traits::ConstU32<16>;
type CommitmentsToKeep = pezframe_support::traits::ConstU32<16>;
}
#[derive(Debug)]
@@ -87,7 +87,7 @@ impl Chain for TestBridgedChain {
type BlockNumber = TestBridgedBlockNumber;
type Hash = H256;
type Hasher = BlakeTwo256;
type Header = sp_runtime::testing::Header;
type Header = pezsp_runtime::testing::Header;
type AccountId = TestAccountId;
type Balance = u64;
@@ -110,12 +110,12 @@ impl ChainWithBeefy for TestBridgedChain {
type MmrHash = <Keccak256 as Hash>::Output;
type BeefyMmrLeafExtra = ();
type AuthorityId = BeefyId;
type AuthorityIdToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
type AuthorityIdToMerkleLeaf = pezpallet_beefy_mmr::BeefyEcdsaToEthereum;
}
/// Run test within test runtime.
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
sp_io::TestExternalities::new(Default::default()).execute_with(test)
pezsp_io::TestExternalities::new(Default::default()).execute_with(test)
}
/// Initialize pallet and run test.
@@ -141,7 +141,7 @@ pub fn run_test_with_initialize<T>(initial_validators_count: u32, test: impl FnO
/// Import given commitment.
pub fn import_commitment(
header: crate::mock_chain::HeaderAndCommitment,
) -> sp_runtime::DispatchResult {
) -> pezsp_runtime::DispatchResult {
crate::Pallet::<TestRuntime>::submit_commitment(
RuntimeOrigin::signed(1),
header
+5 -5
View File
@@ -28,11 +28,11 @@ use crate::{
use bp_beefy::{BeefyPayload, Commitment, ValidatorSetId, MMR_ROOT_PAYLOAD_ID};
use codec::Encode;
use pallet_mmr::NodeIndex;
use pezpallet_mmr::NodeIndex;
use rand::Rng;
use sp_consensus_beefy::mmr::{BeefyNextAuthoritySet, MmrLeafVersion};
use sp_core::Pair;
use sp_runtime::traits::{Hash, Header as HeaderT};
use pezsp_consensus_beefy::mmr::{BeefyNextAuthoritySet, MmrLeafVersion};
use pezsp_core::Pair;
use pezsp_runtime::traits::{Hash, Header as HeaderT};
use std::collections::HashMap;
#[derive(Debug, Clone)]
@@ -190,7 +190,7 @@ impl HeaderBuilder {
next_validator_keys.iter().map(|pair| pair.public()).collect::<Vec<_>>();
let next_validators_mmr_root =
get_authorities_mmr_root::<TestRuntime, (), _>(next_validators.iter());
let leaf = sp_consensus_beefy::mmr::MmrLeaf {
let leaf = pezsp_consensus_beefy::mmr::MmrLeaf {
version: MmrLeafVersion::new(1, 0),
parent_number_and_hash: (header.number().saturating_sub(1), *header.parent_hash()),
beefy_next_authority_set: BeefyNextAuthoritySet {
+5 -5
View File
@@ -5,9 +5,9 @@ use crate::{
};
use bp_beefy::{merkle_root, verify_mmr_leaves_proof, BeefyAuthorityId, MmrDataOrHash};
use codec::Encode;
use frame_support::ensure;
use sp_runtime::traits::{Convert, Hash};
use sp_std::{vec, vec::Vec};
use pezframe_support::ensure;
use pezsp_runtime::traits::{Convert, Hash};
use pezsp_std::{vec, vec::Vec};
type BridgedMmrDataOrHash<T, I> = MmrDataOrHash<BridgedMmrHashing<T, I>, BridgedBeefyMmrLeaf<T, I>>;
/// A way to encode validator id to the BEEFY merkle tree leaf.
@@ -161,8 +161,8 @@ mod tests {
use super::*;
use crate::{mock::*, mock_chain::*, *};
use bp_beefy::{BeefyPayload, MMR_ROOT_PAYLOAD_ID};
use frame_support::{assert_noop, assert_ok};
use sp_consensus_beefy::ValidatorSet;
use pezframe_support::{assert_noop, assert_ok};
use pezsp_consensus_beefy::ValidatorSet;
#[test]
fn submit_commitment_checks_metadata() {
+26 -26
View File
@@ -1,7 +1,7 @@
[package]
name = "pallet-bridge-grandpa"
name = "pezpallet-bridge-grandpa"
version = "0.7.0"
description = "Module implementing GRANDPA on-chain light client used for bridging consensus of substrate-based chains."
description = "Module implementing GRANDPA on-chain light client used for bridging consensus of bizinikiwi-based chains."
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
@@ -21,21 +21,21 @@ tracing = { workspace = true }
bp-header-chain = { workspace = true }
bp-runtime = { workspace = true }
# Substrate Dependencies
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-consensus-grandpa = { features = ["serde"], workspace = true }
sp-runtime = { features = ["serde"], workspace = true }
sp-std = { workspace = true }
# Bizinikiwi Dependencies
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-consensus-grandpa = { features = ["serde"], workspace = true }
pezsp-runtime = { features = ["serde"], workspace = true }
pezsp-std = { workspace = true }
# Optional Benchmarking Dependencies
bp-test-utils = { optional = true, workspace = true }
frame-benchmarking = { optional = true, workspace = true }
pezframe-benchmarking = { optional = true, workspace = true }
[dev-dependencies]
bp-runtime = { features = ["test-helpers"], workspace = true }
sp-core = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
pezsp-core = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
[features]
default = ["std"]
@@ -44,13 +44,13 @@ std = [
"bp-runtime/std",
"bp-test-utils/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"pezframe-benchmarking/std",
"pezframe-support/std",
"pezframe-system/std",
"scale-info/std",
"sp-consensus-grandpa/std",
"sp-runtime/std",
"sp-std/std",
"pezsp-consensus-grandpa/std",
"pezsp-runtime/std",
"pezsp-std/std",
"tracing/std",
]
runtime-benchmarks = [
@@ -58,15 +58,15 @@ runtime-benchmarks = [
"bp-runtime/runtime-benchmarks",
"bp-test-utils",
"bp-test-utils?/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-consensus-grandpa/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezsp-consensus-grandpa/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezsp-runtime/try-runtime",
]
+3 -3
View File
@@ -3,7 +3,7 @@
The bridge GRANDPA pallet is a light client for the GRANDPA finality gadget, running at the bridged chain.
It may import headers and their GRANDPA finality proofs (justifications) of the bridged chain. Imported
headers then may be used to verify storage proofs by other pallets. This makes the bridge GRANDPA pallet
a basic pallet of all bridges with Substrate-based chains. It is used by all bridge types (bridge between
a basic pallet of all bridges with Bizinikiwi-based chains. It is used by all bridge types (bridge between
standalone chains, between teyrchains and any combination of those) and is used by other bridge pallets.
It is used by the teyrchains light client (bridge teyrchains pallet) and by messages pallet.
@@ -12,10 +12,10 @@ It is used by the teyrchains light client (bridge teyrchains pallet) and by mess
You can find detailed information on GRANDPA, by exploring its [repository](https://github.com/paritytech/finality-grandpa).
Here is the minimal required GRANDPA information to understand how pallet works.
Any Substrate chain may use different block authorship algorithms (like BABE or Aura) to determine block producers and
Any Bizinikiwi chain may use different block authorship algorithms (like BABE or Aura) to determine block producers and
generate blocks. This has nothing common with finality, though - the task of block authorship is to coordinate
blocks generation. Any block may be reverted (if there's a fork) if it is not finalized. The finality solution
for (standalone) Substrate-based chains is the GRANDPA finality gadget. If some block is finalized by the gadget, it
for (standalone) Bizinikiwi-based chains is the GRANDPA finality gadget. If some block is finalized by the gadget, it
can't be reverted.
In GRANDPA, there are validators, identified by their public keys. They select some generated block and produce
+6 -6
View File
@@ -48,11 +48,11 @@ use bp_test_utils::{
accounts, make_justification_for_header, JustificationGeneratorParams, TEST_GRANDPA_ROUND,
TEST_GRANDPA_SET_ID,
};
use frame_benchmarking::{benchmarks_instance_pallet, whitelisted_caller};
use frame_system::RawOrigin;
use sp_consensus_grandpa::AuthorityId;
use sp_runtime::traits::{One, Zero};
use sp_std::vec::Vec;
use pezframe_benchmarking::{benchmarks_instance_pallet, whitelisted_caller};
use pezframe_system::RawOrigin;
use pezsp_consensus_grandpa::AuthorityId;
use pezsp_runtime::traits::{One, Zero};
use pezsp_std::vec::Vec;
/// The maximum number of vote ancestries to include in a justification.
///
@@ -71,7 +71,7 @@ const MAX_VOTE_ANCESTRIES_RANGE_END: u32 =
fn precommits_range_end<T: Config<I>, I: 'static>() -> u32 {
let max_bridged_authorities = T::BridgedChain::MAX_AUTHORITIES_COUNT;
let max_bridged_authorities = if max_bridged_authorities > 128 {
sp_std::cmp::max(128, max_bridged_authorities / 5)
pezsp_std::cmp::max(128, max_bridged_authorities / 5)
} else {
max_bridged_authorities
};
+17 -17
View File
@@ -23,18 +23,18 @@ use bp_header_chain::{
SubmitFinalityProofInfo,
};
use bp_runtime::{BlockNumberOf, Chain, OwnedBridgeModule};
use frame_support::{
use pezframe_support::{
dispatch::CallableCallFor,
traits::{Get, IsSubType},
weights::Weight,
};
use sp_consensus_grandpa::SetId;
use sp_runtime::{
use pezsp_consensus_grandpa::SetId;
use pezsp_runtime::{
traits::{CheckedSub, Header, Zero},
transaction_validity::{InvalidTransaction, TransactionValidityError},
RuntimeDebug, SaturatedConversion,
};
use sp_std::fmt::Debug;
use pezsp_std::fmt::Debug;
/// Verified `SubmitFinalityProofInfo<N>`.
#[derive(Copy, Clone, PartialEq, RuntimeDebug)]
@@ -48,7 +48,7 @@ pub struct VerifiedSubmitFinalityProofInfo<N: Debug> {
/// Helper struct that provides methods for working with the `SubmitFinalityProof` call.
pub struct SubmitFinalityProofHelper<T: Config<I>, I: 'static> {
_phantom_data: sp_std::marker::PhantomData<(T, I)>,
_phantom_data: pezsp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> SubmitFinalityProofHelper<T, I> {
@@ -314,8 +314,8 @@ mod tests {
TEST_GRANDPA_SET_ID,
};
use codec::Encode;
use frame_support::weights::Weight;
use sp_runtime::{testing::DigestItem, traits::Header as _, SaturatedConversion};
use pezframe_support::weights::Weight;
use pezsp_runtime::{testing::DigestItem, traits::Header as _, SaturatedConversion};
fn validate_block_submit(num: TestNumber) -> bool {
let bridge_grandpa_call = crate::Call::<TestRuntime, ()>::submit_finality_proof_ex {
@@ -332,7 +332,7 @@ mod tests {
}
fn sync_to_header_10() {
let header10_hash = sp_core::H256::default();
let header10_hash = pezsp_core::H256::default();
BestFinalized::<TestRuntime, ()>::put(HeaderId(10, header10_hash));
}
@@ -489,7 +489,7 @@ mod tests {
// when `improved_by` is less than the free interval
BestFinalized::<TestRuntime, ()>::put(HeaderId(
100 - FreeHeadersInterval::get() as u64 + 1,
sp_core::H256::default(),
pezsp_core::H256::default(),
));
assert!(RuntimeCall::check_obsolete_submit_finality_proof(&RuntimeCall::Grandpa(
bridge_grandpa_call.clone(),
@@ -499,7 +499,7 @@ mod tests {
// when `improved_by` is equal to the free interval
BestFinalized::<TestRuntime, ()>::put(HeaderId(
100 - FreeHeadersInterval::get() as u64,
sp_core::H256::default(),
pezsp_core::H256::default(),
));
assert!(RuntimeCall::check_obsolete_submit_finality_proof(&RuntimeCall::Grandpa(
bridge_grandpa_call.clone(),
@@ -509,7 +509,7 @@ mod tests {
// when `improved_by` is larger than the free interval
BestFinalized::<TestRuntime, ()>::put(HeaderId(
100 - FreeHeadersInterval::get() as u64 - 1,
sp_core::H256::default(),
pezsp_core::H256::default(),
));
assert!(RuntimeCall::check_obsolete_submit_finality_proof(&RuntimeCall::Grandpa(
bridge_grandpa_call.clone(),
@@ -518,15 +518,15 @@ mod tests {
// when `improved_by` is less than the free interval BUT it is a mandatory header
let mut mandatory_header = test_header(100);
let consensus_log = sp_consensus_grandpa::ConsensusLog::<TestNumber>::ScheduledChange(
sp_consensus_grandpa::ScheduledChange {
let consensus_log = pezsp_consensus_grandpa::ConsensusLog::<TestNumber>::ScheduledChange(
pezsp_consensus_grandpa::ScheduledChange {
next_authorities: bp_test_utils::authority_list(),
delay: 0,
},
);
mandatory_header.digest = sp_runtime::Digest {
mandatory_header.digest = pezsp_runtime::Digest {
logs: vec![DigestItem::Consensus(
sp_consensus_grandpa::GRANDPA_ENGINE_ID,
pezsp_consensus_grandpa::GRANDPA_ENGINE_ID,
consensus_log.encode(),
)],
};
@@ -543,7 +543,7 @@ mod tests {
};
BestFinalized::<TestRuntime, ()>::put(HeaderId(
100 - FreeHeadersInterval::get() as u64 + 1,
sp_core::H256::default(),
pezsp_core::H256::default(),
));
assert!(RuntimeCall::check_obsolete_submit_finality_proof(&RuntimeCall::Grandpa(
bridge_grandpa_call.clone(),
@@ -712,7 +712,7 @@ mod tests {
fn check_obsolete_submit_finality_proof_ignores_other_calls() {
run_test(|| {
let call =
RuntimeCall::System(frame_system::Call::<TestRuntime>::remark { remark: vec![42] });
RuntimeCall::System(pezframe_system::Call::<TestRuntime>::remark { remark: vec![42] });
assert_eq!(RuntimeCall::check_obsolete_submit_finality_proof(&call), Ok(None));
})
+62 -62
View File
@@ -14,9 +14,9 @@
// 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/>.
//! Substrate GRANDPA Pallet
//! Bizinikiwi GRANDPA Pallet
//!
//! This pallet is an on-chain GRANDPA light client for Substrate based chains.
//! This pallet is an on-chain GRANDPA light client for Bizinikiwi based chains.
//!
//! This pallet achieves this by trustlessly verifying GRANDPA finality proofs on-chain. Once
//! verified, finalized headers are stored in the pallet, thereby creating a sparse header chain.
@@ -43,13 +43,13 @@ use bp_header_chain::{
StoredHeaderGrandpaInfo,
};
use bp_runtime::{BlockNumberOf, HashOf, HasherOf, HeaderId, HeaderOf, OwnedBridgeModule};
use frame_support::{dispatch::PostDispatchInfo, ensure, DefaultNoBound};
use sp_consensus_grandpa::{AuthorityList, SetId};
use sp_runtime::{
use pezframe_support::{dispatch::PostDispatchInfo, ensure, DefaultNoBound};
use pezsp_consensus_grandpa::{AuthorityList, SetId};
use pezsp_runtime::{
traits::{Header as HeaderT, Zero},
SaturatedConversion,
};
use sp_std::{boxed::Box, prelude::*};
use pezsp_std::{boxed::Box, prelude::*};
mod call_ext;
#[cfg(test)]
@@ -88,19 +88,19 @@ pub type BridgedHeader<T, I> = HeaderOf<<T as Config<I>>::BridgedChain>;
pub type BridgedStoredHeaderData<T, I> =
StoredHeaderData<BridgedBlockNumber<T, I>, BridgedBlockHash<T, I>>;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use bp_runtime::BasicOperatingMode;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// The chain we are bridging to here.
type BridgedChain: ChainWithGrandpa;
@@ -285,7 +285,7 @@ pub mod pallet {
origin: OriginFor<T>,
finality_target: Box<BridgedHeader<T, I>>,
justification: GrandpaJustification<BridgedHeader<T, I>>,
current_set_id: sp_consensus_grandpa::SetId,
current_set_id: pezsp_consensus_grandpa::SetId,
_is_free_execution_expected: bool,
) -> DispatchResultWithPostInfo {
Self::ensure_not_halted().map_err(Error::<T, I>::BridgeModule)?;
@@ -610,7 +610,7 @@ pub mod pallet {
/// Returned value will indicate if a change was enacted or not.
pub(crate) fn try_enact_authority_change<T: Config<I>, I: 'static>(
header: &BridgedHeader<T, I>,
current_set_id: sp_consensus_grandpa::SetId,
current_set_id: pezsp_consensus_grandpa::SetId,
) -> Result<Option<AuthoritySet>, DispatchError> {
// We don't support forced changes - at that point governance intervention is required.
ensure!(
@@ -678,7 +678,7 @@ pub mod pallet {
hash: BridgedBlockHash<T, I>,
number: BridgedBlockNumber<T, I>,
authority_set: bp_header_chain::AuthoritySet,
) -> Result<(), sp_runtime::DispatchError> {
) -> Result<(), pezsp_runtime::DispatchError> {
use bp_header_chain::justification::verify_justification;
Ok(verify_justification::<BridgedHeader<T, I>>(
@@ -783,11 +783,11 @@ pub mod pallet {
impl<T: Config<I>, I: 'static> Pallet<T, I>
where
<T as frame_system::Config>::RuntimeEvent: TryInto<Event<T, I>>,
<T as pezframe_system::Config>::RuntimeEvent: TryInto<Event<T, I>>,
{
/// Get the GRANDPA justifications accepted in the current block.
pub fn synced_headers_grandpa_info() -> Vec<StoredHeaderGrandpaInfo<BridgedHeader<T, I>>> {
frame_system::Pallet::<T>::read_events_no_consensus()
pezframe_system::Pallet::<T>::read_events_no_consensus()
.filter_map(|event| {
let Event::<T, I>::UpdatedBestFinalizedHeader { grandpa_info, .. } =
event.event.try_into().ok()?;
@@ -808,12 +808,12 @@ impl<T: Config<I>, I: 'static> HeaderChain<BridgedChain<T, I>> for GrandpaChainH
}
}
/// (Re)initialize bridge with given header for using it in `pallet-bridge-messages` benchmarks.
/// (Re)initialize bridge with given header for using it in `pezpallet-bridge-messages` benchmarks.
#[cfg(feature = "runtime-benchmarks")]
pub fn initialize_for_benchmarks<T: Config<I>, I: 'static>(header: BridgedHeader<T, I>) {
initialize_bridge::<T, I>(InitializationData {
header: Box::new(header),
authority_list: sp_std::vec::Vec::new(), /* we don't verify any proofs in external
authority_list: pezsp_std::vec::Vec::new(), /* we don't verify any proofs in external
* benchmarks */
set_id: 0,
operating_mode: bp_runtime::BasicOperatingMode::Normal,
@@ -843,17 +843,17 @@ mod tests {
TEST_GRANDPA_SET_ID,
};
use codec::Encode;
use frame_support::{
use pezframe_support::{
assert_err, assert_noop, assert_ok,
dispatch::{Pays, PostDispatchInfo},
storage::generator::StorageValue,
};
use frame_system::{EventRecord, Phase};
use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
use sp_core::Get;
use sp_runtime::{Digest, DigestItem, DispatchError};
use pezframe_system::{EventRecord, Phase};
use pezsp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
use pezsp_core::Get;
use pezsp_runtime::{Digest, DigestItem, DispatchError};
fn initialize_substrate_bridge() {
fn initialize_bizinikiwi_bridge() {
System::set_block_number(1);
System::reset_events();
@@ -864,7 +864,7 @@ mod tests {
origin: RuntimeOrigin,
) -> Result<
InitializationData<TestHeader>,
sp_runtime::DispatchErrorWithPostInfo<PostDispatchInfo>,
pezsp_runtime::DispatchErrorWithPostInfo<PostDispatchInfo>,
> {
let genesis = test_header(0);
@@ -878,7 +878,7 @@ mod tests {
Pallet::<TestRuntime>::initialize(origin, init_data.clone()).map(|_| init_data)
}
fn submit_finality_proof(header: u8) -> frame_support::dispatch::DispatchResultWithPostInfo {
fn submit_finality_proof(header: u8) -> pezframe_support::dispatch::DispatchResultWithPostInfo {
let header = test_header(header.into());
let justification = make_default_justification(&header);
@@ -894,7 +894,7 @@ mod tests {
fn submit_finality_proof_with_set_id(
header: u8,
set_id: u64,
) -> frame_support::dispatch::DispatchResultWithPostInfo {
) -> pezframe_support::dispatch::DispatchResultWithPostInfo {
let header = test_header(header.into());
let justification = make_justification_for_header(JustificationGeneratorParams {
header: header.clone(),
@@ -914,12 +914,12 @@ mod tests {
fn submit_mandatory_finality_proof(
number: u8,
set_id: u64,
) -> frame_support::dispatch::DispatchResultWithPostInfo {
) -> pezframe_support::dispatch::DispatchResultWithPostInfo {
let mut header = test_header(number.into());
// to ease tests that are using `submit_mandatory_finality_proof`, we'll be using the
// same set for all sessions
let consensus_log =
ConsensusLog::<TestNumber>::ScheduledChange(sp_consensus_grandpa::ScheduledChange {
ConsensusLog::<TestNumber>::ScheduledChange(pezsp_consensus_grandpa::ScheduledChange {
next_authorities: authority_list(),
delay: 0,
});
@@ -941,16 +941,16 @@ mod tests {
}
fn next_block() {
use frame_support::traits::OnInitialize;
use pezframe_support::traits::OnInitialize;
let current_number = frame_system::Pallet::<TestRuntime>::block_number();
frame_system::Pallet::<TestRuntime>::set_block_number(current_number + 1);
let current_number = pezframe_system::Pallet::<TestRuntime>::block_number();
pezframe_system::Pallet::<TestRuntime>::set_block_number(current_number + 1);
let _ = Pallet::<TestRuntime>::on_initialize(current_number);
}
fn change_log(delay: u64) -> Digest {
let consensus_log =
ConsensusLog::<TestNumber>::ScheduledChange(sp_consensus_grandpa::ScheduledChange {
ConsensusLog::<TestNumber>::ScheduledChange(pezsp_consensus_grandpa::ScheduledChange {
next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)],
delay,
});
@@ -961,7 +961,7 @@ mod tests {
fn forced_change_log(delay: u64) -> Digest {
let consensus_log = ConsensusLog::<TestNumber>::ForcedChange(
delay,
sp_consensus_grandpa::ScheduledChange {
pezsp_consensus_grandpa::ScheduledChange {
next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)],
delay,
},
@@ -972,7 +972,7 @@ mod tests {
fn many_authorities_log() -> Digest {
let consensus_log =
ConsensusLog::<TestNumber>::ScheduledChange(sp_consensus_grandpa::ScheduledChange {
ConsensusLog::<TestNumber>::ScheduledChange(pezsp_consensus_grandpa::ScheduledChange {
next_authorities: std::iter::repeat((ALICE.into(), 1))
.take(MAX_BRIDGED_AUTHORITIES as usize + 1)
.collect(),
@@ -1020,7 +1020,7 @@ mod tests {
#[test]
fn init_can_only_initialize_pallet_once() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
assert_noop!(
init_with_origin(RuntimeOrigin::root()),
<Error<TestRuntime>>::AlreadyInitialized
@@ -1049,9 +1049,9 @@ mod tests {
}
#[test]
fn pallet_rejects_transactions_if_halted() {
fn pezpallet_rejects_transactions_if_halted() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
assert_ok!(Pallet::<TestRuntime>::set_operating_mode(
RuntimeOrigin::root(),
@@ -1071,7 +1071,7 @@ mod tests {
}
#[test]
fn pallet_rejects_header_if_not_initialized_yet() {
fn pezpallet_rejects_header_if_not_initialized_yet() {
run_test(|| {
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::NotInitialized);
});
@@ -1080,7 +1080,7 @@ mod tests {
#[test]
fn successfully_imports_header_with_valid_finality() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let header_number = 1;
let header = test_header(header_number.into());
@@ -1093,7 +1093,7 @@ mod tests {
let result = submit_finality_proof(header_number);
assert_ok!(result);
assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes);
assert_eq!(result.unwrap().pays_fee, pezframe_support::dispatch::Pays::Yes);
// our test config assumes 2048 max authorities and we are just using couple
let pre_dispatch_proof_size = pre_dispatch_weight.proof_size();
let actual_proof_size = result.unwrap().actual_weight.unwrap().proof_size();
@@ -1135,7 +1135,7 @@ mod tests {
#[test]
fn rejects_justification_that_skips_authority_set_transition() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let header = test_header(1);
@@ -1172,7 +1172,7 @@ mod tests {
#[test]
fn does_not_import_header_with_invalid_finality_proof() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let header = test_header(1);
let mut justification = make_default_justification(&header);
@@ -1225,7 +1225,7 @@ mod tests {
#[test]
fn importing_header_ensures_that_chain_is_extended() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
assert_ok!(submit_finality_proof(4));
assert_err!(submit_finality_proof(3), Error::<TestRuntime>::OldHeader);
@@ -1236,7 +1236,7 @@ mod tests {
#[test]
fn importing_header_enacts_new_authority_set() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let next_set_id = 2;
let next_authorities = vec![(ALICE.into(), 1), (BOB.into(), 1)];
@@ -1258,7 +1258,7 @@ mod tests {
false,
);
assert_ok!(result);
assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::No);
assert_eq!(result.unwrap().pays_fee, pezframe_support::dispatch::Pays::No);
// Make sure that our header is the best finalized
assert_eq!(<BestFinalized<TestRuntime>>::get().unwrap().1, header.hash());
@@ -1304,7 +1304,7 @@ mod tests {
#[test]
fn relayer_pays_tx_fee_when_submitting_huge_mandatory_header() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// let's prepare a huge authorities change header, which is definitely above size limits
let mut header = test_header(2);
@@ -1322,7 +1322,7 @@ mod tests {
false,
);
assert_ok!(result);
assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes);
assert_eq!(result.unwrap().pays_fee, pezframe_support::dispatch::Pays::Yes);
// Make sure that our header is the best finalized
assert_eq!(<BestFinalized<TestRuntime>>::get().unwrap().1, header.hash());
@@ -1333,7 +1333,7 @@ mod tests {
#[test]
fn relayer_pays_tx_fee_when_submitting_justification_with_long_ancestry_votes() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// let's prepare a huge authorities change header, which is definitely above weight
// limits
@@ -1355,7 +1355,7 @@ mod tests {
false,
);
assert_ok!(result);
assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes);
assert_eq!(result.unwrap().pays_fee, pezframe_support::dispatch::Pays::Yes);
// Make sure that our header is the best finalized
assert_eq!(<BestFinalized<TestRuntime>>::get().unwrap().1, header.hash());
@@ -1366,7 +1366,7 @@ mod tests {
#[test]
fn importing_header_rejects_header_with_scheduled_change_delay() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// Need to update the header digest to indicate that our header signals an authority set
// change. However, the change doesn't happen until the next block.
@@ -1393,7 +1393,7 @@ mod tests {
#[test]
fn importing_header_rejects_header_with_forced_changes() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// Need to update the header digest to indicate that it signals a forced authority set
// change.
@@ -1420,7 +1420,7 @@ mod tests {
#[test]
fn importing_header_rejects_header_with_too_many_authorities() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// Need to update the header digest to indicate that our header signals an authority set
// change. However, the change doesn't happen until the next block.
@@ -1477,7 +1477,7 @@ mod tests {
#[test]
fn rate_limiter_disallows_free_imports_once_limit_is_hit_in_single_block() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let result = submit_mandatory_finality_proof(1, 1);
assert_eq!(result.expect("call failed").pays_fee, Pays::No);
@@ -1508,7 +1508,7 @@ mod tests {
)
};
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
for _ in 0..<TestRuntime as Config>::MaxFreeHeadersPerBlock::get() + 1 {
assert_err!(submit_invalid_request(), <Error<TestRuntime>>::InvalidJustification);
@@ -1529,7 +1529,7 @@ mod tests {
#[test]
fn rate_limiter_allows_request_after_new_block_has_started() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let result = submit_mandatory_finality_proof(1, 1);
assert_eq!(result.expect("call failed").pays_fee, Pays::No);
@@ -1556,7 +1556,7 @@ mod tests {
#[test]
fn rate_limiter_ignores_non_mandatory_headers() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let result = submit_finality_proof(1);
assert_eq!(result.expect("call failed").pays_fee, Pays::Yes);
@@ -1581,7 +1581,7 @@ mod tests {
#[test]
fn may_import_non_mandatory_header_for_free() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
// set best finalized to `100`
const BEST: u8 = 12;
@@ -1639,7 +1639,7 @@ mod tests {
#[test]
fn should_prune_headers_over_headers_to_keep_parameter() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
assert_ok!(submit_finality_proof(1));
let first_header_hash = Pallet::<TestRuntime>::best_finalized().unwrap().hash();
next_block();
@@ -1666,7 +1666,7 @@ mod tests {
fn storage_keys_computed_properly() {
assert_eq!(
PalletOperatingMode::<TestRuntime>::storage_value_final_key().to_vec(),
bp_header_chain::storage_keys::pallet_operating_mode_key("Grandpa").0,
bp_header_chain::storage_keys::pezpallet_operating_mode_key("Grandpa").0,
);
assert_eq!(
@@ -1721,7 +1721,7 @@ mod tests {
#[test]
fn submit_finality_proof_requires_signed_origin() {
run_test(|| {
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
let header = test_header(1);
let justification = make_default_justification(&header);
@@ -1765,7 +1765,7 @@ mod tests {
.collect();
// initialize and import several headers
initialize_substrate_bridge();
initialize_bizinikiwi_bridge();
assert_ok!(submit_finality_proof(30));
// wrong origin => error
+13 -13
View File
@@ -19,17 +19,17 @@
use bp_header_chain::ChainWithGrandpa;
use bp_runtime::{Chain, ChainId};
use frame_support::{
construct_runtime, derive_impl, parameter_types, sp_runtime::StateVersion, traits::Hooks,
use pezframe_support::{
construct_runtime, derive_impl, parameter_types, pezsp_runtime::StateVersion, traits::Hooks,
weights::Weight,
};
use sp_core::sr25519::Signature;
use pezsp_core::sr25519::Signature;
pub type AccountId = u64;
pub type TestHeader = sp_runtime::testing::Header;
pub type TestHeader = pezsp_runtime::testing::Header;
pub type TestNumber = u64;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
pub const MAX_BRIDGED_AUTHORITIES: u32 = 5;
@@ -38,13 +38,13 @@ use crate as grandpa;
construct_runtime! {
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Grandpa: grandpa::{Pallet, Call, Event<T>},
}
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = Block;
}
@@ -69,9 +69,9 @@ pub struct TestBridgedChain;
impl Chain for TestBridgedChain {
const ID: ChainId = *b"tbch";
type BlockNumber = frame_system::pallet_prelude::BlockNumberFor<TestRuntime>;
type Hash = <TestRuntime as frame_system::Config>::Hash;
type Hasher = <TestRuntime as frame_system::Config>::Hashing;
type BlockNumber = pezframe_system::pezpallet_prelude::BlockNumberFor<TestRuntime>;
type Hash = <TestRuntime as pezframe_system::Config>::Hash;
type Hasher = <TestRuntime as pezframe_system::Config>::Hashing;
type Header = TestHeader;
type AccountId = AccountId;
@@ -98,8 +98,8 @@ impl ChainWithGrandpa for TestBridgedChain {
}
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
sp_io::TestExternalities::new(Default::default())
pub fn new_test_ext() -> pezsp_io::TestExternalities {
pezsp_io::TestExternalities::new(Default::default())
}
/// Return test within default test externalities context.
+3 -3
View File
@@ -20,10 +20,10 @@ use crate::{Config, Error};
use bp_header_chain::{AuthoritySet, ChainWithGrandpa};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{traits::Get, BoundedVec, CloneNoBound, RuntimeDebugNoBound};
use pezframe_support::{traits::Get, BoundedVec, CloneNoBound, RuntimeDebugNoBound};
use scale_info::TypeInfo;
use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
use sp_std::marker::PhantomData;
use pezsp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
use pezsp_std::marker::PhantomData;
/// A bounded list of Grandpa authorities with associated weights.
pub type StoredAuthorityList<MaxBridgedAuthorities> =
+8 -8
View File
@@ -14,9 +14,9 @@
// 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_bridge_grandpa
//! Autogenerated weights for pezpallet_bridge_grandpa
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
@@ -29,7 +29,7 @@
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_bridge_grandpa
// --pallet=pezpallet_bridge_grandpa
// --extrinsic=*
// --execution=wasm
// --wasm-execution=Compiled
@@ -42,23 +42,23 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
use pezframe_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
use sp_std::marker::PhantomData;
use pezsp_std::marker::PhantomData;
/// Weight functions needed for pallet_bridge_grandpa.
/// Weight functions needed for pezpallet_bridge_grandpa.
pub trait WeightInfo {
fn submit_finality_proof(p: u32, v: u32) -> Weight;
fn force_set_pallet_state() -> Weight;
}
/// Weights for `pallet_bridge_grandpa` that are generated using one of the Bridge testnets.
/// Weights for `pezpallet_bridge_grandpa` that are generated using one of the Bridge testnets.
///
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfo for BridgeWeight<T> {
/// Storage: BridgeUnknownGrandpa PalletOperatingMode (r:1 w:0)
///
/// Proof: BridgeUnknownGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1),
+3 -3
View File
@@ -18,7 +18,7 @@
use crate::weights::{BridgeWeight, WeightInfo};
use frame_support::weights::Weight;
use pezframe_support::weights::Weight;
/// Extended weight info.
pub trait WeightInfoExt: WeightInfo {
@@ -28,7 +28,7 @@ pub trait WeightInfoExt: WeightInfo {
//
// 2) slash relayer if he submits an invalid transaction.
//
// We read and update storage values of other pallets (`pallet-bridge-relayers` and
// We read and update storage values of other pallets (`pezpallet-bridge-relayers` and
// balances/assets pallet). So we need to add this weight to the weight of our call.
// Hence two following methods.
@@ -45,7 +45,7 @@ pub trait WeightInfoExt: WeightInfo {
}
}
impl<T: frame_system::Config> WeightInfoExt for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfoExt for BridgeWeight<T> {
fn submit_finality_proof_overhead_from_runtime() -> Weight {
Weight::zero()
}
+36 -36
View File
@@ -1,5 +1,5 @@
[package]
name = "pallet-bridge-messages"
name = "pezpallet-bridge-messages"
description = "Module that allows bridged chains to exchange messages using lane concept."
version = "0.7.0"
authors.workspace = true
@@ -20,21 +20,21 @@ bp-header-chain = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
# Substrate Dependencies
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-trie = { optional = true, workspace = true }
# Bizinikiwi Dependencies
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-runtime = { workspace = true }
pezsp-std = { workspace = true }
pezsp-trie = { optional = true, workspace = true }
[dev-dependencies]
bp-runtime = { features = ["test-helpers"], workspace = true }
bp-test-utils = { workspace = true }
pallet-balances = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
pezpallet-balances = { workspace = true }
pezpallet-bridge-grandpa = { workspace = true }
pezsp-core = { workspace = true }
pezsp-io = { workspace = true }
[features]
default = ["std"]
@@ -44,17 +44,17 @@ std = [
"bp-runtime/std",
"bp-test-utils/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"pallet-bridge-grandpa/std",
"pezframe-benchmarking/std",
"pezframe-support/std",
"pezframe-system/std",
"pezpallet-balances/std",
"pezpallet-bridge-grandpa/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-trie/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-runtime/std",
"pezsp-std/std",
"pezsp-trie/std",
"tracing/std",
]
runtime-benchmarks = [
@@ -63,20 +63,20 @@ runtime-benchmarks = [
"bp-runtime/runtime-benchmarks",
"bp-runtime/test-helpers",
"bp-test-utils/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-trie?/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-bridge-grandpa/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"pezsp-trie?/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-bridge-grandpa/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-balances/try-runtime",
"pezpallet-bridge-grandpa/try-runtime",
"pezsp-runtime/try-runtime",
]
test-helpers = ["bp-runtime/test-helpers", "sp-trie"]
test-helpers = ["bp-runtime/test-helpers", "pezsp-trie"]
+5 -5
View File
@@ -80,11 +80,11 @@ chain" and the other chain as "bridged chain".
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.
is abstracted from the module and may be of any kind. In our Bizinikiwi-to-Bizinikiwi bridge we're using runtime storage
proofs. Other bridges may use transaction proofs, Bizinikiwi header digests or anything else that may be proved.
**IMPORTANT NOTE**: everything below in this chapter describes details of the messages module configuration. But if
you're interested in well-probed and relatively easy integration of two Substrate-based chains, you may want to look at
you're interested in well-probed and relatively easy integration of two Bizinikiwi-based chains, you may want to look at
the [bridge-runtime-common](../../bin/runtime-common/) crate. This crate is providing a lot of helpers for integration,
which may be directly used from within your runtime. Then if you'll decide to change something in this scheme, get back
here for detailed information.
@@ -124,7 +124,7 @@ dispatch weight of the message before dispatch is called.
The last type is the `pallet_bridge_messages::Config::DeliveryConfirmationPayments`. When confirmation
transaction is received, we call the `pay_reward()` method, passing the range of delivered messages.
You may use the [`pallet-bridge-relayers`](../relayers/) pallet and its
You may use the [`pezpallet-bridge-relayers`](../relayers/) pallet and its
[`DeliveryConfirmationPaymentsAdapter`](../relayers/src/payment_adapter.rs) adapter as a possible
implementation. It allows you to pay fixed reward for relaying the message and some of its portion
for confirming delivery.
@@ -162,7 +162,7 @@ confirmed message needs to be read. So there's another
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
is based on finality of headers (and it is the most obvious option for Bizinikiwi-based chains with
finality notion), then choosing too small values for these parameters may cause significant delays
in message delivery. That's because there are too many actors involved in this scheme: 1) authorities
that are finalizing headers of the target chain need to finalize header with non-empty map; 2) the
+6 -6
View File
@@ -31,11 +31,11 @@ use bp_messages::{
};
use bp_runtime::{AccountIdOf, HashOf, UnverifiedStorageProofParams};
use codec::Decode;
use frame_benchmarking::{account, v2::*};
use frame_support::weights::Weight;
use frame_system::RawOrigin;
use sp_runtime::{traits::TrailingZeroInput, BoundedVec};
use sp_std::{ops::RangeInclusive, prelude::*};
use pezframe_benchmarking::{account, v2::*};
use pezframe_support::weights::Weight;
use pezframe_system::RawOrigin;
use pezsp_runtime::{traits::TrailingZeroInput, BoundedVec};
use pezsp_std::{ops::RangeInclusive, prelude::*};
const SEED: u32 = 0;
@@ -143,7 +143,7 @@ struct ReceiveMessagesProofSetup<T: Config<I>, I: 'static> {
relayer_id_on_src: AccountIdOf<BridgedChainOf<T, I>>,
relayer_id_on_tgt: T::AccountId,
msgs_count: u32,
_phantom_data: sp_std::marker::PhantomData<I>,
_phantom_data: pezsp_std::marker::PhantomData<I>,
}
impl<T: Config<I>, I: 'static> ReceiveMessagesProofSetup<T, I> {
+12 -12
View File
@@ -24,12 +24,12 @@ use bp_messages::{
UnrewardedRelayerOccupation,
};
use bp_runtime::{AccountIdOf, OwnedBridgeModule};
use frame_support::{dispatch::CallableCallFor, traits::IsSubType};
use sp_runtime::transaction_validity::TransactionValidity;
use pezframe_support::{dispatch::CallableCallFor, traits::IsSubType};
use pezsp_runtime::transaction_validity::TransactionValidity;
/// Helper struct that provides methods for working with a call supported by `MessagesCallInfo`.
pub struct CallHelper<T: Config<I>, I: 'static> {
_phantom_data: sp_std::marker::PhantomData<(T, I)>,
_phantom_data: pezsp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> CallHelper<T, I> {
@@ -70,7 +70,7 @@ impl<T: Config<I>, I: 'static> CallHelper<T, I> {
}
}
/// Trait representing a call that is a sub type of `pallet_bridge_messages::Call`.
/// Trait representing a call that is a sub type of `pezpallet_bridge_messages::Call`.
pub trait CallSubType<T: Config<I, RuntimeCall = Self>, I: 'static>:
IsSubType<CallableCallFor<Pallet<T, I>, T>>
{
@@ -112,7 +112,7 @@ pub trait CallSubType<T: Config<I, RuntimeCall = Self>, I: 'static>:
impl<
Call: IsSubType<CallableCallFor<Pallet<T, I>, T>>,
T: frame_system::Config<RuntimeCall = Call> + Config<I>,
T: pezframe_system::Config<RuntimeCall = Call> + Config<I>,
I: 'static,
> CallSubType<T, I> for T::RuntimeCall
{
@@ -195,7 +195,7 @@ impl<
"Rejecting messages transaction on halted pallet"
);
return sp_runtime::transaction_validity::InvalidTransaction::Call.into();
return pezsp_runtime::transaction_validity::InvalidTransaction::Call.into();
},
Some(MessagesCallInfo::ReceiveMessagesProof(proof_info))
if proof_info
@@ -207,7 +207,7 @@ impl<
"Rejecting obsolete messages delivery transaction"
);
return sp_runtime::transaction_validity::InvalidTransaction::Stale.into();
return pezsp_runtime::transaction_validity::InvalidTransaction::Stale.into();
},
Some(MessagesCallInfo::ReceiveMessagesDeliveryProof(proof_info))
if proof_info.is_obsolete() =>
@@ -218,12 +218,12 @@ impl<
"Rejecting obsolete messages confirmation transaction"
);
return sp_runtime::transaction_validity::InvalidTransaction::Stale.into();
return pezsp_runtime::transaction_validity::InvalidTransaction::Stale.into();
},
_ => {},
}
Ok(sp_runtime::transaction_validity::ValidTransaction::default())
Ok(pezsp_runtime::transaction_validity::ValidTransaction::default())
}
}
@@ -253,7 +253,7 @@ mod tests {
target_chain::FromBridgedChainMessagesProof, DeliveredMessages, InboundLaneData, LaneState,
OutboundLaneData, UnrewardedRelayer, UnrewardedRelayersState,
};
use sp_std::ops::RangeInclusive;
use pezsp_std::ops::RangeInclusive;
fn fill_unrewarded_relayers() {
let mut inbound_lane_state = InboundLanes::<TestRuntime>::get(test_lane_id()).unwrap();
@@ -296,7 +296,7 @@ mod tests {
RuntimeCall::Messages(crate::Call::<TestRuntime, ()>::receive_messages_proof {
relayer_id_at_bridged_chain: 42,
messages_count: nonces_end.checked_sub(nonces_start).map(|x| x + 1).unwrap_or(0) as u32,
dispatch_weight: frame_support::weights::Weight::zero(),
dispatch_weight: pezframe_support::weights::Weight::zero(),
proof: Box::new(FromBridgedChainMessagesProof {
bridged_header_hash: Default::default(),
storage_proof: Default::default(),
@@ -310,7 +310,7 @@ mod tests {
}
fn run_test<T>(test: impl Fn() -> T) -> T {
sp_io::TestExternalities::new(Default::default()).execute_with(|| {
pezsp_io::TestExternalities::new(Default::default()).execute_with(|| {
InboundLanes::<TestRuntime>::insert(test_lane_id(), InboundLaneData::opened());
OutboundLanes::<TestRuntime>::insert(test_lane_id(), OutboundLaneData::opened());
test()
+4 -4
View File
@@ -26,8 +26,8 @@ use bp_messages::{
use bp_runtime::AccountIdOf;
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
use scale_info::{Type, TypeInfo};
use sp_runtime::RuntimeDebug;
use sp_std::prelude::PartialEq;
use pezsp_runtime::RuntimeDebug;
use pezsp_std::prelude::PartialEq;
/// Inbound lane storage.
pub trait InboundLaneStorage {
@@ -63,7 +63,7 @@ pub struct StoredInboundLaneData<T: Config<I>, I: 'static>(
pub InboundLaneData<AccountIdOf<BridgedChainOf<T, I>>>,
);
impl<T: Config<I>, I: 'static> sp_std::ops::Deref for StoredInboundLaneData<T, I> {
impl<T: Config<I>, I: 'static> pezsp_std::ops::Deref for StoredInboundLaneData<T, I> {
type Target = InboundLaneData<AccountIdOf<BridgedChainOf<T, I>>>;
fn deref(&self) -> &Self::Target {
@@ -71,7 +71,7 @@ impl<T: Config<I>, I: 'static> sp_std::ops::Deref for StoredInboundLaneData<T, I
}
}
impl<T: Config<I>, I: 'static> sp_std::ops::DerefMut for StoredInboundLaneData<T, I> {
impl<T: Config<I>, I: 'static> pezsp_std::ops::DerefMut for StoredInboundLaneData<T, I> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
@@ -26,9 +26,9 @@ use bp_messages::{
};
use bp_runtime::AccountIdOf;
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use frame_support::{ensure, sp_runtime::RuntimeDebug, PalletError};
use pezframe_support::{ensure, pezsp_runtime::RuntimeDebug, PalletError};
use scale_info::TypeInfo;
use sp_std::marker::PhantomData;
use pezsp_std::marker::PhantomData;
/// Lanes manager errors.
#[derive(
@@ -156,7 +156,7 @@ impl<T: Config<I>, I: 'static> RuntimeInboundLaneStorage<T, I> {
// apart from the explicit closure, the lane may be unable to receive any messages.
// Right now we do an additional check here, but it may be done later (e.g. by
// explicitly closing the lane and reopening it from
// `pallet-xcm-bridge-hub::on-initialize`)
// `pezpallet-xcm-bridge-hub::on-initialize`)
//
// The fact that we only check it here, means that the `MessageDispatch` may switch
// to inactive state during some message dispatch in the middle of message delivery
+16 -16
View File
@@ -69,8 +69,8 @@ use bp_runtime::{
Size,
};
use codec::{Decode, Encode};
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
use sp_std::{marker::PhantomData, prelude::*};
use pezframe_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
use pezsp_std::{marker::PhantomData, prelude::*};
mod call_ext;
mod inbound_lane;
@@ -94,22 +94,22 @@ pub use tests::*;
/// The target that will be used when publishing logs related to this pallet.
pub const LOG_TARGET: &str = "runtime::bridge-messages";
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use bp_messages::{LaneIdType, ReceivedMessages, ReceptionResult};
use bp_runtime::RangeInclusiveExt;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
pub trait Config<I: 'static = ()>: pezframe_system::Config {
// General types
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// Benchmarks results from runtime we're plugged into.
type WeightInfo: WeightInfoExt;
@@ -411,11 +411,11 @@ pub mod pallet {
);
// update relayers state with actual numbers to compute actual weight below
relayers_state.unrewarded_relayer_entries = sp_std::cmp::min(
relayers_state.unrewarded_relayer_entries = pezsp_std::cmp::min(
relayers_state.unrewarded_relayer_entries,
actually_rewarded_relayers,
);
relayers_state.total_messages = sp_std::cmp::min(
relayers_state.total_messages = pezsp_std::cmp::min(
relayers_state.total_messages,
received_range.checked_len().unwrap_or(MessageNonce::MAX),
);
@@ -516,7 +516,7 @@ pub mod pallet {
pub type PalletOperatingMode<T: Config<I>, I: 'static = ()> =
StorageValue<_, MessagesOperatingMode, ValueQuery>;
// TODO: https://github.com/paritytech/parity-bridges-common/pull/2213: let's limit number of
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/89: let's limit number of
// possible opened lanes && use it to constraint maps below
/// Map of lane id => inbound lane data.
@@ -549,7 +549,7 @@ pub mod pallet {
pub opened_lanes: Vec<T::LaneId>,
/// Dummy marker.
#[serde(skip)]
pub _phantom: sp_std::marker::PhantomData<I>,
pub _phantom: pezsp_std::marker::PhantomData<I>,
}
#[pallet::genesis_build]
@@ -570,7 +570,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
#[cfg(feature = "try-runtime")]
fn try_state(_n: BlockNumberFor<T>) -> Result<(), sp_runtime::TryRuntimeError> {
fn try_state(_n: BlockNumberFor<T>) -> Result<(), pezsp_runtime::TryRuntimeError> {
Self::do_try_state()
}
}
@@ -615,14 +615,14 @@ pub mod pallet {
#[cfg(any(feature = "try-runtime", test))]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Ensure the correctness of the state of this pallet.
pub fn do_try_state() -> Result<(), sp_runtime::TryRuntimeError> {
pub fn do_try_state() -> Result<(), pezsp_runtime::TryRuntimeError> {
Self::do_try_state_for_outbound_lanes()
}
/// Ensure the correctness of the state of outbound lanes.
pub fn do_try_state_for_outbound_lanes() -> Result<(), sp_runtime::TryRuntimeError> {
use sp_runtime::traits::One;
use sp_std::vec::Vec;
pub fn do_try_state_for_outbound_lanes() -> Result<(), pezsp_runtime::TryRuntimeError> {
use pezsp_runtime::traits::One;
use pezsp_std::vec::Vec;
// collect unpruned lanes
let mut unpruned_lanes = Vec::new();
+11 -11
View File
@@ -17,7 +17,7 @@
//! A module that is responsible for migration of storage.
use crate::{Config, Pallet};
use frame_support::{
use pezframe_support::{
traits::{Get, StorageVersion},
weights::Weight,
};
@@ -33,7 +33,7 @@ pub mod v0 {
use bp_messages::{MessageNonce, UnrewardedRelayer};
use bp_runtime::AccountIdOf;
use codec::{Decode, Encode};
use sp_std::collections::vec_deque::VecDeque;
use pezsp_std::collections::vec_deque::VecDeque;
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
pub(crate) struct StoredInboundLaneData<T: Config<I>, I: 'static>(
@@ -60,8 +60,8 @@ pub mod v1 {
InboundLaneData, InboundLanes, OutboundLaneData, OutboundLanes, StoredInboundLaneData,
};
use bp_messages::LaneState;
use frame_support::traits::UncheckedOnRuntimeUpgrade;
use sp_std::marker::PhantomData;
use pezframe_support::traits::UncheckedOnRuntimeUpgrade;
use pezsp_std::marker::PhantomData;
/// Migrates the pallet storage to v1.
pub struct UncheckedMigrationV0ToV1<T, I>(PhantomData<(T, I)>);
@@ -98,7 +98,7 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<pezsp_std::vec::Vec<u8>, pezsp_runtime::DispatchError> {
use codec::Encode;
let number_of_inbound_to_migrate = InboundLanes::<T, I>::iter_keys().count();
@@ -107,7 +107,7 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: sp_std::vec::Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: pezsp_std::vec::Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
use codec::Decode;
const LOG_TARGET: &str = "runtime::bridge-messages-migration";
@@ -119,11 +119,11 @@ pub mod v1 {
tracing::info!(target: LOG_TARGET, %number_of_inbound_to_migrate, "post-upgrade expects inbound lanes to have been migrated.");
tracing::info!(target: LOG_TARGET, %number_of_outbound_to_migrate, "post-upgrade expects outbound lanes to have been migrated.");
frame_support::ensure!(
pezframe_support::ensure!(
number_of_inbound_to_migrate as usize == number_of_inbound,
"must migrate all `InboundLanes`."
);
frame_support::ensure!(
pezframe_support::ensure!(
number_of_outbound_to_migrate as usize == number_of_outbound,
"must migrate all `OutboundLanes`."
);
@@ -134,13 +134,13 @@ pub mod v1 {
}
/// [`UncheckedMigrationV0ToV1`] wrapped in a
/// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the
/// [`VersionedMigration`](pezframe_support::migrations::VersionedMigration), ensuring the
/// migration is only performed when on-chain version is 0.
pub type MigrationToV1<T, I> = frame_support::migrations::VersionedMigration<
pub type MigrationToV1<T, I> = pezframe_support::migrations::VersionedMigration<
0,
1,
UncheckedMigrationV0ToV1<T, I>,
Pallet<T, I>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
}
@@ -23,10 +23,10 @@ use bp_messages::{
UnrewardedRelayer,
};
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::{traits::Get, BoundedVec, PalletError};
use pezframe_support::{traits::Get, BoundedVec, PalletError};
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
use sp_std::{collections::vec_deque::VecDeque, marker::PhantomData, ops::RangeInclusive};
use pezsp_runtime::RuntimeDebug;
use pezsp_std::{collections::vec_deque::VecDeque, marker::PhantomData, ops::RangeInclusive};
/// Outbound lane storage.
pub trait OutboundLaneStorage {
@@ -233,7 +233,7 @@ mod tests {
TestRuntime, REGULAR_PAYLOAD,
},
};
use sp_std::ops::RangeInclusive;
use pezsp_std::ops::RangeInclusive;
fn unrewarded_relayers(
nonces: RangeInclusive<MessageNonce>,
+11 -11
View File
@@ -29,11 +29,11 @@ use bp_runtime::{
HashOf, HasherOf, RangeInclusiveExt, RawStorageProof, StorageProofChecker, StorageProofError,
};
use codec::Decode;
use sp_std::vec::Vec;
use pezsp_std::vec::Vec;
/// 'Parsed' message delivery proof - inbound lane id and its state.
pub(crate) type ParsedMessagesDeliveryProofFromBridgedChain<T, I> =
(<T as Config<I>>::LaneId, InboundLaneData<<T as frame_system::Config>::AccountId>);
(<T as Config<I>>::LaneId, InboundLaneData<<T as pezframe_system::Config>::AccountId>);
/// Verify proof of Bridged -> This chain messages.
///
@@ -171,7 +171,7 @@ type MessagesStorageProofAdapter<T, I> = StorageProofCheckerAdapter<T, I>;
/// A `StorageProofAdapter` implementation for raw storage proofs.
struct StorageProofCheckerAdapter<T: Config<I>, I: 'static> {
storage: StorageProofChecker<HasherOf<BridgedChainOf<T, I>>>,
_dummy: sp_std::marker::PhantomData<(T, I)>,
_dummy: pezsp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> StorageProofCheckerAdapter<T, I> {
@@ -220,7 +220,7 @@ mod tests {
use bp_messages::LaneState;
use bp_runtime::{HeaderId, StorageProofError};
use codec::Encode;
use sp_runtime::traits::Header;
use pezsp_runtime::traits::Header;
fn using_messages_proof<R>(
nonces_end: MessageNonce,
@@ -244,7 +244,7 @@ mod tests {
add_unused_key,
);
sp_io::TestExternalities::new(Default::default()).execute_with(move || {
pezsp_io::TestExternalities::new(Default::default()).execute_with(move || {
let bridged_header = BridgedChainHeader::new(
0,
Default::default(),
@@ -254,11 +254,11 @@ mod tests {
);
let bridged_header_hash = bridged_header.hash();
pallet_bridge_grandpa::BestFinalized::<TestRuntime>::put(HeaderId(
pezpallet_bridge_grandpa::BestFinalized::<TestRuntime>::put(HeaderId(
0,
bridged_header_hash,
));
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
bridged_header_hash,
bridged_header.build(),
);
@@ -316,8 +316,8 @@ mod tests {
false,
|proof| {
let bridged_header_hash =
pallet_bridge_grandpa::BestFinalized::<TestRuntime>::get().unwrap().1;
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::remove(
pezpallet_bridge_grandpa::BestFinalized::<TestRuntime>::get().unwrap().1;
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::remove(
bridged_header_hash,
);
verify_messages_proof::<TestRuntime, ()>(proof, 10)
@@ -339,8 +339,8 @@ mod tests {
false,
|proof| {
let bridged_header_hash =
pallet_bridge_grandpa::BestFinalized::<TestRuntime>::get().unwrap().1;
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
pezpallet_bridge_grandpa::BestFinalized::<TestRuntime>::get().unwrap().1;
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
bridged_header_hash,
BridgedChainHeader::new(
0,
@@ -25,8 +25,8 @@ use bp_runtime::{
RawStorageProof, UnverifiedStorageProofParams,
};
use codec::Encode;
use sp_std::{ops::RangeInclusive, prelude::*};
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
use pezsp_std::{ops::RangeInclusive, prelude::*};
use pezsp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
/// Dummy message generation function.
pub fn generate_dummy_message(_: MessageNonce) -> MessagePayload {
+37 -37
View File
@@ -43,14 +43,14 @@ use bp_runtime::{
messages::MessageDispatchResult, Chain, ChainId, Size, UnverifiedStorageProofParams,
};
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::{
use pezframe_support::{
derive_impl,
weights::{constants::RocksDbWeight, Weight},
};
use scale_info::TypeInfo;
use sp_core::H256;
use sp_runtime::{
testing::Header as SubstrateHeader,
use pezsp_core::H256;
use pezsp_runtime::{
testing::Header as BizinikiwiHeader,
traits::{BlakeTwo256, ConstU32},
BuildStorage, StateVersion,
};
@@ -84,11 +84,11 @@ impl Chain for ThisChain {
type BlockNumber = u64;
type Hash = H256;
type Hasher = BlakeTwo256;
type Header = SubstrateHeader;
type Header = BizinikiwiHeader;
type AccountId = AccountId;
type Balance = Balance;
type Nonce = u64;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
fn max_extrinsic_size() -> u32 {
@@ -109,7 +109,7 @@ impl ChainWithMessages for ThisChain {
pub struct BridgedChain;
pub type BridgedHeaderHash = H256;
pub type BridgedChainHeader = SubstrateHeader;
pub type BridgedChainHeader = BizinikiwiHeader;
impl Chain for BridgedChain {
const ID: ChainId = *b"tbch";
@@ -121,7 +121,7 @@ impl Chain for BridgedChain {
type AccountId = TestRelayer;
type Balance = Balance;
type Nonce = u64;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
fn max_extrinsic_size() -> u32 {
@@ -147,41 +147,41 @@ impl ChainWithMessages for BridgedChain {
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 128;
}
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
use crate as pallet_bridge_messages;
use crate as pezpallet_bridge_messages;
frame_support::construct_runtime! {
pezframe_support::construct_runtime! {
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Event<T>},
BridgedChainGrandpa: pallet_bridge_grandpa::{Pallet, Call, Event<T>},
Messages: pallet_bridge_messages::{Pallet, Call, Event<T>},
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pezpallet_balances::{Pallet, Call, Event<T>},
BridgedChainGrandpa: pezpallet_bridge_grandpa::{Pallet, Call, Event<T>},
Messages: pezpallet_bridge_messages::{Pallet, Call, Event<T>},
}
}
pub type DbWeight = RocksDbWeight;
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = Block;
type AccountData = pallet_balances::AccountData<Balance>;
type AccountData = pezpallet_balances::AccountData<Balance>;
type DbWeight = DbWeight;
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for TestRuntime {
type AccountStore = System;
}
impl pallet_bridge_grandpa::Config for TestRuntime {
impl pezpallet_bridge_grandpa::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type BridgedChain = BridgedChain;
type MaxFreeHeadersPerBlock = ConstU32<4>;
type FreeHeadersInterval = ConstU32<1_024>;
type HeadersToKeep = ConstU32<8>;
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<TestRuntime>;
type WeightInfo = pezpallet_bridge_grandpa::weights::BridgeWeight<TestRuntime>;
}
/// weights of messages pallet calls we use in tests.
@@ -288,7 +288,7 @@ impl TestDeliveryPayments {
/// cleared after the call.
pub fn is_reward_paid(relayer: AccountId) -> bool {
let key = (b":delivery-relayer-reward:", relayer).encode();
frame_support::storage::unhashed::take::<bool>(&key).is_some()
pezframe_support::storage::unhashed::take::<bool>(&key).is_some()
}
}
@@ -302,7 +302,7 @@ impl DeliveryPayments<AccountId> for TestDeliveryPayments {
_actual_weight: Weight,
) {
let key = (b":delivery-relayer-reward:", relayer).encode();
frame_support::storage::unhashed::put(&key, &true);
pezframe_support::storage::unhashed::put(&key, &true);
}
}
@@ -315,7 +315,7 @@ impl TestDeliveryConfirmationPayments {
/// cleared after the call.
pub fn is_reward_paid(relayer: AccountId, fee: TestMessageFee) -> bool {
let key = (b":relayer-reward:", relayer, fee).encode();
frame_support::storage::unhashed::take::<bool>(&key).is_some()
pezframe_support::storage::unhashed::take::<bool>(&key).is_some()
}
}
@@ -332,7 +332,7 @@ impl DeliveryConfirmationPayments<AccountId, TestLaneIdType> for TestDeliveryCon
let rewarded_relayers = relayers_rewards.len();
for (relayer, reward) in &relayers_rewards {
let key = (b":relayer-reward:", relayer, reward).encode();
frame_support::storage::unhashed::put(&key, &true);
pezframe_support::storage::unhashed::put(&key, &true);
}
rewarded_relayers as _
@@ -354,8 +354,8 @@ impl TestMessageDispatch {
pub fn emulate_enqueued_message(lane: TestLaneIdType) {
let key = (b"dispatched", lane).encode();
let dispatched = frame_support::storage::unhashed::get_or_default::<MessageNonce>(&key[..]);
frame_support::storage::unhashed::put(&key[..], &(dispatched + 1));
let dispatched = pezframe_support::storage::unhashed::get_or_default::<MessageNonce>(&key[..]);
pezframe_support::storage::unhashed::put(&key[..], &(dispatched + 1));
}
}
@@ -365,7 +365,7 @@ impl MessageDispatch for TestMessageDispatch {
type LaneId = TestLaneIdType;
fn is_active(lane: Self::LaneId) -> bool {
frame_support::storage::unhashed::get_or_default::<MessageNonce>(
pezframe_support::storage::unhashed::get_or_default::<MessageNonce>(
&(b"dispatched", lane).encode()[..],
) <= BridgedChain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX
}
@@ -395,13 +395,13 @@ pub struct TestOnMessagesDelivered;
impl TestOnMessagesDelivered {
pub fn call_arguments() -> Option<(TestLaneIdType, MessageNonce)> {
frame_support::storage::unhashed::get(b"TestOnMessagesDelivered.OnMessagesDelivered")
pezframe_support::storage::unhashed::get(b"TestOnMessagesDelivered.OnMessagesDelivered")
}
}
impl OnMessagesDelivered<TestLaneIdType> for TestOnMessagesDelivered {
fn on_messages_delivered(lane: TestLaneIdType, enqueued_messages: MessageNonce) {
frame_support::storage::unhashed::put(
pezframe_support::storage::unhashed::put(
b"TestOnMessagesDelivered.OnMessagesDelivered",
&(lane, enqueued_messages),
);
@@ -459,15 +459,15 @@ pub fn inbound_unrewarded_relayers_state(lane: TestLaneIdType) -> UnrewardedRela
}
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
pallet_balances::GenesisConfig::<TestRuntime> {
pub fn new_test_ext() -> pezsp_io::TestExternalities {
let mut t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
pezpallet_balances::GenesisConfig::<TestRuntime> {
balances: vec![(ENDOWED_ACCOUNT, 1_000_000)],
..Default::default()
}
.assimilate_storage(&mut t)
.unwrap();
sp_io::TestExternalities::new(t)
pezsp_io::TestExternalities::new(t)
}
/// Run pallet test.
@@ -515,7 +515,7 @@ pub fn prepare_messages_proof(
// let's now insert bridged chain header into the storage
let bridged_header_hash = Default::default();
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
bridged_header_hash,
StoredHeaderData { number: 0, state_root: storage_root },
);
@@ -548,7 +548,7 @@ pub fn prepare_messages_delivery_proof(
// let's now insert bridged chain header into the storage
let bridged_header_hash = Default::default();
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
bridged_header_hash,
StoredHeaderData { number: 0, state_root: storage_root },
);
+1 -1
View File
@@ -21,6 +21,6 @@
#[cfg(test)]
pub(crate) mod mock;
#[cfg(test)]
mod pallet_tests;
mod pezpallet_tests;
pub mod messages_generation;
@@ -37,14 +37,14 @@ use bp_messages::{
use bp_runtime::{BasicOperatingMode, PreComputedSize, RangeInclusiveExt, Size};
use bp_test_utils::generate_owned_bridge_module_tests;
use codec::Encode;
use frame_support::{
use pezframe_support::{
assert_err, assert_noop, assert_ok,
dispatch::Pays,
storage::generator::{StorageMap, StorageValue},
weights::Weight,
};
use frame_system::{EventRecord, Pallet as System, Phase};
use sp_runtime::{BoundedVec, DispatchError};
use pezframe_system::{EventRecord, Pallet as System, Phase};
use pezsp_runtime::{BoundedVec, DispatchError};
fn get_ready_for_events() {
System::<TestRuntime>::set_block_number(1);
@@ -117,7 +117,7 @@ fn receive_messages_delivery_proof() {
}
#[test]
fn pallet_rejects_transactions_if_halted() {
fn pezpallet_rejects_transactions_if_halted() {
run_test(|| {
// send message first to be able to check that delivery_proof fails later
send_regular_message(test_lane_id());
@@ -187,7 +187,7 @@ fn receive_messages_fails_if_dispatcher_is_inactive() {
}
#[test]
fn pallet_rejects_new_messages_in_rejecting_outbound_messages_operating_mode() {
fn pezpallet_rejects_new_messages_in_rejecting_outbound_messages_operating_mode() {
run_test(|| {
// send message first to be able to check that delivery_proof fails later
send_regular_message(test_lane_id());
@@ -1222,7 +1222,7 @@ fn do_try_state_for_outbound_lanes_works() {
);
assert_err!(
Pallet::<TestRuntime>::do_try_state(),
sp_runtime::TryRuntimeError::Other("Found unpruned lanes!")
pezsp_runtime::TryRuntimeError::Other("Found unpruned lanes!")
);
// remove message for nonce 1
+8 -8
View File
@@ -14,9 +14,9 @@
// 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_bridge_messages
//! Autogenerated weights for pezpallet_bridge_messages
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `serban-ROG-Zephyrus`, CPU: `12th Gen Intel(R) Core(TM) i7-12700H`
@@ -29,7 +29,7 @@
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_bridge_messages
// --pallet=pezpallet_bridge_messages
// --extrinsic=*
// --execution=wasm
// --wasm-execution=Compiled
@@ -42,13 +42,13 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
use pezframe_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
use sp_std::marker::PhantomData;
use pezsp_std::marker::PhantomData;
/// Weight functions needed for pallet_bridge_messages.
/// Weight functions needed for pezpallet_bridge_messages.
pub trait WeightInfo {
fn receive_single_message_proof() -> Weight;
fn receive_n_messages_proof(n: u32) -> Weight;
@@ -60,11 +60,11 @@ pub trait WeightInfo {
fn receive_single_n_bytes_message_proof_with_dispatch(n: u32) -> Weight;
}
/// Weights for `pallet_bridge_messages` that are generated using one of the Bridge testnets.
/// Weights for `pezpallet_bridge_messages` that are generated using one of the Bridge testnets.
///
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfo for BridgeWeight<T> {
/// Storage: BridgeUnknownMessages PalletOperatingMode (r:1 w:0)
///
/// Proof: BridgeUnknownMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2),
+3 -3
View File
@@ -20,7 +20,7 @@ use crate::weights::WeightInfo;
use bp_messages::{MessageNonce, UnrewardedRelayersState};
use bp_runtime::{PreComputedSize, Size};
use frame_support::weights::Weight;
use pezframe_support::weights::Weight;
/// Size of the message being delivered in benchmarks.
pub const EXPECTED_DEFAULT_MESSAGE_LENGTH: u32 = 128;
@@ -284,7 +284,7 @@ pub trait WeightInfoExt: WeightInfo {
// storage values that are read during the call. So we may ignore the weight of this check.
//
// However, during (2) we read and update storage values of other pallets
// (`pallet-bridge-relayers` and balances/assets pallet). So we need to add this weight to the
// (`pezpallet-bridge-relayers` and balances/assets pallet). So we need to add this weight to the
// weight of our call. Hence two following methods.
/// Extra weight that is added to the `receive_messages_proof` call weight by signed extensions
@@ -444,7 +444,7 @@ impl WeightInfoExt for () {
}
}
impl<T: frame_system::Config> WeightInfoExt for crate::weights::BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfoExt for crate::weights::BridgeWeight<T> {
fn expected_extra_storage_proof_size() -> u32 {
EXTRA_STORAGE_PROOF_SIZE
}
+47 -47
View File
@@ -1,5 +1,5 @@
[package]
name = "pallet-bridge-relayers"
name = "pezpallet-bridge-relayers"
description = "Module used to store relayer rewards and coordinate relayers set."
version = "0.7.0"
authors.workspace = true
@@ -20,26 +20,26 @@ bp-header-chain = { workspace = true }
bp-messages = { workspace = true }
bp-relayers = { workspace = true }
bp-runtime = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
pallet-bridge-messages = { workspace = true }
pallet-bridge-teyrchains = { workspace = true }
pezpallet-bridge-grandpa = { workspace = true }
pezpallet-bridge-messages = { workspace = true }
pezpallet-bridge-teyrchains = { workspace = true }
# Substrate Dependencies
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
sp-arithmetic = { workspace = true }
sp-runtime = { workspace = true }
# Bizinikiwi Dependencies
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezpallet-transaction-payment = { workspace = true }
pezsp-arithmetic = { workspace = true }
pezsp-runtime = { workspace = true }
[dev-dependencies]
bp-pezkuwi-core = { workspace = true }
bp-test-utils = { workspace = true }
bp-teyrchains = { workspace = true }
pallet-balances = { workspace = true, default-features = true }
pallet-utility = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
pezpallet-balances = { workspace = true, default-features = true }
pezpallet-utility = { workspace = true }
pezsp-core = { workspace = true }
pezsp-io = { workspace = true }
[features]
default = ["std"]
@@ -52,19 +52,19 @@ std = [
"bp-test-utils/std",
"bp-teyrchains/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"pallet-bridge-grandpa/std",
"pallet-bridge-messages/std",
"pallet-bridge-teyrchains/std",
"pallet-transaction-payment/std",
"pallet-utility/std",
"pezframe-benchmarking/std",
"pezframe-support/std",
"pezframe-system/std",
"pezpallet-bridge-grandpa/std",
"pezpallet-bridge-messages/std",
"pezpallet-bridge-teyrchains/std",
"pezpallet-transaction-payment/std",
"pezpallet-utility/std",
"scale-info/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"pezsp-arithmetic/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-runtime/std",
"tracing/std",
]
runtime-benchmarks = [
@@ -75,27 +75,27 @@ runtime-benchmarks = [
"bp-runtime/runtime-benchmarks",
"bp-test-utils/runtime-benchmarks",
"bp-teyrchains/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
"pallet-bridge-messages/runtime-benchmarks",
"pallet-bridge-teyrchains/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-bridge-grandpa/runtime-benchmarks",
"pezpallet-bridge-messages/runtime-benchmarks",
"pezpallet-bridge-teyrchains/runtime-benchmarks",
"pezpallet-transaction-payment/runtime-benchmarks",
"pezpallet-utility/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-bridge-grandpa/try-runtime",
"pallet-bridge-messages/try-runtime",
"pallet-bridge-teyrchains/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-utility/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-balances/try-runtime",
"pezpallet-bridge-grandpa/try-runtime",
"pezpallet-bridge-messages/try-runtime",
"pezpallet-bridge-teyrchains/try-runtime",
"pezpallet-transaction-payment/try-runtime",
"pezpallet-utility/try-runtime",
"pezsp-runtime/try-runtime",
]
integrity-test = []
+10 -10
View File
@@ -20,10 +20,10 @@
use crate::*;
use frame_benchmarking::v2::*;
use frame_support::{assert_ok, weights::Weight};
use frame_system::RawOrigin;
use sp_runtime::traits::One;
use pezframe_benchmarking::v2::*;
use pezframe_support::{assert_ok, weights::Weight};
use pezframe_system::RawOrigin;
use pezsp_runtime::traits::One;
/// Reward amount that is (hopefully) is larger than existential deposit across all chains.
const REWARD_AMOUNT: u32 = u32::MAX;
@@ -47,12 +47,12 @@ pub trait Config<I: 'static = ()>: crate::Config<I> {
fn assert_last_event<T: Config<I>, I: 'static>(
generic_event: <T as pallet::Config<I>>::RuntimeEvent,
) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
pezframe_system::Pallet::<T>::assert_last_event(generic_event.into());
}
#[instance_benchmarks(
where
BeneficiaryOf<T, I>: From<<T as frame_system::Config>::AccountId>,
BeneficiaryOf<T, I>: From<<T as pezframe_system::Config>::AccountId>,
)]
mod benchmarks {
use super::*;
@@ -116,7 +116,7 @@ mod benchmarks {
#[benchmark]
fn register() {
let relayer: T::AccountId = whitelisted_caller();
let valid_till = frame_system::Pallet::<T>::block_number()
let valid_till = pezframe_system::Pallet::<T>::block_number()
.saturating_add(crate::Pallet::<T, I>::required_registration_lease())
.saturating_add(One::one())
.saturating_add(One::one());
@@ -131,14 +131,14 @@ mod benchmarks {
#[benchmark]
fn deregister() {
let relayer: T::AccountId = whitelisted_caller();
let valid_till = frame_system::Pallet::<T>::block_number()
let valid_till = pezframe_system::Pallet::<T>::block_number()
.saturating_add(crate::Pallet::<T, I>::required_registration_lease())
.saturating_add(One::one())
.saturating_add(One::one());
T::deposit_account(relayer.clone(), crate::Pallet::<T, I>::required_stake());
crate::Pallet::<T, I>::register(RawOrigin::Signed(relayer.clone()).into(), valid_till)
.unwrap();
frame_system::Pallet::<T>::set_block_number(valid_till.saturating_add(One::one()));
pezframe_system::Pallet::<T>::set_block_number(valid_till.saturating_add(One::one()));
#[extrinsic_call]
_(RawOrigin::Signed(relayer.clone()));
@@ -153,7 +153,7 @@ mod benchmarks {
fn slash_and_deregister() {
// prepare and register relayer account
let relayer: T::AccountId = whitelisted_caller();
let valid_till = frame_system::Pallet::<T>::block_number()
let valid_till = pezframe_system::Pallet::<T>::block_number()
.saturating_add(crate::Pallet::<T, I>::required_registration_lease())
.saturating_add(One::one())
.saturating_add(One::one());
@@ -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/>.
//! Adapter that allows using `pallet-bridge-relayers` as a signed extension in the
//! Adapter that allows using `pezpallet-bridge-relayers` as a signed extension in the
//! bridge with remote GRANDPA chain.
use crate::{
@@ -24,16 +24,16 @@ use crate::{
use bp_relayers::{BatchCallUnpacker, ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
use bp_runtime::{Chain, StaticStrProvider};
use core::marker::PhantomData;
use frame_support::dispatch::{DispatchInfo, PostDispatchInfo};
use frame_system::Config as SystemConfig;
use pallet_bridge_grandpa::{
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
use pezframe_system::Config as SystemConfig;
use pezpallet_bridge_grandpa::{
CallSubType as BridgeGrandpaCallSubtype, Config as BridgeGrandpaConfig,
SubmitFinalityProofHelper,
};
use pallet_bridge_messages::{
use pezpallet_bridge_messages::{
CallSubType as BridgeMessagesCallSubType, Config as BridgeMessagesConfig, LaneIdOf,
};
use sp_runtime::{
use pezsp_runtime::{
traits::{Dispatchable, Get},
transaction_validity::{TransactionPriority, TransactionValidityError},
Saturating,
@@ -50,11 +50,11 @@ pub struct WithGrandpaChainExtensionConfig<
Runtime,
// batch call unpacker
BatchCallUnpacker,
// instance of the `pallet-bridge-grandpa`, tracked by this extension
// instance of the `pezpallet-bridge-grandpa`, tracked by this extension
BridgeGrandpaPalletInstance,
// instance of BridgedChain `pallet-bridge-messages`, tracked by this extension
// instance of BridgedChain `pezpallet-bridge-messages`, tracked by this extension
BridgeMessagesPalletInstance,
// instance of `pallet-bridge-relayers`, tracked by this extension
// instance of `pezpallet-bridge-relayers`, tracked by this extension
BridgeRelayersPalletInstance,
// message delivery transaction priority boost for every additional message
PriorityBoostPerMessage,
@@ -75,7 +75,7 @@ impl<ID, R, BCU, GI, MI, RI, P> ExtensionConfig
where
ID: StaticStrProvider,
R: BridgeRelayersConfig<RI>
+ BridgeMessagesConfig<MI, BridgedChain = pallet_bridge_grandpa::BridgedChain<R, GI>>
+ BridgeMessagesConfig<MI, BridgedChain = pezpallet_bridge_grandpa::BridgedChain<R, GI>>
+ BridgeGrandpaConfig<GI>,
BCU: BatchCallUnpacker<R>,
GI: 'static,
@@ -91,7 +91,7 @@ where
type BridgeMessagesPalletInstance = MI;
type BridgeRelayersPalletInstance = RI;
type PriorityBoostPerMessage = P;
type RemoteGrandpaChainBlockNumber = pallet_bridge_grandpa::BridgedBlockNumber<R, GI>;
type RemoteGrandpaChainBlockNumber = pezpallet_bridge_grandpa::BridgedBlockNumber<R, GI>;
type LaneId = LaneIdOf<R, Self::BridgeMessagesPalletInstance>;
fn parse_and_check_for_obsolete_call(
@@ -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/>.
//! Adapter that allows using `pallet-bridge-relayers` as a signed extension in the
//! Adapter that allows using `pezpallet-bridge-relayers` as a signed extension in the
//! bridge with any remote chain. This adapter does not refund any finality transactions.
use crate::{extension::verify_messages_call_succeeded, Config as BridgeRelayersConfig};
@@ -22,11 +22,11 @@ use crate::{extension::verify_messages_call_succeeded, Config as BridgeRelayersC
use bp_relayers::{ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
use bp_runtime::StaticStrProvider;
use core::marker::PhantomData;
use frame_support::dispatch::{DispatchInfo, PostDispatchInfo};
use pallet_bridge_messages::{
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
use pezpallet_bridge_messages::{
CallSubType as BridgeMessagesCallSubType, Config as BridgeMessagesConfig, LaneIdOf,
};
use sp_runtime::{
use pezsp_runtime::{
traits::{Dispatchable, Get},
transaction_validity::{TransactionPriority, TransactionValidityError},
};
@@ -43,11 +43,11 @@ pub struct WithMessagesExtensionConfig<
PhantomData<(
// signed extension identifier
IdProvider,
// runtime with `pallet-bridge-messages` pallet deployed
// runtime with `pezpallet-bridge-messages` pallet deployed
Runtime,
// instance of BridgedChain `pallet-bridge-messages`, tracked by this extension
// instance of BridgedChain `pezpallet-bridge-messages`, tracked by this extension
BridgeMessagesPalletInstance,
// instance of `pallet-bridge-relayers`, tracked by this extension
// instance of `pezpallet-bridge-relayers`, tracked by this extension
BridgeRelayersPalletInstance,
// message delivery transaction priority boost for every additional message
PriorityBoostPerMessage,
+33 -33
View File
@@ -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/>.
//! Signed extension, built around `pallet-bridge-relayers`. It is able to:
//! Signed extension, built around `pezpallet-bridge-relayers`. It is able to:
//!
//! - refund the cost of successful message delivery and confirmation transactions to the submitter
//! by registering corresponding reward in the pallet;
@@ -32,21 +32,21 @@ use bp_relayers::{
use bp_runtime::{Chain, RangeInclusiveExt, StaticStrProvider};
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::{fmt::Debug, marker::PhantomData};
use frame_support::{
use pezframe_support::{
dispatch::{DispatchInfo, PostDispatchInfo},
pallet_prelude::TransactionSource,
pezpallet_prelude::TransactionSource,
weights::Weight,
CloneNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound,
};
use frame_system::Config as SystemConfig;
use pallet_bridge_messages::{
use pezframe_system::Config as SystemConfig;
use pezpallet_bridge_messages::{
CallHelper as MessagesCallHelper, Config as BridgeMessagesConfig, LaneIdOf,
};
use pallet_transaction_payment::{
use pezpallet_transaction_payment::{
Config as TransactionPaymentConfig, OnChargeTransaction, Pallet as TransactionPaymentPallet,
};
use scale_info::TypeInfo;
use sp_runtime::{
use pezsp_runtime::{
traits::{
AsSystemOriginSigner, DispatchInfoOf, Dispatchable, PostDispatchInfoOf,
TransactionExtension, ValidateResult, Zero,
@@ -106,13 +106,13 @@ pub enum RelayerAccountAction<AccountId, RewardBalance, LaneId> {
Slash(AccountId, RewardsAccountParams<LaneId>),
}
/// A signed extension, built around `pallet-bridge-relayers`.
/// A signed extension, built around `pezpallet-bridge-relayers`.
///
/// It may be incorporated into runtime to refund relayers for submitting correct
/// message delivery and confirmation transactions, optionally batched with required
/// finality proofs.
///
/// (Works only with `pallet-bridge-messages` and `RewardsAccountParams` as the `Reward`)
/// (Works only with `pezpallet-bridge-messages` and `RewardsAccountParams` as the `Reward`)
#[derive(
DefaultNoBound,
CloneNoBound,
@@ -467,17 +467,17 @@ mod tests {
use bp_runtime::{BasicOperatingMode, HeaderId, Teyrchain};
use bp_test_utils::{make_default_justification, test_keyring, TEST_GRANDPA_SET_ID};
use bp_teyrchains::{BestParaHeadHash, ParaInfo, SubmitTeyrchainHeadsInfo};
use frame_support::{
__private::sp_tracing,
use pezframe_support::{
__private::pezsp_tracing,
assert_storage_noop, parameter_types,
traits::{fungible::Mutate, ReservableCurrency},
weights::Weight,
};
use pallet_bridge_grandpa::{Call as GrandpaCall, Pallet as GrandpaPallet, StoredAuthoritySet};
use pallet_bridge_messages::{Call as MessagesCall, Pallet as MessagesPallet};
use pallet_bridge_teyrchains::{Call as TeyrchainsCall, Pallet as TeyrchainsPallet};
use pallet_utility::Call as UtilityCall;
use sp_runtime::{
use pezpallet_bridge_grandpa::{Call as GrandpaCall, Pallet as GrandpaPallet, StoredAuthoritySet};
use pezpallet_bridge_messages::{Call as MessagesCall, Pallet as MessagesPallet};
use pezpallet_bridge_teyrchains::{Call as TeyrchainsCall, Pallet as TeyrchainsPallet};
use pezpallet_utility::Call as UtilityCall;
use pezsp_runtime::{
traits::{ConstU64, DispatchTransaction, Header as HeaderT},
transaction_validity::{
InvalidTransaction, TransactionSource::External, TransactionValidity, ValidTransaction,
@@ -565,11 +565,11 @@ mod tests {
) {
let authorities = test_keyring().into_iter().map(|(a, w)| (a.into(), w)).collect();
let best_relay_header = HeaderId(best_relay_header_number, BridgedChainHash::default());
pallet_bridge_grandpa::CurrentAuthoritySet::<TestRuntime>::put(
pezpallet_bridge_grandpa::CurrentAuthoritySet::<TestRuntime>::put(
StoredAuthoritySet::try_new(authorities, TEST_GRANDPA_SET_ID).unwrap(),
);
pallet_bridge_grandpa::BestFinalized::<TestRuntime>::put(best_relay_header);
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
pezpallet_bridge_grandpa::BestFinalized::<TestRuntime>::put(best_relay_header);
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime>::insert(
best_relay_header.hash(),
bp_test_utils::test_header::<BridgedChainHeader>(0).build(),
);
@@ -582,16 +582,16 @@ mod tests {
},
next_imported_hash_position: 0,
};
pallet_bridge_teyrchains::ParasInfo::<TestRuntime>::insert(para_id, para_info);
pezpallet_bridge_teyrchains::ParasInfo::<TestRuntime>::insert(para_id, para_info);
let lane_id = test_lane_id();
let in_lane_data =
InboundLaneData { last_confirmed_nonce: best_message, ..Default::default() };
pallet_bridge_messages::InboundLanes::<TestRuntime>::insert(lane_id, in_lane_data);
pezpallet_bridge_messages::InboundLanes::<TestRuntime>::insert(lane_id, in_lane_data);
let out_lane_data =
OutboundLaneData { latest_received_nonce: best_message, ..Default::default() };
pallet_bridge_messages::OutboundLanes::<TestRuntime>::insert(lane_id, out_lane_data);
pezpallet_bridge_messages::OutboundLanes::<TestRuntime>::insert(lane_id, out_lane_data);
Balances::mint_into(&delivery_rewards_account(), ExistentialDeposit::get()).unwrap();
Balances::mint_into(&confirmation_rewards_account(), ExistentialDeposit::get()).unwrap();
@@ -670,7 +670,7 @@ mod tests {
bridged_header_hash: Default::default(),
storage_proof: Default::default(),
lane: test_lane_id(),
nonces_start: pallet_bridge_messages::InboundLanes::<TestRuntime>::get(
nonces_start: pezpallet_bridge_messages::InboundLanes::<TestRuntime>::get(
test_lane_id(),
)
.unwrap()
@@ -1137,7 +1137,7 @@ mod tests {
Option<PreDispatchData<ThisChainAccountId, BridgedChainBlockNumber, TestLaneIdType>>,
TransactionValidityError,
> {
sp_tracing::try_init_simple();
pezsp_tracing::try_init_simple();
let extension: TestExtension = BridgeRelayersTransactionExtension(PhantomData);
extension
.validate_and_prepare(
@@ -1189,17 +1189,17 @@ mod tests {
fn dispatch_info() -> DispatchInfo {
DispatchInfo {
call_weight: Weight::from_parts(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
pezframe_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
0,
),
extension_weight: Weight::zero(),
class: frame_support::dispatch::DispatchClass::Normal,
pays_fee: frame_support::dispatch::Pays::Yes,
class: pezframe_support::dispatch::DispatchClass::Normal,
pays_fee: pezframe_support::dispatch::Pays::Yes,
}
}
fn post_dispatch_info() -> PostDispatchInfo {
PostDispatchInfo { actual_weight: None, pays_fee: frame_support::dispatch::Pays::Yes }
PostDispatchInfo { actual_weight: None, pays_fee: pezframe_support::dispatch::Pays::Yes }
}
fn run_post_dispatch(
@@ -1223,7 +1223,7 @@ mod tests {
let extra_weight = <TestRuntime as RelayersConfig>::WeightInfo::extra_weight_of_successful_receive_messages_proof_call();
post_dispatch_info.actual_weight =
Some(dispatch_info().call_weight.saturating_sub(extra_weight));
pallet_transaction_payment::Pallet::<TestRuntime>::compute_actual_fee(
pezpallet_transaction_payment::Pallet::<TestRuntime>::compute_actual_fee(
1024,
&dispatch_info(),
&post_dispatch_info,
@@ -1232,7 +1232,7 @@ mod tests {
}
fn expected_confirmation_reward() -> RewardBalance {
pallet_transaction_payment::Pallet::<TestRuntime>::compute_actual_fee(
pezpallet_transaction_payment::Pallet::<TestRuntime>::compute_actual_fee(
1024,
&dispatch_info(),
&post_dispatch_info(),
@@ -1783,7 +1783,7 @@ mod tests {
let mut dispatch_info = dispatch_info();
dispatch_info.call_weight = Weight::from_parts(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2,
pezframe_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2,
0,
);
@@ -1804,7 +1804,7 @@ mod tests {
match pre_dispatch_data.call_info {
ExtensionCallInfo::AllFinalityAndMsgs(ref mut info, ..) => {
info.extra_weight.set_ref_time(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
pezframe_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
);
info.extra_size = 32;
},
@@ -2424,7 +2424,7 @@ mod tests {
.into(),
..Default::default()
};
pallet_bridge_messages::InboundLanes::<TestRuntime>::insert(lane_id, in_lane_data);
pezpallet_bridge_messages::InboundLanes::<TestRuntime>::insert(lane_id, in_lane_data);
// now check that the priority of empty tx is the same as priority of 1-message tx
let priority_of_zero_messages_delivery =
@@ -22,8 +22,8 @@
//! single message with nonce `N`, then the transaction with nonces `N..=N+100` will
//! be rejected. This can lower bridge throughput down to one message per block.
use frame_support::traits::Get;
use sp_runtime::transaction_validity::TransactionPriority;
use pezframe_support::traits::Get;
use pezsp_runtime::transaction_validity::TransactionPriority;
// reexport everything from `integrity_tests` module
#[allow(unused_imports)]
@@ -53,19 +53,19 @@ mod integrity_tests {
use bp_messages::MessageNonce;
use bp_runtime::PreComputedSize;
use frame_support::{
use pezframe_support::{
dispatch::{DispatchClass, DispatchInfo, Pays, PostDispatchInfo},
traits::Get,
};
use pallet_transaction_payment::OnChargeTransaction;
use sp_runtime::{
use pezpallet_transaction_payment::OnChargeTransaction;
use pezsp_runtime::{
traits::{Dispatchable, UniqueSaturatedInto, Zero},
transaction_validity::TransactionPriority,
FixedPointOperand, SaturatedConversion, Saturating,
};
type BalanceOf<T> =
<<T as pallet_transaction_payment::Config>::OnChargeTransaction as OnChargeTransaction<
<<T as pezpallet_transaction_payment::Config>::OnChargeTransaction as OnChargeTransaction<
T,
>>::Balance;
@@ -145,7 +145,7 @@ mod integrity_tests {
use bp_header_chain::{
max_expected_submit_finality_proof_arguments_size, ChainWithGrandpa,
};
use pallet_bridge_grandpa::WeightInfoExt;
use pezpallet_bridge_grandpa::WeightInfoExt;
/// Ensures that the value of `PriorityBoostPerHeader` matches the value of
/// `tip_boost_per_header`.
@@ -158,7 +158,7 @@ mod integrity_tests {
tip_boost_per_header: BalanceOf<Runtime>,
) where
Runtime:
pallet_transaction_payment::Config + pallet_bridge_grandpa::Config<GrandpaInstance>,
pezpallet_transaction_payment::Config + pezpallet_bridge_grandpa::Config<GrandpaInstance>,
GrandpaInstance: 'static,
PriorityBoostPerHeader: Get<TransactionPriority>,
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
@@ -190,7 +190,7 @@ mod integrity_tests {
) -> TransactionPriority
where
Runtime:
pallet_transaction_payment::Config + pallet_bridge_grandpa::Config<GrandpaInstance>,
pezpallet_transaction_payment::Config + pezpallet_bridge_grandpa::Config<GrandpaInstance>,
GrandpaInstance: 'static,
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
BalanceOf<Runtime>: Send + Sync + FixedPointOperand,
@@ -206,14 +206,14 @@ mod integrity_tests {
// finally we are able to estimate transaction size and weight
let transaction_size = base_tx_size.saturating_add(tx_call_size);
let transaction_weight = <Runtime as ::pallet_bridge_grandpa::Config<
let transaction_weight = <Runtime as ::pezpallet_bridge_grandpa::Config<
GrandpaInstance,
>>::WeightInfo::submit_finality_proof_weight(
Runtime::BridgedChain::MAX_AUTHORITIES_COUNT * 2 / 3 + 1,
Runtime::BridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY,
);
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
pezpallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
&DispatchInfo {
call_weight: transaction_weight,
extension_weight: Default::default(),
@@ -232,7 +232,7 @@ mod integrity_tests {
use super::*;
use bp_runtime::Teyrchain;
use pallet_bridge_teyrchains::WeightInfoExt;
use pezpallet_bridge_teyrchains::WeightInfoExt;
/// Ensures that the value of `PriorityBoostPerHeader` matches the value of
/// `tip_boost_per_header`.
@@ -249,8 +249,8 @@ mod integrity_tests {
>(
tip_boost_per_header: BalanceOf<Runtime>,
) where
Runtime: pallet_transaction_payment::Config
+ pallet_bridge_teyrchains::Config<TeyrchainsInstance>,
Runtime: pezpallet_transaction_payment::Config
+ pezpallet_bridge_teyrchains::Config<TeyrchainsInstance>,
TeyrchainsInstance: 'static,
Para: Teyrchain,
PriorityBoostPerHeader: Get<TransactionPriority>,
@@ -288,8 +288,8 @@ mod integrity_tests {
tip: BalanceOf<Runtime>,
) -> TransactionPriority
where
Runtime: pallet_transaction_payment::Config
+ pallet_bridge_teyrchains::Config<TeyrchainsInstance>,
Runtime: pezpallet_transaction_payment::Config
+ pezpallet_bridge_teyrchains::Config<TeyrchainsInstance>,
TeyrchainsInstance: 'static,
Para: Teyrchain,
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
@@ -300,14 +300,14 @@ mod integrity_tests {
// all call arguments except the proof itself)
let base_tx_size = 512;
// let's say we are relaying largest teyrchain headers and proof takes some more bytes
let tx_call_size = <Runtime as pallet_bridge_teyrchains::Config<
let tx_call_size = <Runtime as pezpallet_bridge_teyrchains::Config<
TeyrchainsInstance,
>>::WeightInfo::expected_extra_storage_proof_size()
.saturating_add(Para::MAX_HEADER_SIZE);
// finally we are able to estimate transaction size and weight
let transaction_size = base_tx_size.saturating_add(tx_call_size);
let transaction_weight = <Runtime as pallet_bridge_teyrchains::Config<
let transaction_weight = <Runtime as pezpallet_bridge_teyrchains::Config<
TeyrchainsInstance,
>>::WeightInfo::submit_teyrchain_heads_weight(
Runtime::DbWeight::get(),
@@ -316,7 +316,7 @@ mod integrity_tests {
1,
);
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
pezpallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
&DispatchInfo {
call_weight: transaction_weight,
extension_weight: Default::default(),
@@ -335,7 +335,7 @@ mod integrity_tests {
use super::*;
use bp_messages::ChainWithMessages;
use pallet_bridge_messages::WeightInfoExt;
use pezpallet_bridge_messages::WeightInfoExt;
/// Ensures that the value of `PriorityBoostPerMessage` matches the value of
/// `tip_boost_per_message`.
@@ -347,8 +347,8 @@ mod integrity_tests {
pub fn ensure_priority_boost_is_sane<Runtime, MessagesInstance, PriorityBoostPerMessage>(
tip_boost_per_message: BalanceOf<Runtime>,
) where
Runtime: pallet_transaction_payment::Config
+ pallet_bridge_messages::Config<MessagesInstance>,
Runtime: pezpallet_transaction_payment::Config
+ pezpallet_bridge_messages::Config<MessagesInstance>,
MessagesInstance: 'static,
PriorityBoostPerMessage: Get<TransactionPriority>,
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
@@ -375,8 +375,8 @@ mod integrity_tests {
tip: BalanceOf<Runtime>,
) -> TransactionPriority
where
Runtime: pallet_transaction_payment::Config
+ pallet_bridge_messages::Config<MessagesInstance>,
Runtime: pezpallet_transaction_payment::Config
+ pezpallet_bridge_messages::Config<MessagesInstance>,
MessagesInstance: 'static,
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
BalanceOf<Runtime>: Send + Sync + FixedPointOperand,
@@ -389,7 +389,7 @@ mod integrity_tests {
// trie nodes to the proof (x0.5 because we expect some nodes to be reused)
let estimated_message_size = 512;
// let's say all our messages have the same dispatch weight
let estimated_message_dispatch_weight = <Runtime as pallet_bridge_messages::Config<
let estimated_message_dispatch_weight = <Runtime as pezpallet_bridge_messages::Config<
MessagesInstance,
>>::WeightInfo::message_dispatch_weight(
estimated_message_size
@@ -397,7 +397,7 @@ mod integrity_tests {
// messages proof argument size is (for every message) messages size + some additional
// trie nodes. Some of them are reused by different messages, so let's take 2/3 of
// default "overhead" constant
let messages_proof_size = <Runtime as pallet_bridge_messages::Config<
let messages_proof_size = <Runtime as pezpallet_bridge_messages::Config<
MessagesInstance,
>>::WeightInfo::expected_extra_storage_proof_size()
.saturating_mul(2)
@@ -407,7 +407,7 @@ mod integrity_tests {
// finally we are able to estimate transaction size and weight
let transaction_size = base_tx_size.saturating_add(messages_proof_size);
let transaction_weight = <Runtime as pallet_bridge_messages::Config<
let transaction_weight = <Runtime as pezpallet_bridge_messages::Config<
MessagesInstance,
>>::WeightInfo::receive_messages_proof_weight(
&PreComputedSize(transaction_size as _),
@@ -415,7 +415,7 @@ mod integrity_tests {
estimated_message_dispatch_weight.saturating_mul(messages),
);
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
pezpallet_transaction_payment::ChargeTransactionPayment::<Runtime>::get_priority(
&DispatchInfo {
call_weight: transaction_weight,
extension_weight: Default::default(),
@@ -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/>.
//! Adapter that allows using `pallet-bridge-relayers` as a signed extension in the
//! Adapter that allows using `pezpallet-bridge-relayers` as a signed extension in the
//! bridge with remote teyrchain.
use crate::{
@@ -27,19 +27,19 @@ use crate::{
use bp_relayers::{BatchCallUnpacker, ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
use bp_runtime::{StaticStrProvider, Teyrchain};
use core::marker::PhantomData;
use frame_support::dispatch::{DispatchInfo, PostDispatchInfo};
use frame_system::Config as SystemConfig;
use pallet_bridge_grandpa::{
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
use pezframe_system::Config as SystemConfig;
use pezpallet_bridge_grandpa::{
CallSubType as BridgeGrandpaCallSubtype, Config as BridgeGrandpaConfig,
};
use pallet_bridge_messages::{
use pezpallet_bridge_messages::{
CallSubType as BridgeMessagesCallSubType, Config as BridgeMessagesConfig, LaneIdOf,
};
use pallet_bridge_teyrchains::{
use pezpallet_bridge_teyrchains::{
CallSubType as BridgeTeyrchainsCallSubtype, Config as BridgeTeyrchainsConfig,
SubmitTeyrchainHeadsHelper,
};
use sp_runtime::{
use pezsp_runtime::{
traits::{Dispatchable, Get},
transaction_validity::{TransactionPriority, TransactionValidityError},
};
@@ -54,11 +54,11 @@ pub struct WithTeyrchainExtensionConfig<
Runtime,
// batch call unpacker
BatchCallUnpacker,
// instance of the `pallet-bridge-teyrchains`, tracked by this extension
// instance of the `pezpallet-bridge-teyrchains`, tracked by this extension
BridgeTeyrchainsPalletInstance,
// instance of BridgedChain `pallet-bridge-messages`, tracked by this extension
// instance of BridgedChain `pezpallet-bridge-messages`, tracked by this extension
BridgeMessagesPalletInstance,
// instance of `pallet-bridge-relayers`, tracked by this extension
// instance of `pezpallet-bridge-relayers`, tracked by this extension
BridgeRelayersPalletInstance,
// message delivery transaction priority boost for every additional message
PriorityBoostPerMessage,
@@ -99,7 +99,7 @@ where
type BridgeRelayersPalletInstance = RI;
type PriorityBoostPerMessage = P;
type RemoteGrandpaChainBlockNumber =
pallet_bridge_grandpa::BridgedBlockNumber<R, R::BridgesGrandpaPalletInstance>;
pezpallet_bridge_grandpa::BridgedBlockNumber<R, R::BridgesGrandpaPalletInstance>;
type LaneId = LaneIdOf<R, Self::BridgeMessagesPalletInstance>;
fn parse_and_check_for_obsolete_call(
+17 -17
View File
@@ -25,9 +25,9 @@ pub use bp_relayers::RewardLedger;
use bp_relayers::{PaymentProcedure, Registration, RelayerRewardsKeyProvider, StakeAndSlash};
use bp_runtime::StorageDoubleMapKeyProvider;
use core::marker::PhantomData;
use frame_support::{fail, traits::tokens::Balance};
use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
use sp_runtime::{
use pezframe_support::{fail, traits::tokens::Balance};
use pezsp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
use pezsp_runtime::{
traits::{CheckedSub, IdentifyAccount},
Saturating,
};
@@ -51,32 +51,32 @@ pub mod weights;
/// The target that will be used when publishing logs related to this pallet.
pub const LOG_TARGET: &str = "runtime::bridge-relayers";
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
/// `RelayerRewardsKeyProvider` for given configuration.
type RelayerRewardsKeyProviderOf<T, I> = RelayerRewardsKeyProvider<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
<T as Config<I>>::Reward,
<T as Config<I>>::RewardBalance,
>;
/// Shortcut to alternative beneficiary type for `Config::PaymentProcedure`.
pub type BeneficiaryOf<T, I> = <<T as Config<I>>::PaymentProcedure as PaymentProcedure<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
<T as Config<I>>::Reward,
<T as Config<I>>::RewardBalance,
>>::Beneficiary;
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// Type of relayer reward balance.
type RewardBalance: AtLeast32BitUnsigned + Copy + Member + Parameter + MaxEncodedLen;
@@ -107,7 +107,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config<I>, I: 'static> Pallet<T, I>
where
BeneficiaryOf<T, I>: From<<T as frame_system::Config>::AccountId>,
BeneficiaryOf<T, I>: From<<T as pezframe_system::Config>::AccountId>,
{
/// Claim accumulated rewards.
#[pallet::call_index(0)]
@@ -128,7 +128,7 @@ pub mod pallet {
// valid till must be larger than the current block number and the lease must be larger
// than the `RequiredRegistrationLease`
let lease = valid_till.saturating_sub(frame_system::Pallet::<T>::block_number());
let lease = valid_till.saturating_sub(pezframe_system::Pallet::<T>::block_number());
ensure!(
lease > Self::required_registration_lease(),
Error::<T, I>::InvalidRegistrationLease
@@ -202,7 +202,7 @@ pub mod pallet {
// we can't deregister until `valid_till + 1`
ensure!(
registration.valid_till < frame_system::Pallet::<T>::block_number(),
registration.valid_till < pezframe_system::Pallet::<T>::block_number(),
Error::<T, I>::RegistrationIsStillActive,
);
@@ -320,7 +320,7 @@ pub mod pallet {
// registration is inactive if it ends soon
let remaining_lease = registration
.valid_till
.saturating_sub(frame_system::Pallet::<T>::block_number());
.saturating_sub(pezframe_system::Pallet::<T>::block_number());
if remaining_lease <= Self::required_registration_lease() {
return false;
}
@@ -580,9 +580,9 @@ mod tests {
use bp_messages::{HashedLaneId, LaneIdType};
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use frame_support::{assert_noop, assert_ok, traits::fungible::Mutate};
use frame_system::{EventRecord, Pallet as System, Phase};
use sp_runtime::DispatchError;
use pezframe_support::{assert_noop, assert_ok, traits::fungible::Mutate};
use pezframe_system::{EventRecord, Pallet as System, Phase};
use pezsp_runtime::DispatchError;
fn get_ready_for_events() {
System::<TestRuntime>::set_block_number(1);
+33 -33
View File
@@ -17,7 +17,7 @@
//! A module that is responsible for migration of storage.
use alloc::vec::Vec;
use frame_support::{
use pezframe_support::{
traits::{Get, StorageVersion},
weights::Weight,
};
@@ -33,9 +33,9 @@ pub mod v0 {
use bp_runtime::{ChainId, StorageDoubleMapKeyProvider};
use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen};
use core::marker::PhantomData;
use frame_support::{pallet_prelude::OptionQuery, Blake2_128Concat, Identity};
use pezframe_support::{pezpallet_prelude::OptionQuery, Blake2_128Concat, Identity};
use scale_info::TypeInfo;
use sp_runtime::traits::AccountIdConversion;
use pezsp_runtime::traits::AccountIdConversion;
/// Structure used to identify the account that pays a reward to the relayer.
#[derive(Copy, Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo, MaxEncodedLen)]
@@ -59,7 +59,7 @@ pub mod v0 {
}
}
impl<LaneId> sp_runtime::TypeId for RewardsAccountParams<LaneId> {
impl<LaneId> pezsp_runtime::TypeId for RewardsAccountParams<LaneId> {
const TYPE_ID: [u8; 4] = *b"brap";
}
@@ -84,12 +84,12 @@ pub mod v0 {
}
pub(crate) type RelayerRewardsKeyProviderOf<T, I, LaneId> = RelayerRewardsKeyProvider<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
<T as Config<I>>::RewardBalance,
LaneId,
>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type RelayerRewards<T: Config<I>, I: 'static, LaneId> = StorageDoubleMap<
Pallet<T, I>,
<RelayerRewardsKeyProviderOf<T, I, LaneId> as StorageDoubleMapKeyProvider>::Hasher1,
@@ -125,10 +125,10 @@ pub mod v1 {
use bp_runtime::StorageDoubleMapKeyProvider;
use codec::{Codec, EncodeLike};
use core::marker::PhantomData;
use frame_support::{
pallet_prelude::OptionQuery, traits::UncheckedOnRuntimeUpgrade, Blake2_128Concat, Identity,
use pezframe_support::{
pezpallet_prelude::OptionQuery, traits::UncheckedOnRuntimeUpgrade, Blake2_128Concat, Identity,
};
use sp_arithmetic::traits::Zero;
use pezsp_arithmetic::traits::Zero;
pub(crate) struct RelayerRewardsKeyProvider<AccountId, RewardBalance, LaneId>(
PhantomData<(AccountId, RewardBalance, LaneId)>,
@@ -151,12 +151,12 @@ pub mod v1 {
}
pub(crate) type RelayerRewardsKeyProviderOf<T, I, LaneId> = RelayerRewardsKeyProvider<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
<T as Config<I>>::RewardBalance,
LaneId,
>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type RelayerRewards<T: Config<I>, I: 'static, LaneId> = StorageDoubleMap<
Pallet<T, I>,
<RelayerRewardsKeyProviderOf<T, I, LaneId> as StorageDoubleMapKeyProvider>::Hasher1,
@@ -177,7 +177,7 @@ pub mod v1 {
relayer: &T::AccountId,
reward_balance: T::RewardBalance,
) {
use sp_runtime::Saturating;
use pezsp_runtime::Saturating;
if reward_balance.is_zero() {
return;
@@ -240,10 +240,10 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
use codec::Encode;
use frame_support::BoundedBTreeMap;
use sp_runtime::traits::ConstU32;
use pezframe_support::BoundedBTreeMap;
use pezsp_runtime::traits::ConstU32;
// collect actual rewards
let mut rewards: BoundedBTreeMap<
@@ -268,10 +268,10 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
use codec::Decode;
use frame_support::BoundedBTreeMap;
use sp_runtime::traits::ConstU32;
use pezframe_support::BoundedBTreeMap;
use pezsp_runtime::traits::ConstU32;
let rewards_before: BoundedBTreeMap<
(T::AccountId, LaneId),
@@ -298,7 +298,7 @@ pub mod v1 {
}
tracing::info!(target: LOG_TARGET, ?rewards_after, "Found total migrated rewards");
frame_support::ensure!(
pezframe_support::ensure!(
rewards_before == rewards_after,
"The rewards were not migrated correctly!."
);
@@ -309,14 +309,14 @@ pub mod v1 {
}
/// [`UncheckedMigrationV0ToV1`] wrapped in a
/// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the
/// [`VersionedMigration`](pezframe_support::migrations::VersionedMigration), ensuring the
/// migration is only performed when on-chain version is 0.
pub type MigrationToV1<T, I, LaneId> = frame_support::migrations::VersionedMigration<
pub type MigrationToV1<T, I, LaneId> = pezframe_support::migrations::VersionedMigration<
0,
1,
UncheckedMigrationV0ToV1<T, I, LaneId>,
Pallet<T, I>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
}
@@ -331,7 +331,7 @@ pub mod v2 {
use bp_messages::LaneIdType;
use bp_relayers::RewardsAccountParams;
use core::marker::PhantomData;
use frame_support::traits::UncheckedOnRuntimeUpgrade;
use pezframe_support::traits::UncheckedOnRuntimeUpgrade;
/// Migrates the pallet storage to v2.
pub struct UncheckedMigrationV1ToV2<T, I, LaneId>(PhantomData<(T, I, LaneId)>);
@@ -369,10 +369,10 @@ pub mod v2 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
use codec::Encode;
use frame_support::BoundedBTreeMap;
use sp_runtime::traits::ConstU32;
use pezframe_support::BoundedBTreeMap;
use pezsp_runtime::traits::ConstU32;
// collect actual rewards
let mut rewards: BoundedBTreeMap<
@@ -398,10 +398,10 @@ pub mod v2 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
use codec::{Decode, Encode};
use frame_support::BoundedBTreeMap;
use sp_runtime::traits::ConstU32;
use pezframe_support::BoundedBTreeMap;
use pezsp_runtime::traits::ConstU32;
let rewards_before: BoundedBTreeMap<
(T::AccountId, Vec<u8>),
@@ -428,7 +428,7 @@ pub mod v2 {
}
tracing::info!(target: LOG_TARGET, ?rewards_after, "Found total migrated rewards");
frame_support::ensure!(
pezframe_support::ensure!(
rewards_before == rewards_after,
"The rewards were not migrated correctly!."
);
@@ -439,13 +439,13 @@ pub mod v2 {
}
/// [`UncheckedMigrationV1ToV2`] wrapped in a
/// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the
/// [`VersionedMigration`](pezframe_support::migrations::VersionedMigration), ensuring the
/// migration is only performed when on-chain version is 1.
pub type MigrationToV2<T, I, LaneId> = frame_support::migrations::VersionedMigration<
pub type MigrationToV2<T, I, LaneId> = pezframe_support::migrations::VersionedMigration<
1,
2,
UncheckedMigrationV1ToV2<T, I, LaneId>,
Pallet<T, I>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
}
+48 -48
View File
@@ -16,7 +16,7 @@
#![cfg(test)]
use crate as pallet_bridge_relayers;
use crate as pezpallet_bridge_relayers;
use bp_header_chain::ChainWithGrandpa;
use bp_messages::{
@@ -29,14 +29,14 @@ use bp_relayers::{
use bp_runtime::{messages::MessageDispatchResult, Chain, ChainId, Teyrchain};
use bp_teyrchains::SingleParaStoredHeaderDataBuilder;
use codec::Encode;
use frame_support::{
use pezframe_support::{
derive_impl, parameter_types,
traits::fungible::Mutate,
weights::{ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight},
};
use pallet_transaction_payment::Multiplier;
use sp_core::H256;
use sp_runtime::{
use pezpallet_transaction_payment::Multiplier;
use pezsp_core::H256;
use pezsp_runtime::{
traits::{BlakeTwo256, ConstU32, ConstU64, ConstU8},
BuildStorage, FixedPointNumber, Perquintill, StateVersion,
};
@@ -52,9 +52,9 @@ pub type ThisChainHash = H256;
/// Hasher at `ThisChain`.
pub type ThisChainHasher = BlakeTwo256;
/// Header of `ThisChain`.
pub type ThisChainHeader = sp_runtime::generic::Header<ThisChainBlockNumber, ThisChainHasher>;
pub type ThisChainHeader = pezsp_runtime::generic::Header<ThisChainBlockNumber, ThisChainHasher>;
/// Block of `ThisChain`.
pub type ThisChainBlock = frame_system::mocking::MockBlockU32<TestRuntime>;
pub type ThisChainBlock = pezframe_system::mocking::MockBlockU32<TestRuntime>;
/// Account identifier at the `BridgedChain`.
pub type BridgedChainAccountId = u128;
@@ -68,7 +68,7 @@ pub type BridgedChainHash = H256;
pub type BridgedChainHasher = BlakeTwo256;
/// Header of the `BridgedChain`.
pub type BridgedChainHeader =
sp_runtime::generic::Header<BridgedChainBlockNumber, BridgedChainHasher>;
pezsp_runtime::generic::Header<BridgedChainBlockNumber, BridgedChainHasher>;
/// Bridged chain id used in tests.
pub const TEST_BRIDGED_CHAIN_ID: ChainId = *b"brdg";
@@ -97,7 +97,7 @@ impl Chain for ThisUnderlyingChain {
type AccountId = ThisChainAccountId;
type Balance = ThisChainBalance;
type Nonce = u32;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
@@ -130,7 +130,7 @@ impl Chain for BridgedUnderlyingTeyrchain {
type AccountId = BridgedChainAccountId;
type Balance = BridgedChainBalance;
type Nonce = u32;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
@@ -161,7 +161,7 @@ impl Teyrchain for BridgedUnderlyingTeyrchain {
const MAX_HEADER_SIZE: u32 = 1_024;
}
pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed<
pub type TestStakeAndSlash = pezpallet_bridge_relayers::StakeAndSlashNamed<
ThisChainAccountId,
ThisChainBlockNumber,
Balances,
@@ -170,17 +170,17 @@ pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed<
Lease,
>;
frame_support::construct_runtime! {
pezframe_support::construct_runtime! {
pub enum TestRuntime
{
System: frame_system,
Utility: pallet_utility,
Balances: pallet_balances,
TransactionPayment: pallet_transaction_payment,
BridgeRelayers: pallet_bridge_relayers,
BridgeGrandpa: pallet_bridge_grandpa,
BridgeTeyrchains: pallet_bridge_teyrchains,
BridgeMessages: pallet_bridge_messages,
System: pezframe_system,
Utility: pezpallet_utility,
Balances: pezpallet_balances,
TransactionPayment: pezpallet_transaction_payment,
BridgeRelayers: pezpallet_bridge_relayers,
BridgeGrandpa: pezpallet_bridge_grandpa,
BridgeTeyrchains: pezpallet_bridge_teyrchains,
BridgeMessages: pezpallet_bridge_messages,
}
}
@@ -196,38 +196,38 @@ parameter_types! {
pub const TransactionByteFee: ThisChainBalance = 1;
pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(3, 100_000);
pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128);
pub MaximumMultiplier: Multiplier = sp_runtime::traits::Bounded::max_value();
pub MaximumMultiplier: Multiplier = pezsp_runtime::traits::Bounded::max_value();
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = ThisChainBlock;
// TODO: remove when https://github.com/paritytech/polkadot-sdk/pull/4543 merged
// TODO: remove when https://github.com/pezkuwichain/kurdistan-sdk/issues/120 merged
type BlockHashCount = ConstU32<10>;
type AccountData = pallet_balances::AccountData<ThisChainBalance>;
type AccountData = pezpallet_balances::AccountData<ThisChainBalance>;
type DbWeight = DbWeight;
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for TestRuntime {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
}
impl pallet_utility::Config for TestRuntime {
impl pezpallet_utility::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = ();
}
#[derive_impl(pallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pallet_transaction_payment::Config for TestRuntime {
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
#[derive_impl(pezpallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pezpallet_transaction_payment::Config for TestRuntime {
type OnChargeTransaction = pezpallet_transaction_payment::FungibleAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<ThisChainBalance>;
type LengthToFee = ConstantMultiplier<ThisChainBalance, TransactionByteFee>;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
type FeeMultiplierUpdate = pezpallet_transaction_payment::TargetedFeeAdjustment<
TestRuntime,
TargetBlockFullness,
AdjustmentVariable,
@@ -237,16 +237,16 @@ impl pallet_transaction_payment::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
}
impl pallet_bridge_grandpa::Config for TestRuntime {
impl pezpallet_bridge_grandpa::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type BridgedChain = BridgedUnderlyingTeyrchain;
type MaxFreeHeadersPerBlock = ConstU32<4>;
type FreeHeadersInterval = ConstU32<1_024>;
type HeadersToKeep = ConstU32<8>;
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<TestRuntime>;
type WeightInfo = pezpallet_bridge_grandpa::weights::BridgeWeight<TestRuntime>;
}
impl pallet_bridge_teyrchains::Config for TestRuntime {
impl pezpallet_bridge_teyrchains::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type BridgesGrandpaPalletInstance = ();
type ParasPalletName = BridgedParasPalletName;
@@ -254,20 +254,20 @@ impl pallet_bridge_teyrchains::Config for TestRuntime {
SingleParaStoredHeaderDataBuilder<BridgedUnderlyingTeyrchain>;
type HeadsToKeep = ConstU32<8>;
type MaxParaHeadDataSize = ConstU32<1024>;
type WeightInfo = pallet_bridge_teyrchains::weights::BridgeWeight<TestRuntime>;
type WeightInfo = pezpallet_bridge_teyrchains::weights::BridgeWeight<TestRuntime>;
type OnNewHead = ();
}
impl pallet_bridge_messages::Config for TestRuntime {
impl pezpallet_bridge_messages::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<TestRuntime>;
type WeightInfo = pezpallet_bridge_messages::weights::BridgeWeight<TestRuntime>;
type OutboundPayload = Vec<u8>;
type InboundPayload = Vec<u8>;
type LaneId = TestLaneIdType;
type DeliveryPayments = ();
type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
type DeliveryConfirmationPayments = pezpallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
TestRuntime,
(),
(),
@@ -281,10 +281,10 @@ impl pallet_bridge_messages::Config for TestRuntime {
type BridgedHeaderChain = BridgeGrandpa;
}
impl pallet_bridge_relayers::Config for TestRuntime {
impl pezpallet_bridge_relayers::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type RewardBalance = RewardBalance;
type Reward = RewardsAccountParams<pallet_bridge_messages::LaneIdOf<TestRuntime, ()>>;
type Reward = RewardsAccountParams<pezpallet_bridge_messages::LaneIdOf<TestRuntime, ()>>;
type PaymentProcedure = TestPaymentProcedure;
type StakeAndSlash = TestStakeAndSlash;
type Balance = ThisChainBalance;
@@ -292,7 +292,7 @@ impl pallet_bridge_relayers::Config for TestRuntime {
}
#[cfg(feature = "runtime-benchmarks")]
impl pallet_bridge_relayers::benchmarking::Config for TestRuntime {
impl pezpallet_bridge_relayers::benchmarking::Config for TestRuntime {
fn bench_reward() -> Self::Reward {
RewardsAccountParams::new(
TestLaneIdType::default(),
@@ -317,7 +317,7 @@ impl pallet_bridge_relayers::benchmarking::Config for TestRuntime {
}
fn deposit_account(account: Self::AccountId, balance: Self::Balance) {
frame_support::assert_ok!(Balances::mint_into(
pezframe_support::assert_ok!(Balances::mint_into(
&account,
balance.saturating_add(ExistentialDeposit::get())
));
@@ -370,7 +370,7 @@ pub struct DummyMessageDispatch;
impl DummyMessageDispatch {
pub fn deactivate(lane: TestLaneIdType) {
frame_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
pezframe_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
}
}
@@ -380,7 +380,7 @@ impl MessageDispatch for DummyMessageDispatch {
type LaneId = TestLaneIdType;
fn is_active(lane: Self::LaneId) -> bool {
frame_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
Some(false)
}
@@ -407,9 +407,9 @@ pub fn test_reward_account_param() -> RewardsAccountParams<TestLaneIdType> {
}
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
sp_io::TestExternalities::new(t)
pub fn new_test_ext() -> pezsp_io::TestExternalities {
let t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
pezsp_io::TestExternalities::new(t)
}
/// Run pallet test.
@@ -15,7 +15,7 @@
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Code that allows relayers pallet to be used as a payment mechanism for
//! the `pallet-bridge-messages` pallet using `RewardsAccountParams`.
//! the `pezpallet-bridge-messages` pallet using `RewardsAccountParams`.
use crate::{Config, Pallet};
@@ -28,12 +28,12 @@ pub use bp_relayers::PayRewardFromAccount;
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::Chain;
use core::{marker::PhantomData, ops::RangeInclusive};
use frame_support::{sp_runtime::SaturatedConversion, traits::Get};
use pallet_bridge_messages::LaneIdOf;
use sp_arithmetic::traits::{Saturating, Zero};
use pezframe_support::{pezsp_runtime::SaturatedConversion, traits::Get};
use pezpallet_bridge_messages::LaneIdOf;
use pezsp_arithmetic::traits::{Saturating, Zero};
/// Adapter that allows relayers pallet to be used as a delivery+dispatch payment mechanism
/// for the `pallet-bridge-messages` pallet and using `RewardsAccountParams`.
/// for the `pezpallet-bridge-messages` pallet and using `RewardsAccountParams`.
pub struct DeliveryConfirmationPaymentsAdapter<T, MI, RI, DeliveryReward>(
PhantomData<(T, MI, RI, DeliveryReward)>,
);
@@ -41,7 +41,7 @@ pub struct DeliveryConfirmationPaymentsAdapter<T, MI, RI, DeliveryReward>(
impl<T, MI, RI, DeliveryReward> DeliveryConfirmationPayments<T::AccountId, LaneIdOf<T, MI>>
for DeliveryConfirmationPaymentsAdapter<T, MI, RI, DeliveryReward>
where
T: Config<RI> + pallet_bridge_messages::Config<MI>,
T: Config<RI> + pezpallet_bridge_messages::Config<MI>,
MI: 'static,
RI: 'static,
DeliveryReward: Get<T::RewardBalance>,
@@ -76,7 +76,7 @@ where
// Update rewards to given relayers, optionally rewarding confirmation relayer.
fn register_relayers_rewards<
T: Config<RI> + pallet_bridge_messages::Config<MI>,
T: Config<RI> + pezpallet_bridge_messages::Config<MI>,
RI: 'static,
MI: 'static,
>(
@@ -117,7 +117,7 @@ mod tests {
use crate::{mock::*, RelayerRewards};
use bp_messages::LaneIdType;
use bp_relayers::PaymentProcedure;
use frame_support::{
use pezframe_support::{
assert_ok,
traits::fungible::{Inspect, Mutate},
};
@@ -178,7 +178,7 @@ mod tests {
#[test]
fn pay_reward_from_account_actually_pays_reward() {
type Balances = pallet_balances::Pallet<TestRuntime>;
type Balances = pezpallet_balances::Pallet<TestRuntime>;
type PayLaneRewardFromAccount =
PayRewardFromAccount<Balances, ThisChainAccountId, TestLaneIdType, RewardBalance>;
@@ -20,8 +20,8 @@
use bp_relayers::StakeAndSlash;
use codec::Codec;
use core::{fmt::Debug, marker::PhantomData};
use frame_support::traits::{tokens::BalanceStatus, NamedReservableCurrency};
use sp_runtime::{traits::Get, DispatchError, DispatchResult};
use pezframe_support::traits::{tokens::BalanceStatus, NamedReservableCurrency};
use pezsp_runtime::{traits::Get, DispatchError, DispatchResult};
/// `StakeAndSlash` that works with `NamedReservableCurrency` and uses named
/// reservations.
@@ -74,8 +74,8 @@ mod tests {
use crate::mock::*;
use bp_relayers::ExplicitOrAccountParams;
use frame_support::traits::fungible::Mutate;
use sp_runtime::traits::IdentifyAccount;
use pezframe_support::traits::fungible::Mutate;
use pezsp_runtime::traits::IdentifyAccount;
fn test_stake() -> ThisChainBalance {
Stake::get()
+7 -7
View File
@@ -14,9 +14,9 @@
// 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_bridge_relayers
//! Autogenerated weights for pezpallet_bridge_relayers
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
@@ -29,7 +29,7 @@
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_bridge_relayers
// --pallet=pezpallet_bridge_relayers
// --extrinsic=*
// --execution=wasm
// --wasm-execution=Compiled
@@ -43,12 +43,12 @@
#![allow(missing_docs)]
use core::marker::PhantomData;
use frame_support::{
use pezframe_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
/// Weight functions needed for pallet_bridge_relayers.
/// Weight functions needed for pezpallet_bridge_relayers.
pub trait WeightInfo {
fn claim_rewards() -> Weight;
fn claim_rewards_to() -> Weight;
@@ -58,11 +58,11 @@ pub trait WeightInfo {
fn register_relayer_reward() -> Weight;
}
/// Weights for `pallet_bridge_relayers` that are generated using one of the Bridge testnets.
/// Weights for `pezpallet_bridge_relayers` that are generated using one of the Bridge testnets.
///
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfo for BridgeWeight<T> {
/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
///
/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540,
+1 -1
View File
@@ -18,7 +18,7 @@
use crate::weights::WeightInfo;
use frame_support::pallet_prelude::Weight;
use pezframe_support::pezpallet_prelude::Weight;
/// Extended weight info.
pub trait WeightInfoExt: WeightInfo {
+26 -26
View File
@@ -1,5 +1,5 @@
[package]
name = "pallet-bridge-teyrchains"
name = "pezpallet-bridge-teyrchains"
version = "0.7.0"
description = "Module that allows bridged relay chains to exchange information on their teyrchains' heads."
authors.workspace = true
@@ -20,20 +20,20 @@ bp-header-chain = { workspace = true }
bp-pezkuwi-core = { workspace = true }
bp-runtime = { workspace = true }
bp-teyrchains = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
pezpallet-bridge-grandpa = { workspace = true }
# Substrate Dependencies
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# Bizinikiwi Dependencies
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-runtime = { workspace = true }
pezsp-std = { workspace = true }
[dev-dependencies]
bp-header-chain = { workspace = true, default-features = true }
bp-test-utils = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
pezsp-core = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
[features]
default = ["std"]
@@ -43,13 +43,13 @@ std = [
"bp-runtime/std",
"bp-teyrchains/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"pallet-bridge-grandpa/std",
"pezframe-benchmarking/std",
"pezframe-support/std",
"pezframe-system/std",
"pezpallet-bridge-grandpa/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
"pezsp-runtime/std",
"pezsp-std/std",
"tracing/std",
]
runtime-benchmarks = [
@@ -58,16 +58,16 @@ runtime-benchmarks = [
"bp-runtime/runtime-benchmarks",
"bp-test-utils/runtime-benchmarks",
"bp-teyrchains/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-bridge-grandpa/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-bridge-grandpa/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-bridge-grandpa/try-runtime",
"pezsp-runtime/try-runtime",
]
@@ -23,9 +23,9 @@ use crate::{
use bp_pezkuwi_core::teyrchains::{ParaHash, ParaHeadsProof, ParaId};
use bp_runtime::UnverifiedStorageProofParams;
use frame_benchmarking::{account, benchmarks_instance_pallet};
use frame_system::RawOrigin;
use sp_std::prelude::*;
use pezframe_benchmarking::{account, benchmarks_instance_pallet};
use pezframe_system::RawOrigin;
use pezsp_std::prelude::*;
/// Pallet we're benchmarking here.
pub struct Pallet<T: Config<I>, I: 'static = ()>(crate::Pallet<T, I>);
@@ -45,7 +45,7 @@ pub trait Config<I: 'static>: crate::Config<I> {
benchmarks_instance_pallet! {
where_clause {
where
<T as pallet_bridge_grandpa::Config<T::BridgesGrandpaPalletInstance>>::BridgedChain:
<T as pezpallet_bridge_grandpa::Config<T::BridgesGrandpaPalletInstance>>::BridgedChain:
bp_runtime::Chain<
BlockNumber = RelayBlockNumber,
Hash = RelayBlockHash,
+5 -5
View File
@@ -18,12 +18,12 @@ use crate::{Config, GrandpaPalletOf, Pallet, RelayBlockNumber};
use bp_header_chain::HeaderChain;
use bp_runtime::{HeaderId, OwnedBridgeModule};
use bp_teyrchains::{BestParaHeadHash, SubmitTeyrchainHeadsInfo};
use frame_support::{
use pezframe_support::{
dispatch::CallableCallFor,
traits::{Get, IsSubType},
};
use pallet_bridge_grandpa::SubmitFinalityProofHelper;
use sp_runtime::{
use pezpallet_bridge_grandpa::SubmitFinalityProofHelper;
use pezsp_runtime::{
traits::Zero,
transaction_validity::{InvalidTransaction, TransactionValidityError},
RuntimeDebug,
@@ -41,7 +41,7 @@ pub struct VerifiedSubmitTeyrchainHeadsInfo {
/// Helper struct that provides methods for working with the `SubmitTeyrchainHeads` call.
pub struct SubmitTeyrchainHeadsHelper<T: Config<I>, I: 'static> {
_phantom_data: sp_std::marker::PhantomData<(T, I)>,
_phantom_data: pezsp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> SubmitTeyrchainHeadsHelper<T, I> {
@@ -292,7 +292,7 @@ mod tests {
}
fn insert_relay_block(num: RelayBlockNumber) {
pallet_bridge_grandpa::ImportedHeaders::<TestRuntime, crate::Instance1>::insert(
pezpallet_bridge_grandpa::ImportedHeaders::<TestRuntime, crate::Instance1>::insert(
RelayBlockHash::from([num as u8; 32]),
StoredHeaderData { number: num, state_root: RelayBlockHash::from([10u8; 32]) },
);
+40 -40
View File
@@ -34,10 +34,10 @@ use bp_teyrchains::{
ParaInfo, ParaStoredHeaderData, RelayBlockHash, RelayBlockHasher, RelayBlockNumber,
SubmitTeyrchainHeadsInfo,
};
use frame_support::{dispatch::PostDispatchInfo, DefaultNoBound};
use pallet_bridge_grandpa::SubmitFinalityProofHelper;
use pezframe_support::{dispatch::PostDispatchInfo, DefaultNoBound};
use pezpallet_bridge_grandpa::SubmitFinalityProofHelper;
use proofs::{StorageProofAdapter, TeyrchainsStorageProofAdapter};
use sp_std::{marker::PhantomData, vec::Vec};
use pezsp_std::{marker::PhantomData, vec::Vec};
#[cfg(feature = "runtime-benchmarks")]
use bp_runtime::HeaderOf;
@@ -72,7 +72,7 @@ struct UpdateTeyrchainHeadArtifacts {
pub prune_happened: bool,
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use bp_runtime::{
@@ -83,8 +83,8 @@ pub mod pallet {
BestParaHeadHash, ImportedParaHeadsKeyProvider, OnNewHead, ParaStoredHeaderDataBuilder,
ParasInfoKeyProvider,
};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
/// Stored teyrchain head data of given teyrchains pallet.
pub type StoredParaHeadDataOf<T, I> =
@@ -93,7 +93,7 @@ pub mod pallet {
pub type WeightInfoOf<T, I> = <T as Config<I>>::WeightInfo;
/// Bridge GRANDPA pallet that is used to verify teyrchain proofs.
pub type GrandpaPalletOf<T, I> =
pallet_bridge_grandpa::Pallet<T, <T as Config<I>>::BridgesGrandpaPalletInstance>;
pezpallet_bridge_grandpa::Pallet<T, <T as Config<I>>::BridgesGrandpaPalletInstance>;
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
@@ -158,7 +158,7 @@ pub mod pallet {
/// Convenience trait for defining `BridgedChain` bounds.
pub trait BoundedBridgeGrandpaConfig<I: 'static>:
pallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
pezpallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
{
/// Type of the bridged relay chain.
type BridgedRelayChain: Chain<
@@ -170,7 +170,7 @@ pub mod pallet {
impl<T, I: 'static> BoundedBridgeGrandpaConfig<I> for T
where
T: pallet_bridge_grandpa::Config<I>,
T: pezpallet_bridge_grandpa::Config<I>,
T::BridgedChain:
Chain<BlockNumber = RelayBlockNumber, Hash = RelayBlockHash, Hasher = RelayBlockHasher>,
{
@@ -178,14 +178,14 @@ pub mod pallet {
}
#[pallet::config]
#[pallet::disable_frame_system_supertrait_check]
#[pallet::disable_pezframe_system_supertrait_check]
pub trait Config<I: 'static = ()>:
BoundedBridgeGrandpaConfig<Self::BridgesGrandpaPalletInstance>
{
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// Benchmarks results from runtime we're plugged into.
type WeightInfo: WeightInfoExt;
@@ -214,14 +214,14 @@ pub mod pallet {
/// chain.
///
/// Please keep in mind that this should be the name of the `runtime_teyrchains::paras`
/// pallet from pezkuwi repository, not the `pallet-bridge-teyrchains`.
/// pallet from pezkuwi repository, not the `pezpallet-bridge-teyrchains`.
#[pallet::constant]
type ParasPalletName: Get<&'static str>;
/// Teyrchain head data builder.
///
/// We never store teyrchain heads here, since they may be too big (e.g. because of large
/// digest items). Instead we're using the same approach as `pallet-bridge-grandpa`
/// digest items). Instead we're using the same approach as `pezpallet-bridge-grandpa`
/// pallet - we are only storing `bp_messages::StoredHeaderData` (number and state root),
/// which is enough for our applications. However, we work with different teyrchains here
/// and they can use different primitives (for block numbers and hash). So we can't store
@@ -433,7 +433,7 @@ pub mod pallet {
// we'll need relay chain header to verify that teyrchains heads are always increasing.
let (relay_block_number, relay_block_hash) = at_relay_block;
let relay_block = pallet_bridge_grandpa::ImportedHeaders::<
let relay_block = pezpallet_bridge_grandpa::ImportedHeaders::<
T,
T::BridgesGrandpaPalletInstance,
>::get(relay_block_hash)
@@ -583,7 +583,7 @@ pub mod pallet {
&& SubmitFinalityProofHelper::<T, T::BridgesGrandpaPalletInstance>::has_free_header_slots();
let pays_fee = if is_free {
tracing::trace!(target: LOG_TARGET, "Teyrchain heads update transaction is free");
pallet_bridge_grandpa::on_free_header_imported::<T, T::BridgesGrandpaPalletInstance>(
pezpallet_bridge_grandpa::on_free_header_imported::<T, T::BridgesGrandpaPalletInstance>(
);
Pays::No
} else {
@@ -743,7 +743,7 @@ pub mod pallet {
pub owner: Option<T::AccountId>,
/// Dummy marker.
#[serde(skip)]
pub _phantom: sp_std::marker::PhantomData<I>,
pub _phantom: pezsp_std::marker::PhantomData<I>,
}
#[pallet::genesis_build]
@@ -791,17 +791,17 @@ impl<T: Config<I>, I: 'static, C: Teyrchain<Hash = ParaHash>> HeaderChain<C>
}
}
/// (Re)initialize pallet with given header for using it in `pallet-bridge-messages` benchmarks.
/// (Re)initialize pallet with given header for using it in `pezpallet-bridge-messages` benchmarks.
#[cfg(feature = "runtime-benchmarks")]
pub fn initialize_for_benchmarks<T: Config<I>, I: 'static, PC: Teyrchain<Hash = ParaHash>>(
header: HeaderOf<PC>,
) {
use bp_pezkuwi_core::teyrchains::ParaHead;
use bp_runtime::HeaderIdProvider;
use sp_runtime::traits::Header;
use pezsp_runtime::traits::Header;
let relay_head =
pallet_bridge_grandpa::BridgedHeader::<T, T::BridgesGrandpaPalletInstance>::new(
pezpallet_bridge_grandpa::BridgedHeader::<T, T::BridgesGrandpaPalletInstance>::new(
0,
Default::default(),
Default::default(),
@@ -812,7 +812,7 @@ pub fn initialize_for_benchmarks<T: Config<I>, I: 'static, PC: Teyrchain<Hash =
let teyrchain_head = ParaHead(header.encode());
let updated_head_data = T::ParaStoredHeaderDataBuilder::try_build(teyrchain, &teyrchain_head)
.expect("failed to build stored teyrchain head in benchmarks");
pallet_bridge_grandpa::initialize_for_benchmarks::<T, T::BridgesGrandpaPalletInstance>(
pezpallet_bridge_grandpa::initialize_for_benchmarks::<T, T::BridgesGrandpaPalletInstance>(
relay_head.clone(),
);
Pallet::<T, I>::update_teyrchain_head(
@@ -850,25 +850,25 @@ pub(crate) mod tests {
use bp_teyrchains::{
BestParaHeadHash, BridgeTeyrchainCall, ImportedParaHeadsKeyProvider, ParasInfoKeyProvider,
};
use frame_support::{
use pezframe_support::{
assert_noop, assert_ok,
dispatch::DispatchResultWithPostInfo,
pallet_prelude::Pays,
pezpallet_prelude::Pays,
storage::generator::{StorageDoubleMap, StorageMap},
traits::Get,
weights::Weight,
};
use frame_system::{EventRecord, Pallet as System, Phase};
use sp_core::Hasher;
use sp_runtime::{traits::Header as HeaderT, DispatchError};
use pezframe_system::{EventRecord, Pallet as System, Phase};
use pezsp_core::Hasher;
use pezsp_runtime::{traits::Header as HeaderT, DispatchError};
type BridgesGrandpaPalletInstance = pallet_bridge_grandpa::Instance1;
type BridgesGrandpaPalletInstance = pezpallet_bridge_grandpa::Instance1;
type WeightInfo = <TestRuntime as Config>::WeightInfo;
type DbWeight = <TestRuntime as frame_system::Config>::DbWeight;
type DbWeight = <TestRuntime as pezframe_system::Config>::DbWeight;
pub(crate) fn initialize(state_root: RelayBlockHash) -> RelayBlockHash {
pallet_bridge_grandpa::FreeHeadersRemaining::<TestRuntime, BridgesGrandpaPalletInstance>::set(Some(100));
pallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::initialize(
pezpallet_bridge_grandpa::FreeHeadersRemaining::<TestRuntime, BridgesGrandpaPalletInstance>::set(Some(100));
pezpallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::initialize(
RuntimeOrigin::root(),
bp_header_chain::InitializationData {
header: Box::new(test_relay_header(0, state_root)),
@@ -893,7 +893,7 @@ pub(crate) mod tests {
let hash = header.hash();
let justification = make_default_justification(&header);
assert_ok!(
pallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof_ex(
pezpallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof_ex(
RuntimeOrigin::signed(1),
Box::new(header),
justification.clone(),
@@ -974,7 +974,7 @@ pub(crate) mod tests {
}
fn weight_of_import_teyrchain_1_head(proof: &ParaHeadsProof, prune_expected: bool) -> Weight {
let db_weight = <TestRuntime as frame_system::Config>::DbWeight::get();
let db_weight = <TestRuntime as pezframe_system::Config>::DbWeight::get();
WeightInfoOf::<TestRuntime, ()>::submit_teyrchain_heads_weight(db_weight, proof, 1)
.saturating_sub(if prune_expected {
Weight::zero()
@@ -1180,7 +1180,7 @@ pub(crate) mod tests {
EventRecord {
phase: Phase::Initialization,
event: TestEvent::Grandpa1(
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
pezpallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
number: 1,
hash: relay_1_hash,
grandpa_info: StoredHeaderGrandpaInfo {
@@ -1321,7 +1321,7 @@ pub(crate) mod tests {
EventRecord {
phase: Phase::Initialization,
event: TestEvent::Grandpa1(
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
pezpallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
number: 1,
hash: relay_1_hash,
grandpa_info: StoredHeaderGrandpaInfo {
@@ -1374,7 +1374,7 @@ pub(crate) mod tests {
EventRecord {
phase: Phase::Initialization,
event: TestEvent::Grandpa1(
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
pezpallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
number: 1,
hash: relay_1_hash,
grandpa_info: StoredHeaderGrandpaInfo {
@@ -1415,7 +1415,7 @@ pub(crate) mod tests {
EventRecord {
phase: Phase::Initialization,
event: TestEvent::Grandpa1(
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
pezpallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
number: 1,
hash: relay_1_hash,
grandpa_info: StoredHeaderGrandpaInfo {
@@ -1842,7 +1842,7 @@ pub(crate) mod tests {
initialize(Default::default());
// set free headers limit to `4`
let mut free_headers_remaining = 4;
pallet_bridge_grandpa::FreeHeadersRemaining::<TestRuntime, BridgesGrandpaPalletInstance>::set(
pezpallet_bridge_grandpa::FreeHeadersRemaining::<TestRuntime, BridgesGrandpaPalletInstance>::set(
Some(free_headers_remaining),
);
// import free GRANDPA and teyrchain headers
@@ -1855,7 +1855,7 @@ pub(crate) mod tests {
relay_block_number = relay_block_number + FreeHeadersInterval::get();
proceed(relay_block_number, state_root);
assert_eq!(
pallet_bridge_grandpa::FreeHeadersRemaining::<
pezpallet_bridge_grandpa::FreeHeadersRemaining::<
TestRuntime,
BridgesGrandpaPalletInstance,
>::get(),
@@ -1870,7 +1870,7 @@ pub(crate) mod tests {
proof,
),);
assert_eq!(
pallet_bridge_grandpa::FreeHeadersRemaining::<
pezpallet_bridge_grandpa::FreeHeadersRemaining::<
TestRuntime,
BridgesGrandpaPalletInstance,
>::get(),
@@ -1882,7 +1882,7 @@ pub(crate) mod tests {
let (state_root, proof, teyrchains) =
prepare_teyrchain_heads_proof::<RegularTeyrchainHeader>(vec![(2, head_data(2, 7))]);
relay_block_number = relay_block_number + FreeHeadersInterval::get();
let result = pallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof_ex(
let result = pezpallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof_ex(
RuntimeOrigin::signed(1),
Box::new(test_relay_header(relay_block_number, state_root)),
make_default_justification(&test_relay_header(relay_block_number, state_root)),
@@ -1899,7 +1899,7 @@ pub(crate) mod tests {
);
assert_eq!(result.unwrap().pays_fee, Pays::Yes);
assert_eq!(
pallet_bridge_grandpa::FreeHeadersRemaining::<
pezpallet_bridge_grandpa::FreeHeadersRemaining::<
TestRuntime,
BridgesGrandpaPalletInstance,
>::get(),
+21 -21
View File
@@ -17,23 +17,23 @@
use bp_header_chain::ChainWithGrandpa;
use bp_pezkuwi_core::teyrchains::ParaId;
use bp_runtime::{Chain, ChainId, Teyrchain};
use frame_support::{
use pezframe_support::{
construct_runtime, derive_impl, parameter_types, traits::ConstU32, weights::Weight,
};
use sp_runtime::{
use pezsp_runtime::{
testing::H256,
traits::{BlakeTwo256, Header as HeaderT},
MultiSignature, StateVersion,
};
use crate as pallet_bridge_teyrchains;
use crate as pezpallet_bridge_teyrchains;
pub type AccountId = u64;
pub type RelayBlockHeader =
sp_runtime::generic::Header<crate::RelayBlockNumber, crate::RelayBlockHasher>;
pezsp_runtime::generic::Header<crate::RelayBlockNumber, crate::RelayBlockHasher>;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
pub const PARAS_PALLET_NAME: &str = "Paras";
pub const UNTRACKED_TEYRCHAIN_ID: u32 = 10;
@@ -42,9 +42,9 @@ pub const MAXIMAL_TEYRCHAIN_HEAD_DATA_SIZE: u32 = 1 + 8 + 32;
// total teyrchains that we use in tests
pub const TOTAL_TEYRCHAINS: u32 = 4;
pub type RegularTeyrchainHeader = sp_runtime::testing::Header;
pub type RegularTeyrchainHeader = pezsp_runtime::testing::Header;
pub type RegularTeyrchainHasher = BlakeTwo256;
pub type BigTeyrchainHeader = sp_runtime::generic::Header<u128, BlakeTwo256>;
pub type BigTeyrchainHeader = pezsp_runtime::generic::Header<u128, BlakeTwo256>;
pub struct Teyrchain1;
@@ -166,15 +166,15 @@ impl Teyrchain for BigTeyrchain {
construct_runtime! {
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Grandpa1: pallet_bridge_grandpa::<Instance1>::{Pallet, Event<T>},
Grandpa2: pallet_bridge_grandpa::<Instance2>::{Pallet, Event<T>},
Teyrchains: pallet_bridge_teyrchains::{Call, Pallet, Event<T>},
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Grandpa1: pezpallet_bridge_grandpa::<Instance1>::{Pallet, Event<T>},
Grandpa2: pezpallet_bridge_grandpa::<Instance2>::{Pallet, Event<T>},
Teyrchains: pezpallet_bridge_teyrchains::{Call, Pallet, Event<T>},
}
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = Block;
}
@@ -183,7 +183,7 @@ parameter_types! {
pub const FreeHeadersInterval: u32 = 15;
}
impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRuntime {
impl pezpallet_bridge_grandpa::Config<pezpallet_bridge_grandpa::Instance1> for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type BridgedChain = TestBridgedChain;
type MaxFreeHeadersPerBlock = ConstU32<2>;
@@ -192,7 +192,7 @@ impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRun
type WeightInfo = ();
}
impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance2> for TestRuntime {
impl pezpallet_bridge_grandpa::Config<pezpallet_bridge_grandpa::Instance2> for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type BridgedChain = TestBridgedChain;
type MaxFreeHeadersPerBlock = ConstU32<2>;
@@ -207,10 +207,10 @@ parameter_types! {
pub GetTenFirstTeyrchains: Vec<ParaId> = (0..10).map(ParaId).collect();
}
impl pallet_bridge_teyrchains::Config for TestRuntime {
impl pezpallet_bridge_teyrchains::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type BridgesGrandpaPalletInstance = pallet_bridge_grandpa::Instance1;
type BridgesGrandpaPalletInstance = pezpallet_bridge_grandpa::Instance1;
type ParasPalletName = ParasPalletName;
type ParaStoredHeaderDataBuilder = (Teyrchain1, Teyrchain2, Teyrchain3, BigTeyrchain);
type HeadsToKeep = HeadsToKeep;
@@ -219,7 +219,7 @@ impl pallet_bridge_teyrchains::Config for TestRuntime {
}
#[cfg(feature = "runtime-benchmarks")]
impl pallet_bridge_teyrchains::benchmarking::Config<()> for TestRuntime {
impl pezpallet_bridge_teyrchains::benchmarking::Config<()> for TestRuntime {
fn teyrchains() -> Vec<ParaId> {
vec![
ParaId(Teyrchain1::TEYRCHAIN_ID),
@@ -263,7 +263,7 @@ impl Chain for TestBridgedChain {
type AccountId = AccountId;
type Balance = u32;
type Nonce = u32;
type Signature = sp_runtime::testing::TestSignature;
type Signature = pezsp_runtime::testing::TestSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
@@ -285,8 +285,8 @@ impl ChainWithGrandpa for TestBridgedChain {
}
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
sp_io::TestExternalities::new(Default::default())
pub fn new_test_ext() -> pezsp_io::TestExternalities {
pezsp_io::TestExternalities::new(Default::default())
}
/// Run pallet test.
+2 -2
View File
@@ -22,7 +22,7 @@ use bp_pezkuwi_core::teyrchains::{ParaHead, ParaId};
use bp_runtime::{RawStorageProof, StorageProofChecker, StorageProofError};
use bp_teyrchains::teyrchain_head_storage_key_at_source;
use codec::Decode;
use frame_support::traits::Get;
use pezframe_support::traits::Get;
/// Abstraction over storage proof manipulation, hiding implementation details of actual storage
/// proofs.
@@ -53,7 +53,7 @@ pub type TeyrchainsStorageProofAdapter<T, I> = RawStorageProofAdapter<T, I>;
/// A `StorageProofAdapter` implementation for raw storage proofs.
pub struct RawStorageProofAdapter<T: Config<I>, I: 'static> {
storage: StorageProofChecker<RelayBlockHasher>,
_dummy: sp_std::marker::PhantomData<(T, I)>,
_dummy: pezsp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> RawStorageProofAdapter<T, I> {
+8 -8
View File
@@ -14,9 +14,9 @@
// 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_bridge_teyrchains
//! Autogenerated weights for pezpallet_bridge_teyrchains
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `serban-ROG-Zephyrus`, CPU: `12th Gen Intel(R) Core(TM) i7-12700H`
@@ -29,7 +29,7 @@
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_bridge_teyrchains
// --pallet=pezpallet_bridge_teyrchains
// --extrinsic=*
// --execution=wasm
// --wasm-execution=Compiled
@@ -42,24 +42,24 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
use pezframe_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
use sp_std::marker::PhantomData;
use pezsp_std::marker::PhantomData;
/// Weight functions needed for pallet_bridge_teyrchains.
/// Weight functions needed for pezpallet_bridge_teyrchains.
pub trait WeightInfo {
fn submit_teyrchain_heads_with_n_teyrchains(p: u32) -> Weight;
fn submit_teyrchain_heads_with_1kb_proof() -> Weight;
fn submit_teyrchain_heads_with_16kb_proof() -> Weight;
}
/// Weights for `pallet_bridge_teyrchains` that are generated using one of the Bridge testnets.
/// Weights for `pezpallet_bridge_teyrchains` that are generated using one of the Bridge testnets.
///
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfo for BridgeWeight<T> {
/// Storage: BridgeUnknownTeyrchains PalletOperatingMode (r:1 w:0)
///
/// Proof: BridgeUnknownTeyrchains PalletOperatingMode (max_values: Some(1), max_size: Some(1),
@@ -19,7 +19,7 @@
use crate::weights::{BridgeWeight, WeightInfo};
use bp_runtime::Size;
use frame_support::weights::{RuntimeDbWeight, Weight};
use pezframe_support::weights::{RuntimeDbWeight, Weight};
/// Size of the regular teyrchain head.
///
@@ -42,7 +42,7 @@ pub trait WeightInfoExt: WeightInfo {
//
// 2) slash relayer if he submits an invalid transaction.
//
// We read and update storage values of other pallets (`pallet-bridge-relayers` and
// We read and update storage values of other pallets (`pezpallet-bridge-relayers` and
// balances/assets pallet). So we need to add this weight to the weight of our call.
// Hence two following methods.
@@ -121,7 +121,7 @@ impl WeightInfoExt for () {
}
}
impl<T: frame_system::Config> WeightInfoExt for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfoExt for BridgeWeight<T> {
fn submit_teyrchain_heads_overhead_from_runtime() -> Weight {
Weight::zero()
}
@@ -1,5 +1,5 @@
[package]
name = "pallet-xcm-bridge-hub-router"
name = "pezpallet-xcm-bridge-hub-router"
description = "Bridge hub interface for sibling/parent chains with dynamic fees support."
version = "0.5.0"
authors.workspace = true
@@ -18,13 +18,13 @@ tracing = { workspace = true }
# Bridge dependencies
bp-xcm-bridge-hub-router = { workspace = true }
# Substrate Dependencies
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# Bizinikiwi Dependencies
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-core = { workspace = true }
pezsp-runtime = { workspace = true }
pezsp-std = { workspace = true }
# Pezkuwi Dependencies
pezkuwi-runtime-teyrchains = { workspace = true }
@@ -32,39 +32,39 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
[dev-dependencies]
sp-io = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"pezframe-benchmarking/std",
"pezframe-support/std",
"pezframe-system/std",
"pezkuwi-runtime-teyrchains/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"pezsp-core/std",
"pezsp-runtime/std",
"pezsp-std/std",
"tracing/std",
"xcm-builder/std",
"xcm/std",
]
runtime-benchmarks = [
"bp-xcm-bridge-hub-router/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezkuwi-runtime-teyrchains/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezkuwi-runtime-teyrchains/try-runtime",
"sp-runtime/try-runtime",
"pezsp-runtime/try-runtime",
]
@@ -19,10 +19,10 @@
#![cfg(feature = "runtime-benchmarks")]
use crate::{Bridge, BridgeState, Call};
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError};
use frame_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
use pezframe_benchmarking::{benchmarks_instance_pallet, BenchmarkError};
use pezframe_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
use pezkuwi_runtime_teyrchains::FeeTracker;
use sp_runtime::{traits::Zero, Saturating};
use pezsp_runtime::{traits::Zero, Saturating};
use xcm::prelude::*;
/// Pallet we're benchmarking here.
@@ -24,8 +24,8 @@
//! this chain.
//!
//! **A note on terminology**: when we mention the bridge hub here, we mean the chain that
//! has the messages pallet deployed (`pallet-bridge-grandpa`, `pallet-bridge-messages`,
//! `pallet-xcm-bridge-hub`, ...). It may be the system bridge hub teyrchain or any other
//! has the messages pallet deployed (`pezpallet-bridge-grandpa`, `pezpallet-bridge-messages`,
//! `pezpallet-xcm-bridge-hub`, ...). It may be the system bridge hub teyrchain or any other
//! chain.
#![cfg_attr(not(feature = "std"), no_std)]
@@ -33,11 +33,11 @@
use bp_xcm_bridge_hub_router::MINIMAL_DELIVERY_FEE_FACTOR;
pub use bp_xcm_bridge_hub_router::{BridgeState, XcmChannelStatusProvider};
use codec::Encode;
use frame_support::traits::Get;
use pezframe_support::traits::Get;
use pezkuwi_runtime_teyrchains::FeeTracker;
use sp_core::H256;
use sp_runtime::{FixedPointNumber, FixedU128};
use sp_std::vec::Vec;
use pezsp_core::H256;
use pezsp_runtime::{FixedPointNumber, FixedU128};
use pezsp_std::vec::Vec;
use xcm::prelude::*;
use xcm_builder::{ExporterFor, InspectMessageQueues, SovereignPaidRemoteExporter};
@@ -63,18 +63,18 @@ pub const HARD_MESSAGE_SIZE_LIMIT: u32 = 32 * 1024;
/// bridge hub teyrchain.
pub const LOG_TARGET: &str = "xcm::bridge-hub-router";
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// Benchmarks results from runtime we're plugged into.
type WeightInfo: WeightInfo;
@@ -445,12 +445,12 @@ impl<T: Config<I>, I: 'static> FeeTracker for Pallet<T, I> {
#[cfg(test)]
mod tests {
use super::*;
use frame_support::assert_ok;
use pezframe_support::assert_ok;
use mock::*;
use frame_support::traits::Hooks;
use frame_system::{EventRecord, Phase};
use sp_runtime::traits::One;
use pezframe_support::traits::Hooks;
use pezframe_system::{EventRecord, Phase};
use pezsp_runtime::traits::One;
fn congested_bridge(delivery_fee_factor: FixedU128) -> BridgeState {
BridgeState { is_congested: true, delivery_fee_factor }
@@ -16,20 +16,20 @@
#![cfg(test)]
use crate as pallet_xcm_bridge_hub_router;
use crate as pezpallet_xcm_bridge_hub_router;
use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
use codec::Encode;
use frame_support::{
use pezframe_support::{
construct_runtime, derive_impl, parameter_types,
traits::{Contains, Equals},
};
use sp_runtime::{traits::ConstU128, BuildStorage};
use sp_std::cell::RefCell;
use pezsp_runtime::{traits::ConstU128, BuildStorage};
use pezsp_std::cell::RefCell;
use xcm::prelude::*;
use xcm_builder::{InspectMessageQueues, NetworkExportTable, NetworkExportTableItem};
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
/// HRMP fee.
pub const HRMP_FEE: u128 = 500;
@@ -41,8 +41,8 @@ pub const BYTE_FEE: u128 = 1_000;
construct_runtime! {
pub enum TestRuntime
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
XcmBridgeHubRouter: pallet_xcm_bridge_hub_router::{Pallet, Storage, Event<T>},
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
XcmBridgeHubRouter: pezpallet_xcm_bridge_hub_router::{Pallet, Storage, Event<T>},
}
}
@@ -64,12 +64,12 @@ parameter_types! {
pub UnknownXcmVersionForRoutableLocation: Location = Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Teyrchain(9999)]);
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type Block = Block;
}
impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
impl pezpallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
@@ -80,7 +80,7 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
type DestinationVersion =
LatestOrNoneForLocationVersionChecker<Equals<UnknownXcmVersionForRoutableLocation>>;
type BridgeHubOrigin = frame_system::EnsureRoot<u64>;
type BridgeHubOrigin = pezframe_system::EnsureRoot<u64>;
type ToBridgeHubSender = TestToBridgeHubSender;
type LocalXcmChannelManager = TestLocalXcmChannelManager;
@@ -88,7 +88,7 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
type FeeAsset = BridgeFeeAsset;
}
pub struct LatestOrNoneForLocationVersionChecker<Location>(sp_std::marker::PhantomData<Location>);
pub struct LatestOrNoneForLocationVersionChecker<Location>(pezsp_std::marker::PhantomData<Location>);
impl<LocationValue: Contains<Location>> GetVersion
for LatestOrNoneForLocationVersionChecker<LocationValue>
{
@@ -155,7 +155,7 @@ pub struct TestLocalXcmChannelManager;
impl TestLocalXcmChannelManager {
pub fn make_congested(with: &Location) {
frame_support::storage::unhashed::put(
pezframe_support::storage::unhashed::put(
&(b"TestLocalXcmChannelManager.Congested", with).encode()[..],
&true,
);
@@ -164,16 +164,16 @@ impl TestLocalXcmChannelManager {
impl XcmChannelStatusProvider for TestLocalXcmChannelManager {
fn is_congested(with: &Location) -> bool {
frame_support::storage::unhashed::get_or_default(
pezframe_support::storage::unhashed::get_or_default(
&(b"TestLocalXcmChannelManager.Congested", with).encode()[..],
)
}
}
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
sp_io::TestExternalities::new(t)
pub fn new_test_ext() -> pezsp_io::TestExternalities {
let t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
pezsp_io::TestExternalities::new(t)
}
/// Run pallet test.
@@ -187,5 +187,5 @@ pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
}
pub(crate) fn fake_message_hash<T>(message: &Xcm<T>) -> XcmHash {
message.using_encoded(sp_io::hashing::blake2_256)
message.using_encoded(pezsp_io::hashing::blake2_256)
}
@@ -14,9 +14,9 @@
// 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_xcm_bridge_hub_router
//! Autogenerated weights for pezpallet_xcm_bridge_hub_router
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-08-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
@@ -29,7 +29,7 @@
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_xcm_bridge_hub_router
// --pallet=pezpallet_xcm_bridge_hub_router
// --extrinsic=*
// --execution=wasm
// --wasm-execution=Compiled
@@ -42,24 +42,24 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
use pezframe_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
use sp_std::marker::PhantomData;
use pezsp_std::marker::PhantomData;
/// Weight functions needed for pallet_xcm_bridge_hub_router.
/// Weight functions needed for pezpallet_xcm_bridge_hub_router.
pub trait WeightInfo {
fn on_initialize_when_non_congested() -> Weight;
fn on_initialize_when_congested() -> Weight;
fn report_bridge_status() -> Weight;
}
/// Weights for `pallet_xcm_bridge_hub_router` that are generated using one of the Bridge testnets.
/// Weights for `pezpallet_xcm_bridge_hub_router` that are generated using one of the Bridge testnets.
///
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
impl<T: pezframe_system::Config> WeightInfo for BridgeWeight<T> {
///
/// Storage: `XcmBridgeHubRouter::DeliveryFeeFactor` (r:1 w:1)
///
+33 -33
View File
@@ -1,5 +1,5 @@
[package]
name = "pallet-xcm-bridge-hub"
name = "pezpallet-xcm-bridge-hub"
description = "Module that adds dynamic bridges/lanes support to XCM infrastructure at the bridge hub."
version = "0.2.0"
authors.workspace = true
@@ -19,14 +19,14 @@ tracing = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge-hub = { workspace = true }
pallet-bridge-messages = { workspace = true }
pezpallet-bridge-messages = { workspace = true }
# Substrate Dependencies
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# Bizinikiwi Dependencies
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-core = { workspace = true }
pezsp-runtime = { workspace = true }
pezsp-std = { workspace = true }
# Pezkuwi Dependencies
xcm = { workspace = true }
@@ -36,10 +36,10 @@ xcm-executor = { workspace = true }
[dev-dependencies]
bp-header-chain = { workspace = true }
bp-xcm-bridge-hub-router = { workspace = true }
pallet-balances = { workspace = true }
pallet-xcm-bridge-hub-router = { workspace = true }
pezpallet-balances = { workspace = true }
pezpallet-xcm-bridge-hub-router = { workspace = true }
pezkuwi-teyrchain-primitives = { workspace = true }
sp-io = { workspace = true }
pezsp-io = { workspace = true }
[features]
default = ["std"]
@@ -50,17 +50,17 @@ std = [
"bp-xcm-bridge-hub-router/std",
"bp-xcm-bridge-hub/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"pallet-bridge-messages/std",
"pallet-xcm-bridge-hub-router/std",
"pezframe-support/std",
"pezframe-system/std",
"pezpallet-balances/std",
"pezpallet-bridge-messages/std",
"pezpallet-xcm-bridge-hub-router/std",
"pezkuwi-teyrchain-primitives/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-runtime/std",
"pezsp-std/std",
"tracing/std",
"xcm-builder/std",
"xcm-executor/std",
@@ -72,23 +72,23 @@ runtime-benchmarks = [
"bp-runtime/runtime-benchmarks",
"bp-xcm-bridge-hub-router/runtime-benchmarks",
"bp-xcm-bridge-hub/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bridge-messages/runtime-benchmarks",
"pallet-xcm-bridge-hub-router/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-bridge-messages/runtime-benchmarks",
"pezpallet-xcm-bridge-hub-router/runtime-benchmarks",
"pezkuwi-teyrchain-primitives/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-bridge-messages/try-runtime",
"pallet-xcm-bridge-hub-router/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-balances/try-runtime",
"pezpallet-bridge-messages/try-runtime",
"pezpallet-xcm-bridge-hub-router/try-runtime",
"pezsp-runtime/try-runtime",
]
@@ -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/>.
//! The code that allows to use the pallet (`pallet-xcm-bridge-hub`) as inbound
//! The code that allows to use the pallet (`pezpallet-xcm-bridge-hub`) as inbound
//! bridge messages dispatcher. Internally, it just forwards inbound blob to the
//! XCM-level blob dispatcher, which pushes message to some other queue (e.g.
//! to HRMP queue with the sibling target chain).
@@ -27,10 +27,10 @@ use bp_messages::target_chain::{DispatchMessage, MessageDispatch};
use bp_runtime::messages::MessageDispatchResult;
use bp_xcm_bridge_hub::{LocalXcmChannelManager, XcmAsPlainPayload};
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::{weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
use pallet_bridge_messages::{Config as BridgeMessagesConfig, WeightInfoExt};
use pezframe_support::{weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, WeightInfoExt};
use scale_info::TypeInfo;
use sp_runtime::SaturatedConversion;
use pezsp_runtime::SaturatedConversion;
use xcm::prelude::*;
use xcm_builder::{DispatchBlob, DispatchBlobError};
@@ -136,8 +136,8 @@ mod tests {
use bp_messages::{target_chain::DispatchMessageData, LaneIdType, MessageKey};
use bp_xcm_bridge_hub::{Bridge, BridgeLocations, BridgeState};
use frame_support::assert_ok;
use pallet_bridge_messages::InboundLaneStorage;
use pezframe_support::assert_ok;
use pezpallet_bridge_messages::InboundLaneStorage;
use xcm_executor::traits::ConvertLocation;
fn bridge() -> (Box<BridgeLocations>, TestLaneIdType) {
+12 -12
View File
@@ -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/>.
//! The code that allows to use the pallet (`pallet-xcm-bridge-hub`) as XCM message
//! The code that allows to use the pallet (`pezpallet-xcm-bridge-hub`) as XCM message
//! exporter at the sending bridge hub. Internally, it just enqueues outbound blob
//! in the messages pallet queue.
//!
@@ -29,8 +29,8 @@ use bp_messages::{
MessageNonce,
};
use bp_xcm_bridge_hub::{BridgeId, BridgeState, LocalXcmChannelManager, XcmAsPlainPayload};
use frame_support::{ensure, traits::Get};
use pallet_bridge_messages::{
use pezframe_support::{ensure, traits::Get};
use pezpallet_bridge_messages::{
Config as BridgeMessagesConfig, Error, Pallet as BridgeMessagesPallet,
};
use xcm::prelude::*;
@@ -225,7 +225,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
return;
}
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2006 we either need fishermens
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/83 we either need fishermens
// to watch this rule violation (suspended, but keep sending new messages), or we need a
// hard limit for that like other XCM queues have
@@ -373,8 +373,8 @@ mod tests {
use bp_runtime::RangeInclusiveExt;
use bp_xcm_bridge_hub::{Bridge, BridgeLocations, BridgeState};
use frame_support::{assert_ok, traits::EnsureOrigin};
use pallet_bridge_messages::InboundLaneStorage;
use pezframe_support::{assert_ok, traits::EnsureOrigin};
use pezpallet_bridge_messages::InboundLaneStorage;
use xcm_builder::{NetworkExportTable, UnpaidRemoteExporter};
use xcm_executor::traits::{export_xcm, ConvertLocation};
@@ -663,7 +663,7 @@ mod tests {
// check before - no messages
assert_eq!(
pallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
pezpallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
expected_lane_id
)
.unwrap()
@@ -685,7 +685,7 @@ mod tests {
// we need to set `UniversalLocation` for `sibling_teyrchain_origin` for
// `XcmOverBridgeWrappedWithExportMessageRouterInstance`.
ExportMessageOriginUniversalLocation::set(Some(SiblingUniversalLocation::get()));
// send `ExportMessage(message)` by `pallet_xcm_bridge_hub_router`.
// send `ExportMessage(message)` by `pezpallet_xcm_bridge_hub_router`.
ExecuteXcmOverSendXcm::set_origin_for_execute(SiblingLocation::get());
assert_ok!(send_xcm::<XcmOverBridgeWrappedWithExportMessageRouter>(
dest.clone(),
@@ -694,7 +694,7 @@ mod tests {
// check after - a message ready to be relayed
assert_eq!(
pallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
pezpallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
expected_lane_id
)
.unwrap()
@@ -804,8 +804,8 @@ mod tests {
// valid routable destination
let dest = Location::new(2, BridgedUniversalDestination::get());
fn router_bridge_state() -> pallet_xcm_bridge_hub_router::BridgeState {
pallet_xcm_bridge_hub_router::Bridge::<
fn router_bridge_state() -> pezpallet_xcm_bridge_hub_router::BridgeState {
pezpallet_xcm_bridge_hub_router::Bridge::<
TestRuntime,
XcmOverBridgeWrappedWithExportMessageRouterInstance,
>::get()
@@ -835,7 +835,7 @@ mod tests {
// make bridges congested with sending too much messages
for _ in 1..(OUTBOUND_LANE_CONGESTED_THRESHOLD + 2) {
// send `ExportMessage(message)` by `pallet_xcm_bridge_hub_router`.
// send `ExportMessage(message)` by `pezpallet_xcm_bridge_hub_router`.
ExecuteXcmOverSendXcm::set_origin_for_execute(origin_as_location.clone());
assert_ok!(send_xcm::<XcmOverBridgeWrappedWithExportMessageRouter>(
dest.clone(),
+43 -43
View File
@@ -18,13 +18,13 @@
//! open and close bridges between local (to this pallet location) and remote XCM
//! destinations.
//!
//! The `pallet_xcm_bridge_hub` pallet is used to manage (open, close) bridges between chains from
//! The `pezpallet_xcm_bridge_hub` pallet is used to manage (open, close) bridges between chains from
//! different consensuses. The new extrinsics `fn open_bridge` and `fn close_bridge` are introduced.
//! Other chains can manage channels with different bridged global consensuses.
//!
//! # Concept of `lane` and `LaneId`
//!
//! There is another `pallet_bridge_messages` pallet that handles inbound/outbound lanes for
//! There is another `pezpallet_bridge_messages` pallet that handles inbound/outbound lanes for
//! messages. Each lane is a unique connection between two chains from different consensuses and is
//! identified by `LaneId`. `LaneId` is generated once when a new bridge is requested by `fn
//! open_bridge`. It is generated by `BridgeLocations::calculate_lane_id` based on the following
@@ -48,7 +48,7 @@
//!
//! # Concept of `bridge` and `BridgeId`
//!
//! The `pallet_xcm_bridge_hub` pallet needs to store some metadata about opened bridges. The bridge
//! The `pezpallet_xcm_bridge_hub` pallet needs to store some metadata about opened bridges. The bridge
//! (or bridge metadata) is stored under the `BridgeId` key.
//!
//! `BridgeId` is generated from `bridge_origin_relative_location` and
@@ -71,8 +71,8 @@
//!
//! # How to Open a Bridge?
//!
//! The `pallet_xcm_bridge_hub` pallet has the extrinsic `fn open_bridge` and an important
//! configuration `pallet_xcm_bridge_hub::Config::OpenBridgeOrigin`, which translates the call's
//! The `pezpallet_xcm_bridge_hub` pallet has the extrinsic `fn open_bridge` and an important
//! configuration `pezpallet_xcm_bridge_hub::Config::OpenBridgeOrigin`, which translates the call's
//! origin to the XCM `Location` and converts it to the `bridge_origin_universal_location`. With the
//! current setup, this origin/location is expected to be either the relay chain or a sibling
//! teyrchain as one side of the bridge. Another parameter is
@@ -149,11 +149,11 @@ use bp_xcm_bridge_hub::BridgeLocationsError;
pub use bp_xcm_bridge_hub::{
Bridge, BridgeId, BridgeLocations, BridgeState, LocalXcmChannelManager,
};
use frame_support::{traits::fungible::MutateHold, DefaultNoBound};
use frame_system::Config as SystemConfig;
use pallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
use sp_runtime::traits::Zero;
use sp_std::{boxed::Box, vec::Vec};
use pezframe_support::{traits::fungible::MutateHold, DefaultNoBound};
use pezframe_system::Config as SystemConfig;
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
use pezsp_runtime::traits::Zero;
use pezsp_std::{boxed::Box, vec::Vec};
use xcm::prelude::*;
use xcm_builder::DispatchBlob;
use xcm_executor::traits::ConvertLocation;
@@ -171,14 +171,14 @@ mod mock;
/// The target that will be used when publishing logs related to this pallet.
pub const LOG_TARGET: &str = "runtime::bridge-xcm";
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{tokens::Precision, Contains},
};
use frame_system::pallet_prelude::{BlockNumberFor, *};
use pezframe_system::pezpallet_prelude::{BlockNumberFor, *};
/// The reason for this pallet placing a hold on funds.
#[pallet::composite_enum]
@@ -189,20 +189,20 @@ pub mod pallet {
}
#[pallet::config]
#[pallet::disable_frame_system_supertrait_check]
#[pallet::disable_pezframe_system_supertrait_check]
pub trait Config<I: 'static = ()>:
BridgeMessagesConfig<Self::BridgeMessagesPalletInstance>
{
/// The overarching event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// Runtime's universal location.
type UniversalLocation: Get<InteriorLocation>;
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1666 remove `ChainId` and
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/80 remove `ChainId` and
// replace it with the `NetworkId` - then we'll be able to use
// `T as pallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
// `T as pezpallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
/// Bridged network as relative location of bridged `GlobalConsensus`.
#[pallet::constant]
type BridgedNetwork: Get<Location>;
@@ -253,13 +253,13 @@ pub mod pallet {
pub type BridgeOf<T, I> = Bridge<ThisChainOf<T, I>, LaneIdOf<T, I>>;
/// An alias for this chain.
pub type ThisChainOf<T, I> =
pallet_bridge_messages::ThisChainOf<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
pezpallet_bridge_messages::ThisChainOf<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
/// An alias for lane identifier type.
pub type LaneIdOf<T, I> =
<T as BridgeMessagesConfig<<T as Config<I>>::BridgeMessagesPalletInstance>>::LaneId;
/// An alias for the associated lanes manager.
pub type LanesManagerOf<T, I> =
pallet_bridge_messages::LanesManager<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
pezpallet_bridge_messages::LanesManager<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
#[pallet::pallet]
#[pallet::storage_version(migration::STORAGE_VERSION)]
@@ -276,7 +276,7 @@ pub mod pallet {
}
#[cfg(feature = "try-runtime")]
fn try_state(_n: BlockNumberFor<T>) -> Result<(), sp_runtime::TryRuntimeError> {
fn try_state(_n: BlockNumberFor<T>) -> Result<(), pezsp_runtime::TryRuntimeError> {
Self::do_try_state()
}
}
@@ -295,7 +295,7 @@ pub mod pallet {
/// The states after this call: bridge is `Opened`, outbound lane is `Opened`, inbound lane
/// is `Opened`.
#[pallet::call_index(0)]
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/paritytech/parity-bridges-common/issues/3046 - add benchmarks impl
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/pezkuwichain/kurdistan-sdk/issues/87 - add benchmarks impl
pub fn open_bridge(
origin: OriginFor<T>,
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
@@ -333,7 +333,7 @@ pub mod pallet {
/// The states after this call: everything is either `Closed`, or purged from the
/// runtime storage.
#[pallet::call_index(1)]
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/paritytech/parity-bridges-common/issues/3046 - add benchmarks impl
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/pezkuwichain/kurdistan-sdk/issues/87 - add benchmarks impl
pub fn close_bridge(
origin: OriginFor<T>,
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
@@ -343,7 +343,7 @@ pub mod pallet {
let locations =
Self::bridge_locations_from_origin(origin, bridge_destination_universal_location)?;
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1760 - may do refund here, if
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/81 - may do refund here, if
// bridge/lanes are already closed + for messages that are not pruned
// update bridge metadata - this also guarantees that the bridge is in the proper state
@@ -565,7 +565,7 @@ pub mod pallet {
pub fn bridge_locations_from_origin(
origin: OriginFor<T>,
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
) -> Result<Box<BridgeLocations>, sp_runtime::DispatchError> {
) -> Result<Box<BridgeLocations>, pezsp_runtime::DispatchError> {
Self::bridge_locations(
T::OpenBridgeOrigin::ensure_origin(origin)?,
(*bridge_destination_universal_location)
@@ -578,7 +578,7 @@ pub mod pallet {
pub fn bridge_locations(
bridge_origin_relative_location: Location,
bridge_destination_universal_location: InteriorLocation,
) -> Result<Box<BridgeLocations>, sp_runtime::DispatchError> {
) -> Result<Box<BridgeLocations>, pezsp_runtime::DispatchError> {
BridgeLocations::bridge_locations(
T::UniversalLocation::get(),
bridge_origin_relative_location,
@@ -608,7 +608,7 @@ pub mod pallet {
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Returns some `NetworkId` if contains `GlobalConsensus` junction.
fn bridged_network_id() -> Result<NetworkId, sp_runtime::DispatchError> {
fn bridged_network_id() -> Result<NetworkId, pezsp_runtime::DispatchError> {
match T::BridgedNetwork::get().take_first_interior() {
Some(GlobalConsensus(network)) => Ok(network),
_ => Err(Error::<T, I>::BridgeLocations(
@@ -622,8 +622,8 @@ pub mod pallet {
#[cfg(any(test, feature = "try-runtime", feature = "std"))]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Ensure the correctness of the state of this pallet.
pub fn do_try_state() -> Result<(), sp_runtime::TryRuntimeError> {
use sp_std::collections::btree_set::BTreeSet;
pub fn do_try_state() -> Result<(), pezsp_runtime::TryRuntimeError> {
use pezsp_std::collections::btree_set::BTreeSet;
let mut lanes = BTreeSet::new();
@@ -640,7 +640,7 @@ pub mod pallet {
"Invalid `LaneToBridge` configuration, probably missing or not removed laneId!"
);
// check connected `pallet_bridge_messages` state.
// check connected `pezpallet_bridge_messages` state.
Self::do_try_state_for_messages()
}
@@ -648,7 +648,7 @@ pub mod pallet {
pub fn do_try_state_for_bridge(
bridge_id: BridgeId,
bridge: BridgeOf<T, I>,
) -> Result<T::LaneId, sp_runtime::TryRuntimeError> {
) -> Result<T::LaneId, pezsp_runtime::TryRuntimeError> {
tracing::info!(target: LOG_TARGET, ?bridge_id, ?bridge, "Checking `do_try_state_for_bridge`");
// check `BridgeId` points to the same `LaneId` and vice versa.
@@ -657,7 +657,7 @@ pub mod pallet {
"Found `LaneToBridge` inconsistency for bridge_id - missing mapping!"
);
// check `pallet_bridge_messages` state for that `LaneId`.
// check `pezpallet_bridge_messages` state for that `LaneId`.
let lanes_manager = LanesManagerOf::<T, I>::new();
ensure!(
lanes_manager.any_state_inbound_lane(bridge.lane_id).is_ok(),
@@ -691,10 +691,10 @@ pub mod pallet {
Ok(bridge.lane_id)
}
/// Ensure the correctness of the state of the connected `pallet_bridge_messages` instance.
pub fn do_try_state_for_messages() -> Result<(), sp_runtime::TryRuntimeError> {
/// Ensure the correctness of the state of the connected `pezpallet_bridge_messages` instance.
pub fn do_try_state_for_messages() -> Result<(), pezsp_runtime::TryRuntimeError> {
// check that all `InboundLanes` laneIds have mapping to some bridge.
for lane_id in pallet_bridge_messages::InboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
for lane_id in pezpallet_bridge_messages::InboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
tracing::info!(target: LOG_TARGET, ?lane_id, "Checking `do_try_state_for_messages` for `InboundLanes`...");
ensure!(
LaneToBridge::<T, I>::get(lane_id).is_some(),
@@ -703,7 +703,7 @@ pub mod pallet {
}
// check that all `OutboundLanes` laneIds have mapping to some bridge.
for lane_id in pallet_bridge_messages::OutboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
for lane_id in pezpallet_bridge_messages::OutboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
tracing::info!(target: LOG_TARGET, ?lane_id, "Checking `do_try_state_for_messages` for `OutboundLanes`");
ensure!(
LaneToBridge::<T, I>::get(lane_id).is_some(),
@@ -735,13 +735,13 @@ pub mod pallet {
pub opened_bridges: Vec<(Location, InteriorLocation, Option<T::LaneId>)>,
/// Dummy marker.
#[serde(skip)]
pub _phantom: sp_std::marker::PhantomData<(T, I)>,
pub _phantom: pezsp_std::marker::PhantomData<(T, I)>,
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
where
T: frame_system::Config<AccountId = AccountIdOf<ThisChainOf<T, I>>>,
T: pezframe_system::Config<AccountId = AccountIdOf<ThisChainOf<T, I>>>,
{
fn build(&self) {
for (
@@ -839,9 +839,9 @@ mod tests {
use bp_messages::LaneIdType;
use mock::*;
use frame_support::{assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec};
use frame_system::{EventRecord, Phase};
use sp_runtime::TryRuntimeError;
use pezframe_support::{assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec};
use pezframe_system::{EventRecord, Phase};
use pezsp_runtime::TryRuntimeError;
fn fund_origin_sovereign_account(locations: &BridgeLocations, balance: Balance) -> AccountId {
let bridge_owner_account =
@@ -913,7 +913,7 @@ mod tests {
OpenBridgeOrigin::disallowed_origin(),
Box::new(bridged_asset_hub_universal_location().into()),
),
sp_runtime::DispatchError::BadOrigin,
pezsp_runtime::DispatchError::BadOrigin,
);
})
}
@@ -1219,7 +1219,7 @@ mod tests {
Box::new(bridged_asset_hub_universal_location().into()),
0,
),
sp_runtime::DispatchError::BadOrigin,
pezsp_runtime::DispatchError::BadOrigin,
);
})
}
@@ -17,7 +17,7 @@
//! A module that is responsible for migration of storage.
use crate::{Config, Pallet, LOG_TARGET};
use frame_support::{
use pezframe_support::{
traits::{Get, OnRuntimeUpgrade, StorageVersion},
weights::Weight,
};
@@ -121,7 +121,7 @@ impl<
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: sp_std::vec::Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(_state: pezsp_std::vec::Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
let bridge_origin_relative_location = SourceRelativeLocation::get();
let bridge_destination_universal_location = BridgedUniversalLocation::get();
let lane_id = Lane::get();
@@ -131,12 +131,12 @@ impl<
bridge_origin_relative_location.clone(),
bridge_destination_universal_location.clone(),
) else {
return Err(sp_runtime::DispatchError::Other("Invalid locations!"));
return Err(pezsp_runtime::DispatchError::Other("Invalid locations!"));
};
let Some((bridge_id, _)) = Pallet::<T, I>::bridge_by_lane_id(&lane_id) else {
return Err(sp_runtime::DispatchError::Other("Missing bridge!"));
return Err(pezsp_runtime::DispatchError::Other("Missing bridge!"));
};
frame_support::ensure!(
pezframe_support::ensure!(
locations.bridge_id() == &bridge_id,
"Bridge is not stored correctly!"
);
+51 -51
View File
@@ -16,7 +16,7 @@
#![cfg(test)]
use crate as pallet_xcm_bridge_hub;
use crate as pezpallet_xcm_bridge_hub;
use bp_messages::{
target_chain::{DispatchMessage, MessageDispatch},
@@ -25,19 +25,19 @@ use bp_messages::{
use bp_runtime::{messages::MessageDispatchResult, Chain, ChainId, HashOf};
use bp_xcm_bridge_hub::{BridgeId, LocalXcmChannelManager};
use codec::{Decode, Encode};
use frame_support::{
use pezframe_support::{
assert_ok, derive_impl, parameter_types,
traits::{EnsureOrigin, Equals, Everything, Get, OriginTrait},
weights::RuntimeDbWeight,
};
use pezkuwi_teyrchain_primitives::primitives::Sibling;
use sp_core::H256;
use sp_runtime::{
testing::Header as SubstrateHeader,
use pezsp_core::H256;
use pezsp_runtime::{
testing::Header as BizinikiwiHeader,
traits::{BlakeTwo256, ConstU128, ConstU32, IdentityLookup},
AccountId32, BuildStorage, StateVersion,
};
use sp_std::cell::RefCell;
use pezsp_std::cell::RefCell;
use xcm::{latest::PEZKUWICHAIN_GENESIS_HASH, prelude::*};
use xcm_builder::{
AllowUnpaidExecutionFrom, DispatchBlob, DispatchBlobError, FixedWeightBounds,
@@ -48,7 +48,7 @@ use xcm_executor::{traits::ConvertOrigin, XcmExecutor};
pub type AccountId = AccountId32;
pub type Balance = u64;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
/// Lane identifier type used for tests.
pub type TestLaneIdType = HashedLaneId;
@@ -57,13 +57,13 @@ pub const SIBLING_ASSET_HUB_ID: u32 = 2001;
pub const THIS_BRIDGE_HUB_ID: u32 = 2002;
pub const BRIDGED_ASSET_HUB_ID: u32 = 1001;
frame_support::construct_runtime! {
pezframe_support::construct_runtime! {
pub enum TestRuntime {
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Event<T>},
Messages: pallet_bridge_messages::{Pallet, Call, Event<T>},
XcmOverBridge: pallet_xcm_bridge_hub::{Pallet, Call, HoldReason, Event<T>},
XcmOverBridgeWrappedWithExportMessageRouter: pallet_xcm_bridge_hub_router = 57,
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pezpallet_balances::{Pallet, Event<T>},
Messages: pezpallet_bridge_messages::{Pallet, Call, Event<T>},
XcmOverBridge: pezpallet_xcm_bridge_hub::{Pallet, Call, HoldReason, Event<T>},
XcmOverBridgeWrappedWithExportMessageRouter: pezpallet_xcm_bridge_hub_router = 57,
}
}
@@ -72,20 +72,20 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 1;
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for TestRuntime {
type AccountId = AccountId;
type AccountData = pallet_balances::AccountData<Balance>;
type AccountData = pezpallet_balances::AccountData<Balance>;
type Block = Block;
type Lookup = IdentityLookup<Self::AccountId>;
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for TestRuntime {
type AccountStore = System;
}
impl pallet_bridge_messages::Config for TestRuntime {
impl pezpallet_bridge_messages::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = TestMessagesWeights;
@@ -106,7 +106,7 @@ impl pallet_bridge_messages::Config for TestRuntime {
pub struct TestMessagesWeights;
impl pallet_bridge_messages::WeightInfo for TestMessagesWeights {
impl pezpallet_bridge_messages::WeightInfo for TestMessagesWeights {
fn receive_single_message_proof() -> Weight {
Weight::zero()
}
@@ -133,7 +133,7 @@ impl pallet_bridge_messages::WeightInfo for TestMessagesWeights {
}
}
impl pallet_bridge_messages::WeightInfoExt for TestMessagesWeights {
impl pezpallet_bridge_messages::WeightInfoExt for TestMessagesWeights {
fn expected_extra_storage_proof_size() -> u32 {
0
}
@@ -164,7 +164,7 @@ parameter_types! {
pub const BridgeDeposit: Balance = 100_000;
// configuration for pallet_xcm_bridge_hub_router
// configuration for pezpallet_xcm_bridge_hub_router
pub BridgeHubLocation: Location = Here.into();
pub BridgeFeeAsset: AssetId = Location::here().into();
pub BridgeTable: Vec<NetworkExportTableItem>
@@ -184,7 +184,7 @@ pub fn bridged_asset_hub_universal_location() -> InteriorLocation {
BridgedUniversalDestination::get()
}
impl pallet_xcm_bridge_hub::Config for TestRuntime {
impl pezpallet_xcm_bridge_hub::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type UniversalLocation = UniversalLocation;
@@ -194,7 +194,7 @@ impl pallet_xcm_bridge_hub::Config for TestRuntime {
type MessageExportPrice = ();
type DestinationVersion = AlwaysLatest;
type ForceOrigin = frame_system::EnsureNever<()>;
type ForceOrigin = pezframe_system::EnsureNever<()>;
type OpenBridgeOrigin = OpenBridgeOrigin;
type BridgeOriginAccountIdConverter = LocationToAccountId;
@@ -211,7 +211,7 @@ impl pallet_xcm_bridge_hub::Config for TestRuntime {
/// A router instance simulates a scenario where the router is deployed on a different chain than
/// the `MessageExporter`. This means that the router sends an `ExportMessage`.
pub type XcmOverBridgeWrappedWithExportMessageRouterInstance = ();
impl pallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageRouterInstance>
impl pezpallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageRouterInstance>
for TestRuntime
{
type RuntimeEvent = RuntimeEvent;
@@ -224,9 +224,9 @@ impl pallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageR
type DestinationVersion = AlwaysLatest;
// We convert to root `here` location with `BridgeHubLocationXcmOriginAsRoot`
type BridgeHubOrigin = frame_system::EnsureRoot<AccountId>;
type BridgeHubOrigin = pezframe_system::EnsureRoot<AccountId>;
// **Note**: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which
// calls the `ExportXcm` implementation of `pallet_xcm_bridge_hub` as the
// calls the `ExportXcm` implementation of `pezpallet_xcm_bridge_hub` as the
// `MessageExporter`.
type ToBridgeHubSender = ExecuteXcmOverSendXcm;
type LocalXcmChannelManager = TestLocalXcmChannelManager;
@@ -257,7 +257,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
// We just set `MessageExporter` as our `pallet_xcm_bridge_hub` instance.
// We just set `MessageExporter` as our `pezpallet_xcm_bridge_hub` instance.
type MessageExporter = (XcmOverBridge,);
type UniversalAliases = ();
type CallDispatcher = RuntimeCall;
@@ -276,11 +276,11 @@ thread_local! {
/// The `SendXcm` implementation directly executes XCM using `XcmExecutor`.
///
/// We ensure that the `ExportMessage` produced by `pallet_xcm_bridge_hub_router` is compatible with
/// the `ExportXcm` implementation of `pallet_xcm_bridge_hub`.
/// We ensure that the `ExportMessage` produced by `pezpallet_xcm_bridge_hub_router` is compatible with
/// the `ExportXcm` implementation of `pezpallet_xcm_bridge_hub`.
///
/// Note: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which calls the
/// `ExportXcm` implementation of `pallet_xcm_bridge_hub` as `MessageExporter`.
/// `ExportXcm` implementation of `pezpallet_xcm_bridge_hub` as `MessageExporter`.
pub struct ExecuteXcmOverSendXcm;
impl SendXcm for ExecuteXcmOverSendXcm {
type Ticket = Xcm<()>;
@@ -296,7 +296,7 @@ impl SendXcm for ExecuteXcmOverSendXcm {
let xcm: Xcm<RuntimeCall> = ticket.into();
let origin = EXECUTE_XCM_ORIGIN.with(|o| o.borrow().clone().unwrap());
let mut hash = xcm.using_encoded(sp_io::hashing::blake2_256);
let mut hash = xcm.using_encoded(pezsp_io::hashing::blake2_256);
let outcome = XcmExecutor::<XcmConfig>::prepare_and_execute(
origin,
xcm,
@@ -345,7 +345,7 @@ thread_local! {
}
pub struct BridgeHubLocationXcmOriginAsRoot<RuntimeOrigin>(
sp_std::marker::PhantomData<RuntimeOrigin>,
pezsp_std::marker::PhantomData<RuntimeOrigin>,
);
impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
for BridgeHubLocationXcmOriginAsRoot<RuntimeOrigin>
@@ -447,13 +447,13 @@ impl EnsureOrigin<RuntimeOrigin> for OpenBridgeOrigin {
}
pub(crate) type OpenBridgeOriginOf<T, I> =
<T as pallet_xcm_bridge_hub::Config<I>>::OpenBridgeOrigin;
<T as pezpallet_xcm_bridge_hub::Config<I>>::OpenBridgeOrigin;
pub struct TestLocalXcmChannelManager;
impl TestLocalXcmChannelManager {
pub fn make_congested() {
frame_support::storage::unhashed::put(b"TestLocalXcmChannelManager.Congested", &true);
pezframe_support::storage::unhashed::put(b"TestLocalXcmChannelManager.Congested", &true);
}
fn suspended_key(bridge: &BridgeId) -> Vec<u8> {
@@ -464,11 +464,11 @@ impl TestLocalXcmChannelManager {
}
pub fn is_bridge_suspended(bridge: &BridgeId) -> bool {
frame_support::storage::unhashed::get_or_default(&Self::suspended_key(bridge))
pezframe_support::storage::unhashed::get_or_default(&Self::suspended_key(bridge))
}
pub fn is_bridge_resumed(bridge: &BridgeId) -> bool {
frame_support::storage::unhashed::get_or_default(&Self::resumed_key(bridge))
pezframe_support::storage::unhashed::get_or_default(&Self::resumed_key(bridge))
}
fn build_congestion_message(bridge: &BridgeId, is_congested: bool) -> Vec<Instruction<()>> {
@@ -480,7 +480,7 @@ impl TestLocalXcmChannelManager {
XcmOverBridgeWrappedWithExportMessageRouter(XcmBridgeHubRouterCall),
}
sp_std::vec![
pezsp_std::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
@@ -512,7 +512,7 @@ impl TestLocalXcmChannelManager {
);
if result.is_ok() {
frame_support::storage::unhashed::put(&key, &true);
pezframe_support::storage::unhashed::put(&key, &true);
}
result.map(|_| ())
@@ -523,7 +523,7 @@ impl LocalXcmChannelManager for TestLocalXcmChannelManager {
type Error = SendError;
fn is_congested(_with: &Location) -> bool {
frame_support::storage::unhashed::get_or_default(b"TestLocalXcmChannelManager.Congested")
pezframe_support::storage::unhashed::get_or_default(b"TestLocalXcmChannelManager.Congested")
}
fn suspend_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> {
@@ -535,7 +535,7 @@ impl LocalXcmChannelManager for TestLocalXcmChannelManager {
}
}
impl pallet_xcm_bridge_hub_router::XcmChannelStatusProvider for TestLocalXcmChannelManager {
impl pezpallet_xcm_bridge_hub_router::XcmChannelStatusProvider for TestLocalXcmChannelManager {
fn is_congested(with: &Location) -> bool {
<Self as LocalXcmChannelManager>::is_congested(with)
}
@@ -545,13 +545,13 @@ pub struct TestBlobDispatcher;
impl TestBlobDispatcher {
pub fn is_dispatched() -> bool {
frame_support::storage::unhashed::get_or_default(b"TestBlobDispatcher.Dispatched")
pezframe_support::storage::unhashed::get_or_default(b"TestBlobDispatcher.Dispatched")
}
}
impl DispatchBlob for TestBlobDispatcher {
fn dispatch_blob(_blob: Vec<u8>) -> Result<(), DispatchBlobError> {
frame_support::storage::unhashed::put(b"TestBlobDispatcher.Dispatched", &true);
pezframe_support::storage::unhashed::put(b"TestBlobDispatcher.Dispatched", &true);
Ok(())
}
}
@@ -564,11 +564,11 @@ impl Chain for ThisUnderlyingChain {
type BlockNumber = u64;
type Hash = H256;
type Hasher = BlakeTwo256;
type Header = SubstrateHeader;
type Header = BizinikiwiHeader;
type AccountId = AccountId;
type Balance = Balance;
type Nonce = u64;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
@@ -588,7 +588,7 @@ impl ChainWithMessages for ThisUnderlyingChain {
}
pub type BridgedHeaderHash = H256;
pub type BridgedChainHeader = SubstrateHeader;
pub type BridgedChainHeader = BizinikiwiHeader;
pub struct BridgedUnderlyingChain;
impl Chain for BridgedUnderlyingChain {
@@ -600,7 +600,7 @@ impl Chain for BridgedUnderlyingChain {
type AccountId = AccountId;
type Balance = Balance;
type Nonce = u64;
type Signature = sp_runtime::MultiSignature;
type Signature = pezsp_runtime::MultiSignature;
const STATE_VERSION: StateVersion = StateVersion::V1;
@@ -633,7 +633,7 @@ pub struct TestMessageDispatch;
impl TestMessageDispatch {
pub fn deactivate(lane: TestLaneIdType) {
frame_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
pezframe_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
}
}
@@ -643,7 +643,7 @@ impl MessageDispatch for TestMessageDispatch {
type LaneId = TestLaneIdType;
fn is_active(lane: Self::LaneId) -> bool {
frame_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
Some(false)
}
@@ -662,8 +662,8 @@ impl MessageDispatch for TestMessageDispatch {
/// Run pallet test.
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
sp_io::TestExternalities::new(
frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap(),
pezsp_io::TestExternalities::new(
pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap(),
)
.execute_with(test)
}