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

chore: update dependencies to support pallet-revive #1900

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,203 changes: 3,144 additions & 1,059 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
resolver = "2"
members = ["crates/*"]

[workspace.dependencies]
ink = { git = "https://github.com/use-ink/ink", branch = "cmichi-remove-wasm-default-to-revive" }
ink_env = { git = "https://github.com/use-ink/ink", branch = "cmichi-remove-wasm-default-to-revive" }
ink_metadata = { git = "https://github.com/use-ink/ink", branch = "cmichi-remove-wasm-default-to-revive" }

sp-core = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067" }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067" }

# We want to reduce the size of build outputs in the CI to increase the effectiveness
# of the cache. Hence we need to apply some basic optimizations and disable everything
# that increases binary size.
Expand Down
16 changes: 6 additions & 10 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ pub use docker::{
};

use anyhow::{
bail,
Context,
Result,
bail
};
use colored::Colorize;
use semver::Version;
Expand Down Expand Up @@ -223,7 +223,7 @@ impl BuildResult {
.to_string()
.bold()
);
return out
return out;
};

let mut out = format!(
Expand Down Expand Up @@ -341,10 +341,7 @@ fn exec_cargo_for_onchain_target(
if matches!(target, Target::RiscV) {
env.push(("RUSTUP_TOOLCHAIN", Some("rve-nightly".to_string())));
fs::create_dir_all(&crate_metadata.target_directory)?;
env.push((
"CARGO_ENCODED_RUSTFLAGS",
Some(format!("{}", rustflags)),
));
env.push(("CARGO_ENCODED_RUSTFLAGS", Some(format!("{}", rustflags))));
} else {
env.push(("CARGO_ENCODED_RUSTFLAGS", Some(rustflags)));
};
Expand Down Expand Up @@ -613,7 +610,7 @@ fn check_dylint_requirements(_working_dir: Option<&Path>) -> Result<()> {
child
} else {
tracing::debug!("Error spawning `{:?}`", cmd);
return false
return false;
};

child.wait().map(|ret| ret.success()).unwrap_or_else(|err| {
Expand Down Expand Up @@ -720,7 +717,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {

// if image exists, then --verifiable was called and we need to build inside docker.
if build_mode == &BuildMode::Verifiable {
return docker_build(args)
return docker_build(args);
}

// The CLI flag `optimization-passes` overwrites optimization passes which are
Expand Down Expand Up @@ -827,7 +824,6 @@ fn local_build(
network,
unstable_flags,
keep_debug_symbols,
extra_lints,
skip_wasm_validation,
target,
max_memory_pages,
Expand Down Expand Up @@ -903,7 +899,7 @@ fn local_build(
crate_metadata.original_code.display(),
pre_fingerprint
);
return Ok((None, build_info, dest_code_path))
return Ok((None, build_info, dest_code_path));
}

verbose_eprintln!(
Expand Down
18 changes: 12 additions & 6 deletions crates/cargo-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ documentation = "https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/"
homepage = "https://www.parity.io/"
description = "Setup and deployment tool for developing Wasm based smart contracts via ink!"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
categories = ["command-line-utilities", "development-tools::build-utils", "development-tools::cargo-plugins"]
include = [
"Cargo.toml", "src/**/*.rs", "README.md", "LICENSE", "build.rs",
categories = [
"command-line-utilities",
"development-tools::build-utils",
"development-tools::cargo-plugins",
]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE", "build.rs"]

[dependencies]
contract-build = { version = "5.0.0-alpha", path = "../build" }
Expand All @@ -26,7 +28,11 @@ contract-analyze = { version = "5.0.0-alpha", path = "../analyze" }

anyhow = "1.0.83"
clap = { version = "4.5.4", features = ["derive", "env"] }
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info", "serde"] }
primitive-types = { version = "0.12.2", default-features = false, features = [
"codec",
"scale-info",
"serde",
] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
which = "6.0.1"
Expand All @@ -44,8 +50,8 @@ comfy-table = "7.1.1"
# dependencies for extrinsics (deploying and calling a contract)
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
subxt = { version = "0.37.0", features = ["substrate-compat"] }
sp-core = "31.0.0"
sp-weights = "30.0.0"
sp-core = { workspace = true }
sp-weights = { workspace = true }
hex = "0.4.3"

[build-dependencies]
Expand Down
6 changes: 4 additions & 2 deletions crates/cargo-contract/src/cmd/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ use contract_extrinsics::{
};
use ink_env::Environment;
use serde::Serialize;
use sp_core::Bytes;
use sp_core::{
Bytes,
H160,
};
use std::{
fmt::{
Debug,
Display,
},
str::FromStr,
};
use sp_core::H160;
use subxt::{
config::{
DefaultExtrinsicParams,
Expand Down
22 changes: 13 additions & 9 deletions crates/extrinsics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentation = "https://docs.rs/contract-extrinsics"
homepage = "https://www.substrate.io/"
description = "Library defining extrinsics for smart contracts on substrate"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
include = ["Cargo.toml", "*.rs", "LICENSE",]
include = ["Cargo.toml", "*.rs", "LICENSE"]

[dependencies]
contract-build = { version = "5.0.0-alpha", path = "../build" }
Expand All @@ -24,26 +24,30 @@ blake2 = { version = "0.10.6", default-features = false }
futures = { version = "0.3.30", default-features = false, features = ["std"] }
itertools = { version = "0.12", default-features = false }
tracing = "0.1.40"
scale = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] }
scale = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
] }
colored = "2.1.0"
serde = { version = "1.0.202", default-features = false, features = ["derive"] }
serde_json = "1.0.117"
url = { version = "2.5.0", features = ["serde"] }
rust_decimal = "1.35"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
sp-core = "31.0.0"
sp-runtime = "34.0.0"
sp-weights = "30.0.0"
pallet-contracts-uapi = { package = "pallet-contracts-uapi-next", version = "=6.0.3", features = ["scale"] }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-weights = { workspace = true }
pallet-contracts-uapi = { package = "pallet-contracts-uapi-next", version = "=6.0.3", features = [
"scale",
] }
scale-info = "2.11.3"
subxt = "0.37.0"
hex = "0.4.3"
derivative = "2.2.0"
ink_metadata = "5.0.0"
ink_env = "5.0.0"
ink_metadata = { workspace = true }
ink_env = { workspace = true }

[dev-dependencies]
ink = "5.0.0"
ink = { workspace = true, features = ["unstable"] }
assert_cmd = "2.0.14"
regex = "1.10.4"
predicates = "3.1.0"
Expand Down
14 changes: 4 additions & 10 deletions crates/extrinsics/src/extrinsic_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with cargo-contract. If not, see <http://www.gnu.org/licenses/>.

use crate::WasmCode;
use sp_core::H160;
use crate::{
upload::Determinism,
WasmCode,
};
use subxt::{
ext::{
codec::Compact,
scale_encode::EncodeAsType,
},
utils::MultiAddress,
use subxt::ext::{
codec::Compact,
scale_encode::EncodeAsType,
};

/// Copied from `sp_weight` to additionally implement `scale_encode::EncodeAsType`.
Expand Down
2 changes: 1 addition & 1 deletion crates/extrinsics/src/extrinsic_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ use crate::{
url_to_string,
ContractArtifacts,
};
use scale::Encode;
use std::{
marker::PhantomData,
option::Option,
path::PathBuf,
};
use scale::Encode;

/// Arguments required for creating and sending an extrinsic to a Substrate node.
#[derive(Derivative)]
Expand Down
7 changes: 5 additions & 2 deletions crates/extrinsics/src/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ use scale::{
Decode,
Encode,
};
use sp_core::{Bytes, H160};
use sp_core::{
Bytes,
H160,
};
use sp_weights::Weight;
use std::fmt::Display;
use subxt::{
Expand Down Expand Up @@ -344,7 +347,7 @@ where
self.args.storage_deposit_limit.unwrap(),
code,
self.args.data.clone(),
None
None,
)
.build();

Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/src/byte_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ where
{
if bytes.is_empty() {
// Return empty string without prepended `0x`.
return serializer.serialize_str("")
return serializer.serialize_str("");
}
serde_hex::serialize(bytes, serializer)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/src/compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn check_contract_ink_compatibility(
.iter()
.any(|req| req.matches(ink_version))
{
return Some(ver)
return Some(ver);
}
None
})
Expand Down
24 changes: 16 additions & 8 deletions crates/transcode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,33 @@ contract-metadata = { version = "5.0.0-alpha", path = "../metadata" }
escape8259 = "0.5.2"
hex = "0.4.3"
indexmap = "2.2.6"
ink_env = "5.0.0"
ink_metadata = "5.0.0"
ink_env = { workspace = true }
ink_metadata = { workspace = true }
itertools = "0.12.1"
tracing = "0.1.40"
nom = "7.1.3"
nom-supreme = { version = "0.7.0", features = ["error"] }
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info", "serde"] }
scale = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] }
scale-info = { version = "2.11.3", default-features = false, features = ["derive"] }
primitive-types = { version = "0.12.2", default-features = false, features = [
"codec",
"scale-info",
"serde",
] }
scale = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
] }
scale-info = { version = "2.11.3", default-features = false, features = [
"derive",
] }
serde = { version = "1.0.202", default-features = false, features = ["derive"] }
serde_json = "1.0.117"
thiserror = "1.0.60"
strsim = "0.11.1"

[dev-dependencies]
assert_matches = "1.5.0"
ink = "5.0.0"
sp-core = "31.0.0"
sp-keyring = "34.0.0"
ink = { workspace = true }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067" }
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", rev = "645878a27115db52e5d63115699b4bbb89034067" }

[features]
# This `std` feature is required for testing using an inline contract's metadata, because `ink!` annotates the metadata
Expand Down
14 changes: 7 additions & 7 deletions crates/transcode/src/account_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ impl AccountId32 {
use base58::FromBase58;
let data = s.from_base58().map_err(|_| FromSs58Error::BadBase58)?;
if data.len() < 2 {
return Err(FromSs58Error::BadLength)
return Err(FromSs58Error::BadLength);
}
let prefix_len = match data[0] {
0..=63 => 1,
64..=127 => 2,
_ => return Err(FromSs58Error::InvalidPrefix),
};
if data.len() != prefix_len + body_len + CHECKSUM_LEN {
return Err(FromSs58Error::BadLength)
return Err(FromSs58Error::BadLength);
}
let hash = ss58hash(&data[0..body_len + prefix_len]);
let checksum = &hash[0..CHECKSUM_LEN];
if data[body_len + prefix_len..body_len + prefix_len + CHECKSUM_LEN] != *checksum
{
// Invalid checksum.
return Err(FromSs58Error::InvalidChecksum)
return Err(FromSs58Error::InvalidChecksum);
}

let result = data[prefix_len..body_len + prefix_len]
Expand Down Expand Up @@ -212,14 +212,14 @@ mod test {
use super::*;

use sp_core::crypto::Ss58Codec;
use sp_keyring::AccountKeyring;
use sp_keyring::Sr25519Keyring;

#[test]
fn ss58_is_compatible_with_substrate_impl() {
let keyrings = vec![
AccountKeyring::Alice,
AccountKeyring::Bob,
AccountKeyring::Charlie,
Sr25519Keyring::Alice,
Sr25519Keyring::Bob,
Sr25519Keyring::Charlie,
];

for keyring in keyrings {
Expand Down
Loading