Skip to content

Commit

Permalink
frame::prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
runcomet committed Nov 22, 2024
1 parent 09757a4 commit 93bd28d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 30 deletions.
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",
]
24 changes: 14 additions & 10 deletions substrate/frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

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

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

pub use pallet::*;

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

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

// use frame_support::pallet_prelude::*;
// use frame_system::pallet_prelude::*;

#[pallet::config]
pub trait Config: frame_system::Config {
Expand Down Expand Up @@ -96,15 +99,16 @@ 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::{

//use frame_support::{derive_impl, ConsensusEngineId};
//use sp_core::H256;
use frame::{deps::{sp_runtime::{
generic::DigestItem, testing::Header, traits::Header as HeaderT, BuildStorage,
};
}, frame_support::{derive_impl, ConsensusEngineId, construct_runtime}}, 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 +159,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

0 comments on commit 93bd28d

Please sign in to comment.