From 3ab028d14c0ec0de0fb49d04fe6bfda0444c3c8d Mon Sep 17 00:00:00 2001 From: German Nikolishin Date: Mon, 26 Feb 2024 11:49:03 +0000 Subject: [PATCH 1/5] bump metadata version --- crates/metadata/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index d0336c6cc79..98374883562 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -83,13 +83,15 @@ use serde::{ /// this crate. #[derive(Debug, Serialize, Deserialize, Eq, PartialEq, JsonSchema)] pub enum MetadataVersion { + #[serde(rename = "5")] + V5, #[serde(rename = "4")] V4, } impl Default for MetadataVersion { fn default() -> Self { - Self::V4 + Self::V5 } } From edfd4f84fc9595ffeb24971975f74e4e4a8dc0b3 Mon Sep 17 00:00:00 2001 From: German Nikolishin Date: Mon, 26 Feb 2024 11:54:20 +0000 Subject: [PATCH 2/5] add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37aa5ad1e69..229e41ed06c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Bump metadata version to 5 [#2126](https://github.com/paritytech/ink/pull/2126) ### Fixed - Fix alignment in allocator [#2100](https://github.com/paritytech/ink/pull/2100) From 6af9bddea78962f6591469b6a28a2141365b33f9 Mon Sep 17 00:00:00 2001 From: German Nikolishin Date: Mon, 26 Feb 2024 15:20:09 +0000 Subject: [PATCH 3/5] replace enum with const --- crates/metadata/src/lib.rs | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index 98374883562..6bb5d4c0c41 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -75,30 +75,12 @@ use serde::{ /// /// The serialized metadata format (which this represents) is different from the /// version of this crate or the contract for Rust semantic versioning purposes. -/// -/// # Note -/// -/// Versions other than the `Default` are considered deprecated. If you want to -/// deserialize legacy metadata versions you will need to use an old version of -/// this crate. -#[derive(Debug, Serialize, Deserialize, Eq, PartialEq, JsonSchema)] -pub enum MetadataVersion { - #[serde(rename = "5")] - V5, - #[serde(rename = "4")] - V4, -} - -impl Default for MetadataVersion { - fn default() -> Self { - Self::V5 - } -} +const METADATA_VERSION: u64 = 5; /// An entire ink! project for metadata file generation purposes. #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct InkProject { - version: MetadataVersion, + version: u64, #[serde(flatten)] registry: PortableRegistry, #[serde(rename = "storage")] @@ -133,7 +115,7 @@ impl InkProject { registry: PortableRegistry, ) -> Self { Self { - version: Default::default(), + version: METADATA_VERSION, layout, spec, registry, @@ -141,7 +123,7 @@ impl InkProject { } /// Returns the metadata version used by the contract. - pub fn version(&self) -> &MetadataVersion { + pub fn version(&self) -> &u64 { &self.version } From 141f56284c13cb07de5eeccbb0556cfd9a23eb8f Mon Sep 17 00:00:00 2001 From: German Nikolishin Date: Mon, 26 Feb 2024 18:53:52 +0000 Subject: [PATCH 4/5] fix --- crates/metadata/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index 6bb5d4c0c41..8d3d4042fff 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -99,7 +99,7 @@ impl InkProject { let mut registry = Registry::new(); Self { - version: Default::default(), + version: METADATA_VERSION, layout: layout.into().into_portable(&mut registry), spec: spec.into().into_portable(&mut registry), registry: registry.into(), From e34eb65d33dc44d876dc9a60fc2f4bf13c1caca0 Mon Sep 17 00:00:00 2001 From: German Nikolishin Date: Tue, 27 Feb 2024 14:46:08 +0000 Subject: [PATCH 5/5] disable on-chain CI step --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10487cea4b9..49d2fab1802 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -492,6 +492,7 @@ jobs: INK_STATIC_BUFFER_SIZE=30 cargo test --verbose --manifest-path integration-tests/static-buffer/Cargo.toml --all-features - name: Run E2E test with on-chain contract + if: false # temporary disable step until new version of `cargo-contract` is released. env: # Fix linking of `linkme`: https://github.com/dtolnay/linkme/issues/49 RUSTFLAGS: -Clink-arg=-z -Clink-arg=nostart-stop-gc