From 2bbadc96c83f892678d65ddc99593e6cfb54a13a Mon Sep 17 00:00:00 2001
From: StackOverflowExcept1on
<109800286+StackOverflowExcept1on@users.noreply.github.com>
Date: Mon, 17 Jul 2023 17:09:00 +0300
Subject: [PATCH 1/5] refactor(examples): inherit crates from workspace (#2951)
---
examples/async-custom-entry/Cargo.toml | 4 ++--
examples/async-signal-entry/Cargo.toml | 4 ++--
examples/async-signal-entry/src/lib.rs | 2 +-
examples/async-tester/Cargo.toml | 2 +-
examples/async-tester/src/lib.rs | 2 +-
examples/btree/Cargo.toml | 4 ++--
examples/btree/src/lib.rs | 2 +-
examples/calc-hash/Cargo.toml | 2 +-
examples/calc-hash/in-one-block/Cargo.toml | 4 ++--
examples/calc-hash/in-one-block/src/lib.rs | 2 +-
examples/calc-hash/over-blocks/Cargo.toml | 4 ++--
examples/calc-hash/over-blocks/src/lib.rs | 2 +-
examples/calc-hash/src/lib.rs | 2 +-
examples/distributor/Cargo.toml | 4 ++--
examples/distributor/src/lib.rs | 2 +-
examples/messager/Cargo.toml | 2 +-
examples/node/Cargo.toml | 4 ++--
examples/node/src/lib.rs | 2 +-
examples/program-factory/Cargo.toml | 4 ++--
examples/program-factory/src/lib.rs | 2 +-
examples/proxy-relay/Cargo.toml | 6 +++---
examples/proxy-relay/src/lib.rs | 2 +-
examples/proxy-reservation-with-gas/Cargo.toml | 6 +++---
examples/proxy-reservation-with-gas/src/lib.rs | 2 +-
examples/proxy/Cargo.toml | 6 +++---
examples/proxy/src/lib.rs | 2 +-
examples/reservation-manager/Cargo.toml | 2 +-
examples/send-from-reservation/Cargo.toml | 4 ++--
examples/send-from-reservation/src/lib.rs | 2 +-
examples/sys-calls/Cargo.toml | 4 ++--
examples/sys-calls/src/lib.rs | 4 ++--
examples/syscall-error/Cargo.toml | 4 ++--
examples/wait-timeout/Cargo.toml | 4 ++--
examples/wait-timeout/src/lib.rs | 2 +-
examples/waiter/Cargo.toml | 4 ++--
examples/waiter/src/lib.rs | 2 +-
36 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/examples/async-custom-entry/Cargo.toml b/examples/async-custom-entry/Cargo.toml
index 80df2e7dbbd..7a059c0d776 100644
--- a/examples/async-custom-entry/Cargo.toml
+++ b/examples/async-custom-entry/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -20,5 +20,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/async-signal-entry/Cargo.toml b/examples/async-signal-entry/Cargo.toml
index 2153a46fd41..e60c5baaceb 100644
--- a/examples/async-signal-entry/Cargo.toml
+++ b/examples/async-signal-entry/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -20,5 +20,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/async-signal-entry/src/lib.rs b/examples/async-signal-entry/src/lib.rs
index b89d1859b7a..921725da3ef 100644
--- a/examples/async-signal-entry/src/lib.rs
+++ b/examples/async-signal-entry/src/lib.rs
@@ -26,7 +26,7 @@ mod code {
#[cfg(feature = "std")]
pub use code::WASM_BINARY_OPT as WASM_BINARY;
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
#[derive(Debug, Encode, Decode)]
pub enum InitAction {
diff --git a/examples/async-tester/Cargo.toml b/examples/async-tester/Cargo.toml
index 0fa042683f7..114ec3a62a3 100644
--- a/examples/async-tester/Cargo.toml
+++ b/examples/async-tester/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
diff --git a/examples/async-tester/src/lib.rs b/examples/async-tester/src/lib.rs
index fd56051875b..41822dd4176 100644
--- a/examples/async-tester/src/lib.rs
+++ b/examples/async-tester/src/lib.rs
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/btree/Cargo.toml b/examples/btree/Cargo.toml
index ad3c0576e71..4b566bb34d6 100644
--- a/examples/btree/Cargo.toml
+++ b/examples/btree/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -20,5 +20,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/btree/src/lib.rs b/examples/btree/src/lib.rs
index b0e12cd284e..6a4510cc50d 100644
--- a/examples/btree/src/lib.rs
+++ b/examples/btree/src/lib.rs
@@ -28,8 +28,8 @@ pub use code::WASM_BINARY_OPT as WASM_BINARY;
extern crate alloc;
-use codec::{Decode, Encode};
use gstd::prelude::*;
+use parity_scale_codec::{Decode, Encode};
#[derive(Encode, Debug, Decode, PartialEq, Eq)]
pub enum Request {
diff --git a/examples/calc-hash/Cargo.toml b/examples/calc-hash/Cargo.toml
index c085cf4c66d..b61fb33ecf3 100644
--- a/examples/calc-hash/Cargo.toml
+++ b/examples/calc-hash/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"]}
+parity-scale-codec = { workspace = true, features = ["derive"]}
sha2 = { version = "0.10.6", default-features = false }
[build-dependencies]
diff --git a/examples/calc-hash/in-one-block/Cargo.toml b/examples/calc-hash/in-one-block/Cargo.toml
index a31a8b01148..fcd0da368bb 100644
--- a/examples/calc-hash/in-one-block/Cargo.toml
+++ b/examples/calc-hash/in-one-block/Cargo.toml
@@ -7,12 +7,12 @@ license = "GPL-3.0"
workspace = "../../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"]}
+parity-scale-codec = { workspace = true, features = ["derive"]}
gstd.workspace = true
shared = { path = "..", package = "demo-calc-hash" }
[build-dependencies]
-gear-wasm-builder = { path = "../../../utils/wasm-builder" }
+gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
diff --git a/examples/calc-hash/in-one-block/src/lib.rs b/examples/calc-hash/in-one-block/src/lib.rs
index 8bd2715bf26..fafd39d6b22 100644
--- a/examples/calc-hash/in-one-block/src/lib.rs
+++ b/examples/calc-hash/in-one-block/src/lib.rs
@@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
#![no_std]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/calc-hash/over-blocks/Cargo.toml b/examples/calc-hash/over-blocks/Cargo.toml
index 1882dcf3f09..f3795a7d0b0 100644
--- a/examples/calc-hash/over-blocks/Cargo.toml
+++ b/examples/calc-hash/over-blocks/Cargo.toml
@@ -7,12 +7,12 @@ license = "GPL-3.0"
workspace = "../../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"]}
+parity-scale-codec = { workspace = true, features = ["derive"]}
gstd.workspace = true
shared = { path = "../", package = "demo-calc-hash" }
[build-dependencies]
-gear-wasm-builder = { path = "../../../utils/wasm-builder" }
+gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
diff --git a/examples/calc-hash/over-blocks/src/lib.rs b/examples/calc-hash/over-blocks/src/lib.rs
index 31601d44ce6..7c0054dd056 100644
--- a/examples/calc-hash/over-blocks/src/lib.rs
+++ b/examples/calc-hash/over-blocks/src/lib.rs
@@ -17,7 +17,7 @@
// along with this program. If not, see .
#![no_std]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
use shared::PackageId;
#[cfg(feature = "std")]
diff --git a/examples/calc-hash/src/lib.rs b/examples/calc-hash/src/lib.rs
index 83cabb8f870..fbf5ed779b0 100644
--- a/examples/calc-hash/src/lib.rs
+++ b/examples/calc-hash/src/lib.rs
@@ -2,7 +2,7 @@
extern crate alloc;
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
use sha2::Digest;
pub type PackageId = [u8; 32];
diff --git a/examples/distributor/Cargo.toml b/examples/distributor/Cargo.toml
index bc754787a82..00d2f03613f 100644
--- a/examples/distributor/Cargo.toml
+++ b/examples/distributor/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -21,5 +21,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/distributor/src/lib.rs b/examples/distributor/src/lib.rs
index 785fc47ad37..1c355820a6d 100644
--- a/examples/distributor/src/lib.rs
+++ b/examples/distributor/src/lib.rs
@@ -20,8 +20,8 @@
extern crate alloc;
-use codec::{Decode, Encode};
use gstd::{prelude::*, ActorId};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/messager/Cargo.toml b/examples/messager/Cargo.toml
index d9702547ea4..cc570e340ab 100644
--- a/examples/messager/Cargo.toml
+++ b/examples/messager/Cargo.toml
@@ -10,7 +10,7 @@ workspace = "../../"
gstd.workspace = true
[build-dependencies]
-gear-wasm-builder = { path = "../../utils/wasm-builder" }
+gear-wasm-builder.workspace = true
[features]
std = []
diff --git a/examples/node/Cargo.toml b/examples/node/Cargo.toml
index f260cd2aa32..097453824e4 100644
--- a/examples/node/Cargo.toml
+++ b/examples/node/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -21,5 +21,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/node/src/lib.rs b/examples/node/src/lib.rs
index 8181863a61e..04daeef71bc 100644
--- a/examples/node/src/lib.rs
+++ b/examples/node/src/lib.rs
@@ -21,8 +21,8 @@
extern crate alloc;
use alloc::collections::BTreeSet;
-use codec::{Decode, Encode};
use gstd::{debug, exec, msg, prelude::*, ActorId, MessageId};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/program-factory/Cargo.toml b/examples/program-factory/Cargo.toml
index 67ef3ceb1f4..09539fd458c 100644
--- a/examples/program-factory/Cargo.toml
+++ b/examples/program-factory/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
hex-literal = "*"
@@ -21,5 +21,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/program-factory/src/lib.rs b/examples/program-factory/src/lib.rs
index 64d014d1cda..8e3f6db7467 100644
--- a/examples/program-factory/src/lib.rs
+++ b/examples/program-factory/src/lib.rs
@@ -24,9 +24,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
#[cfg(not(feature = "std"))]
use gstd::prelude::*;
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/proxy-relay/Cargo.toml b/examples/proxy-relay/Cargo.toml
index 45a12020fce..b12547ba515 100644
--- a/examples/proxy-relay/Cargo.toml
+++ b/examples/proxy-relay/Cargo.toml
@@ -7,9 +7,9 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
-scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
+scale-info = { workspace = true, features = ["derive"] }
[build-dependencies]
gear-wasm-builder.workspace = true
@@ -18,5 +18,5 @@ gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std", "scale-info/std"]
+std = ["parity-scale-codec/std", "scale-info/std"]
default = ["std"]
diff --git a/examples/proxy-relay/src/lib.rs b/examples/proxy-relay/src/lib.rs
index 1a191507d70..4852a5435f1 100644
--- a/examples/proxy-relay/src/lib.rs
+++ b/examples/proxy-relay/src/lib.rs
@@ -18,8 +18,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
use gstd::Vec;
+use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
diff --git a/examples/proxy-reservation-with-gas/Cargo.toml b/examples/proxy-reservation-with-gas/Cargo.toml
index 4dbb8803fda..4371dac5811 100644
--- a/examples/proxy-reservation-with-gas/Cargo.toml
+++ b/examples/proxy-reservation-with-gas/Cargo.toml
@@ -7,9 +7,9 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
-scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
+scale-info = { workspace = true, features = ["derive"] }
[build-dependencies]
gear-wasm-builder.workspace = true
@@ -18,5 +18,5 @@ gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std", "scale-info/std"]
+std = ["parity-scale-codec/std", "scale-info/std"]
default = ["std"]
diff --git a/examples/proxy-reservation-with-gas/src/lib.rs b/examples/proxy-reservation-with-gas/src/lib.rs
index cb7c3791d06..00a5c6f8a6a 100644
--- a/examples/proxy-reservation-with-gas/src/lib.rs
+++ b/examples/proxy-reservation-with-gas/src/lib.rs
@@ -18,7 +18,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml
index e6eb980087b..e3603c7e609 100644
--- a/examples/proxy/Cargo.toml
+++ b/examples/proxy/Cargo.toml
@@ -8,8 +8,8 @@ workspace = "../../"
[dependencies]
gstd = { workspace = true }
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
-scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
+scale-info = { workspace = true, features = ["derive"] }
[build-dependencies]
gear-wasm-builder.workspace = true
@@ -19,5 +19,5 @@ gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
wasm-wrapper = []
-std = ["wasm-wrapper", "codec/std", "scale-info/std"]
+std = ["wasm-wrapper", "parity-scale-codec/std", "scale-info/std"]
default = ["std"]
diff --git a/examples/proxy/src/lib.rs b/examples/proxy/src/lib.rs
index 96fcd51fd32..91cc0648d14 100644
--- a/examples/proxy/src/lib.rs
+++ b/examples/proxy/src/lib.rs
@@ -18,7 +18,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "wasm-wrapper")]
diff --git a/examples/reservation-manager/Cargo.toml b/examples/reservation-manager/Cargo.toml
index 1d00c38a043..df7f282d5ff 100644
--- a/examples/reservation-manager/Cargo.toml
+++ b/examples/reservation-manager/Cargo.toml
@@ -8,7 +8,7 @@ workspace = "../../"
[dependencies]
gstd.workspace = true
-parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
[build-dependencies]
gear-wasm-builder.workspace = true
diff --git a/examples/send-from-reservation/Cargo.toml b/examples/send-from-reservation/Cargo.toml
index cfbb0503d7e..0cfee5b00e8 100644
--- a/examples/send-from-reservation/Cargo.toml
+++ b/examples/send-from-reservation/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
[build-dependencies]
@@ -20,5 +20,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/send-from-reservation/src/lib.rs b/examples/send-from-reservation/src/lib.rs
index 50071d4f7ee..aa927e0333e 100644
--- a/examples/send-from-reservation/src/lib.rs
+++ b/examples/send-from-reservation/src/lib.rs
@@ -18,7 +18,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/sys-calls/Cargo.toml b/examples/sys-calls/Cargo.toml
index d628842162f..ba8908b4021 100644
--- a/examples/sys-calls/Cargo.toml
+++ b/examples/sys-calls/Cargo.toml
@@ -8,7 +8,7 @@ workspace = "../../"
[dependencies]
gstd = { workspace = true }
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
[build-dependencies]
gear-wasm-builder.workspace = true
@@ -18,5 +18,5 @@ gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
wasm-wrapper = []
-std = ["wasm-wrapper", "codec/std"]
+std = ["wasm-wrapper", "parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/sys-calls/src/lib.rs b/examples/sys-calls/src/lib.rs
index 40a73d2037c..49601408e14 100644
--- a/examples/sys-calls/src/lib.rs
+++ b/examples/sys-calls/src/lib.rs
@@ -20,7 +20,7 @@
extern crate alloc;
-use codec::{Decode, Encode};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "wasm-wrapper")]
mod code {
@@ -108,13 +108,13 @@ pub const PAY_PROGRAM_RENT_EXPECT: &str = "Unable to pay rent";
#[cfg(not(feature = "wasm-wrapper"))]
mod wasm {
use super::Kind;
- use codec::Encode;
use gstd::{
errors::{ReplyCode, SignalCode, SimpleExecutionError},
exec, format,
msg::{self, MessageHandle},
prog, ActorId, CodeId, MessageId, ReservationId, Vec,
};
+ use parity_scale_codec::Encode;
static mut CODE_ID: CodeId = CodeId::new([0u8; 32]);
static mut SIGNAL_DETAILS: (MessageId, SignalCode, ActorId) = (
diff --git a/examples/syscall-error/Cargo.toml b/examples/syscall-error/Cargo.toml
index 1047919ae6a..885b3139f81 100644
--- a/examples/syscall-error/Cargo.toml
+++ b/examples/syscall-error/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
gsys.workspace = true
@@ -21,5 +21,5 @@ gtest.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/wait-timeout/Cargo.toml b/examples/wait-timeout/Cargo.toml
index 330caa0c9df..dcd5f2521bd 100644
--- a/examples/wait-timeout/Cargo.toml
+++ b/examples/wait-timeout/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
gstd.workspace = true
futures = { version = "0.3", default-features = false, features = ["alloc"] }
@@ -20,5 +20,5 @@ gear-wasm-builder.workspace = true
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/wait-timeout/src/lib.rs b/examples/wait-timeout/src/lib.rs
index 3b5efee30b8..51c746d1082 100644
--- a/examples/wait-timeout/src/lib.rs
+++ b/examples/wait-timeout/src/lib.rs
@@ -18,8 +18,8 @@
#![no_std]
-use codec::{Decode, Encode};
use gstd::ActorId;
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
diff --git a/examples/waiter/Cargo.toml b/examples/waiter/Cargo.toml
index 2a73c8b1653..a72ef94b3a5 100644
--- a/examples/waiter/Cargo.toml
+++ b/examples/waiter/Cargo.toml
@@ -7,7 +7,7 @@ license = "GPL-3.0"
workspace = "../../"
[dependencies]
-codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
+parity-scale-codec = { workspace = true, features = ["derive"] }
futures.workspace = true
gstd.workspace = true
@@ -23,5 +23,5 @@ demo-waiter = { path = ".", features = ["debug"] }
[features]
debug = ["gstd/debug"]
-std = ["codec/std"]
+std = ["parity-scale-codec/std"]
default = ["std"]
diff --git a/examples/waiter/src/lib.rs b/examples/waiter/src/lib.rs
index 69795a18e21..d02e5988083 100644
--- a/examples/waiter/src/lib.rs
+++ b/examples/waiter/src/lib.rs
@@ -17,8 +17,8 @@
// along with this program. If not, see .
#![no_std]
-use codec::{Decode, Encode};
use gstd::{ActorId, Vec};
+use parity_scale_codec::{Decode, Encode};
#[cfg(feature = "std")]
mod code {
From 6e1bc61a3c1f52921652f790757ccceafce3211a Mon Sep 17 00:00:00 2001
From: Arsenii Lyashenko
Date: Mon, 17 Jul 2023 17:45:03 +0300
Subject: [PATCH 2/5] chore: Exclude weight files from stats (#2950)
---
.gitattributes | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.gitattributes b/.gitattributes
index 92aff2ba136..6735b9f34ac 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,5 +4,7 @@
*.jpg binary
*.wasm binary
-**/Cargo.lock linguist-generated=true
-**/package-lock.json linguist-generated=true
+**/Cargo.lock linguist-generated
+**/package-lock.json linguist-generated
+**/weights.rs linguist-generated
+**/src/weights/** linguist-generated
From 5f1c499f26956901f21f3892b1593910fb09def6 Mon Sep 17 00:00:00 2001
From: Arsenii Lyashenko
Date: Mon, 17 Jul 2023 21:33:11 +0300
Subject: [PATCH 3/5] ci: Add missing cargo init step (#2956)
---
.github/workflows/CI.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml
index 533197300e1..54fd8d02ece 100644
--- a/.github/workflows/CI.yaml
+++ b/.github/workflows/CI.yaml
@@ -159,6 +159,9 @@ jobs:
- name: "ACTIONS: Setup environment variable"
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage')
run: echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV
+
+ - name: "Buid: Init"
+ run: ./scripts/gear.sh init cargo
- name: "Build: Gear"
run: ./scripts/gear.sh build gear --locked --release
From 5be5da0a68687bb04055882494b48b703fab0c52 Mon Sep 17 00:00:00 2001
From: StackOverflowExcept1on
<109800286+StackOverflowExcept1on@users.noreply.github.com>
Date: Tue, 18 Jul 2023 15:57:30 +0300
Subject: [PATCH 4/5] chore(gclient): improve `get_state` test (#2955)
---
gclient/tests/state.rs | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs
index d3740f15930..eed29c931f7 100644
--- a/gclient/tests/state.rs
+++ b/gclient/tests/state.rs
@@ -20,10 +20,6 @@ use demo_meta_io::Wallet;
use gclient::{EventProcessor, GearApi};
use gmeta::MetadataRepr;
use parity_scale_codec::Decode;
-use tokio::fs;
-
-// TODO: remove in order to directly import metadata (issue #2945).
-const META_PATH: &str = "../examples/new-meta/demo_new_meta.meta.txt";
#[tokio::test]
async fn get_state() -> anyhow::Result<()> {
@@ -56,9 +52,8 @@ async fn get_state() -> anyhow::Result<()> {
// Read and check `metahash`
let actual_metahash = api.read_metahash(program_id).await?.0;
- let meta = fs::read_to_string(META_PATH).await?;
- let expected_metahash = MetadataRepr::from_hex(meta)
- .expect("Failed to read meta from hex")
+ let expected_metahash = MetadataRepr::from_bytes(demo_new_meta::WASM_METADATA)
+ .expect("Failed to read meta from bytes")
.hash();
assert_eq!(actual_metahash, expected_metahash);
From 96b0558a6f7240b9e5e43a714e3aded3548d2847 Mon Sep 17 00:00:00 2001
From: Georgy Shepelev
Date: Wed, 19 Jul 2023 09:13:24 +0400
Subject: [PATCH 5/5] refactor(sandbox-host): Remove unnecessary 'host-sandbox'
feature (#2954)
---
core-backend/sandbox/Cargo.toml | 2 +-
lazy-pages/Cargo.toml | 2 +-
runtime-interface/Cargo.toml | 1 -
runtime-interface/src/gear_sandbox/detail.rs | 2 +-
sandbox/host/Cargo.toml | 8 +---
sandbox/host/src/sandbox.rs | 50 +++++---------------
sandbox/sandbox/Cargo.toml | 1 -
sandbox/sandbox/src/lib.rs | 4 +-
8 files changed, 19 insertions(+), 51 deletions(-)
diff --git a/core-backend/sandbox/Cargo.toml b/core-backend/sandbox/Cargo.toml
index 796413827ec..4d9b264c6d3 100644
--- a/core-backend/sandbox/Cargo.toml
+++ b/core-backend/sandbox/Cargo.toml
@@ -12,7 +12,7 @@ gear-backend-common.workspace = true
gsys ={ workspace = true }
gear-wasm-instrument.workspace = true
-gear-sandbox = { workspace = true, features = ["host-sandbox"] }
+gear-sandbox.workspace = true
# Use max_level_debug feature to remove tracing in sys-calls by default.
log.workspace = true
derive_more.workspace = true
diff --git a/lazy-pages/Cargo.toml b/lazy-pages/Cargo.toml
index ce90b741a49..a088e0b9a48 100644
--- a/lazy-pages/Cargo.toml
+++ b/lazy-pages/Cargo.toml
@@ -20,7 +20,7 @@ derive_more.workspace = true
static_assertions.workspace = true
once_cell.workspace = true
-gear-sandbox-host = { workspace = true, features = ["host-sandbox"] }
+gear-sandbox-host.workspace = true
gear-core.workspace = true
gear-backend-common.workspace = true
diff --git a/runtime-interface/Cargo.toml b/runtime-interface/Cargo.toml
index 861e339545b..5bdad24e5a5 100644
--- a/runtime-interface/Cargo.toml
+++ b/runtime-interface/Cargo.toml
@@ -40,4 +40,3 @@ std = [
"region",
"gear-sandbox-host",
]
-host-sandbox = ["gear-sandbox-host?/host-sandbox"]
diff --git a/runtime-interface/src/gear_sandbox/detail.rs b/runtime-interface/src/gear_sandbox/detail.rs
index a0e1d47c22b..33cd6697b87 100644
--- a/runtime-interface/src/gear_sandbox/detail.rs
+++ b/runtime-interface/src/gear_sandbox/detail.rs
@@ -35,7 +35,7 @@ impl Store {
pub fn new() -> Self {
Self {
store_data_key: 0,
- store: sandbox_env::Store::new(sandbox_env::SandboxBackend::TryWasmer),
+ store: sandbox_env::Store::new(sandbox_env::SandboxBackend::Wasmer),
}
}
diff --git a/sandbox/host/Cargo.toml b/sandbox/host/Cargo.toml
index 4d5ecdf98cb..854f36e26a0 100644
--- a/sandbox/host/Cargo.toml
+++ b/sandbox/host/Cargo.toml
@@ -17,7 +17,7 @@ codec = { workspace = true, features = ["std"] }
environmental = "1.1.3"
thiserror.workspace = true
log = { workspace = true, features = ["std"] }
-wasmer = { version = "2.2", features = ["singlepass"], optional = true }
+wasmer = { version = "2.2", features = ["singlepass"] }
wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", features = ["virtual_memory"] }
sp-allocator = { workspace = true, features = ["std"] }
sp-wasm-interface = { workspace = true, features = ["std"] }
@@ -27,8 +27,4 @@ once_cell = "1.17.1"
tempfile = "3.5.0"
[features]
-default = ["host-sandbox"]
-host-sandbox = [
- "wasmer",
- "wasmer-cache",
-]
+default = ["wasmer-cache"]
diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs
index 5b0dae9f3fc..4cafa6502a6 100644
--- a/sandbox/host/src/sandbox.rs
+++ b/sandbox/host/src/sandbox.rs
@@ -20,7 +20,6 @@
//!
//! Sandboxing is backed by wasmi and wasmer, depending on the configuration.
-#[cfg(feature = "host-sandbox")]
mod wasmer_backend;
mod wasmi_backend;
@@ -35,16 +34,17 @@ use crate::{
util,
};
-#[cfg(feature = "host-sandbox")]
-use self::wasmer_backend::{
- get_global as wasmer_get_global, instantiate as wasmer_instantiate, invoke as wasmer_invoke,
- new_memory as wasmer_new_memory, set_global as wasmer_set_global, Backend as WasmerBackend,
- MemoryWrapper as WasmerMemoryWrapper,
-};
-use self::wasmi_backend::{
- get_global as wasmi_get_global, instantiate as wasmi_instantiate, invoke as wasmi_invoke,
- new_memory as wasmi_new_memory, set_global as wasmi_set_global,
- MemoryWrapper as WasmiMemoryWrapper,
+use self::{
+ wasmer_backend::{
+ get_global as wasmer_get_global, instantiate as wasmer_instantiate,
+ invoke as wasmer_invoke, new_memory as wasmer_new_memory, set_global as wasmer_set_global,
+ Backend as WasmerBackend, MemoryWrapper as WasmerMemoryWrapper,
+ },
+ wasmi_backend::{
+ get_global as wasmi_get_global, instantiate as wasmi_instantiate, invoke as wasmi_invoke,
+ new_memory as wasmi_new_memory, set_global as wasmi_set_global,
+ MemoryWrapper as WasmiMemoryWrapper,
+ },
};
pub use gear_sandbox_env as env;
@@ -186,7 +186,6 @@ enum BackendInstance {
Wasmi(wasmi::ModuleRef),
/// Wasmer module instance
- #[cfg(feature = "host-sandbox")]
Wasmer(wasmer::Instance),
}
@@ -225,7 +224,6 @@ impl SandboxInstance {
wasmi_invoke(self, wasmi_instance, export_name, args, sandbox_context)
}
- #[cfg(feature = "host-sandbox")]
BackendInstance::Wasmer(wasmer_instance) => {
wasmer_invoke(wasmer_instance, export_name, args, sandbox_context)
}
@@ -239,7 +237,6 @@ impl SandboxInstance {
match &self.backend_instance {
BackendInstance::Wasmi(wasmi_instance) => wasmi_get_global(wasmi_instance, name),
- #[cfg(feature = "host-sandbox")]
BackendInstance::Wasmer(wasmer_instance) => wasmer_get_global(wasmer_instance, name),
}
}
@@ -255,7 +252,6 @@ impl SandboxInstance {
match &self.backend_instance {
BackendInstance::Wasmi(wasmi_instance) => wasmi_set_global(wasmi_instance, name, value),
- #[cfg(feature = "host-sandbox")]
BackendInstance::Wasmer(wasmer_instance) => {
wasmer_set_global(wasmer_instance, name, value)
}
@@ -369,11 +365,7 @@ pub enum SandboxBackend {
Wasmi,
/// Wasmer environment
- #[cfg(feature = "host-sandbox")]
Wasmer,
-
- /// Use wasmer backend if available. Fall back to wasmi otherwise.
- TryWasmer,
}
/// Memory reference in terms of a selected backend
@@ -383,7 +375,6 @@ pub enum Memory {
Wasmi(WasmiMemoryWrapper),
/// Wasmer memory refernce
- #[cfg(feature = "host-sandbox")]
Wasmer(WasmerMemoryWrapper),
}
@@ -393,13 +384,11 @@ impl Memory {
match self {
Memory::Wasmi(memory) => Some(memory.clone()),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(_) => None,
}
}
/// View as wasmer memory
- #[cfg(feature = "host-sandbox")]
pub fn as_wasmer(&self) -> Option {
match self {
Memory::Wasmer(memory) => Some(memory.clone()),
@@ -413,7 +402,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.read(source_addr, size),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => sandboxed_memory.read(source_addr, size),
}
}
@@ -422,7 +410,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.read_into(source_addr, destination),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => {
sandboxed_memory.read_into(source_addr, destination)
}
@@ -433,7 +420,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.write_from(dest_addr, source),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => sandboxed_memory.write_from(dest_addr, source),
}
}
@@ -442,7 +428,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.memory_grow(pages),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => sandboxed_memory.memory_grow(pages),
}
}
@@ -451,7 +436,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.memory_size(),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => sandboxed_memory.memory_size(),
}
}
@@ -460,7 +444,6 @@ impl util::MemoryTransfer for Memory {
match self {
Memory::Wasmi(sandboxed_memory) => sandboxed_memory.get_buff(),
- #[cfg(feature = "host-sandbox")]
Memory::Wasmer(sandboxed_memory) => sandboxed_memory.get_buff(),
}
}
@@ -472,7 +455,6 @@ enum BackendContext {
Wasmi,
/// Wasmer specific context
- #[cfg(feature = "host-sandbox")]
Wasmer(WasmerBackend),
}
@@ -481,13 +463,7 @@ impl BackendContext {
match backend {
SandboxBackend::Wasmi => BackendContext::Wasmi,
- #[cfg(not(feature = "host-sandbox"))]
- SandboxBackend::TryWasmer => BackendContext::Wasmi,
-
- #[cfg(feature = "host-sandbox")]
- SandboxBackend::Wasmer | SandboxBackend::TryWasmer => {
- BackendContext::Wasmer(WasmerBackend::new())
- }
+ SandboxBackend::Wasmer => BackendContext::Wasmer(WasmerBackend::new()),
}
}
}
@@ -554,7 +530,6 @@ impl Store {
let memory = match &backend_context {
BackendContext::Wasmi => wasmi_new_memory(initial, maximum)?,
- #[cfg(feature = "host-sandbox")]
BackendContext::Wasmer(context) => wasmer_new_memory(context, initial, maximum)?,
};
@@ -661,7 +636,6 @@ impl Store {
let sandbox_instance = match self.backend_context {
BackendContext::Wasmi => wasmi_instantiate(wasm, guest_env, sandbox_context)?,
- #[cfg(feature = "host-sandbox")]
BackendContext::Wasmer(ref context) => {
wasmer_instantiate(context, wasm, guest_env, sandbox_context)?
}
diff --git a/sandbox/sandbox/Cargo.toml b/sandbox/sandbox/Cargo.toml
index 36dbf5ddaed..9332dfdeefd 100644
--- a/sandbox/sandbox/Cargo.toml
+++ b/sandbox/sandbox/Cargo.toml
@@ -40,4 +40,3 @@ std = [
"wasmi/virtual_memory",
]
strict = []
-host-sandbox = ["gear-runtime-interface/host-sandbox"]
diff --git a/sandbox/sandbox/src/lib.rs b/sandbox/sandbox/src/lib.rs
index 7e9fda46ad3..ccbf1be9969 100644
--- a/sandbox/sandbox/src/lib.rs
+++ b/sandbox/sandbox/src/lib.rs
@@ -52,10 +52,10 @@ use sp_std::prelude::*;
use sp_wasm_interface::HostPointer;
pub use sp_wasm_interface::{ReturnValue, Value};
-#[cfg(not(all(feature = "host-sandbox", not(feature = "std"))))]
+#[cfg(feature = "std")]
pub use self::embedded_executor as default_executor;
pub use self::env::HostError;
-#[cfg(all(feature = "host-sandbox", not(feature = "std")))]
+#[cfg(not(feature = "std"))]
pub use self::host_executor as default_executor;
/// The target used for logging.