Skip to content

Commit

Permalink
Upgrade Polkadot SDK to Stable2407 and Enhance Configurations (#773)
Browse files Browse the repository at this point in the history
* uplift to stable2407

* paritytech/polkadot-sdk#4831

* paritytech/polkadot-sdk#3820

* polkadot-evm/frontier#1253

* paritytech/polkadot-sdk#3952

* paritytech/polkadot-sdk#3872

* fix rpc_builder type

* paritytech/polkadot-sdk#4410

* paritytech/polkadot-sdk#4097

* use stable rust toolchain

* paritytech/polkadot-sdk#3964

* cargo fmt

* clippy and lint issues

* e2e-test estimate gas when delegating

* only run staking e2e-test so it's easier for reviewing by external

* only run staking e2e-test so it's easier for reviewing by external

* restore run all e2e tests

* Update Rust Toolchain to 1.77, Suppress Warnings, and Enhance Runtime (#778)

* using runt 1.77

* fix clippy errors

* fixing clippy

* update to runtime 2200

* update proyect version to 0.22.0

* add missing migration

* removed the upgrade of versioning

* update cargo.lock

* using runtime

* fix  command

* fix compilation

* fix metadata test

* missing Config associated type

* modify MaxPageSize to the original till we need to increase it

* use latest release for zombienet tests

* go back to stable2407-3 release for zombienet tests

* go back to previous MaxPageSize

---------

Co-authored-by: Alessandro Siniscalchi <[email protected]>
Co-authored-by: luispdm <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent 04a0061 commit f824e61
Show file tree
Hide file tree
Showing 18 changed files with 3,330 additions and 3,707 deletions.
4,286 changes: 1,962 additions & 2,324 deletions Cargo.lock

Large diffs are not rendered by default.

294 changes: 147 additions & 147 deletions Cargo.toml

Large diffs are not rendered by default.

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 @@ -45,11 +45,11 @@ use laos_runtime::{
};
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 @@ -81,6 +81,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
}
}

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

type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
Expand Down Expand Up @@ -496,7 +497,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 @@ -557,7 +557,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 @@ -594,7 +593,6 @@ fn start_consensus(
block_import,
para_client: client,
relay_client: relay_chain_interface,
sync_oracle,
keystore,
collator_key,
para_id,
Expand All @@ -607,10 +605,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
9 changes: 8 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,6 @@ 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;
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 = 28 * DAYS;
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 @@ -206,6 +206,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Disallows local origins from dispatching XCM sends/executions.
Expand Down
4 changes: 4 additions & 0 deletions runtime/laos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,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: 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;
}
Loading

0 comments on commit f824e61

Please sign in to comment.