mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 18:55:48 +00:00
update Substrate/Polkadot/Cumulus refs (#1562)
* update Substrate/Polkadot/Cumulus refs * finality-grandpa 0.16 * fix miillau-runtime compilation * fix rialto runtime compilation * fixed rialto-parachain runtime compilation * backport GRANDPA test fixes * helper instead of removed record_all_keys * substrate-relay is compiling * millau-bridge-node at least compiles * rialto-bridge-node at least compiles * rialto-parachain-collator compiles * fixings tests (wip) * fmt * fixed BEEFY alert * clippy * removed unused dep * -extra var * move Leaf to mod mmr * fix benchmarks
This commit is contained in:
committed by
Bastian Köcher
parent
ad38cdb873
commit
95c30c780c
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
|
||||
finality-grandpa = { version = "0.15.0", default-features = false }
|
||||
finality-grandpa = { version = "0.16.0", default-features = false }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
num-traits = { version = "0.2", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
|
||||
@@ -741,7 +741,7 @@ pub mod pallet {
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
PalletOperatingMode::<T, I>::put(&self.operating_mode);
|
||||
PalletOperatingMode::<T, I>::put(self.operating_mode);
|
||||
if let Some(ref owner) = self.owner {
|
||||
PalletOwner::<T, I>::put(owner);
|
||||
}
|
||||
@@ -1022,7 +1022,7 @@ impl<T: Config<I>, I: 'static> InboundLaneStorage for RuntimeInboundLaneStorage<
|
||||
Some(data) => data,
|
||||
None => {
|
||||
let data: InboundLaneData<T::InboundRelayer> =
|
||||
InboundLanes::<T, I>::get(&self.lane_id).into();
|
||||
InboundLanes::<T, I>::get(self.lane_id).into();
|
||||
*self.cached_data.try_borrow_mut().expect(
|
||||
"we're in the single-threaded environment;\
|
||||
we have no recursive borrows; qed",
|
||||
@@ -1037,7 +1037,7 @@ impl<T: Config<I>, I: 'static> InboundLaneStorage for RuntimeInboundLaneStorage<
|
||||
"we're in the single-threaded environment;\
|
||||
we have no recursive borrows; qed",
|
||||
) = Some(data.clone());
|
||||
InboundLanes::<T, I>::insert(&self.lane_id, StoredInboundLaneData::<T, I>(data))
|
||||
InboundLanes::<T, I>::insert(self.lane_id, StoredInboundLaneData::<T, I>(data))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,11 +1055,11 @@ impl<T: Config<I>, I: 'static> OutboundLaneStorage for RuntimeOutboundLaneStorag
|
||||
}
|
||||
|
||||
fn data(&self) -> OutboundLaneData {
|
||||
OutboundLanes::<T, I>::get(&self.lane_id)
|
||||
OutboundLanes::<T, I>::get(self.lane_id)
|
||||
}
|
||||
|
||||
fn set_data(&mut self, data: OutboundLaneData) {
|
||||
OutboundLanes::<T, I>::insert(&self.lane_id, data)
|
||||
OutboundLanes::<T, I>::insert(self.lane_id, data)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -1134,7 +1134,7 @@ mod tests {
|
||||
fn inbound_unrewarded_relayers_state(
|
||||
lane: bp_messages::LaneId,
|
||||
) -> bp_messages::UnrewardedRelayersState {
|
||||
let inbound_lane_data = InboundLanes::<TestRuntime, ()>::get(&lane).0;
|
||||
let inbound_lane_data = InboundLanes::<TestRuntime, ()>::get(lane).0;
|
||||
let last_delivered_nonce = inbound_lane_data.last_delivered_nonce();
|
||||
let relayers = inbound_lane_data.relayers;
|
||||
bp_messages::UnrewardedRelayersState {
|
||||
@@ -1656,7 +1656,7 @@ mod tests {
|
||||
receive_messages_delivery_proof();
|
||||
|
||||
assert_eq!(
|
||||
OutboundLanes::<TestRuntime, ()>::get(&TEST_LANE_ID).latest_received_nonce,
|
||||
OutboundLanes::<TestRuntime, ()>::get(TEST_LANE_ID).latest_received_nonce,
|
||||
1,
|
||||
);
|
||||
});
|
||||
@@ -1839,7 +1839,7 @@ mod tests {
|
||||
0, // weight may be zero in this case (all messages are improperly encoded)
|
||||
),);
|
||||
|
||||
assert_eq!(InboundLanes::<TestRuntime>::get(&TEST_LANE_ID).last_delivered_nonce(), 1,);
|
||||
assert_eq!(InboundLanes::<TestRuntime>::get(TEST_LANE_ID).last_delivered_nonce(), 1,);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1860,7 +1860,7 @@ mod tests {
|
||||
REGULAR_PAYLOAD.declared_weight + REGULAR_PAYLOAD.declared_weight,
|
||||
),);
|
||||
|
||||
assert_eq!(InboundLanes::<TestRuntime>::get(&TEST_LANE_ID).last_delivered_nonce(), 3,);
|
||||
assert_eq!(InboundLanes::<TestRuntime>::get(TEST_LANE_ID).last_delivered_nonce(), 3,);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ pub mod pallet {
|
||||
target: LOG_TARGET,
|
||||
"The head of parachain {:?} is None. {}",
|
||||
parachain,
|
||||
if ParasInfo::<T, I>::contains_key(¶chain) {
|
||||
if ParasInfo::<T, I>::contains_key(parachain) {
|
||||
"Looks like it is not yet registered at the source relay chain"
|
||||
} else {
|
||||
"Looks like it has been deregistered from the source relay chain"
|
||||
@@ -514,7 +514,7 @@ pub mod pallet {
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
PalletOperatingMode::<T, I>::put(&self.operating_mode);
|
||||
PalletOperatingMode::<T, I>::put(self.operating_mode);
|
||||
if let Some(ref owner) = self.owner {
|
||||
PalletOwner::<T, I>::put(owner);
|
||||
}
|
||||
@@ -532,8 +532,8 @@ mod tests {
|
||||
|
||||
use bp_parachains::{BestParaHeadHash, ImportedParaHeadsKeyProvider, ParasInfoKeyProvider};
|
||||
use bp_runtime::{
|
||||
BasicOperatingMode, OwnedBridgeModuleError, StorageDoubleMapKeyProvider,
|
||||
StorageMapKeyProvider,
|
||||
record_all_trie_keys, BasicOperatingMode, OwnedBridgeModuleError,
|
||||
StorageDoubleMapKeyProvider, StorageMapKeyProvider,
|
||||
};
|
||||
use bp_test_utils::{
|
||||
authority_list, generate_owned_bridge_module_tests, make_default_justification,
|
||||
@@ -546,9 +546,7 @@ mod tests {
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_runtime::DispatchError;
|
||||
use sp_trie::{
|
||||
record_all_keys, trie_types::TrieDBMutV1, LayoutV1, MemoryDB, Recorder, TrieMut,
|
||||
};
|
||||
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, Recorder, TrieMut};
|
||||
|
||||
type BridgesGrandpaPalletInstance = pallet_bridge_grandpa::Instance1;
|
||||
type WeightInfo = <TestRuntime as Config>::WeightInfo;
|
||||
@@ -590,7 +588,7 @@ mod tests {
|
||||
let mut root = Default::default();
|
||||
let mut mdb = MemoryDB::default();
|
||||
{
|
||||
let mut trie = TrieDBMutV1::<RelayBlockHasher>::new(&mut mdb, &mut root);
|
||||
let mut trie = TrieDBMutBuilderV1::<RelayBlockHasher>::new(&mut mdb, &mut root).build();
|
||||
for (parachain, head) in heads {
|
||||
let storage_key =
|
||||
parachain_head_storage_key_at_source(PARAS_PALLET_NAME, ParaId(parachain));
|
||||
@@ -602,10 +600,10 @@ mod tests {
|
||||
}
|
||||
|
||||
// generate storage proof to be delivered to This chain
|
||||
let mut proof_recorder = Recorder::<RelayBlockHash>::new();
|
||||
record_all_keys::<LayoutV1<RelayBlockHasher>, _>(&mdb, &root, &mut proof_recorder)
|
||||
.map_err(|_| "record_all_keys has failed")
|
||||
.expect("record_all_keys should not fail in benchmarks");
|
||||
let mut proof_recorder = Recorder::<LayoutV1<RelayBlockHasher>>::new();
|
||||
record_all_trie_keys::<LayoutV1<RelayBlockHasher>, _>(&mdb, &root, &mut proof_recorder)
|
||||
.map_err(|_| "record_all_trie_keys has failed")
|
||||
.expect("record_all_trie_keys should not fail in benchmarks");
|
||||
let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect();
|
||||
|
||||
(root, ParaHeadsProof(storage_proof), parachains)
|
||||
|
||||
@@ -148,8 +148,8 @@ mod tests {
|
||||
run_test(|| {
|
||||
register_relayers_rewards::<TestRuntime>(&RELAYER_2, relayers_rewards(), 10);
|
||||
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_1), Some(80));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_2), Some(120));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_1), Some(80));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_2), Some(120));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ mod tests {
|
||||
run_test(|| {
|
||||
register_relayers_rewards::<TestRuntime>(&RELAYER_3, relayers_rewards(), 10);
|
||||
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_1), Some(80));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_2), Some(70));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_3), Some(50));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_1), Some(80));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_2), Some(70));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_3), Some(50));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -169,9 +169,9 @@ mod tests {
|
||||
run_test(|| {
|
||||
register_relayers_rewards::<TestRuntime>(&RELAYER_3, relayers_rewards(), 1000);
|
||||
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_1), None);
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_2), None);
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(&RELAYER_3), Some(200));
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_1), None);
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_2), None);
|
||||
assert_eq!(RelayerRewards::<TestRuntime>::get(RELAYER_3), Some(200));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use frame_support::traits::{ValidatorSet, ValidatorSetWithIdentification};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use pallet::*;
|
||||
@@ -49,6 +50,24 @@ pub mod pallet {
|
||||
pub(super) type InitialValidators<T: Config> = StorageValue<_, Vec<T::ValidatorId>>;
|
||||
}
|
||||
|
||||
impl<T: pallet_session::Config + Config> ValidatorSet<T::AccountId> for Pallet<T> {
|
||||
type ValidatorId = T::ValidatorId;
|
||||
type ValidatorIdOf = T::ValidatorIdOf;
|
||||
|
||||
fn session_index() -> sp_staking::SessionIndex {
|
||||
pallet_session::Pallet::<T>::current_index()
|
||||
}
|
||||
|
||||
fn validators() -> Vec<Self::ValidatorId> {
|
||||
pallet_session::Pallet::<T>::validators()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> ValidatorSetWithIdentification<T::AccountId> for Pallet<T> {
|
||||
type Identification = ();
|
||||
type IdentificationOf = ();
|
||||
}
|
||||
|
||||
impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> {
|
||||
fn end_session(_: sp_staking::SessionIndex) {}
|
||||
fn start_session(_: sp_staking::SessionIndex) {}
|
||||
|
||||
Reference in New Issue
Block a user