Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Polkadot SDK to Stable2407 and Enhance Runtime Configurations #773

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,027 changes: 1,863 additions & 2,164 deletions Cargo.lock

Large diffs are not rendered by default.

280 changes: 140 additions & 140 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"fmt-check": "prettier ./tests --check",
"fmt": "prettier ./tests --write",
"build": "./compile_contracts.sh",
"test": "mocha -r ts-node/register -t 600000 'tests/**/*.ts'",
"test": "mocha -r ts-node/register -t 600000 ''tests/**/*.ts'",
"test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'"
},
"author": "",
Expand Down
3 changes: 1 addition & 2 deletions node/src/chain_spec/laos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ use laos_runtime::{
use sc_service::ChainType;
use sp_runtime::Perbill;

pub(crate) type ChainSpec =
sc_service::GenericChainSpec<laos_runtime::RuntimeGenesisConfig, Extensions>;
pub(crate) type ChainSpec = sc_service::GenericChainSpec<Extensions>;

pub(crate) fn development_config() -> ChainSpec {
ChainSpec::builder(
Expand Down
2 changes: 2 additions & 0 deletions node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::{
use futures::{future, prelude::*};
// Substrate
use sc_client_api::BlockchainEvents;
#[allow(deprecated)]
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};

use sc_network_sync::SyncingService;
Expand Down Expand Up @@ -138,6 +139,7 @@ impl<Api> EthCompatRuntimeApiCollection for Api where
}

#[allow(clippy::too_many_arguments)]
#[allow(deprecated)]
pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager: &TaskManager,
client: Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
Expand Down
13 changes: 5 additions & 8 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use futures::FutureExt;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
#[allow(deprecated)]
use sc_executor::{
HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY,
};
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
Expand Down Expand Up @@ -74,6 +74,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
}
}

#[allow(deprecated)]
type ParachainExecutor = NativeElseWasmExecutor<ParachainNativeExecutor>;

type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
Expand Down Expand Up @@ -469,7 +470,6 @@ async fn start_node_impl(
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service.clone(),
keystore_container.keystore(),
relay_chain_slot_duration,
para_id,
Expand Down Expand Up @@ -530,7 +530,6 @@ fn start_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
sync_oracle: Arc<SyncingService<Block>>,
keystore: KeystorePtr,
relay_chain_slot_duration: Duration,
para_id: ParaId,
Expand Down Expand Up @@ -567,7 +566,6 @@ fn start_consensus(
block_import,
para_client: client,
relay_client: relay_chain_interface,
sync_oracle,
keystore,
collator_key,
para_id,
Expand All @@ -580,10 +578,9 @@ fn start_consensus(
collation_request_receiver: None,
};

let fut =
basic_aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _>(
params,
);
let fut = basic_aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _>(
params,
);
task_manager.spawn_essential_handle().spawn("aura", None, fut);

Ok(())
Expand Down
11 changes: 1 addition & 10 deletions pallets/parachain-staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4833,8 +4833,6 @@ fn deferred_payment_and_at_stake_storage_items_cleaned_up_for_candidates_not_pro

#[test]
fn deferred_payment_steady_state_event_flow() {
use frame_support::traits::{Currency, ExistenceRequirement, WithdrawReasons};

// this test "flows" through a number of rounds, asserting that certain things do/don't happen
// once the staking pallet is in a "steady state" (specifically, once we are past the first few
// rounds to clear RewardPaymentDelay)
Expand Down Expand Up @@ -4886,14 +4884,7 @@ fn deferred_payment_steady_state_event_flow() {
let reset_issuance = || {
let new_issuance = Balances::total_issuance();
let diff = new_issuance - initial_issuance;
let burned = Balances::burn(diff);
Balances::settle(
&111,
burned,
WithdrawReasons::FEE,
ExistenceRequirement::AllowDeath,
)
.expect("Account can absorb burn");
Balances::burn(Some(111).into(), diff, false).expect("Account can absorb burn");
};

// fn to roll through the first RewardPaymentDelay rounds. returns new round index
Expand Down
4 changes: 4 additions & 0 deletions runtime/laos/src/apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ impl_runtime_apis! {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

fn initialize_pending_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header);
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down
11 changes: 10 additions & 1 deletion runtime/laos/src/configs/cumulus_xcmp_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ use crate::{weights, AccountId, MessageQueue, ParachainSystem, Runtime, RuntimeE

use super::xcm_config::XcmOriginToTransactDispatchOrigin;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use frame_support::traits::TransformOrigin;
use frame_support::{parameter_types, traits::TransformOrigin};
use frame_system::EnsureRoot;
use parachains_common::message_queue::ParaIdToSibling;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;

parameter_types! {
pub const MaxActiveOutboundChannels: u32 = 128;
pub const MaxPageSize: u32 = 103 * 1024;
}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ChannelInfo = ParachainSystem;
Expand All @@ -34,4 +39,8 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
type MaxActiveOutboundChannels = MaxActiveOutboundChannels;
// Most on-chain HRMP channels are configured to use 102400 bytes of max message size, so we
// need to set the page size larger than that until we reduce the channel size on-chain.
type MaxPageSize = MaxPageSize;
}
11 changes: 1 addition & 10 deletions runtime/laos/src/configs/treasury.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::collective::CouncilMajority;
use crate::{
currency::UNIT, weights, AccountId, Balance, Balances, BlockNumber, Permill, Runtime,
RuntimeEvent, Treasury,
weights, AccountId, Balance, Balances, BlockNumber, Permill, Runtime, RuntimeEvent, Treasury,
};
use frame_support::{
parameter_types,
Expand All @@ -23,35 +22,27 @@ parameter_types! {

parameter_types! {
pub const Burn: Permill = Permill::zero();
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 100 * UNIT;
pub const SpendPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES);
pub const MaxApprovals: u32 = 100;
pub const TreasuryId: PalletId = PalletId(*b"py/trsry");
pub const PayoutPeriod: BlockNumber = 5;
pub TreasuryAccount: AccountId = Treasury::account_id();
}

type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, CouncilMajority>;
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, CouncilMajority>;

impl pallet_treasury::Config for Runtime {
type AssetKind = ();
type ApproveOrigin = ApproveOrigin;
type BalanceConverter = UnityAssetBalanceConversion;
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Burn = Burn;
type BurnDestination = ();
type Currency = Balances;
type MaxApprovals = MaxApprovals;
type OnSlash = Treasury;
type PalletId = TreasuryId;
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
type PayoutPeriod = PayoutPeriod;
type ProposalBond = ProposalBond;
type ProposalBondMaximum = ();
type ProposalBondMinimum = ProposalBondMinimum;
type RejectOrigin = RejectOrigin;
type RuntimeEvent = RuntimeEvent;
type SpendFunds = ();
Expand Down
1 change: 1 addition & 0 deletions runtime/laos/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl staging_xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// No local origins on this chain are allowed to dispatch XCM sends/executions.
Expand Down
11 changes: 9 additions & 2 deletions runtime/laos/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with LAOS. If not, see <http://www.gnu.org/licenses/>.

use crate::Runtime;
use crate::{ParachainSystem, Runtime};

pub type Migrations = (cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,);
pub type Migrations = (
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
);

impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
type ChannelList = ParachainSystem;
}
45 changes: 0 additions & 45 deletions runtime/laos/src/weights/pallet_treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,51 +46,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
fn propose_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `172`
// Estimated: `1489`
// Minimum execution time: 20_586_000 picoseconds.
Weight::from_parts(21_637_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Treasury::Proposals` (r:1 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`)
fn reject_proposal() -> Weight {
// Proof Size summary in bytes:
// Measured: `306`
// Estimated: `6172`
// Minimum execution time: 35_905_000 picoseconds.
Weight::from_parts(36_761_000, 0)
.saturating_add(Weight::from_parts(0, 6172))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Treasury::Proposals` (r:1 w:0)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 99]`.
fn approve_proposal(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `433 + p * (8 ±0)`
// Estimated: `3549`
// Minimum execution time: 6_302_000 picoseconds.
Weight::from_parts(9_291_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
// Standard Error: 853
.saturating_add(Weight::from_parts(50_001, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight {
Expand Down
Loading