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

TransactionExtension: Update naming #1468

Open
jsdw opened this issue Mar 8, 2024 · 3 comments
Open

TransactionExtension: Update naming #1468

jsdw opened this issue Mar 8, 2024 · 3 comments

Comments

@jsdw
Copy link
Collaborator

jsdw commented Mar 8, 2024

See eg paritytech/polkadot-sdk#2280 and my comment here links to the bit showing the new encoding: paritytech/polkadot-sdk#2280 (comment) (though note that the actual extrinsic version will change to 5 for the new type based on latest comments).

We've used frame-decode to suppor tthis new TX version in Subxt, but we should still:

  1. Rename our SignedExtensions to TransactionExtensions (updating the other naming around these as appropriate, eg I think "additional signed" becomes "implicit").
    2 Rename our tx client methods to match the update, eg create_unsigned becomes create_bare.
  2. Modify our existing methods to enable creating V5 extrinsics when they are supported (I think this will rely on V16 metadata to show support, and also likely on a TransactionExtension existing which allows us to add a signature.) We want to be able to create "bare" and "general" extrinsics in general, and fall back to creating V4s when V5 not supported.
@jsdw
Copy link
Collaborator Author

jsdw commented Sep 10, 2024

An update on this with some changes and more detail:

The high level PR in PolkadotSDK is now (the above one was closed):

paritytech/polkadot-sdk#3685

A couple of RFCs around this:

https://polkadot-fellows.github.io/RFCs/approved/0084-general-transaction-extrinsic-format.html
https://polkadot-fellows.github.io/RFCs/approved/0099-transaction-extension-version.html

Basic summary from client PoV as I understand it:

Previously, we had Signed and Unsigned transactions.

Transactions are basically encoded by concatenating a "preamble + call_data".

The preamble starts with a single byte which can be inspected to see what type of transaction we'll need to decode.

  • For old school unsigned transactions, the preamble is simply the byte b00000100 and nothing else.
  • For old school signed transactions, the preamble is a b10000100 byte followed by the From Address, Signature and Signed Extensions.

These stay the same (although "unsigned transactions" are renamed to "Bare" transactions), but we'll now have two new types of transaction:

  • "new" signed transactions, with a preamble of b10000101 byte followed by From Address, Signature, 1 byte denoting Signed Extension version (currently will be 0), and then Signed Extensions.
  • General transactions, with a preamble of b01000101 byte followed by 1 byte denoting Signed Extension Version (currently will be 0) and then Signed Extensions.

Existing transactions stay the same and can be encoded and decoded the same way, but to encode/decode the new style transactions, we will look at the first byte and use that to know that we are dealing with new transactions and decode/encode them accordingly.

See https://github.com/paritytech/polkadot-sdk/pull/3685/files#diff-7be1730dfe08652baee2cb237c2d33df42c5eb85408639864c6a4a9223f0ca32R99-R133 for more on how the preamble is encoded/decoded

Another change is that "SignedExtension"s will be renamed to "TransactionExtension"s. These are the things like CheckMetadataHash,CheckMortality etc. The format for them doesn't change AFAIK, but we rename a couple of terms around them (eg "additional_signed" in the metadata will become "implicit" in metadata V16: https://github.com/paritytech/polkadot-sdk/pull/3685/files#diff-da22df55e2e056a2b6230692383b8cef27777ede1e9aea39d237b558816d35d3R85).

@niklasad1
Copy link
Member

@jsdw can we close this after subxt migrated to frame-decode which supports the new transaction extension v5?

@jsdw
Copy link
Collaborator Author

jsdw commented Nov 27, 2024

We still want to rename things in Subxt so that we have TransactionExtensions rather than SignedExtensions and any other bits like that :)

I updated the title/description to match this

@jsdw jsdw changed the title TransactionExtension: Update naming and support new transaction type. TransactionExtension: Update naming ~~and support new transaction type.~~ Nov 27, 2024
@jsdw jsdw changed the title TransactionExtension: Update naming ~~and support new transaction type.~~ TransactionExtension: Update naming Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants