mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
paras: dismiss pvf_checking_enabled configuration (#7138)
* paras: unconditionally precheck pvfs * Update integration tests * paras_registrar tests * runtime benchmark tests * fix bench * bypass prechecking in test node * adjust bench * ".git/.scripts/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras * ".git/.scripts/commands/bench/bench.sh" runtime kusama runtime_parachains::paras * ".git/.scripts/commands/bench/bench.sh" runtime rococo runtime_parachains::paras * ".git/.scripts/commands/bench/bench.sh" runtime westend runtime_parachains::paras * use test helper * fix new test --------- Co-authored-by: command-bot <>
This commit is contained in:
Generated
+1
@@ -7896,6 +7896,7 @@ dependencies = [
|
||||
"sp-core",
|
||||
"sp-inherents",
|
||||
"sp-io",
|
||||
"sp-keyring",
|
||||
"sp-keystore",
|
||||
"sp-npos-elections",
|
||||
"sp-runtime",
|
||||
|
||||
@@ -32,8 +32,8 @@ use polkadot_service::{
|
||||
ClientHandle, Error, ExecuteWithClient, FullClient, IsCollator, NewFull, PrometheusConfig,
|
||||
};
|
||||
use polkadot_test_runtime::{
|
||||
ParasSudoWrapperCall, Runtime, SignedExtra, SignedPayload, SudoCall, UncheckedExtrinsic,
|
||||
VERSION,
|
||||
ParasCall, ParasSudoWrapperCall, Runtime, SignedExtra, SignedPayload, SudoCall,
|
||||
UncheckedExtrinsic, VERSION,
|
||||
};
|
||||
use sc_chain_spec::ChainSpec;
|
||||
use sc_client_api::execution_extensions::ExecutionStrategies;
|
||||
@@ -281,6 +281,19 @@ pub struct PolkadotTestNode {
|
||||
}
|
||||
|
||||
impl PolkadotTestNode {
|
||||
/// Send a sudo call to this node.
|
||||
async fn send_sudo(
|
||||
&self,
|
||||
call: impl Into<polkadot_test_runtime::RuntimeCall>,
|
||||
caller: Sr25519Keyring,
|
||||
nonce: u32,
|
||||
) -> Result<(), RpcTransactionError> {
|
||||
let sudo = SudoCall::sudo { call: Box::new(call.into()) };
|
||||
|
||||
let extrinsic = construct_extrinsic(&*self.client, sudo, caller, nonce);
|
||||
self.rpc_handlers.send_transaction(extrinsic.into()).await.map(drop)
|
||||
}
|
||||
|
||||
/// Send an extrinsic to this node.
|
||||
pub async fn send_extrinsic(
|
||||
&self,
|
||||
@@ -299,18 +312,21 @@ impl PolkadotTestNode {
|
||||
validation_code: impl Into<ValidationCode>,
|
||||
genesis_head: impl Into<HeadData>,
|
||||
) -> Result<(), RpcTransactionError> {
|
||||
let validation_code: ValidationCode = validation_code.into();
|
||||
let call = ParasSudoWrapperCall::sudo_schedule_para_initialize {
|
||||
id,
|
||||
genesis: ParaGenesisArgs {
|
||||
genesis_head: genesis_head.into(),
|
||||
validation_code: validation_code.into(),
|
||||
validation_code: validation_code.clone(),
|
||||
para_kind: ParaKind::Parachain,
|
||||
},
|
||||
};
|
||||
|
||||
self.send_extrinsic(SudoCall::sudo { call: Box::new(call.into()) }, Sr25519Keyring::Alice)
|
||||
.await
|
||||
.map(drop)
|
||||
self.send_sudo(call, Sr25519Keyring::Alice, 0).await?;
|
||||
|
||||
// Bypass pvf-checking.
|
||||
let call = ParasCall::add_trusted_validation_code { validation_code };
|
||||
self.send_sudo(call, Sr25519Keyring::Alice, 1).await
|
||||
}
|
||||
|
||||
/// Wait for `count` blocks to be imported in the node and then exit. This function will not return if no blocks
|
||||
|
||||
@@ -56,6 +56,7 @@ frame-support-test = { git = "https://github.com/paritytech/substrate", branch =
|
||||
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
serde_json = "1.0.96"
|
||||
libsecp256k1 = "0.7.0"
|
||||
test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../primitives/test-helpers" }
|
||||
|
||||
@@ -1731,8 +1731,12 @@ mod tests {
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benchmarking {
|
||||
use super::{Pallet as Auctions, *};
|
||||
use frame_support::traits::{EnsureOrigin, OnInitialize};
|
||||
use frame_support::{
|
||||
assert_ok,
|
||||
traits::{EnsureOrigin, OnInitialize},
|
||||
};
|
||||
use frame_system::RawOrigin;
|
||||
use runtime_parachains::paras;
|
||||
use sp_runtime::{traits::Bounded, SaturatedConversion};
|
||||
|
||||
use frame_benchmarking::{account, benchmarks, whitelisted_caller, BenchmarkError};
|
||||
@@ -1745,7 +1749,7 @@ mod benchmarking {
|
||||
assert_eq!(event, &system_event);
|
||||
}
|
||||
|
||||
fn fill_winners<T: Config>(lease_period_index: LeasePeriodOf<T>) {
|
||||
fn fill_winners<T: Config + paras::Config>(lease_period_index: LeasePeriodOf<T>) {
|
||||
let auction_index = AuctionCounter::<T>::get();
|
||||
let minimum_balance = CurrencyOf::<T>::minimum_balance();
|
||||
|
||||
@@ -1763,6 +1767,10 @@ mod benchmarking {
|
||||
)
|
||||
.is_ok());
|
||||
}
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
T::Registrar::worst_validation_code(),
|
||||
));
|
||||
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
@@ -1786,7 +1794,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
benchmarks! {
|
||||
where_clause { where T: pallet_babe::Config }
|
||||
where_clause { where T: pallet_babe::Config + paras::Config }
|
||||
|
||||
new_auction {
|
||||
let duration = T::BlockNumber::max_value();
|
||||
@@ -1824,7 +1832,12 @@ mod benchmarking {
|
||||
let worst_head_data = T::Registrar::worst_head_data();
|
||||
let worst_validation_code = T::Registrar::worst_validation_code();
|
||||
T::Registrar::register(owner.clone(), para, worst_head_data.clone(), worst_validation_code.clone())?;
|
||||
T::Registrar::register(owner, new_para, worst_head_data, worst_validation_code)?;
|
||||
T::Registrar::register(owner, new_para, worst_head_data, worst_validation_code.clone())?;
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
worst_validation_code,
|
||||
));
|
||||
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
// Make an existing bid
|
||||
|
||||
@@ -1953,6 +1953,7 @@ mod benchmarking {
|
||||
use super::{Pallet as Crowdloan, *};
|
||||
use frame_support::{assert_ok, traits::OnInitialize};
|
||||
use frame_system::RawOrigin;
|
||||
use runtime_parachains::paras;
|
||||
use sp_core::crypto::UncheckedFrom;
|
||||
use sp_runtime::traits::{Bounded, CheckedSub};
|
||||
use sp_std::prelude::*;
|
||||
@@ -1967,7 +1968,7 @@ mod benchmarking {
|
||||
assert_eq!(event, &system_event);
|
||||
}
|
||||
|
||||
fn create_fund<T: Config>(id: u32, end: T::BlockNumber) -> ParaId {
|
||||
fn create_fund<T: Config + paras::Config>(id: u32, end: T::BlockNumber) -> ParaId {
|
||||
let cap = BalanceOf::<T>::max_value();
|
||||
let (_, offset) = T::Auctioneer::lease_period_length();
|
||||
// Set to the very beginning of lease period index 0.
|
||||
@@ -1987,7 +1988,16 @@ mod benchmarking {
|
||||
|
||||
let head_data = T::Registrar::worst_head_data();
|
||||
let validation_code = T::Registrar::worst_validation_code();
|
||||
assert_ok!(T::Registrar::register(caller.clone(), para_id, head_data, validation_code));
|
||||
assert_ok!(T::Registrar::register(
|
||||
caller.clone(),
|
||||
para_id,
|
||||
head_data,
|
||||
validation_code.clone()
|
||||
));
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
assert_ok!(Crowdloan::<T>::create(
|
||||
@@ -2020,6 +2030,8 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
benchmarks! {
|
||||
where_clause { where T: paras::Config }
|
||||
|
||||
create {
|
||||
let para_id = ParaId::from(1_u32);
|
||||
let cap = BalanceOf::<T>::max_value();
|
||||
@@ -2035,7 +2047,12 @@ mod benchmarking {
|
||||
let verifier = MultiSigner::unchecked_from(account::<[u8; 32]>("verifier", 0, 0));
|
||||
|
||||
CurrencyOf::<T>::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
T::Registrar::register(caller.clone(), para_id, head_data, validation_code)?;
|
||||
T::Registrar::register(caller.clone(), para_id, head_data, validation_code.clone())?;
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
}: _(RawOrigin::Signed(caller), para_id, cap, first_period, last_period, end, Some(verifier))
|
||||
@@ -2123,7 +2140,12 @@ mod benchmarking {
|
||||
let verifier = MultiSigner::unchecked_from(account::<[u8; 32]>("verifier", 0, 0));
|
||||
|
||||
CurrencyOf::<T>::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
T::Registrar::register(caller.clone(), para_id, head_data, validation_code)?;
|
||||
T::Registrar::register(caller.clone(), para_id, head_data, validation_code.clone())?;
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
Crowdloan::<T>::create(
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
//! Mocking utilities for testing with real pallets.
|
||||
|
||||
use crate::{
|
||||
auctions, crowdloan, paras_registrar,
|
||||
auctions, crowdloan,
|
||||
mock::{conclude_pvf_checking, validators_public_keys},
|
||||
paras_registrar,
|
||||
slot_range::SlotRange,
|
||||
slots,
|
||||
traits::{AuctionStatus, Auctioneer, Leaser, Registrar as RegistrarT},
|
||||
@@ -31,12 +33,15 @@ use frame_support::{
|
||||
use frame_support_test::TestRandomness;
|
||||
use frame_system::EnsureRoot;
|
||||
use parity_scale_codec::Encode;
|
||||
use primitives::{BlockNumber, HeadData, Header, Id as ParaId, ValidationCode, LOWEST_PUBLIC_ID};
|
||||
use primitives::{
|
||||
BlockNumber, HeadData, Header, Id as ParaId, SessionIndex, ValidationCode, LOWEST_PUBLIC_ID,
|
||||
};
|
||||
use runtime_parachains::{
|
||||
configuration, origin, paras, shared, Origin as ParaOrigin, ParaLifecycle,
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_io::TestExternalities;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup, One},
|
||||
@@ -298,9 +303,21 @@ pub fn new_test_ext_with_offset(n: BlockNumber) -> TestExternalities {
|
||||
|
||||
const BLOCKS_PER_SESSION: u32 = 10;
|
||||
|
||||
const VALIDATORS: &[Sr25519Keyring] = &[
|
||||
Sr25519Keyring::Alice,
|
||||
Sr25519Keyring::Bob,
|
||||
Sr25519Keyring::Charlie,
|
||||
Sr25519Keyring::Dave,
|
||||
Sr25519Keyring::Ferdie,
|
||||
];
|
||||
|
||||
fn maybe_new_session(n: u32) {
|
||||
if n % BLOCKS_PER_SESSION == 0 {
|
||||
shared::Pallet::<Test>::set_session_index(shared::Pallet::<Test>::session_index() + 1);
|
||||
let session_index = shared::Pallet::<Test>::session_index() + 1;
|
||||
let validators_pub_keys = validators_public_keys(VALIDATORS);
|
||||
|
||||
shared::Pallet::<Test>::set_session_index(session_index);
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validators_pub_keys);
|
||||
Paras::test_on_new_session();
|
||||
}
|
||||
}
|
||||
@@ -357,6 +374,10 @@ fn basic_end_to_end_works() {
|
||||
let para_1 = LOWEST_PUBLIC_ID;
|
||||
let para_2 = LOWEST_PUBLIC_ID + 1;
|
||||
assert!(System::block_number().is_one());
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
let start_block = System::block_number();
|
||||
|
||||
// User 1 and 2 will own parachains
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
Balances::make_free_balance_be(&account_id(2), 1_000_000_000);
|
||||
@@ -370,6 +391,7 @@ fn basic_end_to_end_works() {
|
||||
genesis_head.clone(),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
assert_ok!(Registrar::reserve(signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(2),
|
||||
@@ -392,7 +414,7 @@ fn basic_end_to_end_works() {
|
||||
));
|
||||
|
||||
// 2 sessions later they are parathreads
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(para_1)), Some(ParaLifecycle::Parathread));
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(para_2)), Some(ParaLifecycle::Parathread));
|
||||
|
||||
@@ -411,7 +433,7 @@ fn basic_end_to_end_works() {
|
||||
let crowdloan_account = Crowdloan::fund_account_id(fund_2.fund_index);
|
||||
|
||||
// Auction ending begins on block 100 + offset, so we make a bid before then.
|
||||
run_to_block(90 + offset);
|
||||
run_to_block(start_block + 90 + offset);
|
||||
|
||||
Balances::make_free_balance_be(&account_id(10), 1_000_000_000);
|
||||
Balances::make_free_balance_be(&account_id(20), 1_000_000_000);
|
||||
@@ -431,7 +453,7 @@ fn basic_end_to_end_works() {
|
||||
assert_ok!(Crowdloan::contribute(signed(2), ParaId::from(para_2), 920, None));
|
||||
|
||||
// Auction ends at block 110 + offset
|
||||
run_to_block(109 + offset);
|
||||
run_to_block(start_block + 109 + offset);
|
||||
assert!(contains_event(
|
||||
crowdloan::Event::<Test>::HandleBidResult {
|
||||
para_id: ParaId::from(para_2),
|
||||
@@ -439,7 +461,7 @@ fn basic_end_to_end_works() {
|
||||
}
|
||||
.into()
|
||||
));
|
||||
run_to_block(110 + offset);
|
||||
run_to_block(start_block + 110 + offset);
|
||||
assert_eq!(
|
||||
last_event(),
|
||||
auctions::Event::<Test>::AuctionClosed { auction_index: 1 }.into()
|
||||
@@ -473,7 +495,7 @@ fn basic_end_to_end_works() {
|
||||
);
|
||||
|
||||
// New leases will start on block 400
|
||||
let lease_start_block = 400 + offset;
|
||||
let lease_start_block = start_block + 400 + offset;
|
||||
run_to_block(lease_start_block);
|
||||
|
||||
// First slot, Para 1 should be transitioning to Parachain
|
||||
@@ -587,19 +609,24 @@ fn competing_slots() {
|
||||
let max_bids = 10u32;
|
||||
let para_id = LOWEST_PUBLIC_ID;
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// Create n paras and owners
|
||||
let validation_code = Registrar::worst_validation_code();
|
||||
for n in 1..=max_bids {
|
||||
Balances::make_free_balance_be(&account_id(n), 1_000_000_000);
|
||||
let genesis_head = Registrar::worst_head_data();
|
||||
let validation_code = Registrar::worst_validation_code();
|
||||
assert_ok!(Registrar::reserve(signed(n)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(n),
|
||||
para_id + n - 1,
|
||||
genesis_head,
|
||||
validation_code,
|
||||
validation_code.clone(),
|
||||
));
|
||||
}
|
||||
// The code undergoing the prechecking is the same for all paras.
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Start a new auction in the future
|
||||
let duration = 149u32;
|
||||
@@ -611,7 +638,7 @@ fn competing_slots() {
|
||||
));
|
||||
|
||||
// Paras should be onboarded
|
||||
run_to_block(20); // session 2
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
for n in 1..=max_bids {
|
||||
// Increment block number
|
||||
@@ -645,7 +672,7 @@ fn competing_slots() {
|
||||
}
|
||||
|
||||
// Auction should be done after ending period
|
||||
run_to_block(160);
|
||||
run_to_block(180);
|
||||
|
||||
// Appropriate Paras should have won slots
|
||||
// 900 + 4500 + 2x 8100 = 21,600
|
||||
@@ -683,23 +710,28 @@ fn competing_bids() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one());
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
let start_para = LOWEST_PUBLIC_ID - 1;
|
||||
// Create 3 paras and owners
|
||||
let validation_code = Registrar::worst_validation_code();
|
||||
for n in 1..=3 {
|
||||
Balances::make_free_balance_be(&account_id(n), 1_000_000_000);
|
||||
let genesis_head = Registrar::worst_head_data();
|
||||
let validation_code = Registrar::worst_validation_code();
|
||||
assert_ok!(Registrar::reserve(signed(n)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(n),
|
||||
ParaId::from(start_para + n),
|
||||
genesis_head,
|
||||
validation_code,
|
||||
validation_code.clone(),
|
||||
));
|
||||
}
|
||||
// The code undergoing the prechecking is the same for all paras.
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Finish registration of paras.
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// Start a new auction in the future
|
||||
let starting_block = System::block_number();
|
||||
@@ -785,24 +817,33 @@ fn basic_swap_works() {
|
||||
// This test will test a swap between a parachain and parathread works successfully.
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// User 1 and 2 will own paras
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
Balances::make_free_balance_be(&account_id(2), 1_000_000_000);
|
||||
// First register 2 parathreads with different data
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
let validation_code = test_validation_code(20);
|
||||
assert_ok!(Registrar::reserve(signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(2),
|
||||
ParaId::from(2001),
|
||||
test_genesis_head(20),
|
||||
test_validation_code(20),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Paras should be onboarding
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2000)), Some(ParaLifecycle::Onboarding));
|
||||
@@ -818,7 +859,7 @@ fn basic_swap_works() {
|
||||
));
|
||||
|
||||
// 2 sessions later they are parathreads
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2000)), Some(ParaLifecycle::Parathread));
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2001)), Some(ParaLifecycle::Parathread));
|
||||
|
||||
@@ -938,24 +979,33 @@ fn parachain_swap_works() {
|
||||
// This test will test a swap between two parachains works successfully.
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// User 1 and 2 will own paras
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
Balances::make_free_balance_be(&account_id(2), 1_000_000_000);
|
||||
// First register 2 parathreads with different data
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
let validation_code = test_validation_code(20);
|
||||
assert_ok!(Registrar::reserve(signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(2),
|
||||
ParaId::from(2001),
|
||||
test_genesis_head(20),
|
||||
test_validation_code(20),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Paras should be onboarding
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2000)), Some(ParaLifecycle::Onboarding));
|
||||
@@ -1107,24 +1157,34 @@ fn parachain_swap_works() {
|
||||
fn crowdloan_ending_period_bid() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// User 1 and 2 will own paras
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
Balances::make_free_balance_be(&account_id(2), 1_000_000_000);
|
||||
|
||||
// First register 2 parathreads
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
let validation_code = test_validation_code(20);
|
||||
assert_ok!(Registrar::reserve(signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(2),
|
||||
ParaId::from(2001),
|
||||
test_genesis_head(20),
|
||||
test_validation_code(20),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Paras should be onboarding
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2000)), Some(ParaLifecycle::Onboarding));
|
||||
@@ -1132,6 +1192,7 @@ fn crowdloan_ending_period_bid() {
|
||||
|
||||
// Start a new auction in the future
|
||||
let duration = 99u32;
|
||||
let ends_at = System::block_number() + duration;
|
||||
let lease_period_index_start = 4u32;
|
||||
assert_ok!(Auctions::new_auction(
|
||||
RuntimeOrigin::root(),
|
||||
@@ -1140,7 +1201,7 @@ fn crowdloan_ending_period_bid() {
|
||||
));
|
||||
|
||||
// 2 sessions later they are parathreads
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2000)), Some(ParaLifecycle::Parathread));
|
||||
assert_eq!(Paras::lifecycle(ParaId::from(2001)), Some(ParaLifecycle::Parathread));
|
||||
|
||||
@@ -1179,9 +1240,9 @@ fn crowdloan_ending_period_bid() {
|
||||
));
|
||||
|
||||
// Go to beginning of ending period
|
||||
run_to_block(100);
|
||||
run_to_block(ends_at);
|
||||
|
||||
assert_eq!(Auctions::auction_status(100), AuctionStatus::<u32>::EndingPeriod(0, 0));
|
||||
assert_eq!(Auctions::auction_status(ends_at), AuctionStatus::<u32>::EndingPeriod(0, 0));
|
||||
let mut winning = [(); SlotRange::SLOT_RANGE_COUNT].map(|_| None);
|
||||
|
||||
winning[SlotRange::ZeroOne as u8 as usize] = Some((account_id(2), ParaId::from(2001), 900));
|
||||
@@ -1190,13 +1251,13 @@ fn crowdloan_ending_period_bid() {
|
||||
|
||||
assert_eq!(Auctions::winning(0), Some(winning));
|
||||
|
||||
run_to_block(101);
|
||||
run_to_block(ends_at + 1);
|
||||
|
||||
Balances::make_free_balance_be(&account_id(1234), 1_000_000_000);
|
||||
assert_ok!(Crowdloan::contribute(signed(1234), ParaId::from(2000), 900, None));
|
||||
|
||||
// Data propagates correctly
|
||||
run_to_block(102);
|
||||
run_to_block(ends_at + 2);
|
||||
let mut winning = [(); SlotRange::SLOT_RANGE_COUNT].map(|_| None);
|
||||
winning[SlotRange::ZeroOne as u8 as usize] = Some((account_id(2), ParaId::from(2001), 900));
|
||||
winning[SlotRange::ZeroThree as u8 as usize] =
|
||||
@@ -1210,6 +1271,9 @@ fn auction_bid_requires_registered_para() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// Start a new auction in the future
|
||||
let duration = 99u32;
|
||||
let lease_period_index_start = 4u32;
|
||||
@@ -1234,13 +1298,15 @@ fn auction_bid_requires_registered_para() {
|
||||
);
|
||||
|
||||
// Now we register the para
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Still can't bid until it is fully onboarded
|
||||
assert_noop!(
|
||||
@@ -1256,7 +1322,7 @@ fn auction_bid_requires_registered_para() {
|
||||
);
|
||||
|
||||
// Onboarded on Session 2
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// Success
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
@@ -1276,6 +1342,9 @@ fn gap_bids_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// Start a new auction in the future
|
||||
let duration = 99u32;
|
||||
let lease_period_index_start = 4u32;
|
||||
@@ -1288,23 +1357,25 @@ fn gap_bids_work() {
|
||||
Balances::make_free_balance_be(&account_id(2), 1_000_000_000);
|
||||
|
||||
// Now register 2 paras
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
assert_ok!(Registrar::reserve(signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(2),
|
||||
ParaId::from(2001),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Onboarded on Session 2
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// Make bids
|
||||
Balances::make_free_balance_be(&account_id(10), 1_000_000_000);
|
||||
@@ -1359,7 +1430,7 @@ fn gap_bids_work() {
|
||||
));
|
||||
|
||||
// Finish the auction
|
||||
run_to_block(110 + LeaseOffset::get());
|
||||
run_to_block(130 + LeaseOffset::get());
|
||||
|
||||
// Should have won the lease periods
|
||||
assert_eq!(
|
||||
@@ -1457,15 +1528,21 @@ fn gap_bids_work() {
|
||||
fn cant_bid_on_existing_lease_periods() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(System::block_number().is_one()); /* So events are emitted */
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
Balances::make_free_balance_be(&account_id(1), 1_000_000_000);
|
||||
// First register a parathread
|
||||
let validation_code = test_validation_code(10);
|
||||
assert_ok!(Registrar::reserve(signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
signed(1),
|
||||
ParaId::from(2000),
|
||||
test_genesis_head(10),
|
||||
test_validation_code(10),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Start a new auction in the future
|
||||
let starting_block = System::block_number();
|
||||
@@ -1478,7 +1555,7 @@ fn cant_bid_on_existing_lease_periods() {
|
||||
));
|
||||
|
||||
// 2 sessions later they are parathreads
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// Open a crowdloan for Para 1 for slots 0-3
|
||||
assert_ok!(Crowdloan::create(
|
||||
|
||||
@@ -22,7 +22,9 @@ use frame_support::{
|
||||
weights::Weight,
|
||||
};
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use primitives::{HeadData, Id as ParaId, ValidationCode};
|
||||
use primitives::{HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, ValidationCode};
|
||||
use runtime_parachains::paras;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_runtime::{traits::SaturatedConversion, Permill};
|
||||
use std::{cell::RefCell, collections::HashMap};
|
||||
|
||||
@@ -231,3 +233,30 @@ impl frame_support::traits::EstimateNextSessionRotation<u32> for TestNextSession
|
||||
(None, Weight::zero())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validators_public_keys(validators: &[Sr25519Keyring]) -> Vec<primitives::ValidatorId> {
|
||||
validators.iter().map(|v| v.public().into()).collect()
|
||||
}
|
||||
|
||||
pub fn conclude_pvf_checking<T: paras::Config>(
|
||||
validation_code: &ValidationCode,
|
||||
validators: &[Sr25519Keyring],
|
||||
session_index: SessionIndex,
|
||||
) {
|
||||
let num_required = primitives::supermajority_threshold(validators.len());
|
||||
validators.iter().enumerate().take(num_required).for_each(|(idx, key)| {
|
||||
let validator_index = idx as u32;
|
||||
let statement = PvfCheckStatement {
|
||||
accept: true,
|
||||
subject: validation_code.hash(),
|
||||
session_index,
|
||||
validator_index: validator_index.into(),
|
||||
};
|
||||
let signature = key.sign(&statement.signing_payload());
|
||||
let _ = paras::Pallet::<T>::include_pvf_check_statement(
|
||||
frame_system::Origin::<T>::None.into(),
|
||||
statement,
|
||||
signature.into(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -655,7 +655,9 @@ impl<T: Config> Pallet<T> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{paras_registrar, traits::Registrar as RegistrarTrait};
|
||||
use crate::{
|
||||
mock::conclude_pvf_checking, paras_registrar, traits::Registrar as RegistrarTrait,
|
||||
};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
error::BadOrigin,
|
||||
@@ -664,10 +666,11 @@ mod tests {
|
||||
};
|
||||
use frame_system::limits;
|
||||
use pallet_balances::Error as BalancesError;
|
||||
use primitives::{Balance, BlockNumber, Header};
|
||||
use primitives::{Balance, BlockNumber, Header, SessionIndex};
|
||||
use runtime_parachains::{configuration, origin, shared};
|
||||
use sp_core::H256;
|
||||
use sp_io::TestExternalities;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
transaction_validity::TransactionPriority,
|
||||
@@ -835,6 +838,14 @@ mod tests {
|
||||
|
||||
const BLOCKS_PER_SESSION: u32 = 3;
|
||||
|
||||
const VALIDATORS: &[Sr25519Keyring] = &[
|
||||
Sr25519Keyring::Alice,
|
||||
Sr25519Keyring::Bob,
|
||||
Sr25519Keyring::Charlie,
|
||||
Sr25519Keyring::Dave,
|
||||
Sr25519Keyring::Ferdie,
|
||||
];
|
||||
|
||||
fn run_to_block(n: BlockNumber) {
|
||||
// NOTE that this function only simulates modules of interest. Depending on new pallet may
|
||||
// require adding it here.
|
||||
@@ -847,9 +858,12 @@ mod tests {
|
||||
}
|
||||
// Session change every 3 blocks.
|
||||
if (b + 1) % BLOCKS_PER_SESSION == 0 {
|
||||
shared::Pallet::<Test>::set_session_index(
|
||||
shared::Pallet::<Test>::session_index() + 1,
|
||||
);
|
||||
let session_index = shared::Pallet::<Test>::session_index() + 1;
|
||||
let validators_pub_keys = VALIDATORS.iter().map(|v| v.public().into()).collect();
|
||||
|
||||
shared::Pallet::<Test>::set_session_index(session_index);
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validators_pub_keys);
|
||||
|
||||
Parachains::test_on_new_session();
|
||||
}
|
||||
System::set_block_number(b + 1);
|
||||
@@ -895,35 +909,41 @@ mod tests {
|
||||
fn end_to_end_scenario_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let para_id = LOWEST_PUBLIC_ID;
|
||||
run_to_block(1);
|
||||
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// first para is not yet registered
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
// We register the Para ID
|
||||
let validation_code = test_validation_code(32);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_id,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
run_to_session(2);
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
// It is now a parathread.
|
||||
assert!(Parachains::is_parathread(para_id));
|
||||
assert!(!Parachains::is_parachain(para_id));
|
||||
// Some other external process will elevate parathread to parachain
|
||||
assert_ok!(Registrar::make_parachain(para_id));
|
||||
run_to_session(4);
|
||||
run_to_session(START_SESSION_INDEX + 4);
|
||||
// It is now a parachain.
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
assert!(Parachains::is_parachain(para_id));
|
||||
// Turn it back into a parathread
|
||||
assert_ok!(Registrar::make_parathread(para_id));
|
||||
run_to_session(6);
|
||||
run_to_session(START_SESSION_INDEX + 6);
|
||||
assert!(Parachains::is_parathread(para_id));
|
||||
assert!(!Parachains::is_parachain(para_id));
|
||||
// Deregister it
|
||||
assert_ok!(Registrar::deregister(RuntimeOrigin::root(), para_id,));
|
||||
run_to_session(8);
|
||||
run_to_session(START_SESSION_INDEX + 8);
|
||||
// It is nothing
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
assert!(!Parachains::is_parachain(para_id));
|
||||
@@ -933,18 +953,24 @@ mod tests {
|
||||
#[test]
|
||||
fn register_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
run_to_block(1);
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
let para_id = LOWEST_PUBLIC_ID;
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
|
||||
let validation_code = test_validation_code(32);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_eq!(Balances::reserved_balance(&1), <Test as Config>::ParaDeposit::get());
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_id,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
run_to_session(2);
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert!(Parachains::is_parathread(para_id));
|
||||
assert_eq!(
|
||||
Balances::reserved_balance(&1),
|
||||
@@ -988,7 +1014,7 @@ mod tests {
|
||||
test_genesis_head(max_head_size() as usize),
|
||||
test_validation_code(max_code_size() as usize),
|
||||
));
|
||||
|
||||
// Can skip pre-check and deregister para which's still onboarding.
|
||||
run_to_session(2);
|
||||
|
||||
assert_ok!(Registrar::deregister(RuntimeOrigin::root(), para_id));
|
||||
@@ -1038,20 +1064,26 @@ mod tests {
|
||||
#[test]
|
||||
fn deregister_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
run_to_block(1);
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
let para_id = LOWEST_PUBLIC_ID;
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
|
||||
let validation_code = test_validation_code(32);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_id,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
run_to_session(2);
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert!(Parachains::is_parathread(para_id));
|
||||
assert_ok!(Registrar::deregister(RuntimeOrigin::root(), para_id,));
|
||||
run_to_session(4);
|
||||
run_to_session(START_SESSION_INDEX + 4);
|
||||
assert!(paras::Pallet::<Test>::lifecycle(para_id).is_none());
|
||||
assert_eq!(Balances::reserved_balance(&1), 0);
|
||||
});
|
||||
@@ -1060,22 +1092,28 @@ mod tests {
|
||||
#[test]
|
||||
fn deregister_handles_basic_errors() {
|
||||
new_test_ext().execute_with(|| {
|
||||
run_to_block(1);
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
let para_id = LOWEST_PUBLIC_ID;
|
||||
assert!(!Parachains::is_parathread(para_id));
|
||||
|
||||
let validation_code = test_validation_code(32);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_id,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
run_to_session(2);
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
assert!(Parachains::is_parathread(para_id));
|
||||
// Owner check
|
||||
assert_noop!(Registrar::deregister(RuntimeOrigin::signed(2), para_id,), BadOrigin);
|
||||
assert_ok!(Registrar::make_parachain(para_id));
|
||||
run_to_session(4);
|
||||
run_to_session(START_SESSION_INDEX + 4);
|
||||
// Cant directly deregister parachain
|
||||
assert_noop!(
|
||||
Registrar::deregister(RuntimeOrigin::root(), para_id,),
|
||||
@@ -1087,24 +1125,31 @@ mod tests {
|
||||
#[test]
|
||||
fn swap_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
// Successfully register first two parachains
|
||||
let para_1 = LOWEST_PUBLIC_ID;
|
||||
let para_2 = LOWEST_PUBLIC_ID + 1;
|
||||
|
||||
let validation_code = test_validation_code(max_code_size() as usize);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_1,
|
||||
test_genesis_head(max_head_size() as usize),
|
||||
test_validation_code(max_code_size() as usize),
|
||||
validation_code.clone(),
|
||||
));
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(2),
|
||||
para_2,
|
||||
test_genesis_head(max_head_size() as usize),
|
||||
test_validation_code(max_code_size() as usize),
|
||||
validation_code.clone(),
|
||||
));
|
||||
run_to_session(2);
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// Upgrade para 1 into a parachain
|
||||
assert_ok!(Registrar::make_parachain(para_1));
|
||||
@@ -1115,7 +1160,7 @@ mod tests {
|
||||
swap_data.insert(para_2, 1337);
|
||||
SwapData::set(swap_data);
|
||||
|
||||
run_to_session(4);
|
||||
run_to_session(START_SESSION_INDEX + 4);
|
||||
|
||||
// Roles are as we expect
|
||||
assert!(Parachains::is_parachain(para_1));
|
||||
@@ -1132,7 +1177,7 @@ mod tests {
|
||||
other_id: para_1,
|
||||
}));
|
||||
|
||||
run_to_session(6);
|
||||
run_to_session(START_SESSION_INDEX + 6);
|
||||
|
||||
// Roles are swapped
|
||||
assert!(!Parachains::is_parachain(para_1));
|
||||
@@ -1159,15 +1204,17 @@ mod tests {
|
||||
|
||||
// Parachain to parachain swap
|
||||
let para_3 = LOWEST_PUBLIC_ID + 2;
|
||||
let validation_code = test_validation_code(max_code_size() as usize);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(3)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(3),
|
||||
para_3,
|
||||
test_genesis_head(max_head_size() as usize),
|
||||
test_validation_code(max_code_size() as usize),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX + 6);
|
||||
|
||||
run_to_session(8);
|
||||
run_to_session(START_SESSION_INDEX + 8);
|
||||
|
||||
// Upgrade para 3 into a parachain
|
||||
assert_ok!(Registrar::make_parachain(para_3));
|
||||
@@ -1177,7 +1224,7 @@ mod tests {
|
||||
swap_data.insert(para_3, 777);
|
||||
SwapData::set(swap_data);
|
||||
|
||||
run_to_session(10);
|
||||
run_to_session(START_SESSION_INDEX + 10);
|
||||
|
||||
// Both are parachains
|
||||
assert!(Parachains::is_parachain(para_3));
|
||||
@@ -1234,9 +1281,12 @@ mod tests {
|
||||
#[test]
|
||||
fn swap_handles_bad_states() {
|
||||
new_test_ext().execute_with(|| {
|
||||
const START_SESSION_INDEX: SessionIndex = 1;
|
||||
run_to_session(START_SESSION_INDEX);
|
||||
|
||||
let para_1 = LOWEST_PUBLIC_ID;
|
||||
let para_2 = LOWEST_PUBLIC_ID + 1;
|
||||
run_to_block(1);
|
||||
|
||||
// paras are not yet registered
|
||||
assert!(!Parachains::is_parathread(para_1));
|
||||
assert!(!Parachains::is_parathread(para_2));
|
||||
@@ -1248,20 +1298,22 @@ mod tests {
|
||||
);
|
||||
|
||||
// We register Paras 1 and 2
|
||||
let validation_code = test_validation_code(32);
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(1)));
|
||||
assert_ok!(Registrar::reserve(RuntimeOrigin::signed(2)));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(1),
|
||||
para_1,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
assert_ok!(Registrar::register(
|
||||
RuntimeOrigin::signed(2),
|
||||
para_2,
|
||||
test_genesis_head(32),
|
||||
test_validation_code(32),
|
||||
validation_code.clone(),
|
||||
));
|
||||
conclude_pvf_checking::<Test>(&validation_code, VALIDATORS, START_SESSION_INDEX);
|
||||
|
||||
// Cannot swap
|
||||
assert_ok!(Registrar::swap(RuntimeOrigin::root(), para_1, para_2));
|
||||
@@ -1270,7 +1322,7 @@ mod tests {
|
||||
Error::<Test>::CannotSwap
|
||||
);
|
||||
|
||||
run_to_session(2);
|
||||
run_to_session(START_SESSION_INDEX + 2);
|
||||
|
||||
// They are now a parathread.
|
||||
assert!(Parachains::is_parathread(para_1));
|
||||
@@ -1293,7 +1345,7 @@ mod tests {
|
||||
Error::<Test>::CannotSwap
|
||||
);
|
||||
|
||||
run_to_session(3);
|
||||
run_to_session(START_SESSION_INDEX + 3);
|
||||
|
||||
// Cannot swap
|
||||
assert_ok!(Registrar::swap(RuntimeOrigin::root(), para_1, para_2));
|
||||
@@ -1302,7 +1354,7 @@ mod tests {
|
||||
Error::<Test>::CannotSwap
|
||||
);
|
||||
|
||||
run_to_session(4);
|
||||
run_to_session(START_SESSION_INDEX + 4);
|
||||
|
||||
// It is now a parachain.
|
||||
assert!(Parachains::is_parachain(para_1));
|
||||
@@ -1316,7 +1368,7 @@ mod tests {
|
||||
RuntimeEvent::Registrar(paras_registrar::Event::Swapped { .. })
|
||||
)));
|
||||
|
||||
run_to_session(5);
|
||||
run_to_session(START_SESSION_INDEX + 5);
|
||||
|
||||
// Cannot swap
|
||||
assert_ok!(Registrar::swap(RuntimeOrigin::root(), para_1, para_2));
|
||||
@@ -1325,7 +1377,7 @@ mod tests {
|
||||
Error::<Test>::CannotSwap
|
||||
);
|
||||
|
||||
run_to_session(6);
|
||||
run_to_session(START_SESSION_INDEX + 6);
|
||||
|
||||
// Swap worked!
|
||||
assert!(Parachains::is_parachain(para_2));
|
||||
@@ -1338,7 +1390,7 @@ mod tests {
|
||||
// Something starts to downgrade a para
|
||||
assert_ok!(Registrar::make_parathread(para_2));
|
||||
|
||||
run_to_session(7);
|
||||
run_to_session(START_SESSION_INDEX + 7);
|
||||
|
||||
// Cannot swap
|
||||
assert_ok!(Registrar::swap(RuntimeOrigin::root(), para_1, para_2));
|
||||
@@ -1347,7 +1399,7 @@ mod tests {
|
||||
Error::<Test>::CannotSwap
|
||||
);
|
||||
|
||||
run_to_session(8);
|
||||
run_to_session(START_SESSION_INDEX + 8);
|
||||
|
||||
assert!(Parachains::is_parathread(para_1));
|
||||
assert!(Parachains::is_parathread(para_2));
|
||||
@@ -1386,7 +1438,11 @@ mod benchmarking {
|
||||
RawOrigin::Signed(caller).into(),
|
||||
para,
|
||||
genesis_head,
|
||||
validation_code
|
||||
validation_code.clone()
|
||||
));
|
||||
assert_ok!(runtime_parachains::paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
return para
|
||||
}
|
||||
@@ -1421,10 +1477,14 @@ mod benchmarking {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
assert_ok!(Registrar::<T>::reserve(RawOrigin::Signed(caller.clone()).into()));
|
||||
}: _(RawOrigin::Signed(caller.clone()), para, genesis_head, validation_code)
|
||||
}: _(RawOrigin::Signed(caller.clone()), para, genesis_head, validation_code.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::<T>::Registered{ para_id: para, manager: caller }.into());
|
||||
assert_eq!(paras::Pallet::<T>::lifecycle(para), Some(ParaLifecycle::Onboarding));
|
||||
assert_ok!(runtime_parachains::paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
next_scheduled_session::<T>();
|
||||
assert_eq!(paras::Pallet::<T>::lifecycle(para), Some(ParaLifecycle::Parathread));
|
||||
}
|
||||
@@ -1435,10 +1495,14 @@ mod benchmarking {
|
||||
let para = ParaId::from(69);
|
||||
let genesis_head = Registrar::<T>::worst_head_data();
|
||||
let validation_code = Registrar::<T>::worst_validation_code();
|
||||
}: _(RawOrigin::Root, manager.clone(), deposit, para, genesis_head, validation_code)
|
||||
}: _(RawOrigin::Root, manager.clone(), deposit, para, genesis_head, validation_code.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::<T>::Registered { para_id: para, manager }.into());
|
||||
assert_eq!(paras::Pallet::<T>::lifecycle(para), Some(ParaLifecycle::Onboarding));
|
||||
assert_ok!(runtime_parachains::paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
));
|
||||
next_scheduled_session::<T>();
|
||||
assert_eq!(paras::Pallet::<T>::lifecycle(para), Some(ParaLifecycle::Parathread));
|
||||
}
|
||||
|
||||
@@ -988,6 +988,7 @@ mod benchmarking {
|
||||
use super::*;
|
||||
use frame_support::assert_ok;
|
||||
use frame_system::RawOrigin;
|
||||
use runtime_parachains::paras;
|
||||
use sp_runtime::traits::{Bounded, One};
|
||||
|
||||
use frame_benchmarking::{account, benchmarks, whitelisted_caller, BenchmarkError};
|
||||
@@ -1002,7 +1003,7 @@ mod benchmarking {
|
||||
assert_eq!(event, &system_event);
|
||||
}
|
||||
|
||||
fn register_a_parathread<T: Config>(i: u32) -> (ParaId, T::AccountId) {
|
||||
fn register_a_parathread<T: Config + paras::Config>(i: u32) -> (ParaId, T::AccountId) {
|
||||
let para = ParaId::from(i);
|
||||
let leaser: T::AccountId = account("leaser", i, 0);
|
||||
T::Currency::make_free_balance_be(&leaser, BalanceOf::<T>::max_value());
|
||||
@@ -1013,14 +1014,21 @@ mod benchmarking {
|
||||
leaser.clone(),
|
||||
para,
|
||||
worst_head_data,
|
||||
worst_validation_code
|
||||
worst_validation_code.clone(),
|
||||
));
|
||||
assert_ok!(paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
worst_validation_code,
|
||||
));
|
||||
|
||||
T::Registrar::execute_pending_transitions();
|
||||
|
||||
(para, leaser)
|
||||
}
|
||||
|
||||
benchmarks! {
|
||||
where_clause { where T: paras::Config }
|
||||
|
||||
force_lease {
|
||||
// If there is an offset, we need to be on that block to be able to do lease things.
|
||||
frame_system::Pallet::<T>::set_block_number(T::LeaseOffset::get() + One::one());
|
||||
|
||||
@@ -17,29 +17,30 @@
|
||||
//! Autogenerated weights for `runtime_parachains::paras`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-05-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// target/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=kusama-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --chain=kusama-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/kusama/src/weights/runtime_parachains_paras.rs
|
||||
// --output=./runtime/kusama/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
@@ -64,11 +65,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `8309`
|
||||
// Estimated: `11774`
|
||||
// Minimum execution time: 31_454_000 picoseconds.
|
||||
Weight::from_parts(31_826_000, 0)
|
||||
// Minimum execution time: 31_199_000 picoseconds.
|
||||
Weight::from_parts(31_493_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11774))
|
||||
// Standard Error: 3
|
||||
.saturating_add(Weight::from_parts(1_953, 0).saturating_mul(c.into()))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_976, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(6))
|
||||
}
|
||||
@@ -79,11 +80,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_749_000 picoseconds.
|
||||
Weight::from_parts(8_953_000, 0)
|
||||
// Minimum execution time: 8_460_000 picoseconds.
|
||||
Weight::from_parts(8_645_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(857, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(890, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras FutureCodeHash (r:1 w:1)
|
||||
@@ -92,32 +93,30 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras CurrentCodeHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeCooldowns (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpgradeCooldowns (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras FutureCodeUpgrades (r:0 w:1)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeRestrictionSignal (r:0 w:1)
|
||||
/// Proof Skipped: Paras UpgradeRestrictionSignal (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn force_schedule_code_upgrade(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `16462`
|
||||
// Estimated: `19927`
|
||||
// Minimum execution time: 55_906_000 picoseconds.
|
||||
Weight::from_parts(56_178_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 19927))
|
||||
// Measured: `8391`
|
||||
// Estimated: `11856`
|
||||
// Minimum execution time: 47_009_000 picoseconds.
|
||||
Weight::from_parts(47_428_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11856))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_967, 0).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(1_999, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(8))
|
||||
.saturating_add(T::DbWeight::get().writes(8))
|
||||
.saturating_add(T::DbWeight::get().writes(7))
|
||||
}
|
||||
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -130,11 +129,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `95`
|
||||
// Estimated: `3560`
|
||||
// Minimum execution time: 13_961_000 picoseconds.
|
||||
Weight::from_parts(14_114_000, 0)
|
||||
// Minimum execution time: 13_825_000 picoseconds.
|
||||
Weight::from_parts(13_969_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3560))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(858, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(888, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -146,28 +145,32 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4251`
|
||||
// Estimated: `7716`
|
||||
// Minimum execution time: 20_280_000 picoseconds.
|
||||
Weight::from_parts(20_641_000, 0)
|
||||
// Minimum execution time: 19_150_000 picoseconds.
|
||||
Weight::from_parts(19_571_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 7716))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared CurrentSessionIndex (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn add_trusted_validation_code(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 8_193_000 picoseconds.
|
||||
Weight::from_parts(8_317_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
// Measured: `622`
|
||||
// Estimated: `4087`
|
||||
// Minimum execution time: 80_323_000 picoseconds.
|
||||
Weight::from_parts(57_788_688, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4087))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_948, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(Weight::from_parts(1_449, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:0)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -177,8 +180,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 6_072_000 picoseconds.
|
||||
Weight::from_parts(6_224_000, 0)
|
||||
// Minimum execution time: 5_737_000 picoseconds.
|
||||
Weight::from_parts(5_935_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -193,8 +196,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 89_474_000 picoseconds.
|
||||
Weight::from_parts(90_579_000, 0)
|
||||
// Minimum execution time: 91_237_000 picoseconds.
|
||||
Weight::from_parts(92_747_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -217,8 +220,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27199`
|
||||
// Estimated: `30664`
|
||||
// Minimum execution time: 783_434_000 picoseconds.
|
||||
Weight::from_parts(789_541_000, 0)
|
||||
// Minimum execution time: 780_738_000 picoseconds.
|
||||
Weight::from_parts(791_043_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30664))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(104))
|
||||
@@ -233,8 +236,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27177`
|
||||
// Estimated: `30642`
|
||||
// Minimum execution time: 87_212_000 picoseconds.
|
||||
Weight::from_parts(89_108_000, 0)
|
||||
// Minimum execution time: 87_301_000 picoseconds.
|
||||
Weight::from_parts(88_560_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30642))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -253,8 +256,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26667`
|
||||
// Estimated: `30132`
|
||||
// Minimum execution time: 624_548_000 picoseconds.
|
||||
Weight::from_parts(628_911_000, 0)
|
||||
// Minimum execution time: 620_267_000 picoseconds.
|
||||
Weight::from_parts(628_507_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30132))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
@@ -269,8 +272,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 86_738_000 picoseconds.
|
||||
Weight::from_parts(87_816_000, 0)
|
||||
// Minimum execution time: 86_924_000 picoseconds.
|
||||
Weight::from_parts(87_727_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
|
||||
@@ -340,16 +340,22 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
// make sure parachains exist prior to session change.
|
||||
for i in 0..cores {
|
||||
let para_id = ParaId::from(i as u32);
|
||||
let validation_code = mock_validation_code();
|
||||
|
||||
paras::Pallet::<T>::schedule_para_initialize(
|
||||
para_id,
|
||||
paras::ParaGenesisArgs {
|
||||
genesis_head: Self::mock_head_data(),
|
||||
validation_code: mock_validation_code(),
|
||||
validation_code: validation_code.clone(),
|
||||
para_kind: ParaKind::Parachain,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<T>::add_trusted_validation_code(
|
||||
frame_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
paras::ParaKind,
|
||||
};
|
||||
use frame_support::{assert_noop, assert_ok, traits::Currency as _};
|
||||
use primitives::BlockNumber;
|
||||
use primitives::{BlockNumber, ValidationCode};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
fn run_to_block(to: BlockNumber, new_session: Option<Vec<BlockNumber>>) {
|
||||
@@ -130,14 +130,17 @@ fn default_genesis_config() -> MockGenesisConfig {
|
||||
}
|
||||
|
||||
fn register_parachain_with_balance(id: ParaId, balance: Balance) {
|
||||
let validation_code: ValidationCode = vec![1].into();
|
||||
assert_ok!(Paras::schedule_para_initialize(
|
||||
id,
|
||||
crate::paras::ParaGenesisArgs {
|
||||
para_kind: ParaKind::Parachain,
|
||||
genesis_head: vec![1].into(),
|
||||
validation_code: vec![1].into(),
|
||||
validation_code: validation_code.clone(),
|
||||
},
|
||||
));
|
||||
|
||||
assert_ok!(Paras::add_trusted_validation_code(RuntimeOrigin::root(), validation_code));
|
||||
<Test as Config>::Currency::make_free_balance_be(&id.into_account_truncating(), balance);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,8 @@ benchmarks! {
|
||||
add_trusted_validation_code {
|
||||
let c in 1 .. MAX_CODE_SIZE;
|
||||
let new_code = ValidationCode(vec![0; c as usize]);
|
||||
|
||||
pvf_check::prepare_bypassing_bench::<T>(new_code.clone());
|
||||
}: _(RawOrigin::Root, new_code)
|
||||
|
||||
poke_unused_validation_code {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//! This module focuses on the benchmarking of the `include_pvf_check_statement` dispatchable.
|
||||
|
||||
use crate::{configuration, paras::*, shared::Pallet as ParasShared};
|
||||
use frame_support::assert_ok;
|
||||
use frame_system::RawOrigin;
|
||||
use primitives::{HeadData, Id as ParaId, ValidationCode, ValidatorId, ValidatorIndex};
|
||||
use sp_application_crypto::RuntimeAppPublic;
|
||||
@@ -43,7 +44,7 @@ where
|
||||
{
|
||||
initialize::<T>();
|
||||
// we do not plan to trigger finalization, thus the cause is inconsequential.
|
||||
initialize_pvf_active_vote::<T>(VoteCause::Onboarding);
|
||||
initialize_pvf_active_vote::<T>(VoteCause::Onboarding, CAUSES_NUM);
|
||||
|
||||
// `unwrap` cannot panic here since the `initialize` function should initialize validators count
|
||||
// to be more than 0.
|
||||
@@ -68,7 +69,7 @@ where
|
||||
T: Config + shared::Config,
|
||||
{
|
||||
initialize::<T>();
|
||||
initialize_pvf_active_vote::<T>(cause);
|
||||
initialize_pvf_active_vote::<T>(cause, CAUSES_NUM);
|
||||
|
||||
let mut stmts = generate_statements::<T>(outcome).collect::<Vec<_>>();
|
||||
// this should be ensured by the `initialize` function.
|
||||
@@ -85,6 +86,29 @@ where
|
||||
stmt_n_sig
|
||||
}
|
||||
|
||||
/// Prepares storage for invoking `add_trusted_validation_code` with several paras initializing to
|
||||
/// the same code.
|
||||
pub fn prepare_bypassing_bench<T>(validation_code: ValidationCode)
|
||||
where
|
||||
T: Config + shared::Config,
|
||||
{
|
||||
// Suppose a sensible number of paras initialize to the same code.
|
||||
const PARAS_NUM: usize = 10;
|
||||
|
||||
initialize::<T>();
|
||||
for i in 0..PARAS_NUM {
|
||||
let id = ParaId::from(i as u32);
|
||||
assert_ok!(Pallet::<T>::schedule_para_initialize(
|
||||
id,
|
||||
ParaGenesisArgs {
|
||||
para_kind: ParaKind::Parachain,
|
||||
genesis_head: HeadData(vec![1, 2, 3, 4]),
|
||||
validation_code: validation_code.clone(),
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// What caused the PVF pre-checking vote?
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub enum VoteCause {
|
||||
@@ -122,11 +146,11 @@ where
|
||||
///
|
||||
/// The subject of the vote (i.e. validation code) and the cause (upgrade/onboarding) is specified
|
||||
/// by the test setup.
|
||||
fn initialize_pvf_active_vote<T>(vote_cause: VoteCause)
|
||||
fn initialize_pvf_active_vote<T>(vote_cause: VoteCause, causes_num: usize)
|
||||
where
|
||||
T: Config + shared::Config,
|
||||
{
|
||||
for i in 0..CAUSES_NUM {
|
||||
for i in 0..causes_num {
|
||||
let id = ParaId::from(i as u32);
|
||||
|
||||
if vote_cause == VoteCause::Upgrade {
|
||||
|
||||
@@ -501,7 +501,8 @@ impl WeightInfo for TestWeightInfo {
|
||||
Weight::MAX
|
||||
}
|
||||
fn add_trusted_validation_code(_c: u32) -> Weight {
|
||||
Weight::MAX
|
||||
// Called during integration tests for para initialization.
|
||||
Weight::zero()
|
||||
}
|
||||
fn poke_unused_validation_code() -> Weight {
|
||||
Weight::MAX
|
||||
@@ -602,9 +603,6 @@ pub mod pallet {
|
||||
PvfCheckDoubleVote,
|
||||
/// The given PVF does not exist at the moment of process a vote.
|
||||
PvfCheckSubjectInvalid,
|
||||
/// The PVF pre-checking statement cannot be included since the PVF pre-checking mechanism
|
||||
/// is disabled.
|
||||
PvfCheckDisabled,
|
||||
/// Parachain cannot currently schedule a code upgrade.
|
||||
CannotUpgradeCode,
|
||||
}
|
||||
@@ -970,12 +968,6 @@ pub mod pallet {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_none(origin)?;
|
||||
|
||||
// Make sure that PVF pre-checking is enabled.
|
||||
ensure!(
|
||||
configuration::Pallet::<T>::config().pvf_checking_enabled,
|
||||
Error::<T>::PvfCheckDisabled,
|
||||
);
|
||||
|
||||
let validators = shared::Pallet::<T>::active_validator_keys();
|
||||
let current_session = shared::Pallet::<T>::session_index();
|
||||
if stmt.session_index < current_session {
|
||||
@@ -1062,10 +1054,6 @@ pub mod pallet {
|
||||
_ => return InvalidTransaction::Call.into(),
|
||||
};
|
||||
|
||||
if !configuration::Pallet::<T>::config().pvf_checking_enabled {
|
||||
return InvalidTransaction::Custom(INVALID_TX_PVF_CHECK_DISABLED).into()
|
||||
}
|
||||
|
||||
let current_session = shared::Pallet::<T>::session_index();
|
||||
if stmt.session_index < current_session {
|
||||
return InvalidTransaction::Stale.into()
|
||||
@@ -1126,7 +1114,6 @@ pub mod pallet {
|
||||
const INVALID_TX_BAD_VALIDATOR_IDX: u8 = 1;
|
||||
const INVALID_TX_BAD_SUBJECT: u8 = 2;
|
||||
const INVALID_TX_DOUBLE_VOTE: u8 = 3;
|
||||
const INVALID_TX_PVF_CHECK_DISABLED: u8 = 4;
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// This is a call to schedule code upgrades for parachains which is safe to be called
|
||||
@@ -1828,9 +1815,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// Makes sure that the given code hash has passed pre-checking.
|
||||
///
|
||||
/// If the given code hash has already passed pre-checking, then the approval happens
|
||||
/// immediately. Similarly, if the pre-checking is turned off, the update is scheduled immediately
|
||||
/// as well. In this case, the behavior is similar to the previous, i.e. the upgrade sequence
|
||||
/// is purely time-based.
|
||||
/// immediately.
|
||||
///
|
||||
/// If the code is unknown, but the pre-checking for that PVF is already running then we perform
|
||||
/// "coalescing". We save the cause for this PVF pre-check request and just add it to the
|
||||
@@ -1859,12 +1844,9 @@ impl<T: Config> Pallet<T> {
|
||||
let known_code = CodeByHash::<T>::contains_key(&code_hash);
|
||||
weight += T::DbWeight::get().reads(1);
|
||||
|
||||
if !cfg.pvf_checking_enabled || known_code {
|
||||
// Either:
|
||||
// - the code is known and there is no active PVF vote for it meaning it is
|
||||
// already checked, or
|
||||
// - the PVF checking is diabled
|
||||
// In any case: fast track the PVF checking into the accepted state
|
||||
if known_code {
|
||||
// The code is known and there is no active PVF vote for it meaning it is
|
||||
// already checked -- fast track the PVF checking into the accepted state.
|
||||
weight += T::DbWeight::get().reads(1);
|
||||
let now = <frame_system::Pallet<T>>::block_number();
|
||||
weight += Self::enact_pvf_accepted(now, &code_hash, &[cause], 0, cfg);
|
||||
|
||||
@@ -55,6 +55,22 @@ fn sign_and_include_pvf_check_statement(stmt: PvfCheckStatement) {
|
||||
Paras::include_pvf_check_statement(None.into(), stmt, signature.into()).unwrap();
|
||||
}
|
||||
|
||||
fn submit_super_majority_pvf_votes(
|
||||
validation_code: &ValidationCode,
|
||||
session_index: SessionIndex,
|
||||
accept: bool,
|
||||
) {
|
||||
[0, 1, 2, 3]
|
||||
.into_iter()
|
||||
.map(|i| PvfCheckStatement {
|
||||
accept,
|
||||
subject: validation_code.hash(),
|
||||
session_index,
|
||||
validator_index: i.into(),
|
||||
})
|
||||
.for_each(sign_and_include_pvf_check_statement);
|
||||
}
|
||||
|
||||
fn run_to_block(to: BlockNumber, new_session: Option<Vec<BlockNumber>>) {
|
||||
let keystore: KeystorePtr = Arc::new(LocalKeystore::in_memory());
|
||||
for validator in VALIDATORS.iter() {
|
||||
@@ -420,7 +436,9 @@ fn code_upgrade_applied_after_delay() {
|
||||
let para_id = ParaId::from(0);
|
||||
let new_code = ValidationCode(vec![4, 5, 6]);
|
||||
|
||||
run_to_block(2, None);
|
||||
// Wait for at least one session change to set active validators.
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
run_to_block(2, Some(vec![1]));
|
||||
assert_eq!(Paras::current_code(¶_id), Some(original_code.clone()));
|
||||
|
||||
let expected_at = {
|
||||
@@ -428,6 +446,9 @@ fn code_upgrade_applied_after_delay() {
|
||||
let expected_at = 1 + validation_upgrade_delay;
|
||||
let next_possible_upgrade_at = 1 + validation_upgrade_cooldown;
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 1, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
Paras::note_new_head(para_id, Default::default(), 1);
|
||||
|
||||
assert!(Paras::past_code_meta(¶_id).most_recent_change().is_none());
|
||||
@@ -515,7 +536,9 @@ fn code_upgrade_applied_after_delay_even_when_late() {
|
||||
let para_id = ParaId::from(0);
|
||||
let new_code = ValidationCode(vec![4, 5, 6]);
|
||||
|
||||
run_to_block(2, None);
|
||||
// Wait for at least one session change to set active validators.
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
run_to_block(2, Some(vec![1]));
|
||||
assert_eq!(Paras::current_code(¶_id), Some(original_code.clone()));
|
||||
|
||||
let expected_at = {
|
||||
@@ -523,6 +546,9 @@ fn code_upgrade_applied_after_delay_even_when_late() {
|
||||
let expected_at = 1 + validation_upgrade_delay;
|
||||
let next_possible_upgrade_at = 1 + validation_upgrade_cooldown;
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 1, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
Paras::note_new_head(para_id, Default::default(), 1);
|
||||
|
||||
assert!(Paras::past_code_meta(¶_id).most_recent_change().is_none());
|
||||
@@ -595,8 +621,14 @@ fn submit_code_change_when_not_allowed_is_err() {
|
||||
let new_code = ValidationCode(vec![4, 5, 6]);
|
||||
let newer_code = ValidationCode(vec![4, 5, 6, 7]);
|
||||
|
||||
run_to_block(1, None);
|
||||
// Wait for at least one session change to set active validators.
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
run_to_block(1, Some(vec![1]));
|
||||
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 1, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
assert_eq!(FutureCodeUpgrades::<Test>::get(¶_id), Some(1 + validation_upgrade_delay));
|
||||
assert_eq!(FutureCodeHash::<Test>::get(¶_id), Some(new_code.hash()));
|
||||
check_code_is_stored(&new_code);
|
||||
@@ -625,7 +657,7 @@ fn upgrade_restriction_elapsed_doesnt_mean_can_upgrade() {
|
||||
// rather an artifact of the current implementation and not necessarily something we want
|
||||
// to keep in the future.
|
||||
//
|
||||
// This test exists that this is not accidentially changed.
|
||||
// This test exists that this is not accidentally changed.
|
||||
|
||||
let code_retention_period = 10;
|
||||
let validation_upgrade_delay = 7;
|
||||
@@ -660,8 +692,14 @@ fn upgrade_restriction_elapsed_doesnt_mean_can_upgrade() {
|
||||
let new_code = ValidationCode(vec![4, 5, 6]);
|
||||
let newer_code = ValidationCode(vec![4, 5, 6, 7]);
|
||||
|
||||
run_to_block(1, None);
|
||||
// Wait for at least one session change to set active validators.
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
run_to_block(1, Some(vec![1]));
|
||||
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 0, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
Paras::note_new_head(para_id, dummy_head_data(), 0);
|
||||
assert_eq!(
|
||||
UpgradeRestrictionSignal::<Test>::get(¶_id),
|
||||
@@ -722,7 +760,10 @@ fn full_parachain_cleanup_storage() {
|
||||
let para_id = ParaId::from(0);
|
||||
let new_code = ValidationCode(vec![4, 5, 6]);
|
||||
|
||||
run_to_block(2, None);
|
||||
// Wait for at least one session change to set active validators.
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
run_to_block(2, Some(vec![1]));
|
||||
|
||||
assert_eq!(Paras::current_code(¶_id), Some(original_code.clone()));
|
||||
check_code_is_stored(&original_code);
|
||||
|
||||
@@ -730,6 +771,9 @@ fn full_parachain_cleanup_storage() {
|
||||
// this parablock is in the context of block 1.
|
||||
let expected_at = 1 + validation_upgrade_delay;
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 1, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
Paras::note_new_head(para_id, Default::default(), 1);
|
||||
|
||||
assert!(Paras::past_code_meta(¶_id).most_recent_change().is_none());
|
||||
@@ -832,14 +876,7 @@ fn cannot_offboard_ongoing_pvf_check() {
|
||||
assert_err!(Paras::schedule_para_cleanup(para_id), Error::<Test>::CannotOffboard);
|
||||
|
||||
// Include votes for super-majority.
|
||||
IntoIterator::into_iter([0, 1, 2, 3])
|
||||
.map(|i| PvfCheckStatement {
|
||||
accept: true,
|
||||
subject: new_code.hash(),
|
||||
session_index: EXPECTED_SESSION,
|
||||
validator_index: i.into(),
|
||||
})
|
||||
.for_each(sign_and_include_pvf_check_statement);
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
// Voting concluded, can offboard even though an upgrade is in progress.
|
||||
assert_ok!(Paras::schedule_para_cleanup(para_id));
|
||||
@@ -985,10 +1022,16 @@ fn code_hash_at_returns_up_to_end_of_code_retention_period() {
|
||||
};
|
||||
|
||||
new_test_ext(genesis_config).execute_with(|| {
|
||||
// Wait for at least one session change to set active validators.
|
||||
run_to_block(2, Some(vec![1]));
|
||||
const EXPECTED_SESSION: SessionIndex = 1;
|
||||
|
||||
let para_id = ParaId::from(0);
|
||||
let old_code: ValidationCode = vec![1, 2, 3].into();
|
||||
let new_code: ValidationCode = vec![4, 5, 6].into();
|
||||
Paras::schedule_code_upgrade(para_id, new_code.clone(), 0, &Configuration::config());
|
||||
// Include votes for super-majority.
|
||||
submit_super_majority_pvf_votes(&new_code, EXPECTED_SESSION, true);
|
||||
|
||||
// The new validation code can be applied but a new parablock hasn't gotten in yet,
|
||||
// so the old code should still be current.
|
||||
@@ -998,7 +1041,7 @@ fn code_hash_at_returns_up_to_end_of_code_retention_period() {
|
||||
run_to_block(10, None);
|
||||
Paras::note_new_head(para_id, Default::default(), 7);
|
||||
|
||||
assert_eq!(Paras::past_code_meta(¶_id).upgrade_times, vec![upgrade_at(2, 10)]);
|
||||
assert_eq!(Paras::past_code_meta(¶_id).upgrade_times, vec![upgrade_at(4, 10)]);
|
||||
assert_eq!(Paras::current_code(¶_id), Some(new_code.clone()));
|
||||
|
||||
// Make sure that the old code is available **before** the code retion period passes.
|
||||
@@ -1103,14 +1146,7 @@ fn pvf_check_coalescing_onboarding_and_upgrade() {
|
||||
assert!(!Paras::pvfs_require_precheck().is_empty());
|
||||
|
||||
// Supermajority of validators vote for `validation_code`. It should be approved.
|
||||
IntoIterator::into_iter([0, 1, 2, 3])
|
||||
.map(|i| PvfCheckStatement {
|
||||
accept: true,
|
||||
subject: validation_code.hash(),
|
||||
session_index: EXPECTED_SESSION,
|
||||
validator_index: i.into(),
|
||||
})
|
||||
.for_each(sign_and_include_pvf_check_statement);
|
||||
submit_super_majority_pvf_votes(&validation_code, EXPECTED_SESSION, true);
|
||||
|
||||
// Check that `b` actually onboards.
|
||||
assert_eq!(ActionsQueue::<Test>::get(EXPECTED_SESSION + 2), vec![b]);
|
||||
@@ -1253,47 +1289,6 @@ fn pvf_check_upgrade_reject() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pvf_check_submit_vote_while_disabled() {
|
||||
let genesis_config = MockGenesisConfig {
|
||||
configuration: crate::configuration::GenesisConfig {
|
||||
config: HostConfiguration { pvf_checking_enabled: false, ..Default::default() },
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
new_test_ext(genesis_config).execute_with(|| {
|
||||
// This will set the session index to 1 and seed the validators.
|
||||
run_to_block(1, Some(vec![1]));
|
||||
|
||||
let stmt = PvfCheckStatement {
|
||||
accept: false,
|
||||
subject: ValidationCode(vec![1, 2, 3]).hash(),
|
||||
session_index: 1,
|
||||
validator_index: 1.into(),
|
||||
};
|
||||
|
||||
let signature: ValidatorSignature =
|
||||
Sr25519Keyring::Alice.sign(&stmt.signing_payload()).into();
|
||||
|
||||
let call =
|
||||
Call::include_pvf_check_statement { stmt: stmt.clone(), signature: signature.clone() };
|
||||
|
||||
let validate_unsigned =
|
||||
<Paras as ValidateUnsigned>::validate_unsigned(TransactionSource::InBlock, &call);
|
||||
assert_eq!(
|
||||
validate_unsigned,
|
||||
InvalidTransaction::Custom(INVALID_TX_PVF_CHECK_DISABLED).into()
|
||||
);
|
||||
|
||||
assert_err!(
|
||||
Paras::include_pvf_check_statement(None.into(), stmt.clone(), signature.clone()),
|
||||
Error::<Test>::PvfCheckDisabled
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pvf_check_submit_vote() {
|
||||
let code_a: ValidationCode = vec![3, 2, 1].into();
|
||||
|
||||
@@ -18,26 +18,30 @@ use super::*;
|
||||
|
||||
use frame_support::assert_ok;
|
||||
use keyring::Sr25519Keyring;
|
||||
use primitives::{BlockNumber, CollatorId, SessionIndex, ValidatorId};
|
||||
use primitives::{BlockNumber, CollatorId, SessionIndex, ValidationCode, ValidatorId};
|
||||
|
||||
use crate::{
|
||||
configuration::HostConfiguration,
|
||||
initializer::SessionChangeNotification,
|
||||
mock::{
|
||||
new_test_ext, Configuration, MockGenesisConfig, Paras, ParasShared, Scheduler, System, Test,
|
||||
new_test_ext, Configuration, MockGenesisConfig, Paras, ParasShared, RuntimeOrigin,
|
||||
Scheduler, System, Test,
|
||||
},
|
||||
paras::{ParaGenesisArgs, ParaKind},
|
||||
};
|
||||
|
||||
fn schedule_blank_para(id: ParaId, parakind: ParaKind) {
|
||||
let validation_code: ValidationCode = vec![1, 2, 3].into();
|
||||
assert_ok!(Paras::schedule_para_initialize(
|
||||
id,
|
||||
ParaGenesisArgs {
|
||||
genesis_head: Vec::new().into(),
|
||||
validation_code: vec![1, 2, 3].into(),
|
||||
validation_code: validation_code.clone(),
|
||||
para_kind: parakind,
|
||||
}
|
||||
));
|
||||
|
||||
assert_ok!(Paras::add_trusted_validation_code(RuntimeOrigin::root(), validation_code));
|
||||
}
|
||||
|
||||
fn run_to_block(
|
||||
|
||||
@@ -123,8 +123,8 @@ impl<T: Config> Pallet<T> {
|
||||
CurrentSessionIndex::<T>::set(index);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-benchmarks", test))]
|
||||
pub(crate) fn set_active_validators_ascending(active: Vec<ValidatorId>) {
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
pub fn set_active_validators_ascending(active: Vec<ValidatorId>) {
|
||||
ActiveValidatorIndices::<T>::set(
|
||||
(0..active.len()).map(|i| ValidatorIndex(i as _)).collect(),
|
||||
);
|
||||
|
||||
@@ -17,29 +17,30 @@
|
||||
//! Autogenerated weights for `runtime_parachains::paras`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-05-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// target/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=polkadot-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --chain=polkadot-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/polkadot/src/weights/runtime_parachains_paras.rs
|
||||
// --output=./runtime/polkadot/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
@@ -64,11 +65,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `8309`
|
||||
// Estimated: `11774`
|
||||
// Minimum execution time: 32_553_000 picoseconds.
|
||||
Weight::from_parts(32_756_000, 0)
|
||||
// Minimum execution time: 32_694_000 picoseconds.
|
||||
Weight::from_parts(32_922_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11774))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_957, 0).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(1_979, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(6))
|
||||
}
|
||||
@@ -79,11 +80,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_606_000 picoseconds.
|
||||
Weight::from_parts(8_843_000, 0)
|
||||
// Minimum execution time: 8_539_000 picoseconds.
|
||||
Weight::from_parts(8_748_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(864, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(882, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
@@ -94,32 +95,30 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras CurrentCodeHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeCooldowns (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpgradeCooldowns (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras FutureCodeUpgrades (r:0 w:1)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeRestrictionSignal (r:0 w:1)
|
||||
/// Proof Skipped: Paras UpgradeRestrictionSignal (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn force_schedule_code_upgrade(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `16765`
|
||||
// Estimated: `20230`
|
||||
// Minimum execution time: 60_112_000 picoseconds.
|
||||
Weight::from_parts(60_521_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 20230))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(1_987, 0).saturating_mul(c.into()))
|
||||
// Measured: `8694`
|
||||
// Estimated: `12159`
|
||||
// Minimum execution time: 51_492_000 picoseconds.
|
||||
Weight::from_parts(51_683_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 12159))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(2_009, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(9))
|
||||
.saturating_add(T::DbWeight::get().writes(8))
|
||||
.saturating_add(T::DbWeight::get().writes(7))
|
||||
}
|
||||
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -132,11 +131,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `95`
|
||||
// Estimated: `3560`
|
||||
// Minimum execution time: 14_802_000 picoseconds.
|
||||
Weight::from_parts(14_961_000, 0)
|
||||
// Minimum execution time: 14_471_000 picoseconds.
|
||||
Weight::from_parts(14_720_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3560))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(868, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(887, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -148,28 +147,34 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4251`
|
||||
// Estimated: `7716`
|
||||
// Minimum execution time: 20_603_000 picoseconds.
|
||||
Weight::from_parts(20_988_000, 0)
|
||||
// Minimum execution time: 20_295_000 picoseconds.
|
||||
Weight::from_parts(20_587_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 7716))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared CurrentSessionIndex (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn add_trusted_validation_code(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 9_017_000 picoseconds.
|
||||
Weight::from_parts(9_203_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
// Measured: `925`
|
||||
// Estimated: `4390`
|
||||
// Minimum execution time: 85_377_000 picoseconds.
|
||||
Weight::from_parts(69_772_527, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4390))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_965, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(Weight::from_parts(1_441, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:0)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -179,14 +184,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 6_910_000 picoseconds.
|
||||
Weight::from_parts(7_219_000, 0)
|
||||
// Minimum execution time: 6_677_000 picoseconds.
|
||||
Weight::from_parts(6_911_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -195,16 +198,14 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26948`
|
||||
// Estimated: `30413`
|
||||
// Minimum execution time: 92_251_000 picoseconds.
|
||||
Weight::from_parts(93_638_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30413))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 92_860_000 picoseconds.
|
||||
Weight::from_parts(93_926_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -213,6 +214,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
@@ -223,14 +226,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27502`
|
||||
// Estimated: `30967`
|
||||
// Minimum execution time: 792_755_000 picoseconds.
|
||||
Weight::from_parts(799_668_000, 0)
|
||||
// Minimum execution time: 792_233_000 picoseconds.
|
||||
Weight::from_parts(800_363_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30967))
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(104))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -239,16 +240,14 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27480`
|
||||
// Estimated: `30945`
|
||||
// Minimum execution time: 92_117_000 picoseconds.
|
||||
Weight::from_parts(93_358_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30945))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `27177`
|
||||
// Estimated: `30642`
|
||||
// Minimum execution time: 88_272_000 picoseconds.
|
||||
Weight::from_parts(89_916_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30642))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -257,20 +256,20 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26970`
|
||||
// Estimated: `30435`
|
||||
// Minimum execution time: 625_094_000 picoseconds.
|
||||
Weight::from_parts(633_347_000, 0)
|
||||
// Minimum execution time: 623_703_000 picoseconds.
|
||||
Weight::from_parts(630_875_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30435))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -279,12 +278,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26948`
|
||||
// Estimated: `30413`
|
||||
// Minimum execution time: 91_139_000 picoseconds.
|
||||
Weight::from_parts(92_235_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30413))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 87_411_000 picoseconds.
|
||||
Weight::from_parts(89_432_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,29 +17,30 @@
|
||||
//! Autogenerated weights for `runtime_parachains::paras`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// target/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=rococo-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --chain=rococo-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/rococo/src/weights/runtime_parachains_paras.rs
|
||||
// --output=./runtime/rococo/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
@@ -64,11 +65,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `8309`
|
||||
// Estimated: `11774`
|
||||
// Minimum execution time: 32_230_000 picoseconds.
|
||||
Weight::from_parts(32_484_000, 0)
|
||||
// Minimum execution time: 32_367_000 picoseconds.
|
||||
Weight::from_parts(32_540_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11774))
|
||||
// Standard Error: 3
|
||||
.saturating_add(Weight::from_parts(1_972, 0).saturating_mul(c.into()))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_977, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(6))
|
||||
}
|
||||
@@ -79,11 +80,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_577_000 picoseconds.
|
||||
Weight::from_parts(8_741_000, 0)
|
||||
// Minimum execution time: 8_523_000 picoseconds.
|
||||
Weight::from_parts(8_633_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(857, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(882, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
@@ -94,32 +95,30 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras CurrentCodeHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeCooldowns (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpgradeCooldowns (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras FutureCodeUpgrades (r:0 w:1)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeRestrictionSignal (r:0 w:1)
|
||||
/// Proof Skipped: Paras UpgradeRestrictionSignal (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn force_schedule_code_upgrade(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `16769`
|
||||
// Estimated: `20234`
|
||||
// Minimum execution time: 59_725_000 picoseconds.
|
||||
Weight::from_parts(60_345_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 20234))
|
||||
// Measured: `8698`
|
||||
// Estimated: `12163`
|
||||
// Minimum execution time: 50_830_000 picoseconds.
|
||||
Weight::from_parts(50_953_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 12163))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_981, 0).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(2_008, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(9))
|
||||
.saturating_add(T::DbWeight::get().writes(8))
|
||||
.saturating_add(T::DbWeight::get().writes(7))
|
||||
}
|
||||
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -132,11 +131,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `95`
|
||||
// Estimated: `3560`
|
||||
// Minimum execution time: 14_733_000 picoseconds.
|
||||
Weight::from_parts(14_854_000, 0)
|
||||
// Minimum execution time: 14_524_000 picoseconds.
|
||||
Weight::from_parts(14_595_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3560))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(863, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(886, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -148,28 +147,34 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4251`
|
||||
// Estimated: `7716`
|
||||
// Minimum execution time: 21_286_000 picoseconds.
|
||||
Weight::from_parts(21_593_000, 0)
|
||||
// Minimum execution time: 20_191_000 picoseconds.
|
||||
Weight::from_parts(20_738_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 7716))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared CurrentSessionIndex (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn add_trusted_validation_code(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 8_945_000 picoseconds.
|
||||
Weight::from_parts(9_207_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
// Measured: `929`
|
||||
// Estimated: `4394`
|
||||
// Minimum execution time: 84_027_000 picoseconds.
|
||||
Weight::from_parts(66_112_336, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4394))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_961, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(Weight::from_parts(1_446, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:0)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -179,14 +184,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 6_494_000 picoseconds.
|
||||
Weight::from_parts(6_828_000, 0)
|
||||
// Minimum execution time: 6_672_000 picoseconds.
|
||||
Weight::from_parts(6_990_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -195,16 +198,14 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26952`
|
||||
// Estimated: `30417`
|
||||
// Minimum execution time: 92_204_000 picoseconds.
|
||||
Weight::from_parts(92_879_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30417))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 92_650_000 picoseconds.
|
||||
Weight::from_parts(93_865_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -213,6 +214,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
@@ -223,14 +226,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27506`
|
||||
// Estimated: `30971`
|
||||
// Minimum execution time: 780_344_000 picoseconds.
|
||||
Weight::from_parts(789_583_000, 0)
|
||||
// Minimum execution time: 772_011_000 picoseconds.
|
||||
Weight::from_parts(782_508_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30971))
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(104))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -239,16 +240,14 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27484`
|
||||
// Estimated: `30949`
|
||||
// Minimum execution time: 91_535_000 picoseconds.
|
||||
Weight::from_parts(92_909_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30949))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `27177`
|
||||
// Estimated: `30642`
|
||||
// Minimum execution time: 88_339_000 picoseconds.
|
||||
Weight::from_parts(90_069_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30642))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -257,20 +256,20 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26974`
|
||||
// Estimated: `30439`
|
||||
// Minimum execution time: 627_464_000 picoseconds.
|
||||
Weight::from_parts(631_072_000, 0)
|
||||
// Minimum execution time: 613_406_000 picoseconds.
|
||||
Weight::from_parts(621_925_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30439))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
/// Proof Skipped: Configuration ActiveConfig (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
@@ -279,12 +278,12 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26952`
|
||||
// Estimated: `30417`
|
||||
// Minimum execution time: 91_119_000 picoseconds.
|
||||
Weight::from_parts(91_722_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30417))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 87_629_000 picoseconds.
|
||||
Weight::from_parts(89_057_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ pub use pallet_balances::Call as BalancesCall;
|
||||
pub use pallet_staking::StakerStatus;
|
||||
pub use pallet_sudo::Call as SudoCall;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
pub use parachains_paras::Call as ParasCall;
|
||||
pub use paras_sudo_wrapper::Call as ParasSudoWrapperCall;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
|
||||
@@ -17,29 +17,30 @@
|
||||
//! Autogenerated weights for `runtime_parachains::paras`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// target/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westend-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::paras
|
||||
// --chain=westend-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/westend/src/weights/runtime_parachains_paras.rs
|
||||
// --output=./runtime/westend/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
@@ -64,11 +65,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `8309`
|
||||
// Estimated: `11774`
|
||||
// Minimum execution time: 32_720_000 picoseconds.
|
||||
Weight::from_parts(33_199_000, 0)
|
||||
// Minimum execution time: 31_695_000 picoseconds.
|
||||
Weight::from_parts(31_903_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11774))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_947, 0).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(1_979, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(6))
|
||||
}
|
||||
@@ -79,11 +80,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 9_146_000 picoseconds.
|
||||
Weight::from_parts(9_372_000, 0)
|
||||
// Minimum execution time: 8_642_000 picoseconds.
|
||||
Weight::from_parts(8_730_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(857, 0).saturating_mul(s.into()))
|
||||
.saturating_add(Weight::from_parts(890, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras FutureCodeHash (r:1 w:1)
|
||||
@@ -92,32 +93,30 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
/// Proof Skipped: Paras CurrentCodeHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeCooldowns (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpgradeCooldowns (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpcomingUpgrades (r:1 w:1)
|
||||
/// Proof Skipped: Paras UpcomingUpgrades (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: System Digest (r:1 w:1)
|
||||
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras FutureCodeUpgrades (r:0 w:1)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras UpgradeRestrictionSignal (r:0 w:1)
|
||||
/// Proof Skipped: Paras UpgradeRestrictionSignal (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn force_schedule_code_upgrade(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `16462`
|
||||
// Estimated: `19927`
|
||||
// Minimum execution time: 57_014_000 picoseconds.
|
||||
Weight::from_parts(57_397_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 19927))
|
||||
// Measured: `8391`
|
||||
// Estimated: `11856`
|
||||
// Minimum execution time: 46_791_000 picoseconds.
|
||||
Weight::from_parts(47_083_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11856))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_967, 0).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(2_011, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(8))
|
||||
.saturating_add(T::DbWeight::get().writes(8))
|
||||
.saturating_add(T::DbWeight::get().writes(7))
|
||||
}
|
||||
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
/// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -130,11 +129,11 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `95`
|
||||
// Estimated: `3560`
|
||||
// Minimum execution time: 14_407_000 picoseconds.
|
||||
Weight::from_parts(14_619_000, 0)
|
||||
// Minimum execution time: 13_939_000 picoseconds.
|
||||
Weight::from_parts(14_133_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3560))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(859, 0).saturating_mul(s.into()))
|
||||
// Standard Error: 2
|
||||
.saturating_add(Weight::from_parts(901, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -146,28 +145,32 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4251`
|
||||
// Estimated: `7716`
|
||||
// Minimum execution time: 20_892_000 picoseconds.
|
||||
Weight::from_parts(21_330_000, 0)
|
||||
// Minimum execution time: 19_323_000 picoseconds.
|
||||
Weight::from_parts(19_629_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 7716))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:0)
|
||||
/// Storage: Paras PvfActiveVoteMap (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteMap (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras CodeByHash (r:1 w:1)
|
||||
/// Proof Skipped: Paras CodeByHash (max_values: None, max_size: None, mode: Measured)
|
||||
/// Storage: Paras PvfActiveVoteList (r:1 w:1)
|
||||
/// Proof Skipped: Paras PvfActiveVoteList (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
/// Proof Skipped: ParasShared CurrentSessionIndex (max_values: Some(1), max_size: None, mode: Measured)
|
||||
/// Storage: Paras ActionsQueue (r:1 w:1)
|
||||
/// Proof Skipped: Paras ActionsQueue (max_values: None, max_size: None, mode: Measured)
|
||||
/// The range of component `c` is `[1, 3145728]`.
|
||||
fn add_trusted_validation_code(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 8_643_000 picoseconds.
|
||||
Weight::from_parts(8_743_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
// Measured: `622`
|
||||
// Estimated: `4087`
|
||||
// Minimum execution time: 81_851_000 picoseconds.
|
||||
Weight::from_parts(65_672_617, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4087))
|
||||
// Standard Error: 1
|
||||
.saturating_add(Weight::from_parts(1_949, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(Weight::from_parts(1_442, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: Paras CodeByHashRefs (r:1 w:0)
|
||||
/// Proof Skipped: Paras CodeByHashRefs (max_values: None, max_size: None, mode: Measured)
|
||||
@@ -177,8 +180,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `28`
|
||||
// Estimated: `3493`
|
||||
// Minimum execution time: 6_322_000 picoseconds.
|
||||
Weight::from_parts(6_500_000, 0)
|
||||
// Minimum execution time: 5_926_000 picoseconds.
|
||||
Weight::from_parts(6_126_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3493))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -193,8 +196,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 88_015_000 picoseconds.
|
||||
Weight::from_parts(89_436_000, 0)
|
||||
// Minimum execution time: 91_618_000 picoseconds.
|
||||
Weight::from_parts(92_712_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -217,8 +220,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27199`
|
||||
// Estimated: `30664`
|
||||
// Minimum execution time: 799_995_000 picoseconds.
|
||||
Weight::from_parts(806_270_000, 0)
|
||||
// Minimum execution time: 773_592_000 picoseconds.
|
||||
Weight::from_parts(781_309_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30664))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(104))
|
||||
@@ -233,8 +236,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27177`
|
||||
// Estimated: `30642`
|
||||
// Minimum execution time: 87_373_000 picoseconds.
|
||||
Weight::from_parts(88_419_000, 0)
|
||||
// Minimum execution time: 86_554_000 picoseconds.
|
||||
Weight::from_parts(88_691_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30642))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
@@ -253,8 +256,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26667`
|
||||
// Estimated: `30132`
|
||||
// Minimum execution time: 632_844_000 picoseconds.
|
||||
Weight::from_parts(641_036_000, 0)
|
||||
// Minimum execution time: 617_351_000 picoseconds.
|
||||
Weight::from_parts(621_906_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30132))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
@@ -269,8 +272,8 @@ impl<T: frame_system::Config> runtime_parachains::paras::WeightInfo for WeightIn
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `26645`
|
||||
// Estimated: `30110`
|
||||
// Minimum execution time: 86_854_000 picoseconds.
|
||||
Weight::from_parts(88_145_000, 0)
|
||||
// Minimum execution time: 85_943_000 picoseconds.
|
||||
Weight::from_parts(87_442_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 30110))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
|
||||
Reference in New Issue
Block a user