-
Notifications
You must be signed in to change notification settings - Fork 10
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
v16: ExtrinsicMetadata extensions #86
Conversation
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>
frame-metadata/src/v16.rs
Outdated
@@ -223,22 +217,25 @@ impl IntoPortable for ExtrinsicMetadata { | |||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize")) | |||
)] | |||
pub struct TransactionExtensionMetadata<T: Form = MetaForm> { | |||
/// Extension version. | |||
pub version: u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the version here, instead of having pub transaction_extensions: Vec<(u8, TransactionExtensionMetadata<T>)>
.
Wdyt? // cc @jsdw @niklasad1 🙏
frame-metadata/src/v16.rs
Outdated
@@ -223,22 +217,25 @@ impl IntoPortable for ExtrinsicMetadata { | |||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize")) | |||
)] | |||
pub struct TransactionExtensionMetadata<T: Form = MetaForm> { | |||
/// Extension version. | |||
pub version: u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In V5 transactions we'll have a single u8
version denoting the set of transaction extensions to use. So while we could use this approach and have eg:
vec![
// v0 extensions
TransactionExtensionMetadata { version: 0, identifier: "Foo", ty: 123, implicit: 456 },
TransactionExtensionMetadata { version: 0, identifier: "Bar", ty: 124, implicit: 457 },
// v1 extensions
TransactionExtensionMetadata { version: 1, identifier: "Foo", ty: 123, implicit: 456 },
TransactionExtensionMetadata { version: 1, identifier: "Bar", ty: 124, implicit: 457 },
TransactionExtensionMetadata { version: 1, identifier: "Wibble", ty: 124, implicit: 457 },
// ...
]
(noting that the order of extensions within each version is important)
It perhaps makes more sense to avoid the repetition and represent extensions something like:
// For each supported version number, list the indexes, in order, of the extensions used:
versions: Map<u8, Vec<u32>> {
0: [0,1],
1: [0,1,2]
},
// All of the extensions used. The above refers to these by index:
extensions: vec![
TransactionExtensionMetadata { identifier: "Foo", ty: 123, implicit: 456 },
TransactionExtensionMetadata { identifier: "Bar", ty: 124, implicit: 457 },
TransactionExtensionMetadata { identifier: "Foo", ty: 123, implicit: 456 },
TransactionExtensionMetadata { identifier: "Bar", ty: 124, implicit: 457 },
TransactionExtensionMetadata { identifier: "Wibble", ty: 124, implicit: 457 },
]
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>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM!
Co-authored-by: James Wilson <james@jsdw.me>
/// The type of the additional transaction data, with the data to be included in the signed payload. | ||
pub additional_signed: T::Type, | ||
/// The type of the implicit data, with the data to be included in the signed payload. | ||
pub implicit: T::Type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, missed that this has been renamed good to know
This PR adds the following to the v16 metadata:
ExtrinsicMetadata::call_ty
as it can be found in the other enums field of the metadataExtrinsicMetadata::extra_ty
as it can be found in the tx extensionsTransactionExtensionMetadata::additional_signed
toTransactionExtensionMetadata::implicit
TransactionExtensionMetadata::version
u8 for versioning extensionscc @paritytech/subxt-team