Implement proper checking of inherents

This commit is contained in:
Luke Parker
2022-11-01 16:37:50 -04:00
parent 19154cf8e1
commit aa0a4cf106
8 changed files with 89 additions and 41 deletions

View File

@@ -8,9 +8,11 @@ authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021"
[dependencies]
async-trait = "0.1"
thiserror = "1"
parity-scale-codec = { version = "3.2", features = ["derive"] }
async-trait = "0.1"
tokio = { version = "1", features = ["macros", "sync", "time", "rt"] }
sp-runtime = { git = "https://github.com/serai-dex/substrate", optional = true }

View File

@@ -2,6 +2,7 @@ use core::{hash::Hash, fmt::Debug};
use std::sync::Arc;
use async_trait::async_trait;
use thiserror::Error;
use parity_scale_codec::{Encode, Decode};
@@ -97,12 +98,14 @@ pub trait Weights: Send + Sync {
}
/// Simplified error enum representing a block's validity.
#[derive(Clone, Copy, PartialEq, Eq, Debug, Encode, Decode)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Error, Encode, Decode)]
pub enum BlockError {
/// Malformed block which is wholly invalid.
#[error("invalid block")]
Fatal,
/// Valid block by syntax, with semantics which may or may not be valid yet are locally
/// considered invalid. If a block fails to validate with this, a slash will not be triggered.
#[error("invalid block under local view")]
Temporal,
}