Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Migrate pallet-grandpa to attribute macros (paritytech#8724)
Browse files Browse the repository at this point in the history
* frame/grandpa: migrate Config

* frame/grandpa: migrate decl_module

* frame/grandpa: migrate decl_event

* frame/grandpa: migrate decl_error

* frame/grandpa: migrate decl_storage

* frame/grandpa: make report_equivocation_unsigned pub(super)

* frame/grandpa: remove unused imports

* frame/grandpa: replace deprecated Module with Pallet

* frame/grandpa: add RawEvent for compatibility

* frame/grandpa: create migration to new storage prefix

* frame/grandpa: bump version to 4.0.0

* frame/grandpa: address review comments

* Try using version 3.1 instead

* frame/grandpa: tweak log text to say cancelled
  • Loading branch information
octol authored and nazar-pc committed Aug 8, 2021
1 parent b9c9f03 commit 77962d8
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 232 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features =
pallet-aura = { version = "3.0.0", default-features = false, path = "../../../frame/aura" }
pallet-balances = { version = "3.0.0", default-features = false, path = "../../../frame/balances" }
frame-support = { version = "3.0.0", default-features = false, path = "../../../frame/support" }
pallet-grandpa = { version = "3.0.0", default-features = false, path = "../../../frame/grandpa" }
pallet-grandpa = { version = "3.1.0", default-features = false, path = "../../../frame/grandpa" }
pallet-randomness-collective-flip = { version = "3.0.0", default-features = false, path = "../../../frame/randomness-collective-flip" }
pallet-sudo = { version = "3.0.0", default-features = false, path = "../../../frame/sudo" }
frame-system = { version = "3.0.0", default-features = false, path = "../../../frame/system" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ frame-support = { version = "3.0.0", default-features = false, path = "../../../
pallet-im-online = { version = "3.0.0", default-features = false, path = "../../../frame/im-online" }
pallet-authority-discovery = { version = "3.0.0", path = "../../../frame/authority-discovery" }
pallet-staking = { version = "3.0.0", path = "../../../frame/staking" }
pallet-grandpa = { version = "3.0.0", path = "../../../frame/grandpa" }
pallet-grandpa = { version = "3.1.0", path = "../../../frame/grandpa" }

# node-specific dependencies
node-runtime = { version = "2.0.0", path = "../runtime" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ frame-system = { version = "3.0.0", path = "../../../frame/system" }
node-testing = { version = "2.0.0", path = "../testing" }
pallet-balances = { version = "3.0.0", path = "../../../frame/balances" }
pallet-contracts = { version = "3.0.0", path = "../../../frame/contracts" }
pallet-grandpa = { version = "3.0.0", path = "../../../frame/grandpa" }
pallet-grandpa = { version = "3.1.0", path = "../../../frame/grandpa" }
pallet-im-online = { version = "3.0.0", path = "../../../frame/im-online" }
pallet-indices = { version = "3.0.0", path = "../../../frame/indices" }
pallet-session = { version = "3.0.0", path = "../../../frame/session" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pallet-democracy = { version = "3.0.0", default-features = false, path = "../../
pallet-election-provider-multi-phase = { version = "3.0.0", default-features = false, path = "../../../frame/election-provider-multi-phase" }
pallet-elections-phragmen = { version = "4.0.0", default-features = false, path = "../../../frame/elections-phragmen" }
pallet-gilt = { version = "3.0.0", default-features = false, path = "../../../frame/gilt" }
pallet-grandpa = { version = "3.0.0", default-features = false, path = "../../../frame/grandpa" }
pallet-grandpa = { version = "3.1.0", default-features = false, path = "../../../frame/grandpa" }
pallet-im-online = { version = "3.0.0", default-features = false, path = "../../../frame/im-online" }
pallet-indices = { version = "3.0.0", default-features = false, path = "../../../frame/indices" }
pallet-identity = { version = "3.0.0", default-features = false, path = "../../../frame/identity" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sc-client-db = { version = "0.9.0", path = "../../../client/db/", features = ["k
sc-client-api = { version = "3.0.0", path = "../../../client/api/" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
pallet-contracts = { version = "3.0.0", path = "../../../frame/contracts" }
pallet-grandpa = { version = "3.0.0", path = "../../../frame/grandpa" }
pallet-grandpa = { version = "3.1.0", path = "../../../frame/grandpa" }
pallet-indices = { version = "3.0.0", path = "../../../frame/indices" }
sp-keyring = { version = "3.0.0", path = "../../../primitives/keyring" }
node-executor = { version = "2.0.0", path = "../executor" }
Expand Down
4 changes: 2 additions & 2 deletions frame/grandpa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-grandpa"
version = "3.0.0"
version = "3.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -17,6 +17,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features =
sp-application-crypto = { version = "3.0.0", default-features = false, path = "../../primitives/application-crypto" }
sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" }
sp-finality-grandpa = { version = "3.0.0", default-features = false, path = "../../primitives/finality-grandpa" }
sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" }
sp-session = { version = "3.0.0", default-features = false, path = "../../primitives/session" }
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }
sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" }
Expand All @@ -31,7 +32,6 @@ log = { version = "0.4.14", default-features = false }
[dev-dependencies]
frame-benchmarking = { version = "3.1.0", path = "../benchmarking" }
grandpa = { package = "finality-grandpa", version = "0.14.0", features = ["derive-codec"] }
sp-io = { version = "3.0.0", path = "../../primitives/io" }
sp-keyring = { version = "3.0.0", path = "../../primitives/keyring" }
pallet-balances = { version = "3.0.0", path = "../balances" }
pallet-offences = { version = "3.0.0", path = "../offences" }
Expand Down
2 changes: 1 addition & 1 deletion frame/grandpa/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#![cfg_attr(not(feature = "std"), no_std)]

use super::{*, Module as Grandpa};
use super::{*, Pallet as Grandpa};
use frame_benchmarking::benchmarks;
use frame_system::RawOrigin;
use sp_core::H256;
Expand Down
4 changes: 2 additions & 2 deletions frame/grandpa/src/equivocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use sp_staking::{
SessionIndex,
};

use super::{Call, Module, Config};
use super::{Call, Pallet, Config};

/// A trait with utility methods for handling equivocation reports in GRANDPA.
/// The offence type is generic, and the trait provides , reporting an offence
Expand Down Expand Up @@ -203,7 +203,7 @@ pub struct GrandpaTimeSlot {
/// A `ValidateUnsigned` implementation that restricts calls to `report_equivocation_unsigned`
/// to local calls (i.e. extrinsics generated on this node) or that already in a block. This
/// guarantees that only block authors can include unsigned equivocation reports.
impl<T: Config> frame_support::unsigned::ValidateUnsigned for Module<T> {
impl<T: Config> frame_support::unsigned::ValidateUnsigned for Pallet<T> {
type Call = Call<T>;
fn validate_unsigned(source: TransactionSource, call: &Self::Call) -> TransactionValidity {
if let Call::report_equivocation_unsigned(equivocation_proof, key_owner_proof) = call {
Expand Down
Loading

0 comments on commit 77962d8

Please sign in to comment.