Migrate frame-system to pallet attribute macro (#7898)

* PRINT_PALLET_UPGRADE=1 cargo check -p frame-system

* Copy attributes, imports, mods and type defs

* Copy Config trait

* Annotate constants

* Tabify

* Migrate hooks

* Upgrade template rename interface to hooks

* Migrate pallet call

* Migrate Event

* Migrate Error

* Migrate Origin

* Remove optional validate_unsigned

* Remove remaining TODO_MAYBE_WHERE_CLAUSE

* Overwrite original lib.rs with migrated lib2.rs.

* Add required Event IsType constraint

* Add disable supertrait check

* Fix leftover Trait trait

* Add missing pallet prefix for weight attributes

* Add missing Error type parameter

* Add missing Hooks type parameter

* Private call visibility, restore original helper types and helpers etc

* Fix hooks type parameter

* Rename RawEvent to Event

* Add missing storage type annotations

* Remove unused imports

* Add GenesisConfig helpers for compat

* Fix unused import warnings

* Update frame/support/procedural/src/storage/print_pallet_upgrade.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Fix test errors and warnings

* Fix remaining errors and warnings

* Apply review suggestion: fix formatting

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply review suggestion: annotate BlockLength as constant

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply review suggestion: add triling comma

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply review suggestion: add triling comma

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply review suggestion: add trailing comma

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply review suggestion: fix storage type indentation

* Apply review suggestion: remove redundant Origin type alias

* Add missing codec derives for BlockLength

* Restore module docs

* Module -> Pallet renamel

* Revert "Update frame/support/procedural/src/storage/print_pallet_upgrade.rs"

This reverts commit d2a2d5b6

* Apply review suggestion: merge crate imports

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Revert "Upgrade template rename interface to hooks"

This reverts commit 306f0239

* Single line import

* Refactor generated genesis build

* Import sp_io::storage

* Revert previous, fully qualify sp_io::storage

* Fix ui tests

* Fix errors after merge, missing changes

* Set UpgradedToDualRefCount to true in genesis build

* Annotated Runtime version with constant, exposing it via metadata

* Add metadata attribute

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
This commit is contained in:
Andrew Jones
2021-01-20 10:48:19 +00:00
committed by GitHub
parent 9d6b9684d9
commit 71ef82afbc
16 changed files with 595 additions and 542 deletions
+5 -5
View File
@@ -329,7 +329,7 @@ fn full_native_block_import_works() {
let events = vec![
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
event: Event::frame_system(frame_system::Event::ExtrinsicSuccess(
DispatchInfo { weight: timestamp_weight, class: DispatchClass::Mandatory, ..Default::default() }
)),
topics: vec![],
@@ -350,7 +350,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
event: Event::frame_system(frame_system::Event::ExtrinsicSuccess(
DispatchInfo { weight: transfer_weight, ..Default::default() }
)),
topics: vec![],
@@ -381,7 +381,7 @@ fn full_native_block_import_works() {
let events = vec![
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
event: Event::frame_system(frame_system::Event::ExtrinsicSuccess(
DispatchInfo { weight: timestamp_weight, class: DispatchClass::Mandatory, ..Default::default() }
)),
topics: vec![],
@@ -404,7 +404,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
event: Event::frame_system(frame_system::Event::ExtrinsicSuccess(
DispatchInfo { weight: transfer_weight, ..Default::default() }
)),
topics: vec![],
@@ -427,7 +427,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
event: Event::frame_system(frame_system::Event::ExtrinsicSuccess(
DispatchInfo { weight: transfer_weight, ..Default::default() }
)),
topics: vec![],
+1 -1
View File
@@ -17,7 +17,7 @@
use codec::{Encode, Joiner};
use frame_support::{
StorageValue, StorageMap,
StorageValue,
traits::Currency,
weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial},
};
@@ -217,7 +217,6 @@ fn should_submit_signed_twice_from_all_accounts() {
#[test]
fn submitted_transaction_should_be_valid() {
use codec::Encode;
use frame_support::storage::StorageMap;
use sp_runtime::transaction_validity::{TransactionSource, TransactionTag};
use sp_runtime::traits::StaticLookup;