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 ink! 3.0.0-rc9 #1135

Merged
merged 12 commits into from
Feb 23, 2022
Merged
39 changes: 37 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
# Unreleased
# Version 3.0-rc9

This is the 9th release candidate for ink! 3.0.

## Breaking Changes
### We removed all data structures other than `Mapping` from the public ink! API

This is a drastic breaking change; it was no easy decision for us.
It affects `Lazy` and `Memory` as well. The rationale behind this change,
as well as some notes on migrating existing contracts, are explained
in [#1111](https://github.com/paritytech/ink/pull/1111).

If you used `Memory` in your contract, you can achieve the same functionality
by passing this data via arguments. If you think there's a case to be
made for bringing it back, please get in contact with us.

If you use [`ink_storage::Mapping`](https://paritytech.github.io/ink/ink_storage/struct.Mapping.html)
in your contract, you need to initialize the data structure using the helper function
[`ink_lang::utils::initialize_contract(…)`](https://paritytech.github.io/ink/ink_lang/utils/fn.initialize_contract.html).
For more code examples you can take a look at our examples, e.g.
[`erc20`](https://github.com/paritytech/ink/blob/master/examples/erc20/lib.rs).

### Please upgrade `scale-info` and `parity-scale-codec` in your contract's dependencies

Expand All @@ -11,6 +31,21 @@ scale-info = { version = "2", default-features = false, features = ["derive"], o
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
```

## Added
- Export `ink_lang::utils::initialize_contract(…)` - [#1077](https://github.com/paritytech/ink/pull/1077).
- Add `get_owner()` function to `dns` example contract - [#1118](https://github.com/paritytech/ink/pull/1118) (thanks [@agryaznov](https://github.com/agryaznov)).

## Changed
- Updated to `parity-scale-codec = "3"` and `scale-info = "2"` - [#1132](https://github.com/paritytech/ink/pull/1132).

## Removed
- Remove `collection` and `lazy` modules from public ink! API - [#1111](https://github.com/paritytech/ink/pull/1111).
- Remove `Memory` from public ink! API - [#1135](https://github.com/paritytech/ink/pull/1135).

## Fixed
- Explicitly specify trait in dispatching - [#1131](https://github.com/paritytech/ink/pull/1131) (thanks [@xgreenx](https://github.com/xgreenx)).
- Make `rust-analyzer` expand ink! macros without warning - [#1107](https://github.com/paritytech/ink/pull/1107).

# Version 3.0-rc8

This is the 8th release candidate for ink! 3.0.
Expand Down Expand Up @@ -57,7 +92,7 @@ The ink! PR which implemented this is [#1065](https://github.com/paritytech/ink/
metadata to V3 is [#1100](https://github.com/paritytech/ink/pull/1100), and for the `polkadot-js/api` it was [polkadot-js/api#4432](https://github.com/polkadot-js/api/pull/4432).

## Changed
- Update metadate to support payable constructors - [#1100](https://github.com/paritytech/ink/pull/1100).
- Update metadata to support payable constructors - [#1100](https://github.com/paritytech/ink/pull/1100).
- Make constructors non-payable by default, require specifying `payable` explicitly - [#1065](https://github.com/paritytech/ink/pull/1065).
- Renamed the error code `EcdsaRecoverFailed` to `EcdsaRecoveryFailed` ‒ [#1064](https://github.com/paritytech/ink/pull/1064).
- Renamed the `ink_env` function `transferred_balance()` to `transferred_value()` ‒ [#1063](https://github.com/paritytech/ink/pull/1063).
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.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
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.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Michael Müller <[email protected]>"]
edition = "2021"

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.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
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.0.0-rc8", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "3.0.0-rc8", path = "../allocator/", default-features = false }
ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false }
ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false }
ink_metadata = { version = "3.0.0-rc9", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "3.0.0-rc9", path = "../allocator/", default-features = false }
ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false }
ink_prelude = { version = "3.0.0-rc9", 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.0.0-rc8", path = "../engine/", optional = true }
ink_engine = { version = "3.0.0-rc9", path = "../engine/", optional = true }

# Hashes for the off-chain environment.
sha2 = { version = "0.10", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/eth_compatibility/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_eth_compatibility"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

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

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

[target.'cfg(not(target_os = "windows"))'.dependencies]
# We do not include `libsecp256k1` on Windows, since it's incompatible.
Expand Down
20 changes: 10 additions & 10 deletions crates/lang/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_lang"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_env = { version = "3.0.0-rc8", path = "../env", default-features = false }
ink_storage = { version = "3.0.0-rc8", path = "../storage", default-features = false }
ink_primitives = { version = "3.0.0-rc8", path = "../primitives", default-features = false }
ink_metadata = { version = "3.0.0-rc8", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "3.0.0-rc8", path = "../prelude", default-features = false }
ink_eth_compatibility = { version = "3.0.0-rc8", path = "../eth_compatibility", default-features = false }
ink_lang_macro = { version = "3.0.0-rc8", path = "macro", default-features = false }
ink_env = { version = "3.0.0-rc9", path = "../env", default-features = false }
ink_storage = { version = "3.0.0-rc9", path = "../storage", default-features = false }
ink_primitives = { version = "3.0.0-rc9", path = "../primitives", default-features = false }
ink_metadata = { version = "3.0.0-rc9", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "3.0.0-rc9", path = "../prelude", default-features = false }
ink_eth_compatibility = { version = "3.0.0-rc9", path = "../eth_compatibility", default-features = false }
ink_lang_macro = { version = "3.0.0-rc9", path = "macro", 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"] }

[dev-dependencies]
ink_lang_ir = { version = "3.0.0-rc8", path = "ir" }
ink_metadata = { version = "3.0.0-rc8", default-features = false, path = "../metadata" }
ink_lang_ir = { version = "3.0.0-rc9", path = "ir" }
ink_metadata = { version = "3.0.0-rc9", default-features = false, path = "../metadata" }

trybuild = { version = "1.0.52", features = ["diff"] }
# Required for the doctest of `env_access::EnvAccess::instantiate_contract`
Expand Down
4 changes: 2 additions & 2 deletions crates/lang/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_lang_codegen"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand All @@ -18,7 +18,7 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
name = "ink_lang_codegen"

[dependencies]
ir = { version = "3.0.0-rc8", package = "ink_lang_ir", path = "../ir", default-features = false }
ir = { version = "3.0.0-rc9", package = "ink_lang_ir", path = "../ir", default-features = false }
quote = "1"
syn = { version = "1.0", features = ["parsing", "full", "extra-traits"] }
proc-macro2 = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/lang/ir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_lang_ir"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand Down
16 changes: 8 additions & 8 deletions crates/lang/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_lang_macro"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_lang_ir = { version = "3.0.0-rc8", path = "../ir", default-features = false }
ink_lang_codegen = { version = "3.0.0-rc8", path = "../codegen", default-features = false }
ink_primitives = { version = "3.0.0-rc8", path = "../../primitives/", default-features = false }
ink_lang_ir = { version = "3.0.0-rc9", path = "../ir", default-features = false }
ink_lang_codegen = { version = "3.0.0-rc9", path = "../codegen", default-features = false }
ink_primitives = { version = "3.0.0-rc9", path = "../../primitives/", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
syn = "1"
proc-macro2 = "1"

[dev-dependencies]
ink_metadata = { version = "3.0.0-rc8", path = "../../metadata/" }
ink_env = { version = "3.0.0-rc8", path = "../../env/" }
ink_storage = { version = "3.0.0-rc8", path = "../../storage/" }
ink_lang = { version = "3.0.0-rc8", path = ".." }
ink_metadata = { version = "3.0.0-rc9", path = "../../metadata/" }
ink_env = { version = "3.0.0-rc9", path = "../../env/" }
ink_storage = { version = "3.0.0-rc9", path = "../../storage/" }
ink_lang = { version = "3.0.0-rc9", path = ".." }
scale-info = { version = "2", default-features = false, features = ["derive"] }

[lib]
Expand Down
6 changes: 3 additions & 3 deletions crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_metadata"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false }
ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false }
ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false }
ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
impl-serde = "0.3.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/prelude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_prelude"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_primitives"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false }
ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
cfg-if = "1"
Expand Down
14 changes: 8 additions & 6 deletions crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_storage"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_env = { version = "3.0.0-rc8", path = "../env/", default-features = false }
ink_metadata = { version = "3.0.0-rc8", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false }
ink_storage_derive = { version = "3.0.0-rc8", path = "derive", default-features = false }
ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false }
ink_env = { version = "3.0.0-rc9", path = "../env/", default-features = false }
ink_metadata = { version = "3.0.0-rc9", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false }
ink_storage_derive = { version = "3.0.0-rc9", path = "derive", default-features = false }
ink_prelude = { version = "3.0.0-rc9", 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 @@ -33,6 +33,8 @@ quickcheck_macros = "1.0"
itertools = "0.10"
paste = "1.0"

ink_lang = { version = "3.0.0-rc9", path = "../lang/", default-features = false }

[features]
default = ["std"]
std = [
Expand Down
12 changes: 6 additions & 6 deletions crates/storage/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_storage_derive"
version = "3.0.0-rc8"
version = "3.0.0-rc9"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand All @@ -25,8 +25,8 @@ synstructure = "0.12.4"

[dev-dependencies]
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
ink_env = { version = "3.0.0-rc8", path = "../../env" }
ink_primitives = { version = "3.0.0-rc8", path = "../../primitives" }
ink_metadata = { version = "3.0.0-rc8", path = "../../metadata" }
ink_prelude = { version = "3.0.0-rc8", path = "../../prelude/" }
ink_storage = { version = "3.0.0-rc8", path = ".." }
ink_env = { version = "3.0.0-rc9", path = "../../env" }
ink_primitives = { version = "3.0.0-rc9", path = "../../primitives" }
ink_metadata = { version = "3.0.0-rc9", path = "../../metadata" }
ink_prelude = { version = "3.0.0-rc9", path = "../../prelude/" }
ink_storage = { version = "3.0.0-rc9", path = ".." }
45 changes: 45 additions & 0 deletions crates/storage/src/lazy/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,51 @@ use ink_env::hash::{
use ink_primitives::Key;

/// A mapping of key-value pairs directly into contract storage.
///
/// # Important
///
/// If you use this data structure you must use the function
/// [`ink_lang::utils::initialize_contract`](https://paritytech.github.io/ink/ink_lang/utils/fn.initialize_contract.html)
/// in your contract's constructors!
///
/// This is an example of how you can do this:
/// ```rust
/// # use ink_lang as ink;
/// # use ink_env::{
/// # Environment,
/// # DefaultEnvironment,
/// # };
/// # type AccountId = <DefaultEnvironment as Environment>::AccountId;
///
/// # #[ink::contract]
/// # mod my_module {
/// use ink_storage::{traits::SpreadAllocate, Mapping};
///
/// #[ink(storage)]
/// #[derive(SpreadAllocate)]
/// pub struct MyContract {
/// balances: Mapping<AccountId, Balance>,
/// }
///
/// impl MyContract {
/// #[ink(constructor)]
/// pub fn new() -> Self {
/// ink_lang::utils::initialize_contract(Self::new_init)
/// }
///
/// /// Default initializes the contract.
/// fn new_init(&mut self) {
/// let caller = Self::env().caller();
/// let value: Balance = Default::default();
/// self.balances.insert(&caller, &value);
/// }
/// # #[ink(message)]
/// # pub fn my_message(&self) { }
/// }
/// # }
/// ```
///
/// More usage examples can be found [in the ink! examples](https://github.com/paritytech/ink/tree/master/examples).
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct Mapping<K, V> {
offset_key: Key,
Expand Down
6 changes: 1 addition & 5 deletions crates/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub(crate) mod collections;
#[allow(dead_code)]
pub(crate) mod lazy;

mod memory;
mod pack;

#[cfg(test)]
Expand All @@ -67,10 +66,7 @@ mod hashmap_entry_api_tests;
mod test_utils;

#[doc(inline)]
pub use self::{
lazy::Mapping,
memory::Memory,
};
pub use self::lazy::Mapping;

#[doc(inline)]
pub(crate) use self::{
Expand Down
Loading