mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 02:08:02 +00:00
Move inherent implementation into the modules (#924)
* Adds new `ProvideInherent` trait Also implements the new trait for `srml/consensus` and `srml/timestamp`. * Adds `impl_outer_inherent!` macro * Reexport macros from `alloc` * Introduce `RuntimeString` and fix `ProvideInherent` on `no_std` * Replace `VersionString` with `RuntimeString` * Improvements for `impl_outer_inherent!` * Make `construct_runtime!` support `impl_outer_inherent!` * Fixes after rebase * Whitespace
This commit is contained in:
@@ -5,7 +5,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
parity-codec = { version = "2.1", default-features = false }
|
||||
parity-codec-derive = { version = "2.1", default-features = false }
|
||||
sr-std = { path = "../sr-std", default-features = false }
|
||||
sr-primitives = { path = "../sr-primitives", default-features = false }
|
||||
sr-version = { path = "../sr-version", default-features = false }
|
||||
@@ -15,7 +14,6 @@ default = ["std"]
|
||||
std = [
|
||||
"sr-std/std",
|
||||
"parity-codec/std",
|
||||
"parity-codec-derive/std",
|
||||
"sr-primitives/std",
|
||||
"sr-version/std",
|
||||
]
|
||||
|
||||
@@ -22,8 +22,6 @@ extern crate sr_std as rstd;
|
||||
extern crate sr_primitives as primitives;
|
||||
#[doc(hidden)]
|
||||
pub extern crate parity_codec as codec;
|
||||
#[macro_use]
|
||||
extern crate parity_codec_derive;
|
||||
extern crate sr_version as runtime_version;
|
||||
|
||||
#[doc(hidden)]
|
||||
@@ -429,17 +427,6 @@ macro_rules! decl_apis {
|
||||
};
|
||||
}
|
||||
|
||||
//TODO: Move into runtime!
|
||||
#[derive(Encode)]
|
||||
#[cfg_attr(feature = "std", derive(Debug, Decode))]
|
||||
pub enum BlockBuilderError {
|
||||
#[cfg(not(feature = "std"))]
|
||||
Generic(&'static str),
|
||||
#[cfg(feature = "std")]
|
||||
Generic(String),
|
||||
TimestampInFuture(u64),
|
||||
}
|
||||
|
||||
decl_apis! {
|
||||
/// The `Core` api trait that is mandantory for each runtime.
|
||||
pub trait Core<Block: BlockT, AuthorityId> {
|
||||
@@ -482,7 +469,7 @@ decl_apis! {
|
||||
/// Generate inherent extrinsics.
|
||||
fn inherent_extrinsics<InherentExtrinsic, UncheckedExtrinsic>(inherent: InherentExtrinsic) -> Vec<UncheckedExtrinsic>;
|
||||
/// Check that the inherents are valid.
|
||||
fn check_inherents<InherentData>(block: Block, data: InherentData) -> Result<(), BlockBuilderError>;
|
||||
fn check_inherents<InherentData, Error>(block: Block, data: InherentData) -> Result<(), Error>;
|
||||
/// Generate a random seed.
|
||||
fn random_seed() -> <Block as BlockT>::Hash;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user