Ensure inherent are first (#8173)

* impl

* fix tests

* impl in execute_block

* fix tests

* add a test in frame-executive

* fix some panic warning

* use trait to get call from extrinsic

* remove unused

* fix test

* fix testing

* fix tests

* return index of extrinsic on error

* fix test

* Update primitives/inherents/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* address comments

rename trait, and refactor

* refactor + doc improvment

* fix tests

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Guillaume Thiolliere
2021-04-13 11:30:13 +02:00
committed by GitHub
parent 6679b88af8
commit a4ed9bb9b2
17 changed files with 427 additions and 61 deletions
@@ -122,6 +122,10 @@ mod module1 {
fn check_inherent(_: &Self::Call, _: &InherentData) -> std::result::Result<(), Self::Error> {
unimplemented!();
}
fn is_inherent(_call: &Self::Call) -> bool {
unimplemented!();
}
}
}
@@ -182,6 +186,10 @@ mod module2 {
fn check_inherent(_call: &Self::Call, _data: &InherentData) -> std::result::Result<(), Self::Error> {
unimplemented!();
}
fn is_inherent(_call: &Self::Call) -> bool {
unimplemented!();
}
}
}
@@ -288,6 +288,10 @@ pub mod pallet {
T::AccountId::from(SomeType6); // Test for where clause
unimplemented!();
}
fn is_inherent(_call: &Self::Call) -> bool {
unimplemented!();
}
}
#[derive(codec::Encode, sp_runtime::RuntimeDebug)]
@@ -170,6 +170,10 @@ pub mod pallet {
fn create_inherent(_data: &InherentData) -> Option<Self::Call> {
unimplemented!();
}
fn is_inherent(_call: &Self::Call) -> bool {
unimplemented!();
}
}
#[derive(codec::Encode, sp_runtime::RuntimeDebug)]
@@ -1,10 +1,11 @@
error[E0046]: not all trait items implemented, missing: `Call`, `Error`, `INHERENT_IDENTIFIER`, `create_inherent`
error[E0046]: not all trait items implemented, missing: `Call`, `Error`, `INHERENT_IDENTIFIER`, `create_inherent`, `is_inherent`
--> $DIR/inherent_check_inner_span.rs:19:2
|
19 | impl<T: Config> ProvideInherent for Pallet<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Call`, `Error`, `INHERENT_IDENTIFIER`, `create_inherent` in implementation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Call`, `Error`, `INHERENT_IDENTIFIER`, `create_inherent`, `is_inherent` in implementation
|
= help: implement the missing item: `type Call = Type;`
= help: implement the missing item: `type Error = Type;`
= help: implement the missing item: `const INHERENT_IDENTIFIER: [u8; 8] = value;`
= help: implement the missing item: `fn create_inherent(_: &InherentData) -> std::option::Option<<Self as ProvideInherent>::Call> { todo!() }`
= help: implement the missing item: `fn is_inherent(_: &<Self as ProvideInherent>::Call) -> bool { todo!() }`
@@ -81,6 +81,10 @@ impl<T: Trait> sp_inherents::ProvideInherent for Module<T> {
fn check_inherent(_: &Self::Call, _: &sp_inherents::InherentData) -> std::result::Result<(), Self::Error> {
unimplemented!();
}
fn is_inherent(_call: &Self::Call) -> bool {
unimplemented!();
}
}
#[cfg(test)]