Skip to content

Commit a0d7e79

Browse files
lexnvniklasad1bkchrjsdwactions-user
authored andcommitted
v16: Expose the unstable metadata v16 (paritytech#5732)
This PR exposes the *unstable* metadata V16. The metadata is exposed under the unstable u32::MAX number. Developers can start experimenting with the new features of the metadata v16. *Please note that this metadata is under development and expect breaking changes until stabilization.* The `ExtrinsicMetadata` trait receives a breaking change. Its associated type `VERSION` is rename to `VERSIONS` and now supports a constant static list of metadata versions. The versions implemented for `UncheckedExtrinsic` are v4 (legacy version) and v5 (new version). For metadata collection, it is assumed that all `TransactionExtensions` are under version 0. Builds on top of: paritytech#5274 Closes: paritytech#5980 Closes: paritytech#5347 Closes: paritytech#5285 cc @paritytech/subxt-team --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Niklas Adolfsson <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: James Wilson <[email protected]> Co-authored-by: GitHub Action <[email protected]>
1 parent d2080c3 commit a0d7e79

File tree

20 files changed

+329
-40
lines changed

20 files changed

+329
-40
lines changed

Cargo.lock

Lines changed: 20 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ frame-benchmarking-pallet-pov = { default-features = false, path = "substrate/fr
786786
frame-election-provider-solution-type = { path = "substrate/frame/election-provider-support/solution-type", default-features = false }
787787
frame-election-provider-support = { path = "substrate/frame/election-provider-support", default-features = false }
788788
frame-executive = { path = "substrate/frame/executive", default-features = false }
789-
frame-metadata = { version = "16.0.0", default-features = false }
789+
frame-metadata = { version = "18.0.0", default-features = false }
790790
frame-metadata-hash-extension = { path = "substrate/frame/metadata-hash-extension", default-features = false }
791791
frame-support = { path = "substrate/frame/support", default-features = false }
792792
frame-support-procedural = { path = "substrate/frame/support/procedural", default-features = false }
@@ -861,7 +861,7 @@ macro_magic = { version = "0.5.1" }
861861
maplit = { version = "1.0.2" }
862862
memmap2 = { version = "0.9.3" }
863863
memory-db = { version = "0.32.0", default-features = false }
864-
merkleized-metadata = { version = "0.1.0" }
864+
merkleized-metadata = { version = "0.1.2" }
865865
merlin = { version = "3.0", default-features = false }
866866
messages-relay = { path = "bridges/relays/messages" }
867867
metered = { version = "0.6.1", default-features = false, package = "prioritized-metered-channel" }

prdoc/pr_5732.prdoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
title: Expose the unstable metadata v16
2+
doc:
3+
- audience: Node Dev
4+
description: |
5+
This PR exposes the *unstable* metadata V16. The metadata is exposed under the unstable u32::MAX number.
6+
Developers can start experimenting with the new features of the metadata v16. *Please note that this metadata is under development and expect breaking changes until stabilization.*
7+
The `ExtrinsicMetadata` trait receives a breaking change. Its associated type `VERSION` is rename to `VERSIONS` and now supports a constant static list of metadata versions.
8+
The versions implemented for `UncheckedExtrinsic` are v4 (legacy version) and v5 (new version).
9+
For metadata collection, it is assumed that all `TransactionExtensions` are under version 0.
10+
11+
crates:
12+
- name: sp-metadata-ir
13+
bump: major
14+
- name: frame-support-procedural
15+
bump: patch
16+
- name: frame-support
17+
bump: minor
18+
- name: frame-support-test
19+
bump: major
20+
- name: frame-metadata-hash-extension
21+
bump: patch
22+
- name: substrate-wasm-builder
23+
bump: minor
24+
- name: pallet-revive
25+
bump: minor
26+
- name: sp-runtime
27+
bump: major
28+
- name: frame-benchmarking-cli
29+
bump: patch

substrate/frame/metadata-hash-extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ substrate-test-runtime-client = { workspace = true }
2525
sp-api = { workspace = true, default-features = true }
2626
sp-transaction-pool = { workspace = true, default-features = true }
2727
merkleized-metadata = { workspace = true }
28-
frame-metadata = { features = ["current"], workspace = true, default-features = true }
28+
frame-metadata = { features = ["current", "unstable"], workspace = true, default-features = true }
2929
sp-tracing = { workspace = true, default-features = true }
3030

3131
[features]

substrate/frame/revive/src/evm/runtime.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ impl<Address: TypeInfo, Signature: TypeInfo, E: EthExtra> ExtrinsicLike
9292
impl<Address, Signature, E: EthExtra> ExtrinsicMetadata
9393
for UncheckedExtrinsic<Address, Signature, E>
9494
{
95-
const VERSION: u8 =
96-
generic::UncheckedExtrinsic::<Address, CallOf<E::Config>, Signature, E::Extension>::VERSION;
95+
const VERSIONS: &'static [u8] = generic::UncheckedExtrinsic::<
96+
Address,
97+
CallOf<E::Config>,
98+
Signature,
99+
E::Extension,
100+
>::VERSIONS;
97101
type TransactionExtensions = E::Extension;
98102
}
99103

substrate/frame/support/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ scale-info = { features = [
2828
], workspace = true }
2929
frame-metadata = { features = [
3030
"current",
31+
"unstable",
3132
], workspace = true }
3233
sp-api = { features = [
3334
"frame-metadata",

substrate/frame/support/procedural/src/construct_runtime/expand/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn expand_runtime_metadata(
117117
pallets: #scrate::__private::vec![ #(#pallets),* ],
118118
extrinsic: #scrate::__private::metadata_ir::ExtrinsicMetadataIR {
119119
ty,
120-
version: <#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata>::VERSION,
120+
versions: <#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata>::VERSIONS.into_iter().map(|ref_version| *ref_version).collect(),
121121
address_ty,
122122
call_ty,
123123
signature_ty,

substrate/frame/support/test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static_assertions = { workspace = true, default-features = true }
1919
serde = { features = ["derive"], workspace = true }
2020
codec = { features = ["derive"], workspace = true }
2121
scale-info = { features = ["derive"], workspace = true }
22-
frame-metadata = { features = ["current"], workspace = true }
22+
frame-metadata = { features = ["current", "unstable"], workspace = true }
2323
sp-api = { workspace = true }
2424
sp-arithmetic = { workspace = true }
2525
sp-io = { workspace = true }

substrate/frame/support/test/tests/pallet.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ parameter_types! {
5353
/// Latest stable metadata version used for testing.
5454
const LATEST_METADATA_VERSION: u32 = 15;
5555

56+
/// Unstable metadata version.
57+
const UNSTABLE_METADATA_VERSION: u32 = u32::MAX;
58+
5659
pub struct SomeType1;
5760
impl From<SomeType1> for u64 {
5861
fn from(_t: SomeType1) -> Self {
@@ -1977,7 +1980,10 @@ fn metadata_at_version() {
19771980

19781981
#[test]
19791982
fn metadata_versions() {
1980-
assert_eq!(vec![14, LATEST_METADATA_VERSION], Runtime::metadata_versions());
1983+
assert_eq!(
1984+
vec![14, LATEST_METADATA_VERSION, UNSTABLE_METADATA_VERSION],
1985+
Runtime::metadata_versions()
1986+
);
19811987
}
19821988

19831989
#[test]

substrate/primitives/metadata-ir/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1717

1818
[dependencies]
1919
codec = { workspace = true }
20-
frame-metadata = { features = ["current"], workspace = true }
20+
frame-metadata = { features = ["current", "unstable"], workspace = true }
2121
scale-info = { features = ["derive"], workspace = true }
2222

2323
[features]

0 commit comments

Comments
 (0)