mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 14:57:56 +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:
@@ -1242,14 +1242,14 @@ pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'st
|
||||
/// Something that acts like an `Extrinsic`.
|
||||
pub trait Extrinsic: Sized {
|
||||
/// The function call.
|
||||
type Call;
|
||||
type Call: TypeInfo;
|
||||
|
||||
/// The payload we carry for signed extrinsics.
|
||||
///
|
||||
/// Usually it will contain a `Signature` and
|
||||
/// may include some additional data that are specific to signed
|
||||
/// extrinsics.
|
||||
type SignaturePayload;
|
||||
type SignaturePayload: SignaturePayload;
|
||||
|
||||
/// Is this `Extrinsic` signed?
|
||||
/// If no information are available about signed/unsigned, `None` should be returned.
|
||||
@@ -1268,6 +1268,31 @@ pub trait Extrinsic: Sized {
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that acts like a [`SignaturePayload`](Extrinsic::SignaturePayload) of an
|
||||
/// [`Extrinsic`].
|
||||
pub trait SignaturePayload {
|
||||
/// The type of the address that signed the extrinsic.
|
||||
///
|
||||
/// Particular to a signed extrinsic.
|
||||
type SignatureAddress: TypeInfo;
|
||||
|
||||
/// The signature type of the extrinsic.
|
||||
///
|
||||
/// Particular to a signed extrinsic.
|
||||
type Signature: TypeInfo;
|
||||
|
||||
/// The additional data that is specific to the signed extrinsic.
|
||||
///
|
||||
/// Particular to a signed extrinsic.
|
||||
type SignatureExtra: TypeInfo;
|
||||
}
|
||||
|
||||
impl SignaturePayload for () {
|
||||
type SignatureAddress = ();
|
||||
type Signature = ();
|
||||
type SignatureExtra = ();
|
||||
}
|
||||
|
||||
/// Implementor is an [`Extrinsic`] and provides metadata about this extrinsic.
|
||||
pub trait ExtrinsicMetadata {
|
||||
/// The format version of the `Extrinsic`.
|
||||
|
||||
Reference in New Issue
Block a user