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

Migrate pallet-authorship to umbrella crate #6620

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
6 changes: 1 addition & 5 deletions Cargo.lock

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

18 changes: 3 additions & 15 deletions substrate/frame/authorship/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,15 @@ codec = { features = [
], workspace = true }
impl-trait-for-tuples = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }

[dev-dependencies]
sp-core = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
frame = { workspace = true, features = ["experimental", "runtime"] }

[features]
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"frame/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
"frame/std",
runcomet marked this conversation as resolved.
Show resolved Hide resolved
]
22 changes: 12 additions & 10 deletions substrate/frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

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

use frame_support::traits::FindAuthor;
use frame::{prelude::*, traits::FindAuthor};

pub use pallet::*;

Expand All @@ -33,11 +33,9 @@ pub trait EventHandler<Author, BlockNumber> {
fn note_author(author: Author);
}

#[frame_support::pallet]
#[frame::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;

#[pallet::config]
pub trait Config: frame_system::Config {
Expand Down Expand Up @@ -96,15 +94,19 @@ mod tests {
use super::*;
use crate as pallet_authorship;
use codec::{Decode, Encode};
use frame_support::{derive_impl, ConsensusEngineId};
use sp_core::H256;
use sp_runtime::{
generic::DigestItem, testing::Header, traits::Header as HeaderT, BuildStorage,
use frame::{
deps::{
frame_support::{construct_runtime, derive_impl, ConsensusEngineId},
sp_runtime::{
generic::DigestItem, testing::Header, traits::Header as HeaderT, BuildStorage,
},
},
hashing::H256,
};

type Block = frame_system::mocking::MockBlock<Test>;

frame_support::construct_runtime!(
construct_runtime!(
pub enum Test
{
System: frame_system,
Expand Down Expand Up @@ -155,7 +157,7 @@ mod tests {
Header::new(number, Default::default(), state_root, parent_hash, Default::default())
}

fn new_test_ext() -> sp_io::TestExternalities {
fn new_test_ext() -> frame::deps::sp_io::TestExternalities {
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
t.into()
}
Expand Down
Loading