Skip to content

Commit 321fe03

Browse files
Robbepopcmichiascjones
authored
Implementation of ink! env (revision 3) (#312)
* [core] initial implementation of env revision 3 * add engine abstraction layer and implement api functions * add support for dispatch_call to env3 * add missing invoke_runtime to api.rs * [core] fix restore_contract docs * [core] initial implementation of off-chain environment * [core] clean-up of env3 fundamental types * [core] add WasmEnv::reset_buffer * show test submodule of env3 when compiling with rustdoc * [core] initial implementation of the off-chain env instance Also many other adjustments. * [core] further enhancements to off-chain env * [core] implement untyped Env for off-chain environment * [core] implemented a good chunk of TypedEnv for the off-chain environment * [core] minor improvements to env3 * [core] further improvements and additions to test-api of env3 * [core] remove former test-api file * [core] env3: add support for ext_tombstone_deposit * [core] env3: add setting of rent allowance in off-chain env * [core] env3: remove buffer.rs * [core] env3: remove property.rs * [core] env3: mark some TypedEnv methods as not-todo * [core] env3: enable off-chain api for non test/doc builds * [core] env3: use a static buffer instead of Vec<u8> * [core] env3: move static buffer into its own module * fix doc comment Co-Authored-By: Michael Müller <[email protected]> * [core] env3: add missing license header * [core] env3: remove deprecated doc note * [core] env3: add off-chain {set/get}_runtime_storage * [core] env3: add off-chain invoke_runtime dispatch This also enables support for registering custom runtime call handlers. * [core] env3: slightly improve env3::random docs comment * [core] env3: move off-chain errors under EnvError * [core] env3: add ext_random support for the off-chain environment * [core] env3: minor clean ups * [core] env3: improve TypedEncoded::assign * [core] env3: un-mut some variables * [core] env3: fix some clippy warnings * [core] env3: add past_printlns to off-chain test api * [core] env3: minor refactoring * [core] env3: apply rustfmt * [core] env3: clean up of call and instantiate contract * [core] env3: rename moment -> time_stamp * [core] env3: make get_runtime_storage return a Result instead of RetCode * [core] env3: remove unneeded import * [core] env3: add some trait impls for EnvTypes::Hash * [core] env3: remove last remaining usages of RetCode * [core] env3: refactor some errors * [core] env3: document the EnvError enum * [core] env3: add impls for fire methods on call and create builders * [core] env3: add doc comment to past_printlns * [core] env3: apply rustfmt * [core] env3: update license headers * [core] env3: support querying and emitting of events in off-chain env * [core] env3: missing license header adjustment * [core] env3: apply rustfmt * [core] env3: rename some methods in off-chain test-api * [core] env3: add doc comment to test::emitted_events * [core] env3: add stub for test::advance_block * [core] env3: rename some more test API methods * [core] env3: initialize entropy of block randomly * [core] env3: extend EnvTypes trait bounds This change makes the trait bounds more similar to what Substrate defines. * [core] env3: document SimpleArithmetic trait * [core] env3: add From<u32> to SimpleArithmetic trait * [core] env3: made some trait bounds more explicit in SimpleArithmetic trait * [core] env3: add comment describing potential future extensions to SimpleArithmetic trait * [core] env3: rename EnvTypes::Moment to TimeStamp * [core] env3: add block_time to ChainSpec * [core] env3: remove CodeDb again Not needed right now. Maybe re-added at a later point. * [core] env3: apply rustfmt * [core] env3: implement off-chain test::advance_block * [core] env3: fix bug in off-chain test::advance_block impl * [core] env3: made SimpleArithmetic trait more explicit towards Output types * [core] env3: add default initialization routines for off-chain environment * [core] env3: remove test::create_user_account for now * [core] env3: fix missing renaming from Moment -> TimeStamp * [core] env3: impl PartialEq and Eq for off-chain error types * [core] env3: add test::run_test for off-chain testing with default setup * [core] env3: fix several minor bugs with the off-chain environment * [core] convert key.rs tests to new env3 * [core] remove commented out code in key.rs tests * [core] evn3: add test::get_contract_storage_rw * [core] use env3 instead of env1 in storage cells * [core] integrate env3 into storage::TypedChunk * [core] remove storage::RawChunk and NonCloneMarker * [core] adjust SyncChunk slightly for TypedChunk modifications * [core] simplify transitioned env3 tests for TypedChunk * [core] transition tests for SynChunk to env3 * [core] transition storage::Stash tests to env3 * [core] transition storage::HashMap tests to env3 * [core] transition storage::BinaryHeap tests to env3 * [lang] remove the entire ink! lang crate It has been deprecated for a whole while. * [model] remove ink! model crate entirely It has been deprecated for a whole while. * [core] remove the old env1 sub-module of ink_core It has been deprecated for a whole while. * [examples] remove model examples * [examples] remove lang examples * [examples] remove core examples * remove "If given too few endowment" from docs Co-Authored-By: Andrew Jones <[email protected]> * fix doc comment Co-Authored-By: Andrew Jones <[email protected]> * fix doc comment Co-Authored-By: Andrew Jones <[email protected]> * [lang2] initial steps towards basing on env3 instead of env2 With this commit `cargo contract build` already works. However, cargo test etc. are still broken. * [lang2] make macros work for `cargo test` * [core, lang2] make contracts compile as ink-as-dependency * [lang2] make events work for ink_lang2 on env3 * [lang2] remove AccessEnv - no longer needed * [core] remove env2 * [lang2] fix tests - Fix warning in ink_lang2 - Remove no longer needed test case - Adjust some passing tests after default module import removal * [*] apply rustfmt * [lang2] silence unused warning for now * [core] rename {create|Create}* to {instantiate|Instantiate}* - CreateBuilder -> InstantiateBuilder - CreateParams -> InstantiateParams - create -> instantiate * [core] rename endowment -> transferred_value for CallBuilder/Params * [examples] adjust Delegator contracts for recents changes * [core] rename now_in_ms -> block_timestamp * [core] follow-up of the call renamings (transferred_value) * [lang2] rename now_in_ms -> block_timestamp * [examples] move examples out of the examples/lang2 folder * [examples] fix runtime-storage example contract * [examples] fix Flipper contract * [examples] fix Incrementer contract * [examples] fix Erc20 contract * [utils] add Key and byte_utils to ink_utils * [utils -> primitives] rename ink_utils -> ink_primitives * [*] move all links from ink_utils -> ink_primitives * [primitives] update Cargo.toml description * [*] use ink_primitives::Key remove ink_core::Key * [primitives] refactor new crate, make it more usable in ink! context * [*] relink to ink_primitives for Key usage * [abi] refactor macros and relink to ink_primitives::Key * [lang2] fix usage of renamed Create{Builder, Params} * [examples] fix examples under recent changes with ink_primitives * [*] apply rustfmt * [lang2/macro] remove deprecated feature usage of proc_macro_hygiene * [examples] remove deprecated proc_macro_hygiene feature * [core] remove test_utils * [core] rename env3 to env * [*] rename all usages of env3 to env * [core] fix feature usage in num-traits of ink_core Cargo.toml * [*] update README * [primitives] conditionally compile type_metadata from ink_primitives * [core] make env::get_contract_storage return Option<Result<T>> * [core] fix some faulty doc comments * [ci] fix GitLab CI * [primitives] fix no_std compilation * [primitives] fix warning * [core] make `rand` dependency optional for `std` crate feature * [core] remove the test-env crate feature from the ink_core crate * [core,primitives] move some tests from primitives to core * [lang] move lang2/ to lang/ * [*] rename all instances of ink_lang2 or lang2 to ink_lang or lang * [lang/macro] fix ink_primitives dependency * [*] apply rustfmt * [core] fix clippy warning * [ci] eliminate README from examples CI checks * [examples] apply rustfmt * [lang/macro] improve event codegen * [core] rename TimeStamp/time_stamp to Timestamp/timestamp * [lang] remove unused extern crate alloc * [core] rename env::address to env::account_id * [lang] perform renamings on ink_lang::EnvAccess but with deprecation instead of removal * [core] fix missing time_stamp renamings * [lang] fix missing TimeStamp renamings * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * rename create_contract -> instantiate_contract Co-Authored-By: Andrew Jones <[email protected]> * rename create_contract -> instantiate_contract Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * impr Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * rename endowment -> transferred_value Co-Authored-By: Andrew Jones <[email protected]> * improve doc comment Co-Authored-By: Andrew Jones <[email protected]> * rename create_contract -> instantiate_contract Co-Authored-By: Andrew Jones <[email protected]> * rename create_contract -> instantiate_contract Co-Authored-By: Andrew Jones <[email protected]> * rename time stamp to timestamp Co-Authored-By: Andrew Jones <[email protected]> * rename SRML to env in docs Co-Authored-By: Andrew Jones <[email protected]> * remove SRML word from docs Co-Authored-By: Andrew Jones <[email protected]> * remove SRML word from docs Co-Authored-By: Andrew Jones <[email protected]> * [lang] fix doc comment for filtered_keys in restore_contract * [core] rename create_contract -> instantiate_contract * [core] rename create_contract -> instantiate_contract * [core] fix some renamings around endowment -> transferred_value * [lang] rename create_contract -> instantiate_contract follow-up * [core] apply rustfmt * [core] improve restore_contract doc comment * [core, lang] link to ink_core::env::* doc comments from all api places * [core] apply rustfmt Co-authored-by: Michael Müller <[email protected]> Co-authored-by: Andrew Jones <[email protected]>
1 parent 6fd834d commit 321fe03

File tree

331 files changed

+6741
-19445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+6741
-19445
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ variables:
1818
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
1919
CI_SERVER_NAME: "GitLab CI"
2020
REGISTRY: registry.parity.io/parity/infrastructure/scripts
21-
ALL_CRATES: "core alloc prelude utils lang2 lang2/macro"
21+
ALL_CRATES: "core alloc prelude primitives lang lang/macro"
2222

2323
.collect-artifacts: &collect-artifacts
2424
artifacts:
@@ -147,31 +147,31 @@ examples-test:
147147
stage: examples
148148
<<: *docker-env
149149
script:
150-
- for example in examples/lang2/*; do
150+
- for example in examples/*/; do
151151
cargo test --verbose --manifest-path ${example}/Cargo.toml;
152152
done
153153

154154
examples-fmt:
155155
stage: examples
156156
<<: *docker-env
157157
script:
158-
- for example in examples/lang2/*; do
158+
- for example in examples/*/; do
159159
cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
160160
done
161161

162162
examples-clippy-std:
163163
stage: examples
164164
<<: *docker-env
165165
script:
166-
- for example in examples/lang2/*; do
166+
- for example in examples/*/; do
167167
cargo clippy --verbose --manifest-path ${example}/Cargo.toml -- -D warnings;
168168
done
169169

170170
examples-clippy-wasm:
171171
stage: examples
172172
<<: *docker-env
173173
script:
174-
- for example in examples/lang2/*; do
174+
- for example in examples/*/; do
175175
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
176176
done
177177

@@ -180,7 +180,7 @@ examples-contract-build:
180180
<<: *docker-env
181181
script:
182182
- *update-cargo-contract
183-
- for example in examples/lang2/*; do
183+
- for example in examples/*/; do
184184
pushd $example &&
185185
cargo contract build &&
186186
popd;
@@ -191,7 +191,7 @@ examples-generate-metadata:
191191
<<: *docker-env
192192
script:
193193
- *update-cargo-contract
194-
- for example in examples/lang2/*; do
194+
- for example in examples/*/; do
195195
pushd $example &&
196196
cargo contract generate-metadata &&
197197
popd;

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Following these will ensure that your pull request is going to be accepted.
3434

3535
1. Run `rustfmt` automatically.
3636
1. Run `clippy` on your changes.
37-
1. Run tests in `debug` and `release` mode using `--features test-env` for off-chain testing.
37+
1. Run tests via `cargo test --release` for off-chain testing.
3838
1. For critical parts perform some manual on-chain tests.
3939
1. Build the code and run tests also for the `wasm32` target.
4040
1. Try to run some examples and see if they are still working correctly.

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ members = [
44
"abi",
55
"core",
66
"lang",
7-
"lang2",
8-
"model",
97
"prelude",
10-
"utils",
8+
"primitives",
119
]
1210
exclude = [
1311
"examples/",

LICENSE_TEMPLATE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
1+
// Copyright {20\d{2}}-{20\d{2}} Parity Technologies (UK) Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
[e2]: https://github.com/Aaronepower/tokei#badges
1515
[f1]: https://img.shields.io/badge/docs-core-blue.svg
1616
[f2]: https://paritytech.github.io/ink/ink_core
17-
[g1]: https://img.shields.io/badge/docs-model-blue.svg
18-
[g2]: https://paritytech.github.io/ink/ink_model
1917
[h1]: https://img.shields.io/badge/docs-abi-blue.svg
2018
[h2]: https://paritytech.github.io/ink/ink_abi
2119

@@ -27,9 +25,9 @@ For more information please visit [the ink! tutorial](https://substrate.dev/subs
2725

2826
## Developer Documentation
2927

30-
| `ink_abi` | `ink_core` | `ink_model` |
31-
| ------------- | ------------- | ------------- |
32-
| [![][h1]][h2] | [![][f1]][f2] | [![][g1]][g2] |
28+
| `ink_abi` | `ink_core` |
29+
| ------------- | ------------- |
30+
| [![][h1]][h2] | [![][f1]][f2] |
3331

3432
### Interaction with Substrate
3533

@@ -81,14 +79,15 @@ To create your own version of the flipper contract, you first need to initialize
8179
cargo contract new flipper
8280
```
8381

84-
Below you can see the code using the `ink_lang2` version of ink!.
82+
Below you can see the code using the `ink_lang` version of ink!.
8583

8684
```rust
87-
use ink_core::storage;
88-
use ink_lang2 as ink;
85+
use ink_lang as ink;
8986

9087
#[ink::contract(version = "0.1.0")]
9188
mod flipper {
89+
use ink_core::storage;
90+
9291
/// The storage of the flipper contract.
9392
#[ink(storage)]
9493
struct Flipper {

RELEASES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ contract! {
6464
<td>
6565

6666
```rust
67-
use ink_lang2 as ink;
67+
use ink_lang as ink;
6868

6969
#[ink::contract(version = "0.1.0")]
7070
mod erc20 {
@@ -78,7 +78,7 @@ mod erc20 {
7878

7979
> Note: we now require a mandatory ink! version in the header. You're welcome.
8080
81-
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/lang2/erc20/src/lib.rs).
81+
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/erc20/src/lib.rs).
8282

8383
## ink! Contract Tag
8484

@@ -146,7 +146,7 @@ struct Erc20 {
146146
</tr>
147147
</table>
148148

149-
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/lang2/erc20/src/lib.rs).
149+
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/erc20/src/lib.rs).
150150

151151
## Declaring Events
152152

@@ -193,7 +193,7 @@ struct Transfer {
193193
</tr>
194194
</table>
195195

196-
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/lang2/erc20/src/lib.rs).
196+
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/erc20/src/lib.rs).
197197

198198
## Environment Handler
199199

@@ -275,7 +275,7 @@ fn total_supply(&self) -> Balance {
275275
</tr>
276276
</table>
277277

278-
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/lang2/erc20/src/lib.rs).
278+
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/erc20/src/lib.rs).
279279

280280
## Defining a Constructor
281281

@@ -335,7 +335,7 @@ impl Erc20 {
335335
</tr>
336336
</table>
337337

338-
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/lang2/erc20/src/lib.rs).
338+
See the [ERC20 example](https://github.com/paritytech/ink/blob/master/examples/erc20/src/lib.rs).
339339

340340
## Cross Contract Calls
341341

@@ -355,7 +355,7 @@ struct Delegator {
355355
let result = self.adder.inc(by);
356356
```
357357

358-
See the [delegator example](https://github.com/paritytech/ink/blob/master/examples/lang2/delegator/lib.rs).
358+
See the [delegator example](https://github.com/paritytech/ink/blob/master/examples/delegator/lib.rs).
359359

360360
## Factory Contracts
361361

@@ -406,7 +406,7 @@ let accumulator = Accumulator::new(init_value)
406406
</tr>
407407
</table>
408408

409-
See the [delegator example](https://github.com/paritytech/ink/blob/master/examples/lang2/delegator/lib.rs).
409+
See the [delegator example](https://github.com/paritytech/ink/blob/master/examples/delegator/lib.rs).
410410

411411
## Contract Tests
412412

@@ -432,7 +432,7 @@ let contract = MyContract::my_constructor(a, b);
432432
Messages can simply be called on the returned instance as if `MyContract::my_constructor` returns a
433433
`Self` instance.
434434

435-
See the [flipper example](https://github.com/paritytech/ink/blob/master/examples/lang2/flipper/src/lib.rs).
435+
See the [flipper example](https://github.com/paritytech/ink/blob/master/examples/flipper/src/lib.rs).
436436

437437
**The off-chain test environment has lost a bit of power compared to the old ink! language.**
438438

abi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ serde = { version = "1.0", default-features = false, features = ["derive", "allo
1919
derive_more = { version = "0.99.2", default-features = false, features = ["from"] }
2020
ink_abi_derive = { path = "derive", default-features = false, optional = true }
2121
ink_prelude = { path = "../prelude/", default-features = false }
22+
ink_primitives = { path = "../primitives/", default-features = false }
2223
type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"] }
2324

2425
[dev-dependencies]

abi/derive/src/has_layout.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn generate_impl(input: TokenStream2) -> Result<TokenStream2> {
6060
}
6161
};
6262

63-
Ok(wrap(ident, "HAS_LAYOUT", has_layout_impl))
63+
Ok(wrap(has_layout_impl))
6464
}
6565

6666
fn generate_fields_layout<'a>(
@@ -97,8 +97,7 @@ fn generate_struct_layout(data_struct: &DataStruct) -> TokenStream2 {
9797
Fields::Unnamed(ref fs) => generate_struct_fields_layout(&fs.unnamed),
9898
Fields::Unit => {
9999
quote! {
100-
use type_metadata::Metadata as _;
101-
_ink_abi::LayoutStruct::new(Self::meta_type(), __core::vec![])
100+
_ink_abi::LayoutStruct::new(<Self as type_metadata::Metadata>::meta_type(), Vec::new())
102101
}
103102
}
104103
}

abi/derive/src/impl_wrapper.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#[cfg(not(feature = "std"))]
16-
use alloc::{
17-
format,
18-
string::{
19-
String,
20-
ToString,
21-
},
22-
};
23-
24-
use proc_macro2::{
25-
Span,
26-
TokenStream as TokenStream2,
27-
};
15+
use proc_macro2::TokenStream as TokenStream2;
2816
use quote::quote;
29-
use syn::Ident;
30-
31-
pub fn wrap(
32-
ident: &Ident,
33-
trait_name: &'static str,
34-
impl_quote: TokenStream2,
35-
) -> TokenStream2 {
36-
let mut renamed = format!("_IMPL_{}_FOR_", trait_name);
37-
renamed.push_str(ident.to_string().trim_start_matches("r#"));
38-
let dummy_const = Ident::new(&renamed, Span::call_site());
3917

18+
pub fn wrap(impl_quote: TokenStream2) -> TokenStream2 {
4019
quote! {
4120
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
42-
const #dummy_const: () = {
21+
const _: () = {
4322
#[allow(unknown_lints)]
4423
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
4524
#[allow(rust_2018_idioms)]

abi/src/layout.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ pub trait HasLayout {
4141
fn layout(&self) -> StorageLayout;
4242
}
4343

44+
impl From<ink_primitives::Key> for LayoutKey {
45+
fn from(key: ink_primitives::Key) -> Self {
46+
LayoutKey(key.0)
47+
}
48+
}
49+
50+
impl HasLayout for ink_primitives::Key {
51+
fn layout(&self) -> StorageLayout {
52+
LayoutRange::cell(*self, <[u8; 32] as type_metadata::Metadata>::meta_type())
53+
.into()
54+
}
55+
}
56+
4457
/// Either a concrete layout bound or another layout sub-struct.
4558
#[derive(Debug, PartialEq, Eq, Serialize, From)]
4659
#[serde(bound = "F::TypeId: Serialize")]
@@ -73,7 +86,7 @@ impl IntoCompact for StorageLayout {
7386
#[derive(Debug, PartialEq, Eq, From, Serialize)]
7487
#[serde(transparent)]
7588
pub struct LayoutKey(
76-
/// Internals must be compatible with `ink_core::storage::Key`.
89+
/// Internals must be compatible with `ink_primitives::Key`.
7790
pub [u8; 32],
7891
);
7992

core/Cargo.toml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,35 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
1717
[dependencies]
1818
ink_abi = { path = "../abi/", default-features = false, features = ["derive"], optional = true }
1919
ink_alloc = { path = "../alloc/", default-features = false }
20-
ink_utils = { path = "../utils/" }
20+
ink_primitives = { path = "../primitives/", default-features = false }
2121
ink_core_derive = { path = "derive", default-features = false }
2222
ink_prelude = { path = "../prelude/", default-features = false }
2323

2424
scale = { package = "parity-scale-codec", version = "1.1", default-features = false, features = ["derive", "full"] }
2525
type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"], optional = true }
26-
derive_more = { version = "0.99.2", default-features = false, features = ["from"] }
26+
derive_more = { version = "0.99.2", default-features = false, features = ["from", "display"] }
2727
smallvec = { version = "1.0", default-features = false, features = ["union"] }
2828
cfg-if = "0.1"
29+
num-traits = { version = "0.2.1", default-features = false, features = ["i128"] }
30+
31+
# Only used in the off-chain environment.
32+
#
33+
# Sadly couldn't be marked as dev-dependency.
34+
# Never use this crate outside of the off-chain environment!
35+
rand = { version = "0.7", default-features = false, features = ["alloc"], optional = true }
2936

3037
[features]
31-
default = ["test-env"]
32-
test-env = [
33-
"std",
34-
]
38+
default = ["std"]
3539
std = [
3640
"ink_abi/std",
3741
"ink_alloc/std",
3842
"ink_prelude/std",
43+
"ink_primitives/std",
3944
"scale/std",
4045
"type-metadata/std",
46+
"rand",
47+
"rand/std",
48+
"num-traits/std",
4149
]
4250
ink-generate-abi = [
4351
"ink_abi",

core/derive/tests/ui/pass/allocate_using.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod utils;
1616

1717
use utils::*;
1818

19-
use ink_core::storage::Key;
19+
use ink_primitives::Key;
2020
use ink_core_derive::AllocateUsing;
2121

2222
#[derive(Default)]

0 commit comments

Comments
 (0)