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 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80f5c6b
uplift to stable2407
magecnion Sep 12, 2024
7d08b77
https://github.com/paritytech/polkadot-sdk/pull/4831
magecnion Sep 12, 2024
c2393a1
https://github.com/paritytech/polkadot-sdk/pull/3820
magecnion Sep 12, 2024
d3ab8b0
polkadot-evm/frontier#1253
magecnion Sep 12, 2024
3c38125
paritytech/polkadot-sdk#3952
magecnion Sep 12, 2024
d83ce57
paritytech/polkadot-sdk#3872
magecnion Sep 12, 2024
f00b928
fix rpc_builder type
magecnion Sep 12, 2024
3c273a7
paritytech/polkadot-sdk#4410
magecnion Sep 12, 2024
e62bf50
paritytech/polkadot-sdk#4097
magecnion Sep 12, 2024
89eead2
use stable rust toolchain
magecnion Sep 12, 2024
a37221d
paritytech/polkadot-sdk#3964
magecnion Sep 12, 2024
5277f61
cargo fmt
magecnion Sep 12, 2024
30836ae
clippy and lint issues
magecnion Sep 12, 2024
77af763
e2e-test estimate gas when delegating
magecnion Sep 12, 2024
5b64ecb
only run staking e2e-test so it's easier for reviewing by external
magecnion Sep 12, 2024
11cd1a1
only run staking e2e-test so it's easier for reviewing by external
magecnion Sep 12, 2024
d70158c
restore run all e2e tests
magecnion Sep 13, 2024
43737f3
Update Rust Toolchain to 1.77, Suppress Warnings, and Enhance Runtime…
asiniscalchi Sep 13, 2024
42e3392
Merge branch 'main' into feature/upgrade-polkadot-sdk-to-stable2407
asiniscalchi Sep 13, 2024
4ccef59
update cargo.lock
asiniscalchi Sep 13, 2024
1b74336
using runtime
asiniscalchi Sep 13, 2024
35896b7
fix command
luispdm Sep 13, 2024
7f688d3
Merge branch 'main' into feature/upgrade-polkadot-sdk-to-stable2407
asiniscalchi Oct 17, 2024
c09297c
fix compilation
asiniscalchi Oct 17, 2024
8ff0567
fix metadata test
asiniscalchi Oct 17, 2024
46b4d70
Merge branch 'main' into feature/upgrade-polkadot-sdk-to-stable2407
asiniscalchi Oct 29, 2024
685699f
missing Config associated type
asiniscalchi Oct 30, 2024
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,286 changes: 1,962 additions & 2,324 deletions Cargo.lock

Large diffs are not rendered by default.

290 changes: 145 additions & 145 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 @@ -42,11 +42,11 @@ use futures::FutureExt;
use laos_runtime::RuntimeApi;
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
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 = 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
Loading