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

feat: upgrade to Polkadot v0.9.32 #434

Merged
merged 19 commits into from
Dec 6, 2022
Merged

Conversation

wischli
Copy link
Contributor

@wischli wischli commented Nov 14, 2022

fixes KILTProtocol/ticket#2289 and KILTProtocol/ticket#2296

Summary of changes (Polkadot v0.9.30-0.9.32)

Breaking Changes

  • Breaking: Outer enums (BREAKING: Rename Call & Event paritytech/substrate#11981)
    • Origin --> RuntimeOrigin
    • Call --> RuntimeCall
    • Event --> RuntimeEvent
    • Convention seems to be to keep Event, Call, Origin for inner pallet usage, e.g. Did::Origin Update: We use Runtime prefix internally as well

Noteworthy PRs

Scheduler, Preimage, Democracy Migration

  • Bound uses of Call paritytech/substrate#11649
    • Referenda, Democracy, Scheduler and Preimage pallets are all now bounded in storage access footprint
    • Removed the concept of a "hard deadline" or weight-override priority and no longer guarantees that at least one scheduled item will be executed per block (since these are both dangerous to parachains which have a strict need of weight limits). This means you must ensure that scheduled items are below the MaximumWeight or they will not be executed.
  • Interesting comment: Bound uses of Call paritytech/substrate#11649 (comment)

There is migration code which moves existing proposals and referenda over to the new format. However IT DOES NOT MIGRATE EVERYTHING:

  • Preimages are NOT migrated. Any registered preimages in Democracy at the time of migration are dropped. Their balance is NOT UNRESERVED.
  • The re-dispatcher used in the old Democracy implementation is removed. Any proposals scheduled for dispatch by Democracy WILL NOT EXECUTE.

This means you SHOULD ensure that:

  • the preimage for the runtime upgrade is placed as an imminent preimage, not with a deposit;
  • no other preimages are in place at the time of upgrade;
  • there are no other proposals scheduled for dispatch by Democracy at the time of upgrade.

The Democracy pallet will be marked as deprecated immediately once Referenda is considered production-ready. ALL TEAMS ARE RECOMMENDED TO SWITCH SWAY FROM DEMOCRACY PALLET TO REFERENDA/CONVICTION-VOTING PALLETS ASAP

Result of try-runtime against Spiritnet on Friday Nov 18, 2022:

2022-11-18 09:27:23.917  INFO                 main runtime::preimage::migration::v1: Migrating 0 images
2022-11-18 09:27:23.917  INFO                 main runtime::scheduler::migration: Trying to migrate 0 agendas...
2022-11-18 09:27:23.917  INFO                 main runtime::scheduler::migration: Migrated 0 agendas.
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: 0 public proposals will be migrated.
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: 25 referenda will be migrated.
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#7
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#20
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#13
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#5
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#8
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#1
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#19
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#9
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#16
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#14
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#21
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#15
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#24
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#22
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#2
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#10
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum #0
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#6
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#11
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#3
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#17
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#18
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#23
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#4
2022-11-18 09:27:23.917  INFO                 main runtime::democracy::migration::v1: migrating referendum paritytech/substrate#25
2022-11-18 09:27:23.918  INFO                 main runtime::democracy::migration::v1: 0 public proposals migrated, 25 referenda migrated

Checklist:

  • I have verified that the code works
    • No panics! (checked arithmetic ops, no indexing array[3] use get(3), ...)
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@wischli wischli self-assigned this Nov 16, 2022
@wischli wischli marked this pull request as ready for review November 18, 2022 15:37
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says that the convetion seems to be to keep using Call, Event, Call etc for pallets, but I see here that that is not really the case. I guess we should also introduce the change in our pallets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Will fix that!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type Call = Call;
type Origin = Origin;
type RuntimeEvent = RuntimeEvent;
type Call = RuntimeCall;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sudo pallet uses RuntimeCall, so I guess we should use the same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type Origin = Origin;
type RuntimeEvent = RuntimeEvent;
type Call = RuntimeCall;
type Origin = RuntimeOrigin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure at this point if keeping Origin makes sense anymore, or if we should also rename this to RuntimeOrigin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// Executive: handles dispatch to the various Pallets.
pub type Executive =
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem, ()>;

#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.. Why do we need this here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this simply be done inside the benche module, since everything only exist for runtime-benchmarks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're just following upstream here. See this comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment in code why we have this there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -336,6 +336,16 @@ pub fn run() -> Result<()> {
)?;
cmd.run(partials.client)
}),
#[cfg(not(feature = "runtime-benchmarks"))]
(BenchmarkCmd::Storage(_), _) => {
return Err(sc_cli::Error::Input(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy noticed the return statement is unneeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -28,7 +28,9 @@ use frame_support::{
use sp_std::{marker::PhantomData, vec};

#[cfg(feature = "try-runtime")]
use frame_support::traits::OnRuntimeUpgradeHelpersExt;
use frame_support::codec::{Decode, Encode};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess these can be combined?

Copy link
Contributor Author

@wischli wischli Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@weichweich weichweich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to have some insight on a few changes. Looks good otherwise. Nice set of changes that were included in the last updates.

pallets/pallet-did-lookup/src/migrations.rs Outdated Show resolved Hide resolved
runtimes/common/src/constants.rs Show resolved Hide resolved
runtimes/common/src/fees.rs Outdated Show resolved Hide resolved
runtimes/clone/src/lib.rs Show resolved Hide resolved
@wischli wischli merged commit 431c1e9 into develop Dec 6, 2022
@wischli wischli deleted the wf-2289-polkadot-v0.9.32 branch December 6, 2022 15:39
@ntn-x2 ntn-x2 mentioned this pull request Jan 13, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants