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

Release 3.3.0 with backwards compatibility fixes #1284

Merged
merged 27 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80d302e
Fix links in release notes (#1277)
cmichi May 25, 2022
0a96173
Revert "Optimise deny_payment. Use eerywhere semantic of deny. (#1267)"
agryaznov Jun 5, 2022
cd26767
Revert backward-incompatible piece of #1224: dependency on `[seal1] s…
agryaznov Jun 6, 2022
061c94e
Revert backward-incompatible piece of #1233: removal of eth_compatibi…
agryaznov Jun 6, 2022
b17e8af
bump crate versions + update RELEASES.md
agryaznov Jun 6, 2022
5ae4bc1
Mapping::insert_return_size is back, having now both `seal1` and `sea…
agryaznov Jun 6, 2022
5633392
set_storage_silent -> set_storage_compat renaming
agryaznov Jun 6, 2022
4be7403
spell fix
agryaznov Jun 10, 2022
ee532c8
Apply suggestions from code review
agryaznov Jun 15, 2022
b0daa41
Apply suggestions from code review
agryaznov Jun 15, 2022
fa6d2c8
Update crates/env/src/backend.rs
agryaznov Jun 15, 2022
e0f2259
doc comments enhanced
agryaznov Jun 15, 2022
3fb9c76
`Mapping::insert()` to use backwards compatible seal fn
agryaznov Jun 15, 2022
06bedc4
unreleased changes planned for 4.x removed from 3.x
agryaznov Jun 15, 2022
f5f6bc9
Add more details to the release notes
HCastano Jun 15, 2022
609236a
fix catched issue with changed api function signature
agryaznov Jun 16, 2022
5a03407
fix storage trait dependent func
agryaznov Jun 16, 2022
dbee0ab
Apply new versions naming policy: step1. Old versions to keep their n…
agryaznov Jun 16, 2022
7e14d0b
Apply new versions naming policy: step2. Add `deprecated` attr and `#…
agryaznov Jun 16, 2022
b1a7393
Apply suggestions from code review
agryaznov Jun 17, 2022
9171c38
fixes after next review round
agryaznov Jun 17, 2022
89b94fc
Merge branch 'v3.x.x' into ag-3.3.0-hotfixes
agryaznov Jun 17, 2022
05f7e82
more fixes after the review round
agryaznov Jun 20, 2022
2466027
fmt
agryaznov Jun 20, 2022
180af6c
Merge branch 'v3.x.x' into ag-3.3.0-hotfixes
agryaznov Jun 20, 2022
ddebf6c
spellcheck config fix
agryaznov Jun 20, 2022
28ee702
Small wording fixes
HCastano Jun 21, 2022
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"crates/primitives",
"crates/engine",
"crates/env",
"crates/eth_compatibility",
"crates/storage",
"crates/storage/derive",
]
Expand Down
26 changes: 24 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
# [Unreleased]
- Backward-incompatible piece of [#1233](https://github.com/paritytech/ink/pull/1233): removal of `eth_compatibility crate`
- Backward-incompatible piece of [#1224](https://github.com/paritytech/ink/pull/1224): dependency on `[seal1] seal_set_storage`
- Backward-incompatible "Optimise deny_payment. Use eerywhere semantic of deny. ([#1267](https://github.com/paritytech/ink/pull/1267))"
(see @HCastano SE [answer](https://substrate.stackexchange.com/a/3000/472) in this regard)
HCastano marked this conversation as resolved.
Show resolved Hide resolved

# Version 3.3.0

This release is to make *ink!* 3.x.x backward compatible with *substrate-contracts-node* version [0.13.0](https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.13.0) again.
HCastano marked this conversation as resolved.
Show resolved Hide resolved
agryaznov marked this conversation as resolved.
Show resolved Hide resolved

## Compatibility
This version should work fine with *substrate-contracts-node* versions from [0.13.0](https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.13.0) up to [0.16.0](https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.16.0)
agryaznov marked this conversation as resolved.
Show resolved Hide resolved

## Changed
*Context: user-reported issues on our SE ([first](https://substrate.stackexchange.com/questions/2721/cargo-contract-3-0-1) and [second](https://substrate.stackexchange.com/questions/2870/cargo-contract-throws-error-about-supplied-arguments-in-inkconstructor-f)) unveiled backward incompatibility introduced in 3.1.0 release.*

The following has been done to restore backward compatibility:
- Reverted backward-incompatible piece of [#1233](https://github.com/paritytech/ink/pull/1233): removal of `eth_compatibility crate`
agryaznov marked this conversation as resolved.
Show resolved Hide resolved
- Reverted backward-incompatible piece of [#1224](https://github.com/paritytech/ink/pull/1224): dependency on `[seal1] seal_set_storage`
agryaznov marked this conversation as resolved.
Show resolved Hide resolved
- Reverted "Optimise deny_payment. Use eerywhere semantic of deny. ([#1267](https://github.com/paritytech/ink/pull/1267))"
HCastano marked this conversation as resolved.
Show resolved Hide resolved
(this one is to restore compatibiliy between minor versions of ink! crates; see @HCastano SE [answer](https://substrate.stackexchange.com/a/3000/472) in this regard)
agryaznov marked this conversation as resolved.
Show resolved Hide resolved

All these breaking changes are subjects to the upcoming MAJOR *ink!* release 4.0.0.

# Version 3.2.0

Expand All @@ -11,13 +33,13 @@ This is the case in the latest release of the [`substrate-contracts-node`](https
[v0.16.0](https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.16.0).

## Added
- Contract size optimization in case contract doesn't accept payment ‒ [#1267](https://github.com/paritytech/ink/pull/1270) [#1273](https://github.com/paritytech/ink/pull/1267) (thanks [@xgreenx](https://github.com/xgreenx)).
- Contract size optimization in case contract doesn't accept payment ‒ [#1267](https://github.com/paritytech/ink/pull/1267) (thanks [@xgreenx](https://github.com/xgreenx)).

## Changed
- Two functions have been stabilized: [`ink_env::ecdsa_recover`](https://paritytech.github.io/ink/ink_env/fn.ecdsa_recover.html) and [`ink_env::ecdsa_to_eth_address`](https://paritytech.github.io/ink/ink_env/fn.ecdsa_to_eth_address.html) ‒ [#1270](https://github.com/paritytech/ink/pull/1270) [#1273](https://github.com/paritytech/ink/pull/1273)

## Fixed
- Fixed bug with recent Rust and `cargo test` ‒ [#1272](https://github.com/paritytech/ink/pull/1270) [#1273](https://github.com/paritytech/ink/pull/1272) (thanks [@xgreenx](https://github.com/xgreenx)).
- Fixed bug with recent Rust and `cargo test` ‒ [#1272](https://github.com/paritytech/ink/pull/1272) (thanks [@xgreenx](https://github.com/xgreenx)).

# Version 3.1.0

Expand Down
2 changes: 1 addition & 1 deletion crates/allocator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_allocator"
version = "3.2.0"
version = "3.3.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_engine"
version = "3.2.0"
version = "3.3.0"
authors = ["Parity Technologies <admin@parity.io>", "Michael Müller <michi@parity.io>"]
edition = "2021"

Expand Down
17 changes: 17 additions & 0 deletions crates/engine/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,23 @@ impl Engine {
});
}

/// Silently writes the encoded value into the storage at the given key.
HCastano marked this conversation as resolved.
Show resolved Hide resolved
pub fn set_storage_compat(&mut self, key: &[u8; 32], encoded_value: &[u8]) {
let callee = self.get_callee();
let account_id = AccountId::from_bytes(&callee[..]);

self.debug_info.inc_writes(account_id.clone());
self.debug_info
.record_cell_for_account(account_id, key.to_vec());

// We ignore if storage is already set for this key
let _ = self.database.insert_into_contract_storage(
&callee,
key,
encoded_value.to_vec(),
);
}

/// Writes the encoded value into the storage at the given key.
/// Returns the size of the previously stored value at the key if any.
pub fn set_storage(&mut self, key: &[u8; 32], encoded_value: &[u8]) -> Option<u32> {
Expand Down
12 changes: 6 additions & 6 deletions crates/env/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_env"
version = "3.2.0"
version = "3.3.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
edition = "2021"

Expand All @@ -15,10 +15,10 @@ categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]

[dependencies]
ink_metadata = { version = "3.2.0", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "3.2.0", path = "../allocator/", default-features = false }
ink_primitives = { version = "3.2.0", path = "../primitives/", default-features = false }
ink_prelude = { version = "3.2.0", path = "../prelude/", default-features = false }
ink_metadata = { version = "3.3.0", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "3.3.0", path = "../allocator/", default-features = false }
ink_primitives = { version = "3.3.0", path = "../primitives/", default-features = false }
ink_prelude = { version = "3.3.0", path = "../prelude/", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
Expand All @@ -32,7 +32,7 @@ static_assertions = "1.1"
rlibc = "1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ink_engine = { version = "3.2.0", path = "../engine/", optional = true }
ink_engine = { version = "3.3.0", path = "../engine/", optional = true }

# Hashes for the off-chain environment.
sha2 = { version = "0.10", optional = true }
Expand Down
18 changes: 16 additions & 2 deletions crates/env/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,22 @@ where
})
}

/// Writes the value to the contract storage under the given key and returns
/// the size of pre-existing value at the specified key if any.
/// The elder version of the function which is equivalent to the new one
/// but returns nothing.
///
/// # Panics
///
/// - If the encode length of value exceeds the configured maximum value length of a storage entry.
agryaznov marked this conversation as resolved.
Show resolved Hide resolved
pub fn set_contract_storage_compat<V>(key: &Key, value: &V)
where
V: scale::Encode,
{
<EnvInstance as OnInstance>::on_instance(|instance| {
EnvBackend::set_contract_storage_compat::<V>(instance, key, value)
});
}

/// Writes the value to the contract storage under the given key.
///
/// # Panics
///
Expand Down
8 changes: 6 additions & 2 deletions crates/env/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,12 @@ impl CallFlags {

/// Environmental contract functionality that does not require `Environment`.
pub trait EnvBackend {
/// Writes the value to the contract storage under the given key and returns
/// the size of the pre-existing value at the specified key if any.
/// Equivalent to the newer version but returns nothing.
agryaznov marked this conversation as resolved.
Show resolved Hide resolved
fn set_contract_storage_compat<V>(&mut self, key: &Key, value: &V)
where
V: scale::Encode;

/// Writes the value to the contract storage under the given key.
fn set_contract_storage<V>(&mut self, key: &Key, value: &V) -> Option<u32>
where
V: scale::Encode;
Expand Down
8 changes: 8 additions & 0 deletions crates/env/src/engine/off_chain/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ impl EnvInstance {
}

impl EnvBackend for EnvInstance {
fn set_contract_storage_compat<V>(&mut self, key: &Key, value: &V)
where
V: scale::Encode,
{
let v = scale::Encode::encode(value);
self.engine.set_storage_compat(key.as_ref(), &v[..]);
}

fn set_contract_storage<V>(&mut self, key: &Key, value: &V) -> Option<u32>
where
V: scale::Encode,
Expand Down
17 changes: 17 additions & 0 deletions crates/env/src/engine/on_chain/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ mod sys {
data_len: u32,
);

#[link_name = "seal_set_storage"]
pub fn seal_set_storage_compat(
key_ptr: Ptr32<[u8]>,
value_ptr: Ptr32<[u8]>,
value_len: u32,
);

pub fn seal_get_storage(
key_ptr: Ptr32<[u8]>,
output_ptr: Ptr32Mut<[u8]>,
Expand Down Expand Up @@ -495,6 +502,16 @@ pub fn deposit_event(topics: &[u8], data: &[u8]) {
}
}

pub fn set_storage_compat(key: &[u8], encoded_value: &[u8]) {
unsafe {
sys::seal_set_storage_compat(
Ptr32::from_slice(key),
Ptr32::from_slice(encoded_value),
encoded_value.len() as u32,
)
}
}

pub fn set_storage(key: &[u8], encoded_value: &[u8]) -> Option<u32> {
let ret_code = unsafe {
sys::seal_set_storage(
Expand Down
8 changes: 8 additions & 0 deletions crates/env/src/engine/on_chain/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ impl EnvInstance {
}

impl EnvBackend for EnvInstance {
fn set_contract_storage_compat<V>(&mut self, key: &Key, value: &V)
where
V: scale::Encode,
{
let buffer = self.scoped_buffer().take_encoded(value);
ext::set_storage_compat(key.as_ref(), buffer);
}

fn set_contract_storage<V>(&mut self, key: &Key, value: &V) -> Option<u32>
where
V: scale::Encode,
Expand Down
30 changes: 30 additions & 0 deletions crates/eth_compatibility/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "ink_eth_compatibility"
version = "3.0.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/paritytech/ink"
documentation = "https://docs.rs/ink_eth_compatibility/"
homepage = "https://www.parity.io/"
description = "[ink!] Ethereum related stuff."
keywords = ["wasm", "parity", "webassembly", "blockchain", "ethereum"]
categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]

[dependencies]
ink_env = { version = "3.0.1", path = "../env", default-features = false }

[target.'cfg(not(target_os = "windows"))'.dependencies]
# We do not include `libsecp256k1` on Windows, since it's incompatible.
# We have https://github.com/paritytech/ink/issues/1068 for removing
# this dependency altogether.
libsecp256k1 = { version = "0.7.0", default-features = false }

[features]
default = ["std"]
std = [
"ink_env/std",
]
1 change: 1 addition & 0 deletions crates/eth_compatibility/LICENSE
1 change: 1 addition & 0 deletions crates/eth_compatibility/README.md
Loading