chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -277,8 +277,8 @@ pub mod pezpallet {
|
||||
|
||||
/// The current number of requests which have written to storage.
|
||||
///
|
||||
/// If the `RequestCount` hits `MaxRequests`, no more calls will be allowed to the pezpallet until
|
||||
/// the request capacity is increased.
|
||||
/// If the `RequestCount` hits `MaxRequests`, no more calls will be allowed to the pezpallet
|
||||
/// until the request capacity is increased.
|
||||
///
|
||||
/// The `RequestCount` is decreased by one at the beginning of every block. This is to ensure
|
||||
/// that the pezpallet can always make progress.
|
||||
@@ -415,11 +415,11 @@ pub mod pezpallet {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pezbp_runtime::{BasicOperatingMode, OwnedBridgeModuleError};
|
||||
use bp_test_utils::generate_owned_bridge_module_tests;
|
||||
use pezframe_support::{assert_noop, assert_ok, traits::Get};
|
||||
use mock::*;
|
||||
use mock_chain::*;
|
||||
use pezbp_runtime::{BasicOperatingMode, OwnedBridgeModuleError};
|
||||
use pezframe_support::{assert_noop, assert_ok, traits::Get};
|
||||
use pezsp_consensus_beefy::mmr::BeefyAuthoritySet;
|
||||
use pezsp_runtime::DispatchError;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use bp_beefy::{BeefyValidatorSignatureOf, ChainWithBeefy, Commitment, MmrDataOrHash};
|
||||
use pezbp_runtime::{BasicOperatingMode, Chain, ChainId};
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{BasicOperatingMode, Chain, ChainId};
|
||||
use pezframe_support::{construct_runtime, derive_impl, weights::Weight};
|
||||
use pezsp_core::{sr25519::Signature, Pair};
|
||||
use pezsp_runtime::{
|
||||
|
||||
@@ -29,10 +29,10 @@ use crate::{
|
||||
use bp_beefy::{BeefyPayload, Commitment, ValidatorSetId, MMR_ROOT_PAYLOAD_ID};
|
||||
use codec::Encode;
|
||||
use pezpallet_mmr::NodeIndex;
|
||||
use rand::Rng;
|
||||
use pezsp_consensus_beefy::mmr::{BeefyNextAuthoritySet, MmrLeafVersion};
|
||||
use pezsp_core::Pair;
|
||||
use pezsp_runtime::traits::{Hash, Header as HeaderT};
|
||||
use rand::Rng;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
use crate::*;
|
||||
|
||||
use bp_header_pez_chain::justification::required_justification_precommits;
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
use bp_test_utils::{
|
||||
accounts, make_justification_for_header, JustificationGeneratorParams, TEST_GRANDPA_ROUND,
|
||||
TEST_GRANDPA_SET_ID,
|
||||
};
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
use pezframe_benchmarking::{benchmarks_instance_pallet, whitelisted_caller};
|
||||
use pezframe_system::RawOrigin;
|
||||
use pezsp_consensus_grandpa::AuthorityId;
|
||||
|
||||
@@ -308,12 +308,12 @@ mod tests {
|
||||
StoredAuthoritySet, WeightInfo,
|
||||
};
|
||||
use bp_header_pez_chain::{ChainWithGrandpa, SubmitFinalityProofInfo};
|
||||
use pezbp_runtime::{BasicOperatingMode, HeaderId};
|
||||
use bp_test_utils::{
|
||||
make_default_justification, make_justification_for_header, JustificationGeneratorParams,
|
||||
TEST_GRANDPA_SET_ID,
|
||||
};
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{BasicOperatingMode, HeaderId};
|
||||
use pezframe_support::weights::Weight;
|
||||
use pezsp_runtime::{testing::DigestItem, traits::Header as _, SaturatedConversion};
|
||||
|
||||
@@ -518,12 +518,13 @@ 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 = pezsp_consensus_grandpa::ConsensusLog::<TestNumber>::ScheduledChange(
|
||||
pezsp_consensus_grandpa::ScheduledChange {
|
||||
next_authorities: bp_test_utils::authority_list(),
|
||||
delay: 0,
|
||||
},
|
||||
);
|
||||
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 = pezsp_runtime::Digest {
|
||||
logs: vec![DigestItem::Consensus(
|
||||
pezsp_consensus_grandpa::GRANDPA_ENGINE_ID,
|
||||
@@ -711,8 +712,9 @@ mod tests {
|
||||
#[test]
|
||||
fn check_obsolete_submit_finality_proof_ignores_other_calls() {
|
||||
run_test(|| {
|
||||
let call =
|
||||
RuntimeCall::System(pezframe_system::Call::<TestRuntime>::remark { remark: vec![42] });
|
||||
let call = RuntimeCall::System(pezframe_system::Call::<TestRuntime>::remark {
|
||||
remark: vec![42],
|
||||
});
|
||||
|
||||
assert_eq!(RuntimeCall::check_obsolete_submit_finality_proof(&call), Ok(None));
|
||||
})
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
//! verified, finalized headers are stored in the pezpallet, thereby creating a sparse header chain.
|
||||
//! This sparse header chain can be used as a source of truth for other higher-level applications.
|
||||
//!
|
||||
//! The pezpallet is responsible for tracking GRANDPA validator set hand-offs. We only import headers
|
||||
//! with justifications signed by the current validator set we know of. The header is inspected for
|
||||
//! a `ScheduledChanges` digest item, which is then used to update to next validator set.
|
||||
//! The pezpallet is responsible for tracking GRANDPA validator set hand-offs. We only import
|
||||
//! headers with justifications signed by the current validator set we know of. The header is
|
||||
//! inspected for a `ScheduledChanges` digest item, which is then used to update to next validator
|
||||
//! set.
|
||||
//!
|
||||
//! Since this pezpallet only tracks finalized headers it does not deal with forks. Forks can only
|
||||
//! occur if the GRANDPA validator set on the bridged chain is either colluding or there is a severe
|
||||
@@ -198,7 +199,8 @@ pub mod pezpallet {
|
||||
)
|
||||
}
|
||||
|
||||
/// Bootstrap the bridge pezpallet with an initial header and authority set from which to sync.
|
||||
/// Bootstrap the bridge pezpallet with an initial header and authority set from which to
|
||||
/// sync.
|
||||
///
|
||||
/// The initial configuration provided does not need to be the genesis header of the bridged
|
||||
/// chain, it can be any arbitrary header. You can also provide the next scheduled set
|
||||
@@ -517,7 +519,8 @@ pub mod pezpallet {
|
||||
InvalidJustification,
|
||||
/// The authority set from the underlying header chain is invalid.
|
||||
InvalidAuthoritySet,
|
||||
/// The header being imported is older than the best finalized header known to the pezpallet.
|
||||
/// The header being imported is older than the best finalized header known to the
|
||||
/// pezpallet.
|
||||
OldHeader,
|
||||
/// The scheduled authority set change found in the header is unsupported by the pezpallet.
|
||||
///
|
||||
@@ -814,7 +817,7 @@ pub fn initialize_for_benchmarks<T: Config<I>, I: 'static>(header: BridgedHeader
|
||||
initialize_bridge::<T, I>(InitializationData {
|
||||
header: Box::new(header),
|
||||
authority_list: pezsp_std::vec::Vec::new(), /* we don't verify any proofs in external
|
||||
* benchmarks */
|
||||
* benchmarks */
|
||||
set_id: 0,
|
||||
operating_mode: pezbp_runtime::BasicOperatingMode::Normal,
|
||||
})
|
||||
@@ -836,13 +839,13 @@ mod tests {
|
||||
System, TestBridgedChain, TestHeader, TestNumber, TestRuntime, MAX_BRIDGED_AUTHORITIES,
|
||||
};
|
||||
use bp_header_pez_chain::BridgeGrandpaCall;
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
use bp_test_utils::{
|
||||
authority_list, generate_owned_bridge_module_tests, make_default_justification,
|
||||
make_justification_for_header, JustificationGeneratorParams, ALICE, BOB,
|
||||
TEST_GRANDPA_SET_ID,
|
||||
};
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
use pezframe_support::{
|
||||
assert_err, assert_noop, assert_ok,
|
||||
dispatch::{Pays, PostDispatchInfo},
|
||||
@@ -1470,7 +1473,9 @@ mod tests {
|
||||
<BestFinalized<TestRuntime>>::put(HeaderId(2, hash));
|
||||
<ImportedHeaders<TestRuntime>>::insert(hash, header.build());
|
||||
|
||||
assert_ok!(Pezpallet::<TestRuntime>::verify_storage_proof(hash, storage_proof).map(|_| ()));
|
||||
assert_ok!(
|
||||
Pezpallet::<TestRuntime>::verify_storage_proof(hash, storage_proof).map(|_| ())
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ use crate::{Config, Error};
|
||||
use bp_header_pez_chain::{AuthoritySet, ChainWithGrandpa};
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use pezframe_support::{traits::Get, BoundedVec, CloneNoBound, RuntimeDebugNoBound};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
|
||||
use pezsp_std::marker::PhantomData;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// A bounded list of Grandpa authorities with associated weights.
|
||||
pub type StoredAuthorityList<MaxBridgedAuthorities> =
|
||||
|
||||
@@ -29,8 +29,8 @@ use bp_messages::{
|
||||
InboundLaneData, LaneState, MessageNonce, OutboundLaneData, UnrewardedRelayer,
|
||||
UnrewardedRelayersState,
|
||||
};
|
||||
use pezbp_runtime::{AccountIdOf, HashOf, UnverifiedStorageProofParams};
|
||||
use codec::Decode;
|
||||
use pezbp_runtime::{AccountIdOf, HashOf, UnverifiedStorageProofParams};
|
||||
use pezframe_benchmarking::{account, v2::*};
|
||||
use pezframe_support::weights::Weight;
|
||||
use pezframe_system::RawOrigin;
|
||||
|
||||
@@ -23,11 +23,11 @@ use bp_messages::{
|
||||
ChainWithMessages, DeliveredMessages, InboundLaneData, LaneState, MessageKey, MessageNonce,
|
||||
OutboundLaneData, ReceptionResult, UnrewardedRelayer,
|
||||
};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||
use scale_info::{Type, TypeInfo};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use pezsp_std::prelude::PartialEq;
|
||||
use scale_info::{Type, TypeInfo};
|
||||
|
||||
/// Inbound lane storage.
|
||||
pub trait InboundLaneStorage {
|
||||
|
||||
@@ -24,11 +24,11 @@ use bp_messages::{
|
||||
target_chain::MessageDispatch, ChainWithMessages, InboundLaneData, LaneState, MessageKey,
|
||||
MessageNonce, OutboundLaneData,
|
||||
};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use pezframe_support::{ensure, pezsp_runtime::RuntimeDebug, PalletError};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_std::marker::PhantomData;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Lanes manager errors.
|
||||
#[derive(
|
||||
@@ -183,9 +183,9 @@ impl<T: Config<I>, I: 'static> RuntimeInboundLaneStorage<T, I> {
|
||||
/// maximal configured.
|
||||
///
|
||||
/// Maximal inbound lane state set size is configured by the
|
||||
/// `MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX` constant from the pezpallet configuration. The PoV
|
||||
/// of the call includes the maximal size of inbound lane state. If the actual size is smaller,
|
||||
/// we may subtract extra bytes from this component.
|
||||
/// `MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX` constant from the pezpallet configuration. The
|
||||
/// PoV of the call includes the maximal size of inbound lane state. If the actual size is
|
||||
/// smaller, we may subtract extra bytes from this component.
|
||||
pub fn extra_proof_size_bytes(&self) -> u64 {
|
||||
let max_encoded_len = StoredInboundLaneData::<T, I>::max_encoded_len();
|
||||
let relayers_count = self.data().relayers.len();
|
||||
|
||||
@@ -64,11 +64,11 @@ use bp_messages::{
|
||||
MessageNonce, MessagePayload, MessagesOperatingMode, OutboundLaneData, OutboundMessageDetails,
|
||||
UnrewardedRelayersState, VerificationError,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use pezbp_runtime::{
|
||||
AccountIdOf, BasicOperatingMode, HashOf, OwnedBridgeModule, PreComputedSize, RangeInclusiveExt,
|
||||
Size,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use pezframe_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
|
||||
use pezsp_std::{marker::PhantomData, prelude::*};
|
||||
|
||||
@@ -677,7 +677,8 @@ pub struct SendMessageArgs<T: Config<I>, I: 'static> {
|
||||
payload: StoredMessagePayload<T, I>,
|
||||
}
|
||||
|
||||
impl<T, I> bp_messages::source_chain::MessagesBridge<T::OutboundPayload, T::LaneId> for Pezpallet<T, I>
|
||||
impl<T, I> bp_messages::source_chain::MessagesBridge<T::OutboundPayload, T::LaneId>
|
||||
for Pezpallet<T, I>
|
||||
where
|
||||
T: Config<I>,
|
||||
I: 'static,
|
||||
|
||||
@@ -31,8 +31,8 @@ pub mod v0 {
|
||||
use super::Config;
|
||||
use crate::BridgedChainOf;
|
||||
use bp_messages::{MessageNonce, UnrewardedRelayer};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use codec::{Decode, Encode};
|
||||
use pezbp_runtime::AccountIdOf;
|
||||
use pezsp_std::collections::vec_deque::VecDeque;
|
||||
|
||||
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
|
||||
@@ -107,7 +107,9 @@ pub mod v1 {
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn post_upgrade(state: pezsp_std::vec::Vec<u8>) -> Result<(), pezsp_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";
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ use bp_messages::{
|
||||
};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use pezframe_support::{traits::Get, BoundedVec, PalletError};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use pezsp_std::{collections::vec_deque::VecDeque, marker::PhantomData, ops::RangeInclusive};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Outbound lane storage.
|
||||
pub trait OutboundLaneStorage {
|
||||
|
||||
@@ -25,10 +25,10 @@ use bp_messages::{
|
||||
ChainWithMessages, InboundLaneData, Message, MessageKey, MessageNonce, MessagePayload,
|
||||
OutboundLaneData, VerificationError,
|
||||
};
|
||||
use codec::Decode;
|
||||
use pezbp_runtime::{
|
||||
HashOf, HasherOf, RangeInclusiveExt, RawStorageProof, StorageProofChecker, StorageProofError,
|
||||
};
|
||||
use codec::Decode;
|
||||
use pezsp_std::vec::Vec;
|
||||
|
||||
/// 'Parsed' message delivery proof - inbound lane id and its state.
|
||||
@@ -218,8 +218,8 @@ mod tests {
|
||||
|
||||
use bp_header_pez_chain::{HeaderChainError, StoredHeaderDataBuilder};
|
||||
use bp_messages::LaneState;
|
||||
use pezbp_runtime::{HeaderId, StorageProofError};
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{HeaderId, StorageProofError};
|
||||
use pezsp_runtime::traits::Header;
|
||||
|
||||
fn using_messages_proof<R>(
|
||||
|
||||
@@ -20,11 +20,11 @@ use bp_messages::{
|
||||
storage_keys, ChainWithMessages, InboundLaneData, MessageKey, MessageNonce, MessagePayload,
|
||||
OutboundLaneData,
|
||||
};
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{
|
||||
grow_storage_value, record_all_trie_keys, AccountIdOf, Chain, HashOf, HasherOf,
|
||||
RawStorageProof, UnverifiedStorageProofParams,
|
||||
};
|
||||
use codec::Encode;
|
||||
use pezsp_std::{ops::RangeInclusive, prelude::*};
|
||||
use pezsp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
|
||||
|
||||
|
||||
@@ -39,21 +39,21 @@ use bp_messages::{
|
||||
Message, MessageKey, MessageNonce, OutboundLaneData, UnrewardedRelayer,
|
||||
UnrewardedRelayersState,
|
||||
};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use pezbp_runtime::{
|
||||
messages::MessageDispatchResult, Chain, ChainId, Size, UnverifiedStorageProofParams,
|
||||
};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use pezframe_support::{
|
||||
derive_impl,
|
||||
weights::{constants::RocksDbWeight, Weight},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::H256;
|
||||
use pezsp_runtime::{
|
||||
testing::Header as BizinikiwiHeader,
|
||||
traits::{BlakeTwo256, ConstU32},
|
||||
BuildStorage, StateVersion,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use std::{collections::VecDeque, ops::RangeInclusive};
|
||||
|
||||
pub type AccountId = u64;
|
||||
@@ -354,7 +354,8 @@ impl TestMessageDispatch {
|
||||
|
||||
pub fn emulate_enqueued_message(lane: TestLaneIdType) {
|
||||
let key = (b"dispatched", lane).encode();
|
||||
let dispatched = pezframe_support::storage::unhashed::get_or_default::<MessageNonce>(&key[..]);
|
||||
let dispatched =
|
||||
pezframe_support::storage::unhashed::get_or_default::<MessageNonce>(&key[..]);
|
||||
pezframe_support::storage::unhashed::put(&key[..], &(dispatched + 1));
|
||||
}
|
||||
}
|
||||
@@ -460,7 +461,9 @@ pub fn inbound_unrewarded_relayers_state(lane: TestLaneIdType) -> UnrewardedRela
|
||||
|
||||
/// Return test externalities to use in tests.
|
||||
pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
let mut t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
|
||||
let mut t = pezframe_system::GenesisConfig::<TestRuntime>::default()
|
||||
.build_storage()
|
||||
.unwrap();
|
||||
pezpallet_balances::GenesisConfig::<TestRuntime> {
|
||||
balances: vec![(ENDOWED_ACCOUNT, 1_000_000)],
|
||||
..Default::default()
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
tests::mock::{RuntimeEvent as TestEvent, *},
|
||||
weights_ext::WeightInfoExt,
|
||||
Call, Config, Error, Event, InboundLanes, LanesManagerError, OutboundLanes, OutboundMessages,
|
||||
Pezpallet, PalletOperatingMode, PalletOwner, StoredInboundLaneData,
|
||||
PalletOperatingMode, PalletOwner, Pezpallet, StoredInboundLaneData,
|
||||
};
|
||||
|
||||
use bp_messages::{
|
||||
@@ -34,9 +34,9 @@ use bp_messages::{
|
||||
OutboundLaneData, OutboundMessageDetails, UnrewardedRelayer, UnrewardedRelayersState,
|
||||
VerificationError,
|
||||
};
|
||||
use pezbp_runtime::{BasicOperatingMode, PreComputedSize, RangeInclusiveExt, Size};
|
||||
use bp_test_utils::generate_owned_bridge_module_tests;
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{BasicOperatingMode, PreComputedSize, RangeInclusiveExt, Size};
|
||||
use pezframe_support::{
|
||||
assert_err, assert_noop, assert_ok,
|
||||
dispatch::Pays,
|
||||
@@ -248,7 +248,10 @@ fn send_message_rejects_too_large_message() {
|
||||
.extra
|
||||
.extend_from_slice(&vec![0u8; max_outbound_payload_size as usize]);
|
||||
assert_noop!(
|
||||
Pezpallet::<TestRuntime, ()>::validate_message(test_lane_id(), &message_payload.clone(),),
|
||||
Pezpallet::<TestRuntime, ()>::validate_message(
|
||||
test_lane_id(),
|
||||
&message_payload.clone(),
|
||||
),
|
||||
Error::<TestRuntime, ()>::MessageRejectedByPallet(VerificationError::MessageTooLarge),
|
||||
);
|
||||
|
||||
|
||||
@@ -284,8 +284,8 @@ 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
|
||||
// (`pezpallet-bridge-relayers` and balances/assets pezpallet). So we need to add this weight to the
|
||||
// weight of our call. Hence two following methods.
|
||||
// (`pezpallet-bridge-relayers` and balances/assets pezpallet). 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
|
||||
/// that are declared at runtime level.
|
||||
|
||||
@@ -22,8 +22,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use bp_relayers::{BatchCallUnpacker, ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
|
||||
use pezbp_runtime::{Chain, StaticStrProvider};
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::{Chain, StaticStrProvider};
|
||||
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
|
||||
use pezframe_system::Config as SystemConfig;
|
||||
use pezpallet_bridge_grandpa::{
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
use crate::{extension::verify_messages_call_succeeded, Config as BridgeRelayersConfig};
|
||||
|
||||
use bp_relayers::{ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
|
||||
use pezbp_runtime::StaticStrProvider;
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::StaticStrProvider;
|
||||
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
|
||||
use pezpallet_bridge_messages::{
|
||||
CallSubType as BridgeMessagesCallSubType, Config as BridgeMessagesConfig, LaneIdOf,
|
||||
|
||||
@@ -29,9 +29,9 @@ use bp_relayers::{
|
||||
ExplicitOrAccountParams, ExtensionCallData, ExtensionCallInfo, ExtensionConfig,
|
||||
RewardsAccountOwner, RewardsAccountParams,
|
||||
};
|
||||
use pezbp_runtime::{Chain, RangeInclusiveExt, StaticStrProvider};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use core::{fmt::Debug, marker::PhantomData};
|
||||
use pezbp_runtime::{Chain, RangeInclusiveExt, StaticStrProvider};
|
||||
use pezframe_support::{
|
||||
dispatch::{DispatchInfo, PostDispatchInfo},
|
||||
pezpallet_prelude::TransactionSource,
|
||||
@@ -45,7 +45,6 @@ use pezpallet_bridge_messages::{
|
||||
use pezpallet_transaction_payment::{
|
||||
Config as TransactionPaymentConfig, OnChargeTransaction, Pezpallet as TransactionPaymentPallet,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{
|
||||
AsSystemOriginSigner, DispatchInfoOf, Dispatchable, PostDispatchInfoOf,
|
||||
@@ -54,6 +53,7 @@ use pezsp_runtime::{
|
||||
transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransactionBuilder},
|
||||
DispatchResult, RuntimeDebug,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub use grandpa_adapter::WithGrandpaChainExtensionConfig;
|
||||
pub use messages_adapter::WithMessagesExtensionConfig;
|
||||
@@ -464,16 +464,18 @@ mod tests {
|
||||
};
|
||||
use bp_pezkuwi_core::teyrchains::{ParaHeadsProof, ParaId};
|
||||
use bp_relayers::RuntimeWithUtilityPallet;
|
||||
use pezbp_runtime::{BasicOperatingMode, HeaderId, Teyrchain};
|
||||
use bp_test_utils::{make_default_justification, test_keyring, TEST_GRANDPA_SET_ID};
|
||||
use bp_teyrchains::{BestParaHeadHash, ParaInfo, SubmitTeyrchainHeadsInfo};
|
||||
use pezbp_runtime::{BasicOperatingMode, HeaderId, Teyrchain};
|
||||
use pezframe_support::{
|
||||
__private::pezsp_tracing,
|
||||
assert_storage_noop, parameter_types,
|
||||
traits::{fungible::Mutate, ReservableCurrency},
|
||||
weights::Weight,
|
||||
};
|
||||
use pezpallet_bridge_grandpa::{Call as GrandpaCall, Pezpallet as GrandpaPallet, StoredAuthoritySet};
|
||||
use pezpallet_bridge_grandpa::{
|
||||
Call as GrandpaCall, Pezpallet as GrandpaPallet, StoredAuthoritySet,
|
||||
};
|
||||
use pezpallet_bridge_messages::{Call as MessagesCall, Pezpallet as MessagesPallet};
|
||||
use pezpallet_bridge_teyrchains::{Call as TeyrchainsCall, Pezpallet as TeyrchainsPallet};
|
||||
use pezpallet_utility::Call as UtilityCall;
|
||||
|
||||
@@ -157,8 +157,8 @@ mod integrity_tests {
|
||||
pub fn ensure_priority_boost_is_sane<Runtime, GrandpaInstance, PriorityBoostPerHeader>(
|
||||
tip_boost_per_header: BalanceOf<Runtime>,
|
||||
) where
|
||||
Runtime:
|
||||
pezpallet_transaction_payment::Config + pezpallet_bridge_grandpa::Config<GrandpaInstance>,
|
||||
Runtime: pezpallet_transaction_payment::Config
|
||||
+ pezpallet_bridge_grandpa::Config<GrandpaInstance>,
|
||||
GrandpaInstance: 'static,
|
||||
PriorityBoostPerHeader: Get<TransactionPriority>,
|
||||
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
@@ -189,8 +189,8 @@ mod integrity_tests {
|
||||
tip: BalanceOf<Runtime>,
|
||||
) -> TransactionPriority
|
||||
where
|
||||
Runtime:
|
||||
pezpallet_transaction_payment::Config + pezpallet_bridge_grandpa::Config<GrandpaInstance>,
|
||||
Runtime: pezpallet_transaction_payment::Config
|
||||
+ pezpallet_bridge_grandpa::Config<GrandpaInstance>,
|
||||
GrandpaInstance: 'static,
|
||||
Runtime::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
BalanceOf<Runtime>: Send + Sync + FixedPointOperand,
|
||||
|
||||
@@ -25,8 +25,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use bp_relayers::{BatchCallUnpacker, ExtensionCallData, ExtensionCallInfo, ExtensionConfig};
|
||||
use pezbp_runtime::{StaticStrProvider, Teyrchain};
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::{StaticStrProvider, Teyrchain};
|
||||
use pezframe_support::dispatch::{DispatchInfo, PostDispatchInfo};
|
||||
use pezframe_system::Config as SystemConfig;
|
||||
use pezpallet_bridge_grandpa::{
|
||||
|
||||
@@ -23,8 +23,8 @@ extern crate alloc;
|
||||
|
||||
pub use bp_relayers::RewardLedger;
|
||||
use bp_relayers::{PaymentProcedure, Registration, RelayerRewardsKeyProvider, StakeAndSlash};
|
||||
use pezbp_runtime::StorageDoubleMapKeyProvider;
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::StorageDoubleMapKeyProvider;
|
||||
use pezframe_support::{fail, traits::tokens::Balance};
|
||||
use pezsp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
|
||||
use pezsp_runtime::{
|
||||
@@ -32,8 +32,8 @@ use pezsp_runtime::{
|
||||
Saturating,
|
||||
};
|
||||
|
||||
pub use pezpallet::*;
|
||||
pub use payment_adapter::{DeliveryConfirmationPaymentsAdapter, PayRewardFromAccount};
|
||||
pub use pezpallet::*;
|
||||
pub use stake_adapter::StakeAndSlashNamed;
|
||||
pub use weights::WeightInfo;
|
||||
pub use weights_ext::WeightInfoExt;
|
||||
@@ -1000,7 +1000,9 @@ mod tests {
|
||||
|
||||
let reserved_balance = Balances::reserved_balance(REGISTER_RELAYER);
|
||||
let free_balance = Balances::free_balance(REGISTER_RELAYER);
|
||||
assert_ok!(Pezpallet::<TestRuntime>::deregister(RuntimeOrigin::signed(REGISTER_RELAYER)));
|
||||
assert_ok!(Pezpallet::<TestRuntime>::deregister(RuntimeOrigin::signed(
|
||||
REGISTER_RELAYER
|
||||
)));
|
||||
assert_eq!(
|
||||
Balances::reserved_balance(REGISTER_RELAYER),
|
||||
reserved_balance - Stake::get()
|
||||
|
||||
@@ -30,12 +30,12 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
|
||||
pub mod v0 {
|
||||
use crate::{Config, Pezpallet};
|
||||
use bp_relayers::RewardsAccountOwner;
|
||||
use pezbp_runtime::{ChainId, StorageDoubleMapKeyProvider};
|
||||
use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::{ChainId, StorageDoubleMapKeyProvider};
|
||||
use pezframe_support::{pezpallet_prelude::OptionQuery, Blake2_128Concat, Identity};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::traits::AccountIdConversion;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Structure used to identify the account that pays a reward to the relayer.
|
||||
#[derive(Copy, Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo, MaxEncodedLen)]
|
||||
@@ -122,11 +122,12 @@ pub mod v1 {
|
||||
use crate::{Config, Pezpallet};
|
||||
use bp_messages::LaneIdType;
|
||||
use bp_relayers::RewardsAccountParams;
|
||||
use pezbp_runtime::StorageDoubleMapKeyProvider;
|
||||
use codec::{Codec, EncodeLike};
|
||||
use core::marker::PhantomData;
|
||||
use pezbp_runtime::StorageDoubleMapKeyProvider;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::OptionQuery, traits::UncheckedOnRuntimeUpgrade, Blake2_128Concat, Identity,
|
||||
pezpallet_prelude::OptionQuery, traits::UncheckedOnRuntimeUpgrade, Blake2_128Concat,
|
||||
Identity,
|
||||
};
|
||||
use pezsp_arithmetic::traits::Zero;
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ use bp_messages::{
|
||||
use bp_relayers::{
|
||||
PayRewardFromAccount, PaymentProcedure, RewardsAccountOwner, RewardsAccountParams,
|
||||
};
|
||||
use pezbp_runtime::{messages::MessageDispatchResult, Chain, ChainId, Teyrchain};
|
||||
use bp_teyrchains::SingleParaStoredHeaderDataBuilder;
|
||||
use codec::Encode;
|
||||
use pezbp_runtime::{messages::MessageDispatchResult, Chain, ChainId, Teyrchain};
|
||||
use pezframe_support::{
|
||||
derive_impl, parameter_types,
|
||||
traits::fungible::Mutate,
|
||||
@@ -267,12 +267,13 @@ impl pezpallet_bridge_messages::Config for TestRuntime {
|
||||
type LaneId = TestLaneIdType;
|
||||
|
||||
type DeliveryPayments = ();
|
||||
type DeliveryConfirmationPayments = pezpallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
|
||||
TestRuntime,
|
||||
(),
|
||||
(),
|
||||
ConstU64<100_000>,
|
||||
>;
|
||||
type DeliveryConfirmationPayments =
|
||||
pezpallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
|
||||
TestRuntime,
|
||||
(),
|
||||
(),
|
||||
ConstU64<100_000>,
|
||||
>;
|
||||
type OnMessagesDelivered = ();
|
||||
|
||||
type MessageDispatch = DummyMessageDispatch;
|
||||
@@ -408,7 +409,9 @@ pub fn test_reward_account_param() -> RewardsAccountParams<TestLaneIdType> {
|
||||
|
||||
/// Return test externalities to use in tests.
|
||||
pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
let t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
|
||||
let t = pezframe_system::GenesisConfig::<TestRuntime>::default()
|
||||
.build_storage()
|
||||
.unwrap();
|
||||
pezsp_io::TestExternalities::new(t)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ use bp_messages::{
|
||||
};
|
||||
pub use bp_relayers::PayRewardFromAccount;
|
||||
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
|
||||
use pezbp_runtime::Chain;
|
||||
use core::{marker::PhantomData, ops::RangeInclusive};
|
||||
use pezbp_runtime::Chain;
|
||||
use pezframe_support::{pezsp_runtime::SaturatedConversion, traits::Get};
|
||||
use pezpallet_bridge_messages::LaneIdOf;
|
||||
use pezsp_arithmetic::traits::{Saturating, Zero};
|
||||
@@ -55,8 +55,10 @@ where
|
||||
confirmation_relayer: &T::AccountId,
|
||||
received_range: &RangeInclusive<bp_messages::MessageNonce>,
|
||||
) -> MessageNonce {
|
||||
let relayers_rewards =
|
||||
bp_messages::calc_relayers_rewards::<T::AccountId>(pez_messages_relayers, received_range);
|
||||
let relayers_rewards = bp_messages::calc_relayers_rewards::<T::AccountId>(
|
||||
pez_messages_relayers,
|
||||
received_range,
|
||||
);
|
||||
let rewarded_relayers = relayers_rewards.len();
|
||||
|
||||
register_relayers_rewards::<T, RI, MI>(
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
use crate::{Config, GrandpaPalletOf, Pezpallet, RelayBlockNumber};
|
||||
use bp_header_pez_chain::HeaderChain;
|
||||
use pezbp_runtime::{HeaderId, OwnedBridgeModule};
|
||||
use bp_teyrchains::{BestParaHeadHash, SubmitTeyrchainHeadsInfo};
|
||||
use pezbp_runtime::{HeaderId, OwnedBridgeModule};
|
||||
use pezframe_support::{
|
||||
dispatch::CallableCallFor,
|
||||
traits::{Get, IsSubType},
|
||||
@@ -260,8 +260,8 @@ mod tests {
|
||||
};
|
||||
use bp_header_pez_chain::StoredHeaderData;
|
||||
use bp_pezkuwi_core::teyrchains::{ParaHash, ParaHeadsProof, ParaId};
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
use bp_teyrchains::BestParaHeadHash;
|
||||
use pezbp_runtime::BasicOperatingMode;
|
||||
|
||||
fn validate_submit_teyrchain_heads(
|
||||
num: RelayBlockNumber,
|
||||
|
||||
@@ -29,22 +29,22 @@ pub use weights_ext::WeightInfoExt;
|
||||
|
||||
use bp_header_pez_chain::{HeaderChain, HeaderChainError};
|
||||
use bp_pezkuwi_core::teyrchains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
|
||||
use pezbp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Teyrchain};
|
||||
use bp_teyrchains::{
|
||||
ParaInfo, ParaStoredHeaderData, RelayBlockHash, RelayBlockHasher, RelayBlockNumber,
|
||||
SubmitTeyrchainHeadsInfo,
|
||||
};
|
||||
use pezbp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Teyrchain};
|
||||
use pezframe_support::{dispatch::PostDispatchInfo, DefaultNoBound};
|
||||
use pezpallet_bridge_grandpa::SubmitFinalityProofHelper;
|
||||
use proofs::{StorageProofAdapter, TeyrchainsStorageProofAdapter};
|
||||
use pezsp_std::{marker::PhantomData, vec::Vec};
|
||||
use proofs::{StorageProofAdapter, TeyrchainsStorageProofAdapter};
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use pezbp_runtime::HeaderOf;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use bp_teyrchains::ParaStoredHeaderDataBuilder;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use codec::Encode;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use pezbp_runtime::HeaderOf;
|
||||
|
||||
// Re-export in crate namespace for `construct_runtime!`.
|
||||
pub use call_ext::*;
|
||||
@@ -75,14 +75,14 @@ struct UpdateTeyrchainHeadArtifacts {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezbp_runtime::{
|
||||
BasicOperatingMode, BoundedStorageValue, OwnedBridgeModule, StorageDoubleMapKeyProvider,
|
||||
StorageMapKeyProvider,
|
||||
};
|
||||
use bp_teyrchains::{
|
||||
BestParaHeadHash, ImportedParaHeadsKeyProvider, OnNewHead, ParaStoredHeaderDataBuilder,
|
||||
ParasInfoKeyProvider,
|
||||
};
|
||||
use pezbp_runtime::{
|
||||
BasicOperatingMode, BoundedStorageValue, OwnedBridgeModule, StorageDoubleMapKeyProvider,
|
||||
StorageMapKeyProvider,
|
||||
};
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
@@ -98,7 +98,8 @@ pub mod pezpallet {
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// The caller has provided head of teyrchain that the pezpallet is not configured to track.
|
||||
/// The caller has provided head of teyrchain that the pezpallet is not configured to
|
||||
/// track.
|
||||
UntrackedTeyrchainRejected {
|
||||
/// Identifier of the teyrchain that is not tracked by the pezpallet.
|
||||
teyrchain: ParaId,
|
||||
@@ -119,7 +120,8 @@ pub mod pezpallet {
|
||||
/// Actual teyrchain head hash.
|
||||
actual_teyrchain_head_hash: ParaHash,
|
||||
},
|
||||
/// The caller has provided obsolete teyrchain head, which is already known to the pezpallet.
|
||||
/// The caller has provided obsolete teyrchain head, which is already known to the
|
||||
/// pezpallet.
|
||||
RejectedObsoleteTeyrchainHead {
|
||||
/// Identifier of the teyrchain with obsolete head.
|
||||
teyrchain: ParaId,
|
||||
@@ -189,7 +191,8 @@ pub mod pezpallet {
|
||||
/// Benchmarks results from runtime we're plugged into.
|
||||
type WeightInfo: WeightInfoExt;
|
||||
|
||||
/// Instance of bridges GRANDPA pezpallet (within this runtime) that this pezpallet is linked to.
|
||||
/// Instance of bridges GRANDPA pezpallet (within this runtime) that this pezpallet is
|
||||
/// linked to.
|
||||
///
|
||||
/// The GRANDPA pezpallet instance must be configured to import headers of relay chain that
|
||||
/// we're interested in.
|
||||
@@ -583,8 +586,10 @@ pub mod pezpallet {
|
||||
&& 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");
|
||||
pezpallet_bridge_grandpa::on_free_header_imported::<T, T::BridgesGrandpaPalletInstance>(
|
||||
);
|
||||
pezpallet_bridge_grandpa::on_free_header_imported::<
|
||||
T,
|
||||
T::BridgesGrandpaPalletInstance,
|
||||
>();
|
||||
Pays::No
|
||||
} else {
|
||||
tracing::trace!(target: LOG_TARGET, "Teyrchain heads update transaction is paid");
|
||||
@@ -791,7 +796,8 @@ impl<T: Config<I>, I: 'static, C: Teyrchain<Hash = ParaHash>> HeaderChain<C>
|
||||
}
|
||||
}
|
||||
|
||||
/// (Re)initialize pezpallet with given header for using it in `pezpallet-bridge-messages` benchmarks.
|
||||
/// (Re)initialize pezpallet 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>,
|
||||
@@ -839,10 +845,6 @@ pub(crate) mod tests {
|
||||
|
||||
use bp_header_pez_chain::{justification::GrandpaJustification, StoredHeaderGrandpaInfo};
|
||||
use bp_pezkuwi_core::teyrchains::ParaHead;
|
||||
use pezbp_runtime::{
|
||||
BasicOperatingMode, OwnedBridgeModuleError, StorageDoubleMapKeyProvider,
|
||||
StorageMapKeyProvider, StorageProofError,
|
||||
};
|
||||
use bp_test_utils::{
|
||||
authority_list, generate_owned_bridge_module_tests, make_default_justification,
|
||||
TEST_GRANDPA_SET_ID,
|
||||
@@ -850,6 +852,10 @@ pub(crate) mod tests {
|
||||
use bp_teyrchains::{
|
||||
BestParaHeadHash, BridgeTeyrchainCall, ImportedParaHeadsKeyProvider, ParasInfoKeyProvider,
|
||||
};
|
||||
use pezbp_runtime::{
|
||||
BasicOperatingMode, OwnedBridgeModuleError, StorageDoubleMapKeyProvider,
|
||||
StorageMapKeyProvider, StorageProofError,
|
||||
};
|
||||
use pezframe_support::{
|
||||
assert_noop, assert_ok,
|
||||
dispatch::DispatchResultWithPostInfo,
|
||||
@@ -1842,9 +1848,10 @@ pub(crate) mod tests {
|
||||
initialize(Default::default());
|
||||
// set free headers limit to `4`
|
||||
let mut free_headers_remaining = 4;
|
||||
pezpallet_bridge_grandpa::FreeHeadersRemaining::<TestRuntime, BridgesGrandpaPalletInstance>::set(
|
||||
Some(free_headers_remaining),
|
||||
);
|
||||
pezpallet_bridge_grandpa::FreeHeadersRemaining::<
|
||||
TestRuntime,
|
||||
BridgesGrandpaPalletInstance,
|
||||
>::set(Some(free_headers_remaining));
|
||||
// import free GRANDPA and teyrchain headers
|
||||
let mut relay_block_number = 0;
|
||||
for i in 0..2 {
|
||||
@@ -1882,7 +1889,10 @@ 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 = pezpallet_bridge_grandpa::Pezpallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof_ex(
|
||||
let result = pezpallet_bridge_grandpa::Pezpallet::<
|
||||
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)),
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
use crate::{Config, GrandpaPalletOf, RelayBlockHash, RelayBlockHasher};
|
||||
use bp_header_pez_chain::{HeaderChain, HeaderChainError};
|
||||
use bp_pezkuwi_core::teyrchains::{ParaHead, ParaId};
|
||||
use pezbp_runtime::{RawStorageProof, StorageProofChecker, StorageProofError};
|
||||
use bp_teyrchains::teyrchain_head_storage_key_at_source;
|
||||
use codec::Decode;
|
||||
use pezbp_runtime::{RawStorageProof, StorageProofChecker, StorageProofError};
|
||||
use pezframe_support::traits::Get;
|
||||
|
||||
/// Abstraction over storage proof manipulation, hiding implementation details of actual storage
|
||||
|
||||
@@ -445,8 +445,8 @@ impl<T: Config<I>, I: 'static> FeeTracker for Pezpallet<T, I> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pezframe_support::assert_ok;
|
||||
use mock::*;
|
||||
use pezframe_support::assert_ok;
|
||||
|
||||
use pezframe_support::traits::Hooks;
|
||||
use pezframe_system::{EventRecord, Phase};
|
||||
|
||||
@@ -88,7 +88,9 @@ impl pezpallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
|
||||
type FeeAsset = BridgeFeeAsset;
|
||||
}
|
||||
|
||||
pub struct LatestOrNoneForLocationVersionChecker<Location>(pezsp_std::marker::PhantomData<Location>);
|
||||
pub struct LatestOrNoneForLocationVersionChecker<Location>(
|
||||
pezsp_std::marker::PhantomData<Location>,
|
||||
);
|
||||
impl<LocationValue: Contains<Location>> GetVersion
|
||||
for LatestOrNoneForLocationVersionChecker<LocationValue>
|
||||
{
|
||||
@@ -172,7 +174,9 @@ impl XcmChannelStatusProvider for TestLocalXcmChannelManager {
|
||||
|
||||
/// Return test externalities to use in tests.
|
||||
pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
let t = pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap();
|
||||
let t = pezframe_system::GenesisConfig::<TestRuntime>::default()
|
||||
.build_storage()
|
||||
.unwrap();
|
||||
pezsp_io::TestExternalities::new(t)
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ pub trait WeightInfo {
|
||||
fn report_bridge_status() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for `pezpallet_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>);
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
use crate::{Config, Pezpallet, LOG_TARGET};
|
||||
|
||||
use bp_messages::target_chain::{DispatchMessage, MessageDispatch};
|
||||
use pezbp_runtime::messages::MessageDispatchResult;
|
||||
use bp_xcm_bridge_hub::{LocalXcmChannelManager, XcmAsPlainPayload};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use pezbp_runtime::messages::MessageDispatchResult;
|
||||
use pezframe_support::{weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, WeightInfoExt};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::SaturatedConversion;
|
||||
use scale_info::TypeInfo;
|
||||
use xcm::prelude::*;
|
||||
use xcm_builder::{DispatchBlob, DispatchBlobError};
|
||||
|
||||
|
||||
@@ -355,9 +355,9 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
|
||||
///
|
||||
/// We are using `HaulBlobExporter`, which requires `HaulBlob` implementation. It assumes that
|
||||
/// there's a single channel between two bridge hubs - `HaulBlob` only accepts the blob and nothing
|
||||
/// else. But bridge messages pezpallet may have a dedicated channel (lane) for every pair of bridged
|
||||
/// chains. So we are using our own `ExportXcm` implementation, but to utilize `HaulBlobExporter` we
|
||||
/// still need this `DummyHaulBlob`.
|
||||
/// else. But bridge messages pezpallet may have a dedicated channel (lane) for every pair of
|
||||
/// bridged chains. So we are using our own `ExportXcm` implementation, but to utilize
|
||||
/// `HaulBlobExporter` we still need this `DummyHaulBlob`.
|
||||
pub struct DummyHaulBlob;
|
||||
|
||||
impl HaulBlob for DummyHaulBlob {
|
||||
@@ -371,8 +371,8 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::{mock::*, Bridges, LaneToBridge, LanesManagerOf};
|
||||
|
||||
use pezbp_runtime::RangeInclusiveExt;
|
||||
use bp_xcm_bridge_hub::{Bridge, BridgeLocations, BridgeState};
|
||||
use pezbp_runtime::RangeInclusiveExt;
|
||||
use pezframe_support::{assert_ok, traits::EnsureOrigin};
|
||||
use pezpallet_bridge_messages::InboundLaneStorage;
|
||||
use xcm_builder::{NetworkExportTable, UnpaidRemoteExporter};
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
//! open and close bridges between local (to this pezpallet location) and remote XCM
|
||||
//! destinations.
|
||||
//!
|
||||
//! The `pezpallet_xcm_bridge_hub` pezpallet 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.
|
||||
//! The `pezpallet_xcm_bridge_hub` pezpallet 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`
|
||||
//!
|
||||
@@ -48,8 +48,8 @@
|
||||
//!
|
||||
//! # Concept of `bridge` and `BridgeId`
|
||||
//!
|
||||
//! The `pezpallet_xcm_bridge_hub` pezpallet needs to store some metadata about opened bridges. The bridge
|
||||
//! (or bridge metadata) is stored under the `BridgeId` key.
|
||||
//! The `pezpallet_xcm_bridge_hub` pezpallet 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
|
||||
//! `bridge_origin_universal_location` using the `latest` XCM structs. `BridgeId` is not transferred
|
||||
@@ -62,8 +62,8 @@
|
||||
//!
|
||||
//! # Migrations and State
|
||||
//!
|
||||
//! This pezpallet implements `try_state`, ensuring compatibility and checking everything so we know if
|
||||
//! any migration is needed. `do_try_state` checks for `BridgeId` compatibility, which is
|
||||
//! This pezpallet implements `try_state`, ensuring compatibility and checking everything so we know
|
||||
//! if any migration is needed. `do_try_state` checks for `BridgeId` compatibility, which is
|
||||
//! recalculated on runtime upgrade. Upgrading to a new XCM version should not break anything,
|
||||
//! except removing older XCM versions. In such cases, we need to add migration for `BridgeId` and
|
||||
//! stored `Versioned*` structs and update `LaneToBridge` mapping, but this won't affect `LaneId`
|
||||
@@ -144,11 +144,11 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use bp_messages::{LaneState, MessageNonce};
|
||||
use pezbp_runtime::{AccountIdOf, BalanceOf, RangeInclusiveExt};
|
||||
use bp_xcm_bridge_hub::BridgeLocationsError;
|
||||
pub use bp_xcm_bridge_hub::{
|
||||
Bridge, BridgeId, BridgeLocations, BridgeState, LocalXcmChannelManager,
|
||||
};
|
||||
use pezbp_runtime::{AccountIdOf, BalanceOf, RangeInclusiveExt};
|
||||
use pezframe_support::{traits::fungible::MutateHold, DefaultNoBound};
|
||||
use pezframe_system::Config as SystemConfig;
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
|
||||
@@ -215,8 +215,8 @@ pub mod pezpallet {
|
||||
/// Checks the XCM version for the destination.
|
||||
type DestinationVersion: GetVersion;
|
||||
|
||||
/// The origin that is allowed to call privileged operations on the pezpallet, e.g. open/close
|
||||
/// bridge for locations.
|
||||
/// The origin that is allowed to call privileged operations on the pezpallet, e.g.
|
||||
/// open/close bridge for locations.
|
||||
type ForceOrigin: EnsureOrigin<<Self as SystemConfig>::RuntimeOrigin>;
|
||||
/// A set of XCM locations within local consensus system that are allowed to open
|
||||
/// bridges with remote destinations.
|
||||
@@ -691,10 +691,15 @@ pub mod pezpallet {
|
||||
Ok(bridge.lane_id)
|
||||
}
|
||||
|
||||
/// Ensure the correctness of the state of the connected `pezpallet_bridge_messages` instance.
|
||||
/// 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 pezpallet_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 +708,11 @@ pub mod pezpallet {
|
||||
}
|
||||
|
||||
// check that all `OutboundLanes` laneIds have mapping to some bridge.
|
||||
for lane_id in pezpallet_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(),
|
||||
@@ -839,7 +848,9 @@ mod tests {
|
||||
use bp_messages::LaneIdType;
|
||||
use mock::*;
|
||||
|
||||
use pezframe_support::{assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec};
|
||||
use pezframe_support::{
|
||||
assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec,
|
||||
};
|
||||
use pezframe_system::{EventRecord, Phase};
|
||||
use pezsp_runtime::TryRuntimeError;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ use bp_messages::{
|
||||
target_chain::{DispatchMessage, MessageDispatch},
|
||||
ChainWithMessages, HashedLaneId, MessageNonce,
|
||||
};
|
||||
use pezbp_runtime::{messages::MessageDispatchResult, Chain, ChainId, HashOf};
|
||||
use bp_xcm_bridge_hub::{BridgeId, LocalXcmChannelManager};
|
||||
use codec::{Decode, Encode};
|
||||
use pezbp_runtime::{messages::MessageDispatchResult, Chain, ChainId, HashOf};
|
||||
use pezframe_support::{
|
||||
assert_ok, derive_impl, parameter_types,
|
||||
traits::{EnsureOrigin, Equals, Everything, Get, OriginTrait},
|
||||
@@ -276,8 +276,8 @@ thread_local! {
|
||||
|
||||
/// The `SendXcm` implementation directly executes XCM using `XcmExecutor`.
|
||||
///
|
||||
/// We ensure that the `ExportMessage` produced by `pezpallet_xcm_bridge_hub_router` is compatible with
|
||||
/// the `ExportXcm` implementation of `pezpallet_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 `pezpallet_xcm_bridge_hub` as `MessageExporter`.
|
||||
@@ -663,7 +663,9 @@ impl MessageDispatch for TestMessageDispatch {
|
||||
/// Run pezpallet test.
|
||||
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
|
||||
pezsp_io::TestExternalities::new(
|
||||
pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap(),
|
||||
pezframe_system::GenesisConfig::<TestRuntime>::default()
|
||||
.build_storage()
|
||||
.unwrap(),
|
||||
)
|
||||
.execute_with(test)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user