Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

feat: FRAME umbrella crate. #14137

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
188a57b
new doc/api package:
kianenigma May 13, 2023
1b203a2
adding stuff for runtime
kianenigma May 23, 2023
da3c1d6
new features
kianenigma May 24, 2023
c5ad834
a lot of changes
kianenigma May 30, 2023
6d5286b
Master.into()
kianenigma May 30, 2023
5543456
everything works again
kianenigma May 30, 2023
54c4901
remove expanded file
kianenigma May 30, 2023
02908ab
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma May 30, 2023
901a8d0
checkpoint
kianenigma May 30, 2023
433fbf1
some updates
kianenigma Jun 3, 2023
837c78a
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 3, 2023
4a3ce15
some chanes
kianenigma Jun 13, 2023
fcfdee6
merge master again
kianenigma Jun 13, 2023
b278a05
update
kianenigma Jun 16, 2023
43824f8
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 16, 2023
ebb6c5e
update with master
kianenigma Jun 16, 2023
658d84f
compiles without support and system
kianenigma Jun 16, 2023
6cd251f
minimal-node and runtime, with frame, with sudo and timestamp
kianenigma Jun 21, 2023
be42459
works with tx-fee payment
kianenigma Jun 21, 2023
010d906
works without timestamp for now
kianenigma Jun 21, 2023
289f18e
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 21, 2023
5934bcc
add dual consensus modes
kianenigma Jun 21, 2023
6b7e50a
remove unused deps and all
kianenigma Jun 21, 2023
679bcea
Update frame/src/lib.rs
kianenigma Jun 21, 2023
aee26b9
Update frame/src/lib.rs
kianenigma Jun 21, 2023
bfda7d8
Update frame/src/lib.rs
kianenigma Jun 21, 2023
7d912d0
make impl_runtime_api work without sp-api
kianenigma Jun 24, 2023
07128f5
Merge branch 'kiz-frame-api' of github.com:paritytech/substrate into …
kianenigma Jun 24, 2023
c96624b
use docify for example
kianenigma Jul 11, 2023
dac888e
clone for identity
kianenigma Jul 12, 2023
81202d1
single tuple is also a signed extension
kianenigma Jul 14, 2023
247582e
update to master
kianenigma Jul 16, 2023
554bd2e
cleanup
kianenigma Jul 16, 2023
7c9ed07
fix how we handel return macro in tt stuff
kianenigma Jul 17, 2023
787eff7
bring back example pallet
kianenigma Jul 17, 2023
dfaa2af
fix warning
kianenigma Jul 17, 2023
37ff8a8
Update bin/minimal/node/src/service.rs
kianenigma Jul 17, 2023
377f148
Update bin/minimal/node/src/service.rs
kianenigma Jul 17, 2023
7284b50
make the node WASM-only
kianenigma Jul 17, 2023
c04418c
Master.into()
kianenigma Jul 20, 2023
1cf4cec
Empty-Commit
kianenigma Jul 20, 2023
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
19 changes: 18 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ members = [
"client/transaction-pool",
"client/transaction-pool/api",
"client/utils",
"frame",
"frame/alliance",
"frame/assets",
"frame/atomic-swap",
Expand Down
46 changes: 46 additions & 0 deletions frame/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[package]
name = "frame"
version = "0.0.1-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "The single package to get you started with FRAME"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
# external deps
parity-scale-codec = { version = "3.2.2", default-features = false, features = ["derive"]}
scale-info = { version = "2.6.0", default-features = false, features = ["derive"]}

# primitive deps
sp-api = { default-features = false, path = "../primitives/api" }
sp-runtime = { default-features = false, path = "../primitives/runtime" }
sp-std = { default-features = false, path = "../primitives/std" }
sp-keyring = { default-features = false, path = "../primitives/keyring" }
sp-io = { default-features = false, path = "../primitives/io" }
sp-core = { default-features = false, path = "../primitives/core" }
sp-arithmetic = { default-features = false, path = "../primitives/arithmetic" }

# frame deps
frame-support = { default-features = false, path = "./support" }
frame-system = { default-features = false, path = "./system" }

[features]
default = [ "std" ]
std = [
"parity-scale-codec/std",
"scale-info/std",

"sp-api/std",
"sp-runtime/std",
"sp-std/std",

"frame-support/std",
]
try-runtime = [
"frame-support/try-runtime",
]
132 changes: 132 additions & 0 deletions frame/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
//! # FRAME
//!
//! > Substrate's State Transition Function (Runtime) Framework.
//!
//! ______ ______ ________ ___ __ __ ______
//! /_____/\ /_____/\ /_______/\ /__//_//_/\ /_____/\
//! \::::_\/_\:::_ \ \ \::: _ \ \\::\| \| \ \\::::_\/_
//! \:\/___/\\:(_) ) )_\::(_) \ \\:. \ \\:\/___/\
//! \:::._\/ \: __ `\ \\:: __ \ \\:.\-/\ \ \\::___\/_
//! \:\ \ \ \ `\ \ \\:.\ \ \ \\. \ \ \ \\:\____/\
//! \_\/ \_\/ \_\/ \__\/\__\/ \__\/ \__\/ \_____\/
//!
//!
//! # Introduction
//!
//! Substrate is at a very high level composed of two parts:
//!
//! 1. A *runtime* who's representing the state transition function of a blockchain, and is encoded
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//! as a wasm blob.
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//! 2. A client' who's primary purpose is to execute the given runtime.
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//!
//! FRAME is the primary framework to build a runtime.
//!
//! ## Pallets
//!
//! ```
//! use frame::pallet;
//!
//! #[pallet::pallet]
//! mod pallet {
//!
//! #[pallet::config]
//! pub trait Config: frame_system::Config {}
//!
//! #[pallet::pallet]
//! pub struct Pallet<T>(_);
//! }
//! # fn main() {}
//! ```
//!
//! ## Runtime
//!
//! <TODO>
//!
//! # This Crate
//!
//! This crate is an amalgamation of multiple other crates that are often used together to compose a
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//! pallet. It is not necessary to use it, and it may fall short for certain purposes.
//!
//! In short, this crate only re-exports types and traits from multiple sources. All of these
//! sources are listed (and re-exported again) in [`deps`].

/// export the main pallet macro. This can wrap a `mod pallet` and will transform it into being
/// a pallet, eg `#[frame::pallet] mod pallet { .. }`.
pub use frame_support::pallet;

/// A prelude that is suitable to be used inside the
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
pub mod prelude {
pub use super::macros::*;
pub use frame_support::pallet_prelude::*;
pub use frame_system::pallet_prelude::*;
}

/// All macros often used in FRAME pallets.
pub mod macros {
pub use frame_support::{
assert_err, assert_err_ignore_postinfo, assert_error_encoded_size, assert_noop, assert_ok,
assert_storage_noop, construct_runtime, defensive, defensive_assert, ensure,
parameter_types, storage_alias,
};
pub use sp_runtime::{bounded_btree_map, bounded_vec};
}

/// All traits often used in FRAME pallets.
///
/// Note that types implementing these traits can also be found in this module.
pub mod traits {
pub use frame_support::traits::*;
pub use sp_runtime::traits::*;
}

/// The arithmetic types used for safe math.
pub mod arithmetic {
pub use sp_arithmetic::{traits::*, *};
}

/// Low level primitive types used in FRAME pallets.
pub mod primitives {
pub use sp_core::{H160, H256, H512, U256, U512};
pub use sp_runtime::traits::{BlakeTwo256, Hash, Keccak256};
}

/// Testing-specific helpers.
pub mod testing {
pub mod prelude {
pub use frame_system::mocking::*;
pub use sp_io::TestExternalities as TestState;
}
}

/// All derive macros.
pub mod derive {
pub use frame_support::{
CloneNoBound, DebugNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound,
RuntimeDebugNoBound,
};
pub use parity_scale_codec::{Decode, Encode};
pub use scale_info::TypeInfo;
pub use sp_std::fmt::Debug;
}

/// Access to all of the dependencies of this crate. In case the re-exports are not enough, this
/// module can be used.
pub mod deps {
pub use frame_support;
pub use frame_system;
pub use parity_scale_codec;
pub use scale_info;
pub use sp_api;
pub use sp_arithmetic;
pub use sp_core;
pub use sp_runtime;
pub use sp_std;
}

/// Substrate's specific `std` library. See [`deps::sp_std`].
pub use sp_std as std;

/// A macro-sub module that contains a list of all pallet macros, with proper documentation. It
/// enhances IDE experience.
// TODO: does not seem to work.
pub use frame_support::pallet_macros as pallet;
3 changes: 1 addition & 2 deletions primitives/core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,7 @@ pub trait Pair: CryptoType + Sized + Clone + Send + Sync + 'static {
/// - the path may be followed by `///`, in which case everything after the `///` is treated
/// as a password.
/// - If `s` begins with a `/` character it is prefixed with the Substrate public `DEV_PHRASE`
/// and
/// interpreted as above.
/// and interpreted as above.
///
/// In this case they are interpreted as HDKD junctions; purely numeric items are interpreted as
/// integers, non-numeric items as strings. Junctions prefixed with `/` are interpreted as soft
Expand Down