Expose information about the extrinsic in the metadata (#4774)

* Expose information about the extrinsic in the metadata

This pr exposes some information about the extrinsic used in the runtime
via metadata. The following information are exposed:

- Version of the extrinsic
- List of all signed extensions used by the extrinsic.

* Increment `spec_version`
This commit is contained in:
Bastian Köcher
2020-01-30 16:41:03 +01:00
committed by GitHub
parent 6272b8d2c7
commit 45938d8033
13 changed files with 269 additions and 141 deletions
+5
View File
@@ -960,6 +960,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> {
type AdditionalSigned = ();
type DispatchInfo = DispatchInfo;
type Pre = ();
const IDENTIFIER: &'static str = "CheckWeight";
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
@@ -1040,6 +1041,7 @@ impl<T: Trait> SignedExtension for CheckNonce<T> {
type AdditionalSigned = ();
type DispatchInfo = DispatchInfo;
type Pre = ();
const IDENTIFIER: &'static str = "CheckNonce";
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
@@ -1124,6 +1126,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckEra<T> {
type AdditionalSigned = T::Hash;
type DispatchInfo = DispatchInfo;
type Pre = ();
const IDENTIFIER: &'static str = "CheckEra";
fn validate(
&self,
@@ -1180,6 +1183,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckGenesis<T> {
type AdditionalSigned = T::Hash;
type DispatchInfo = DispatchInfo;
type Pre = ();
const IDENTIFIER: &'static str = "CheckGenesis";
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
Ok(<Module<T>>::block_hash(T::BlockNumber::zero()))
@@ -1215,6 +1219,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckVersion<T> {
type AdditionalSigned = u32;
type DispatchInfo = DispatchInfo;
type Pre = ();
const IDENTIFIER: &'static str = "CheckVersion";
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
Ok(<Module<T>>::runtime_version().spec_version)