Build block without checking signatures (#4916)

* in executive

* in other places

* to UnsafeResult

* move doc comment

* apply suggestions

* allow validity mocking for TestXt

* add test

* augment checkable instead of another trait

* fix im online test

* blockbuilder dihotomy

* review suggestions

* update test

* Update client/block-builder/src/lib.rs

* updae spec_version

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Nikolay Volf
2020-02-19 01:34:31 +03:00
committed by GitHub
parent ba2362dadd
commit e50f610907
15 changed files with 247 additions and 68 deletions
+10 -1
View File
@@ -41,6 +41,7 @@ use sp_runtime::{
BlindCheckable, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT,
GetNodeBlockType, GetRuntimeBlockType, Verify, IdentityLookup,
},
generic::CheckSignature,
};
use sp_version::RuntimeVersion;
pub use sp_core::{hash::H256};
@@ -126,7 +127,7 @@ impl serde::Serialize for Extrinsic {
impl BlindCheckable for Extrinsic {
type Checked = Self;
fn check(self) -> Result<Self, TransactionValidityError> {
fn check(self, _signature: CheckSignature) -> Result<Self, TransactionValidityError> {
match self {
Extrinsic::AuthoritiesChange(new_auth) => Ok(Extrinsic::AuthoritiesChange(new_auth)),
Extrinsic::Transfer(transfer, signature) => {
@@ -493,6 +494,10 @@ cfg_if! {
system::execute_transaction(extrinsic)
}
fn apply_trusted_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
system::execute_transaction(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
system::finalize_block()
}
@@ -680,6 +685,10 @@ cfg_if! {
system::execute_transaction(extrinsic)
}
fn apply_trusted_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
system::execute_transaction(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
system::finalize_block()
}