Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 5 additions & 21 deletions crates/metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +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 = "4")]
V4,
}

impl Default for MetadataVersion {
fn default() -> Self {
Self::V4
}
}
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")]
Expand All @@ -115,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(),
Expand All @@ -131,15 +115,15 @@ impl InkProject {
registry: PortableRegistry,
) -> Self {
Self {
version: Default::default(),
version: METADATA_VERSION,
layout,
spec,
registry,
}
}

/// Returns the metadata version used by the contract.
pub fn version(&self) -> &MetadataVersion {
pub fn version(&self) -> &u64 {
Copy link
Copy Markdown
Contributor

@peetzweg peetzweg Feb 27, 2024

Choose a reason for hiding this comment

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

Will this change result in the version being output as a number?

So {version: 5} instead of {version: '5'}?

Would prefer it as a number instead of string for easier version comparison up and down. 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this changes the string into the integer. All good there

&self.version
}

Expand Down