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 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
93bd28d
frame::prelude
runcomet Nov 22, 2024
eed4af9
cargo fmt
runcomet Nov 23, 2024
4b2399d
Merge branch 'master' into umbrella-authorship
runcomet Nov 23, 2024
4d3af7f
add prdoc
runcomet Nov 29, 2024
8eeea21
Merge branch 'master' into umbrella-authorship
runcomet Nov 29, 2024
3085bc3
frame/try-runtime
runcomet Nov 29, 2024
6d3c9b8
Merge branch 'master' into umbrella-authorship
runcomet Nov 29, 2024
2dd9ed3
Merge branch 'master' into umbrella-authorship
re-gius Dec 9, 2024
0918a69
preludes only
runcomet Dec 28, 2024
dd3141f
fmt
runcomet Dec 28, 2024
34499fe
remove prdoc
runcomet Dec 28, 2024
070abd6
block mod in prelude
runcomet Dec 28, 2024
2db70e9
Merge branch 'master' into umbrella-authorship
runcomet Dec 28, 2024
7741a6b
nit
runcomet Dec 28, 2024
6cac3c3
nit
runcomet Dec 28, 2024
24c60e8
add std in testing::HeaderTest
runcomet Dec 29, 2024
6420493
nit
runcomet Dec 29, 2024
f5c4e58
nit
runcomet Dec 30, 2024
b540c04
Copy Cargo.toml from main
runcomet Jan 9, 2025
5d16180
Merge branch 'master' into umbrella-authorship
runcomet Jan 9, 2025
b9b1e72
Cargo +nightly fmt
runcomet Jan 9, 2025
36498ac
delete Cargo.lock
runcomet Jan 9, 2025
62fc804
add Cargo.toml
runcomet Jan 10, 2025
e3f523a
Merge branch 'master' into umbrella-authorship
runcomet Jan 10, 2025
4242039
Merge branch 'master' into umbrella-authorship
runcomet Jan 13, 2025
cf2d085
nit
runcomet Jan 14, 2025
507e24a
copy main Cargo.lock
runcomet Jan 16, 2025
ac9b3d2
cargo check
runcomet Jan 16, 2025
b2f72f7
switch .lock to main
runcomet Jan 19, 2025
74158aa
Merge branch 'master' into umbrella-authorship
runcomet Jan 19, 2025
26582e5
remove experimental feature
runcomet Jan 19, 2025
13f097c
Merge branch 'master' into umbrella-authorship
runcomet Jan 20, 2025
c2e4815
Merge branch 'master' into umbrella-authorship
runcomet Jan 26, 2025
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
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 @@ -19,29 +19,17 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { features = [
"derive",
], workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame = { workspace = true, features = ["runtime"] }
impl-trait-for-tuples = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
sp-runtime = { workspace = true }

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

[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/try-runtime",
]
19 changes: 8 additions & 11 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::*;

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,14 @@ 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::sp_runtime::{testing::Header, traits::Header as _},
testing_prelude::*,
};

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

frame_support::construct_runtime!(
construct_runtime!(
pub enum Test
{
System: frame_system,
Expand Down Expand Up @@ -155,7 +152,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() -> TestExternalities {
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
t.into()
}
Expand Down
5 changes: 3 additions & 2 deletions substrate/frame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ pub mod prelude {
/// Other error/result types for runtime
#[doc(no_inline)]
pub use sp_runtime::{
BoundToRuntimeAppPublic, DispatchErrorWithPostInfo, DispatchResultWithInfo, TokenError,
BoundToRuntimeAppPublic, ConsensusEngineId, DigestItem, DispatchErrorWithPostInfo,
DispatchResultWithInfo, TokenError,
};
}

Expand Down Expand Up @@ -561,7 +562,7 @@ pub mod hashing {
/// This is already part of the [`prelude`].
pub mod account {
pub use frame_support::traits::{
AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, InitializeMembers,
AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, FindAuthor, InitializeMembers,
};
pub use sp_runtime::traits::{IdentifyAccount, IdentityLookup};
}
Expand Down
Loading