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

fix/add-exceptions-to-cargo-deny #1722

Merged
merged 9 commits into from
Nov 17, 2024
Merged
612 changes: 121 additions & 491 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ tracing = "0.1.37"
tracing-subscriber = "0.3.16"
tracing-appender = "0.2.2"
which = "4.4.0"
wasmparser = "0.90.0"
wasmparser = "0.116.1"
directories = "5.0.1"
ulid = "1.1"
termcolor = "1.1.3"
Expand All @@ -100,7 +100,11 @@ ed25519-dalek = ">= 2.1.1"
http = "1.0.0"
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
tokio = "1.28.1"
walkdir = "2.5.0"
toml_edit = "0.22.20"
toml = "0.8.19"
reqwest = "0.12.7"
predicates = "3.1.2"

[profile.test-wasms]
inherits = "release"
Expand Down
4 changes: 2 additions & 2 deletions cmd/crates/soroban-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ thiserror = "1.0.31"
sha2 = "0.10.6"
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
predicates = { workspace = true }
fs_extra = "1.3.0"
toml = "0.8.10"
toml = { workspace = true }


[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2", features = ["testutils"]}
soroban-sdk = { workspace = true, features = ["testutils"]}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ impl CustomAccountInterface for Contract {
return Err(Error::NotPermitted);
}
}
Context::CreateContractHostFn(_) => return Err(Error::InvalidContext),
Context::CreateContractWithCtorHostFn(_) | Context::CreateContractHostFn(_) => {
return Err(Error::InvalidContext)
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"]
doctest = false

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2", features = ["testutils"]}
soroban-sdk = { workspace = true, features = ["testutils"]}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"]
doctest = false

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2", features = ["testutils"]}
soroban-sdk = { workspace = true, features = ["testutils"]}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod test {
#[test]
fn test_hello() {
let env = Env::default();
let contract_id = env.register_contract(None, Contract);
let contract_id = env.register(Contract, ());
let client = ContractClient::new(&env, &contract_id);
let world = symbol_short!("world");
let res = client.hello(&world);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2", features = ["testutils"] }
soroban-sdk = { workspace = true, features = ["testutils"] }
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn create_token_contract<'a>(e: &Env, admin: &Address) -> (TokenClient<'a>, Toke
}

fn create_atomic_swap_contract(e: &Env) -> AtomicSwapContractClient {
AtomicSwapContractClient::new(e, &e.register_contract(None, AtomicSwapContract {}))
AtomicSwapContractClient::new(e, &e.register(AtomicSwapContract {}, ()))
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ rust-version.workspace = true
crate-type = ["cdylib"]

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-token-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }
soroban-token-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2", features = ["testutils"] }
soroban-sdk = { workspace = true, features = ["testutils"] }
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use soroban_sdk::{
};

fn create_token<'a>(e: &Env, admin: &Address) -> TokenClient<'a> {
let token = TokenClient::new(e, &e.register_contract(None, Token {}));
let token = TokenClient::new(e, &e.register(Token {}, ()));
token.initialize(admin, &7, &"name".into_val(e), &"symbol".into_val(e));
token
}
Expand Down Expand Up @@ -247,7 +247,7 @@ fn initialize_already_initialized() {
fn decimal_is_over_max() {
let e = Env::default();
let admin = Address::generate(&e);
let token = TokenClient::new(&e, &e.register_contract(None, Token {}));
let token = TokenClient::new(&e, &e.register(Token {}, ()));
token.initialize(
&admin,
&(u32::from(u8::MAX) + 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { version = "=21.7.2" }
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { version = "=21.7.2" , features = ["testutils"]}
soroban-sdk = { workspace = true , features = ["testutils"]}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mod test {
#[test]
fn test_add() {
let e = Env::default();
let contract_id = e.register_contract(None, Contract);
let contract_id = e.register(Contract, ());
let client = ContractClient::new(&e, &contract_id);

let udt = UdtStruct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async fn invoke() {
.arg("--id")
.arg(id)
.assert()
.stdout(predicates::str::contains(id).not())
.stdout(predicates::str::contains(id))
leighmcculloch marked this conversation as resolved.
Show resolved Hide resolved
.success();
invoke_hello_world_with_lib(sandbox, id).await;
let config_locator = locator::Args {
Expand Down
6 changes: 3 additions & 3 deletions cmd/crates/stellar-ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ thiserror = "1.0.32"
serde = "1.0.82"
serde_derive = "1.0.82"
serde_json = "1.0.82"
sha2 = "0.9.9"
sha2 = { workspace = true }
ed25519-dalek = { workspace = true }
stellar-strkey = { workspace = true }
ledger-transport-hid = "0.10.0"
ledger-transport = "0.10.0"
sep5.workspace = true
slip10 = "0.4.3"
slip10 = { package = "slipped10", version = "0.4.6" }
tracing = { workspace = true }
hex.workspace = true
byteorder = "1.5.0"
bollard = { workspace = true }
home = "0.5.9"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
reqwest = { workspace = true, features = ["json"] }
soroban-rpc.workspace = true
phf = { version = "0.11.2", features = ["macros"] }
futures = "0.3.30"
Expand Down
13 changes: 6 additions & 7 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ reqwest = { version = "0.12.7", default-features = false, features = [
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
regex = "1.6.0"
wasm-opt = { version = "0.114.0", optional = true }
wasm-opt = { version = "0.116.1", optional = true }
chrono = { version = "0.4.27", features = ["serde"] }
rpassword = "7.2.0"
dirs = "4.0.0"
toml = "0.5.9"
toml = { workspace = true }
itertools = "0.10.5"
shlex = "1.1.0"
sep5 = { workspace = true }
ethnum = { workspace = true }
clap-markdown = { version = "0.1.4", optional = true }
which = { workspace = true, features = ["regex"] }
strsim = "0.10.0"
strsim = "0.11.1"
heck = "0.5.0"
tracing = { workspace = true }
tracing-appender = { workspace = true }
Expand All @@ -109,7 +108,7 @@ strum_macros = "0.17.1"
async-compression = { version = "0.4.12", features = ["tokio", "gzip"] }
shell-escape = "0.1.5"
tempfile = "3.8.1"
toml_edit = "0.21.0"
toml_edit = { workspace = true }
rust-embed = { version = "8.2.0", features = ["debug-embed"] }
bollard = { workspace = true }
futures-util = "0.3.30"
Expand All @@ -127,14 +126,14 @@ url = "2.5.2"
wasm-gen = "0.1.4"

[build-dependencies]
crate-git-revision = "0.0.4"
crate-git-revision = "0.0.6"
serde.workspace = true
thiserror.workspace = true


[dev-dependencies]
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
predicates = { workspace = true }
walkdir = "2.5.0"
mockito = "1.5.0"
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ mod tests {
let contract_dir = project_dir.join("contracts").join(contract_name);
let cargo_toml_path = contract_dir.as_path().join("Cargo.toml");
let cargo_toml_str = read_to_string(cargo_toml_path.clone()).unwrap();
let doc = cargo_toml_str.parse::<toml_edit::Document>().unwrap();
let doc: toml_edit::DocumentMut = cargo_toml_str.parse().unwrap();
assert!(
doc.get("dependencies")
.unwrap()
Expand Down
9 changes: 5 additions & 4 deletions cmd/soroban-cli/src/config/locator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use clap::arg;
use directories::UserDirs;
use itertools::Itertools;
use serde::de::DeserializeOwned;
use std::{
Expand Down Expand Up @@ -414,11 +415,10 @@ impl KeyType {
}

pub fn read_from_path<T: DeserializeOwned>(path: &Path) -> Result<T, Error> {
let data = fs::read(path).map_err(|_| Error::NetworkFileRead {
let data = fs::read_to_string(path).map_err(|_| Error::NetworkFileRead {
path: path.to_path_buf(),
})?;
let res = toml::from_slice(data.as_slice());
Ok(res?)
Ok(toml::from_str(&data)?)
}

pub fn read_with_global<T: DeserializeOwned>(&self, key: &str, pwd: &Path) -> Result<T, Error> {
Expand Down Expand Up @@ -489,8 +489,9 @@ pub fn global_config_path() -> Result<PathBuf, Error> {
let config_dir = if let Ok(config_home) = std::env::var("XDG_CONFIG_HOME") {
PathBuf::from_str(&config_home).map_err(|_| Error::XdgConfigHome(config_home))?
} else {
dirs::home_dir()
UserDirs::new()
.ok_or(Error::HomeDirNotFound)?
.home_dir()
.join(".config")
};

Expand Down
5 changes: 2 additions & 3 deletions cmd/soroban-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ impl Config {
let path = locator::config_file()?;

if path.exists() {
let data = fs::read(&path).map_err(|_| locator::Error::FileRead { path })?;

Ok(toml::from_slice(&data)?)
let data = fs::read_to_string(&path).map_err(|_| locator::Error::FileRead { path })?;
Ok(toml::from_str(&data)?)
} else {
Ok(Config::default())
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/utils/contract-template/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use soroban_sdk::{vec, Env, String};
#[test]
fn test() {
let env = Env::default();
let contract_id = env.register_contract(None, Contract);
let contract_id = env.register(Contract, ());
let client = ContractClient::new(&env, &contract_id);

let words = client.hello(&String::from_str(&env, "Dev"));
Expand Down
57 changes: 57 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,63 @@ deny = [

# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [

# Requires updating slipped10 to newest sha2 others are dependents that will be updated
{ crate = "sha2", reason = "temporary duplicate until upstream updates" },
willemneal marked this conversation as resolved.
Show resolved Hide resolved
{ crate = "digest", reason = "temporary duplicate until upstream updates" },
{ crate = "block-buffer", reason = "temporary duplicate until upstream updates" },
# slipped again 0.12.1
{ crate = "hmac", reason = "temp" },

# update rpassword, hidapi (then ledger-transport-hid), and dirs-sys (then directories) to 0.52
# { crate = "window-sys", reason = "temp" },

# syn is too large of a surface to check
{ crate = "syn", reason = "Too many crates haven't updated to v2" },

# Need to release new version and update all stellar crates
{ crate = "stellar-strkey", reason = "Temp until new release and updates upstream", version = "0.0.8" },

# Need to update jsonrpsee in stellar-rpc-client
{ crate = "rustls-pemfile", reason = "Temp until new release and updates upstream" },
{ crate = "rustls-webpki", reason = "Temp until new release and updates upstream" },
{ crate = "rustls-native-certs", reason = "Temp until new release and updates upstream", version = "0.7.3" },
{ crate = "rustls", reason = "Temp until new release and updates upstream" },
{ crate = "hyper", reason = "temporary duplicate until upstream updates" },
{ crate = "hyper-rustls", reason = "temporary duplicate until upstream updates", version = "0.27.3" },
{ crate = "http-body", reason = "temporary duplicate until upstream updates" },
{ crate = "http", reason = "temporary duplicate until upstream updates" },
{ crate = "h2", reason = "temporary duplicate until upstream updates", version = "0.3.26" },
{ crate = "base64", reason = "temporary duplicate until upstream updates", version = "0.22.1" },
# Upgrade stellar-rpc-client to use 0.26.0
{ crate = "tokio-rustls", reason = "temporary duplicate until upstream updates" },

# wasm-opt
{ crate = "heck", reason = "wasm-opt needs to update to 0.5", version = "0.5.0"},
{ crate = "strum", reason = "wasm-opt needs to update", version = "0.26.3" },
{ crate = "strum_macros", reason = "wasm-opt needs to update", version = "0.26.4" },


# soroban-env-host must upgrade ark-* to 0.14.5
{ crate = "hashbrown", reason = "temp", version = "13.2"},

{ crate = "windows-sys", reason = "temp", version = "0.59.0"},
{ crate = "windows-targets", reason = "temp", version = "0.52.6"},
{ crate = "windows_x86_64_gnu", reason = "temp", version = "0.52.6"},
{ crate = "windows_x86_64_msvc", reason = "temp", version = "0.52.6"},
# { crate = "dir-sys", reason = "temp", version }
#
# update tracing-subscriber
{ crate = "regex-syntax", reason = "temp", version = "0.8.4" },
{ crate = "regex-automata", reason = "temp", version = "0.4.7" },

# wasm-gen update
{ crate = "byteorder", reason = "temp", version = "1.5.0" },

# testcontainers
{ crate = "idna", reason = "temp", version = "0.5.0" },


# { name = "hashbrown", version = "=0.13.2" },
# { name = "syn", version = "=1.0.109" },
]
Expand Down
Loading