mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +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:
@@ -81,6 +81,10 @@ mod test {
|
||||
extrinsic: ExtrinsicMetadataIR {
|
||||
ty: meta_type::<()>(),
|
||||
version: 0,
|
||||
address_ty: meta_type::<()>(),
|
||||
call_ty: meta_type::<()>(),
|
||||
signature_ty: meta_type::<()>(),
|
||||
extra_ty: meta_type::<()>(),
|
||||
signed_extensions: vec![],
|
||||
},
|
||||
ty: meta_type::<()>(),
|
||||
|
||||
@@ -155,9 +155,19 @@ impl IntoPortable for PalletMetadataIR {
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||
pub struct ExtrinsicMetadataIR<T: Form = MetaForm> {
|
||||
/// The type of the extrinsic.
|
||||
///
|
||||
/// Note: Field used for metadata V14 only.
|
||||
pub ty: T::Type,
|
||||
/// Extrinsic version.
|
||||
pub version: u8,
|
||||
/// The type of the address that signes the extrinsic
|
||||
pub address_ty: T::Type,
|
||||
/// The type of the outermost Call enum.
|
||||
pub call_ty: T::Type,
|
||||
/// The type of the extrinsic's signature.
|
||||
pub signature_ty: T::Type,
|
||||
/// The type of the outermost Extra enum.
|
||||
pub extra_ty: T::Type,
|
||||
/// The signed extensions in the order they appear in the extrinsic.
|
||||
pub signed_extensions: Vec<SignedExtensionMetadataIR<T>>,
|
||||
}
|
||||
@@ -169,6 +179,10 @@ impl IntoPortable for ExtrinsicMetadataIR {
|
||||
ExtrinsicMetadataIR {
|
||||
ty: registry.register_type(&self.ty),
|
||||
version: self.version,
|
||||
address_ty: registry.register_type(&self.address_ty),
|
||||
call_ty: registry.register_type(&self.call_ty),
|
||||
signature_ty: registry.register_type(&self.signature_ty),
|
||||
extra_ty: registry.register_type(&self.extra_ty),
|
||||
signed_extensions: registry.map_into_portable(self.signed_extensions),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,12 +101,11 @@ impl From<ExtrinsicMetadataIR> for ExtrinsicMetadata {
|
||||
fn from(ir: ExtrinsicMetadataIR) -> Self {
|
||||
ExtrinsicMetadata {
|
||||
version: ir.version,
|
||||
address_ty: ir.address_ty,
|
||||
call_ty: ir.call_ty,
|
||||
signature_ty: ir.signature_ty,
|
||||
extra_ty: ir.extra_ty,
|
||||
signed_extensions: ir.signed_extensions.into_iter().map(Into::into).collect(),
|
||||
// Note: These fields are populated by complementary PR: https://github.com/paritytech/substrate/pull/14123.
|
||||
address_ty: ir.ty,
|
||||
call_ty: ir.ty,
|
||||
signature_ty: ir.ty,
|
||||
extra_ty: ir.ty,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user