mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
Metadata V15: Enrich extrinsic type info for decoding (#14123)
* metadata-ir: Add extrinsic type info to decode address, call, sig Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame-metadata: Point to unreleased branch Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata-ir: Include addrees, call, signature in V15 conversion Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata-ir: Include extra ty Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * construct_runtime: Extract address,call,sig,extra ty from tx type Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/tests: Check metadata populates xt types correctly Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata-ir/tests: Add extra fields on ExtrinsicMetadataIR Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * primitives/traits: Expand the `Extrinsic::SignaturePayload` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * primitives: Adjust to new `Extrinsic` associated types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/metadata: Simplify metadata generation Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/example: Adjust to new interface Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/tests: Adjust `extrinsic_metadata_ir_types` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Revert the additional Extrinsic' associated types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * primitives: Add `SignaturePayload` marker trait Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * primitives: Implement SignaturePayload for empty tuple Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust to new SignaturePayload trait Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * tests: Adjust `extrinsic_metadata_ir_types` to new interface Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/support: Adjust pallet test Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame: Add Extrinsic length prefix to the metadata Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * primitives: Populate `ExtrinsicMetadataIR` with `len_ty` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Apply cargo fmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * v15: Remove len type of the extrinsic Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Update frame-metadata Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -23,7 +23,7 @@ use crate::{
|
||||
scale_info::TypeInfo,
|
||||
traits::{
|
||||
self, Applyable, BlakeTwo256, Checkable, DispatchInfoOf, Dispatchable, OpaqueKeys,
|
||||
PostDispatchInfoOf, SignedExtension, ValidateUnsigned,
|
||||
PostDispatchInfoOf, SignaturePayload, SignedExtension, ValidateUnsigned,
|
||||
},
|
||||
transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError},
|
||||
ApplyExtrinsicResultWithInfo, KeyTypeId,
|
||||
@@ -279,6 +279,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// The signature payload of a `TestXt`.
|
||||
type TxSingaturePayload<Extra> = (u64, Extra);
|
||||
|
||||
impl<Extra: TypeInfo> SignaturePayload for TxSingaturePayload<Extra> {
|
||||
type SignatureAddress = u64;
|
||||
type Signature = ();
|
||||
type SignatureExtra = Extra;
|
||||
}
|
||||
|
||||
/// Test transaction, tuple of (sender, call, signed_extra)
|
||||
/// with index only used if sender is some.
|
||||
///
|
||||
@@ -286,7 +295,7 @@ where
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
|
||||
pub struct TestXt<Call, Extra> {
|
||||
/// Signature of the extrinsic.
|
||||
pub signature: Option<(u64, Extra)>,
|
||||
pub signature: Option<TxSingaturePayload<Extra>>,
|
||||
/// Call of the extrinsic.
|
||||
pub call: Call,
|
||||
}
|
||||
@@ -331,9 +340,11 @@ impl<Call: Codec + Sync + Send, Context, Extra> Checkable<Context> for TestXt<Ca
|
||||
}
|
||||
}
|
||||
|
||||
impl<Call: Codec + Sync + Send, Extra> traits::Extrinsic for TestXt<Call, Extra> {
|
||||
impl<Call: Codec + Sync + Send + TypeInfo, Extra: TypeInfo> traits::Extrinsic
|
||||
for TestXt<Call, Extra>
|
||||
{
|
||||
type Call = Call;
|
||||
type SignaturePayload = (u64, Extra);
|
||||
type SignaturePayload = TxSingaturePayload<Extra>;
|
||||
|
||||
fn is_signed(&self) -> Option<bool> {
|
||||
Some(self.signature.is_some())
|
||||
|
||||
Reference in New Issue
Block a user