Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata/v15: Collect transaction extensions by versions into custom metadata #6755

Closed
wants to merge 10 commits into from

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Dec 4, 2024

This PR collects the transaction_extensions_by_version type information into the metadata V15 custom types.

This ensures the V15 contains enough information to work with multiple transaction extensions. The meaning of this field is identical to the one collected by the V16 unstable. It includes indexes of extrinsics from the signed_extension field of the extrinsic metadata.

Exposed Metadata


"custom": {
        "map": {
          "transaction_extensions_by_version": {
            "ty": 1074,
            "value": [
                  4, 0, 36, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0,
                  0, 7, 0, 0, 0, 8, 0, 0, 0,
              ]
          }
        }
      }

The decoded value is Decoded: {0: [0, 1, 2, 3, 4, 5, 6, 7, 8]}.

use codec::Decode;
use std::collections::BTreeMap;

fn main() {
    let value = vec![
        4, 0, 36, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0,
        0, 7, 0, 0, 0, 8, 0, 0, 0,
    ];
    let decoded: BTreeMap<u8, Vec<u32>> = Decode::decode(&mut &value[..]).unwrap();
    println!("Decoded: {decoded:?}");
}

cc @paritytech/subxt-team

lexnv added 3 commits December 4, 2024 13:40
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv added I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework. labels Dec 4, 2024
@lexnv lexnv self-assigned this Dec 4, 2024
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv requested a review from a team as a code owner December 4, 2024 14:43
lexnv added 5 commits December 4, 2024 14:43
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12163465313
Failed job name: test-linux-stable

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
CustomValueMetadata {
ty: meta_type::<TrasactionExtensionsByVersion>(),
value: transaction_extensions_by_version.encode(),
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is enough, this encode the transaction extension indices used for each version.
But the v15 metadata extensions doesn't contains all the extensions.

If we have 2 version. v15 metadata will contains the first version only.
so we need to add in custom metadata all the other transaction extension, or just all the transaction extensions same as v16.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this will no longer work when we include new transactions in the next version.
We collect the same transaction extensions (signed extensions), but that will not be the case in the future. I'll introduce the transaction extensions as well, thanks for pointing this out 🙏

@lexnv
Copy link
Contributor Author

lexnv commented Dec 11, 2024

Introducing a new transaction extension versioning (ie version 1) should happen after the metadata V16 is stabilized (pending on pallet view functions at the moment). Therefore this is not needed in this form, we'll revisit it at a later time

@lexnv lexnv closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants