mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Rococo to use BABE randomness, Westend & Rococo runtime synchronization in file format (#5082)
* * Rococo to use BABE randomness * Westend & Rococo runtime syncronization in file format (starting) * explicit frame_support::weights::Weight
This commit is contained in:
@@ -14,26 +14,37 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The Polkadot runtime. This can be compiled with `#[no_std]`, ready for Wasm.
|
||||
//! The Westend runtime. This can be compiled with `#[no_std]`, ready for Wasm.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
use pallet_transaction_payment::CurrencyAdapter;
|
||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Contains, InstanceFilter, KeyOwnerProofSystem, OnRuntimeUpgrade},
|
||||
PalletId,
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
|
||||
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use pallet_mmr_primitives as mmr;
|
||||
use pallet_session::historical as session_historical;
|
||||
use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};
|
||||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
use primitives::v2::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt,
|
||||
CoreState, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
|
||||
Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes,
|
||||
SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId,
|
||||
ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use runtime_common::{
|
||||
assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar,
|
||||
paras_sudo_wrapper, slots, BlockHashCount, BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate,
|
||||
};
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
|
||||
use runtime_parachains::{
|
||||
configuration as parachains_configuration, disputes as parachains_disputes,
|
||||
dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
|
||||
@@ -42,21 +53,8 @@ use runtime_parachains::{
|
||||
runtime_api_impl::v2 as parachains_runtime_api_impl, scheduler as parachains_scheduler,
|
||||
session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump,
|
||||
};
|
||||
|
||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Contains, InstanceFilter, KeyOwnerProofSystem, OnRuntimeUpgrade},
|
||||
PalletId, RuntimeDebug,
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
|
||||
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use pallet_mmr_primitives as mmr;
|
||||
use pallet_session::historical as session_historical;
|
||||
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
|
||||
use sp_core::OpaqueMetadata;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::{OpaqueMetadata, RuntimeDebug};
|
||||
use sp_runtime::{
|
||||
create_runtime_str,
|
||||
curve::PiecewiseLinear,
|
||||
@@ -69,11 +67,11 @@ use sp_runtime::{
|
||||
ApplyExtrinsicResult, KeyTypeId, Perbill,
|
||||
};
|
||||
use sp_staking::SessionIndex;
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
pub use pallet_election_provider_multi_phase::Call as EPMCall;
|
||||
#[cfg(feature = "std")]
|
||||
pub use pallet_staking::StakerStatus;
|
||||
@@ -84,13 +82,8 @@ pub use sp_runtime::BuildStorage;
|
||||
/// Constant values used within the runtime.
|
||||
use westend_runtime_constants::{currency::*, fee::*, time::*};
|
||||
|
||||
// Weights used in the runtime
|
||||
mod weights;
|
||||
|
||||
// Voter bag threshold definitions.
|
||||
mod bag_thresholds;
|
||||
|
||||
// XCM configurations.
|
||||
mod weights;
|
||||
pub mod xcm_config;
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -171,7 +164,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
|
||||
pub MaximumSchedulerWeight: frame_support::weights::Weight = Perbill::from_percent(80) *
|
||||
BlockWeights::get().max_block;
|
||||
pub const MaxScheduledPerBlock: u32 = 50;
|
||||
pub const NoPreimagePostponement: Option<u32> = Some(10);
|
||||
@@ -704,7 +697,7 @@ parameter_types! {
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
scale_info::TypeInfo,
|
||||
TypeInfo,
|
||||
)]
|
||||
pub enum ProxyType {
|
||||
Any,
|
||||
@@ -1301,8 +1294,8 @@ sp_api::impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn submit_pvf_check_statement(
|
||||
stmt: primitives::v2::PvfCheckStatement,
|
||||
signature: primitives::v2::ValidatorSignature,
|
||||
stmt: PvfCheckStatement,
|
||||
signature: ValidatorSignature,
|
||||
) {
|
||||
parachains_runtime_api_impl::submit_pvf_check_statement::<Runtime>(stmt, signature)
|
||||
}
|
||||
@@ -1477,12 +1470,12 @@ sp_api::impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
fn on_runtime_upgrade() -> (frame_support::weights::Weight, frame_support::weights::Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade westend.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
(weight, BlockWeights::get().max_block)
|
||||
}
|
||||
fn execute_block_no_check(block: Block) -> Weight {
|
||||
fn execute_block_no_check(block: Block) -> frame_support::weights::Weight {
|
||||
Executive::execute_block_no_check(block)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ fn sample_size_is_sensible() {
|
||||
use runtime_common::auctions::WeightInfo;
|
||||
// Need to clean up all samples at the end of an auction.
|
||||
let samples: BlockNumber = EndingPeriod::get() / SampleLength::get();
|
||||
let max_weight: Weight = RocksDbWeight::get().reads_writes(samples.into(), samples.into());
|
||||
let max_weight: frame_support::weights::Weight =
|
||||
RocksDbWeight::get().reads_writes(samples.into(), samples.into());
|
||||
// Max sample cleanup should be no more than half the total block weight.
|
||||
assert!(max_weight * 2 < BlockWeights::get().max_block);
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user