mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17: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:
@@ -36,7 +36,10 @@ use sp_io::{
|
||||
hashing::{blake2_128, twox_128, twox_64},
|
||||
TestExternalities,
|
||||
};
|
||||
use sp_runtime::{DispatchError, ModuleError};
|
||||
use sp_runtime::{
|
||||
traits::{Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
|
||||
DispatchError, ModuleError,
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Used to control if the storage version should be updated.
|
||||
@@ -1700,6 +1703,28 @@ fn metadata_ir_pallet_runtime_docs() {
|
||||
assert_eq!(pallet.docs, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extrinsic_metadata_ir_types() {
|
||||
let ir = Runtime::metadata_ir().extrinsic;
|
||||
|
||||
assert_eq!(meta_type::<<<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload as SignaturePayloadT>::SignatureAddress>(), ir.address_ty);
|
||||
assert_eq!(meta_type::<u64>(), ir.address_ty);
|
||||
|
||||
assert_eq!(meta_type::<<UncheckedExtrinsic as ExtrinsicT>::Call>(), ir.call_ty);
|
||||
assert_eq!(meta_type::<RuntimeCall>(), ir.call_ty);
|
||||
|
||||
assert_eq!(
|
||||
meta_type::<
|
||||
<<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload as SignaturePayloadT>::Signature,
|
||||
>(),
|
||||
ir.signature_ty
|
||||
);
|
||||
assert_eq!(meta_type::<()>(), ir.signature_ty);
|
||||
|
||||
assert_eq!(meta_type::<<<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload as SignaturePayloadT>::SignatureExtra>(), ir.extra_ty);
|
||||
assert_eq!(meta_type::<frame_system::CheckNonZeroSender<Runtime>>(), ir.extra_ty);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pallet_runtime_docs() {
|
||||
let docs = crate::pallet::Pallet::<Runtime>::pallet_documentation_metadata();
|
||||
@@ -1713,7 +1738,6 @@ fn test_pallet_info_access() {
|
||||
assert_eq!(<System as frame_support::traits::PalletInfoAccess>::name(), "System");
|
||||
assert_eq!(<Example as frame_support::traits::PalletInfoAccess>::name(), "Example");
|
||||
assert_eq!(<Example2 as frame_support::traits::PalletInfoAccess>::name(), "Example2");
|
||||
|
||||
assert_eq!(<System as frame_support::traits::PalletInfoAccess>::index(), 0);
|
||||
assert_eq!(<Example as frame_support::traits::PalletInfoAccess>::index(), 1);
|
||||
assert_eq!(<Example2 as frame_support::traits::PalletInfoAccess>::index(), 2);
|
||||
|
||||
Reference in New Issue
Block a user