Skip to content

Commit 55a08f1

Browse files
Copilotdependabot[bot]cptartur
authored
Fix compilation errors from dependency upgrades (snapbox, toml_edit) (#3998)
Closes # ## Introduced changes Fixes breaking API changes introduced by dependency upgrades in the dependabot PR: **snapbox 0.4 → 0.6:** - `assert_matches(expected, actual)` → `assert_data_eq!(actual, expected)` (parameter order swapped) - `.stdout_matches()` → `.stdout_eq()` - `.stderr_matches()` → `.stderr_eq()` - `cargo_bin` function (deprecated) → `snapbox::cargo_bin` macro **toml_edit 0.22 → 0.23:** - `ImDocument` → `Document` (type renamed) Example of the snapbox migration: ```rust // Before use snapbox::assert_matches; assert_matches(expected_pattern, actual_value); // After use snapbox::assert_data_eq; assert_data_eq!(actual_value, expected_pattern); ``` **Additional changes:** - Merged the latest main branch changes to incorporate recent updates - Updated `ctor` dependency from 0.6.2 to 0.6.3 to resolve merge conflicts with the dependabot base branch ## Checklist - [ ] Linked relevant issue - [ ] Updated relevant documentation - [ ] Added relevant tests - [x] Performed self-review of the code - [ ] Added changes to `CHANGELOG.md` <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/foundry-rs/starknet-foundry/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cptartur <52135326+cptartur@users.noreply.github.com> Co-authored-by: Artur Michalek <artur.michalek@swmansion.com>
1 parent bc522a7 commit 55a08f1

File tree

22 files changed

+211
-141
lines changed

22 files changed

+211
-141
lines changed

Cargo.lock

Lines changed: 116 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ cairo-lang-sierra-to-casm = "=2.12.3"
5555
cairo-vm = "2.5.0"
5656
cairo-annotations = { version = "0.6.1", features = ["cairo-lang"] }
5757
dirs = "6.0.0"
58-
dialoguer = "0.11.0"
58+
dialoguer = "0.12.0"
5959
starknet-types-core = { version = "0.2.4", features = ["hash", "prime-bigint"] }
6060
anyhow = "1.0.100"
6161
assert_fs = "1.1.2"
6262
camino = { version = "1.2.1", features = ["serde1"] }
6363
clap = { version = "4.5.48", features = ["derive", "deprecated"] }
6464
clap_complete = "4.5.58"
65-
console = "0.15.11"
65+
console = "0.16.1"
6666
include_dir = "0.7.4"
6767
indoc = "2"
6868
itertools = "0.14.0"
@@ -76,7 +76,7 @@ starknet-rust = "0.18.0"
7676
starknet-rust-crypto = "0.9.0"
7777
tempfile = "3.23.0"
7878
thiserror = "2.0.17"
79-
ctor = "0.4.1"
79+
ctor = "0.6.2"
8080
url = { "version" = "2.5.4", "features" = ["serde"] }
8181
tokio = { version = "1.44.0", features = ["full"] }
8282
futures = "0.3.31"
@@ -91,44 +91,44 @@ docs = { path = "./crates/docs" }
9191
test-case = "3.3.1"
9292
scarb-metadata = "1.14.0"
9393
flatten-serde-json = "0.1.0"
94-
snapbox = "0.4.17"
94+
snapbox = "0.6.23"
9595
scarb-ui = "0.1.7"
9696
semver = "1.0.27"
9797
bimap = "0.6.3"
98-
primitive-types = { version = "0.13.1", features = ["serde"] }
98+
primitive-types = { version = "0.14.0", features = ["serde"] }
9999
shellexpand = "3.1.0"
100-
toml = "0.8.20"
100+
toml = "0.9.8"
101101
rpassword = "7.3.1"
102102
promptly = "0.3.1"
103103
ptree = "0.5.2"
104104
reqwest = { version = "0.12.21", features = ["json"] }
105105
fs_extra = "1.3.0"
106106
openssl = { version = "0.10", features = ["vendored"] }
107-
toml_edit = "0.22.24"
107+
toml_edit = "0.23.7"
108108
axum = "0.8.6"
109109
fs2 = "0.4.3"
110110
flate2 = "1.1.0"
111111
k256 = { version = "0.13.4", features = ["sha256", "ecdsa", "serde"] }
112112
p256 = { version = "0.13.2", features = ["sha256", "ecdsa", "serde"] }
113113
glob = "0.3.2"
114114
sha3 = "0.10.8"
115-
base16ct = { version = "0.2.0", features = ["alloc"] }
115+
base16ct = { version = "0.3.0", features = ["alloc"] }
116116
async-trait = "0.1.87"
117117
serde_path_to_error = "0.1.20"
118118
wiremock = "0.6.3"
119119
const-hex = "1.16.0"
120-
indicatif = "0.17.11"
120+
indicatif = "0.18.3"
121121
shell-words = "1.1.0"
122122
sanitize-filename = "0.6.0"
123-
derive_more = { version = "2.0.1", features = ["display"] }
123+
derive_more = { version = "2.1.0", features = ["display"] }
124124
paste = "1.0.15"
125125
strum = "0.27"
126126
strum_macros = "0.27"
127127
scarb-oracle-hint-service = "0.1.1"
128128
chrono = "0.4.42"
129129
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
130-
tracing = "0.1.41"
130+
tracing = "0.1.43"
131131
tracing-chrome = "0.7.2"
132132
tracing-log = "0.2.0"
133133
comfy-table = "7"
134-
insta = { version = "1.43.1", features = ["filters"] }
134+
insta = { version = "1.44.3", features = ["filters"] }

crates/configuration/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use anyhow::{Context, Result, anyhow};
33
use camino::Utf8PathBuf;
44
use std::fs::File;
55
use std::{env, fs};
6-
use toml::Value;
6+
use toml::Table;
77

88
pub mod core;
99
pub mod test_utils;
@@ -44,7 +44,7 @@ pub fn load_config<T: Config + Default>(
4444
Some(path) => {
4545
let raw_config_toml = fs::read_to_string(path)
4646
.context("Failed to read snfoundry.toml config file")?
47-
.parse::<Value>()
47+
.parse::<Table>()
4848
.context("Failed to parse snfoundry.toml config file")?;
4949

5050
let raw_config_json = serde_json::to_value(raw_config_toml)

crates/forge/tests/e2e/common/runner.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use camino::Utf8PathBuf;
99
use indoc::formatdoc;
1010
use shared::command::CommandExt;
1111
use shared::test_utils::node_url::node_rpc_url;
12-
use snapbox::cmd::{Command as SnapboxCommand, cargo_bin};
12+
use snapbox::cargo_bin;
13+
use snapbox::cmd::Command as SnapboxCommand;
1314
use std::path::{Path, PathBuf};
1415
use std::process::Command;
1516
use std::str::FromStr;

crates/forge/tests/e2e/new.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use regex::Regex;
1111
use scarb_api::ScarbCommand;
1212
use shared::consts::FREE_RPC_PROVIDER_URL;
1313
use shared::test_utils::output_assert::assert_stdout_contains;
14-
use snapbox::assert_matches;
14+
use snapbox::assert_data_eq;
1515
use snapbox::cmd::Command as SnapboxCommand;
1616
use std::ffi::OsString;
1717
use std::path::{Path, PathBuf};
@@ -348,5 +348,5 @@ fn assert_manifest_matches(expected: &str, actual: &str) {
348348
s.lines().sorted().join("\n")
349349
}
350350

351-
assert_matches(sort_lines(expected), sort_lines(actual));
351+
assert_data_eq!(sort_lines(actual), sort_lines(expected));
352352
}

crates/forge/tests/e2e/plugin_versions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use scarb_api::ScarbCommand;
66
use scarb_api::version::scarb_version_for_dir;
77
use shared::test_utils::output_assert::assert_stdout_contains;
88
use snapbox::cmd::Command;
9-
use toml_edit::ImDocument;
9+
use toml_edit::Document;
1010

1111
#[test]
1212
#[cfg_attr(
@@ -23,7 +23,7 @@ fn new_with_new_scarb() {
2323

2424
let manifest = temp.path().join("abc").join("Scarb.toml");
2525
let manifest = &std::fs::read_to_string(manifest).unwrap();
26-
let manifest = ImDocument::parse(manifest).unwrap();
26+
let manifest = Document::parse(manifest).unwrap();
2727

2828
let snforge_std = manifest
2929
.get("dev-dependencies")
@@ -62,7 +62,7 @@ fn new_with_old_scarb() {
6262

6363
let manifest = temp.path().join("abc").join("Scarb.toml");
6464
let manifest = &std::fs::read_to_string(manifest).unwrap();
65-
let manifest = ImDocument::parse(manifest).unwrap();
65+
let manifest = Document::parse(manifest).unwrap();
6666

6767
let snforge_std = manifest
6868
.get("dev-dependencies")

crates/sncast/tests/e2e/account/create.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use serde_json::{json, to_string_pretty};
1111
use shared::test_utils::output_assert::{
1212
AsOutput, assert_stderr_contains, assert_stdout, assert_stdout_contains,
1313
};
14-
use snapbox::assert_matches;
14+
use snapbox::assert_data_eq;
1515
use sncast::AccountType;
1616
use sncast::helpers::constants::{
1717
BRAAVOS_BASE_ACCOUNT_CLASS_HASH, BRAAVOS_CLASS_HASH, OZ_CLASS_HASH, READY_CLASS_HASH,
@@ -85,7 +85,7 @@ pub async fn test_happy_case(account_type: &str) {
8585
}
8686
);
8787

88-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
88+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
8989
}
9090

9191
// TODO(#3556): Remove this test once we drop Argent account type
@@ -153,7 +153,7 @@ pub async fn test_happy_case_argent_with_deprecation_warning() {
153153
}
154154
);
155155

156-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
156+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
157157
}
158158

159159
#[tokio::test]
@@ -214,7 +214,7 @@ pub async fn test_happy_case_generate_salt() {
214214
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
215215
.current_dir(temp_dir.path());
216216

217-
snapbox.assert().success().stdout_matches(indoc! {r"
217+
snapbox.assert().success().stdout_eq(indoc! {r"
218218
Success: Account created
219219
220220
Address: 0x0[..]
@@ -302,7 +302,7 @@ pub async fn test_happy_case_accounts_file_already_exists() {
302302
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
303303
.current_dir(temp_dir.path());
304304

305-
snapbox.assert().success().stdout_matches(indoc! {r"
305+
snapbox.assert().success().stdout_eq(indoc! {r"
306306
Success: Account created
307307
308308
Address: 0x0[..]
@@ -436,7 +436,7 @@ pub async fn test_happy_case_keystore(account_type: &str) {
436436
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
437437
.current_dir(temp_dir.path());
438438

439-
snapbox.assert().stdout_matches(formatdoc! {r"
439+
snapbox.assert().stdout_eq(formatdoc! {r"
440440
Success: Account created
441441
442442
Address: 0x0[..]
@@ -455,9 +455,9 @@ pub async fn test_happy_case_keystore(account_type: &str) {
455455
let contents = fs::read_to_string(temp_dir.path().join(account_file))
456456
.expect("Unable to read created file");
457457

458-
assert_matches(
459-
get_keystore_account_pattern(account_type.parse().unwrap(), None),
458+
assert_data_eq!(
460459
contents,
460+
get_keystore_account_pattern(account_type.parse().unwrap(), None),
461461
);
462462
}
463463

@@ -486,7 +486,7 @@ pub async fn test_happy_case_keystore_argent_with_deprecation_warning() {
486486
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
487487
.current_dir(temp_dir.path());
488488

489-
snapbox.assert().stdout_matches(formatdoc! {r"
489+
snapbox.assert().stdout_eq(formatdoc! {r"
490490
[WARNING] Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account create` is deprecated, please use `ready` instead.
491491
492492
Success: Account created
@@ -507,9 +507,9 @@ pub async fn test_happy_case_keystore_argent_with_deprecation_warning() {
507507
let contents = fs::read_to_string(temp_dir.path().join(account_file))
508508
.expect("Unable to read created file");
509509

510-
assert_matches(
511-
get_keystore_account_pattern("argent".parse().unwrap(), None),
510+
assert_data_eq!(
512511
contents,
512+
get_keystore_account_pattern("argent".parse().unwrap(), None),
513513
);
514514
}
515515

@@ -692,7 +692,7 @@ pub async fn test_happy_case_keystore_int_format() {
692692
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
693693
.current_dir(temp_dir.path());
694694

695-
snapbox.assert().stdout_matches(formatdoc! {r"
695+
snapbox.assert().stdout_eq(formatdoc! {r"
696696
Success: Account created
697697
698698
Address: [..]
@@ -746,7 +746,7 @@ pub async fn test_happy_case_default_name_generation() {
746746
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
747747
.current_dir(tempdir.path())
748748
.assert()
749-
.stdout_matches(formatdoc! {r"
749+
.stdout_eq(formatdoc! {r"
750750
Success: Account created
751751
752752
Address: 0x0[..]
@@ -779,7 +779,7 @@ pub async fn test_happy_case_default_name_generation() {
779779
.stdin("Y")
780780
.assert()
781781
.success()
782-
.stdout_matches(indoc! {r"
782+
.stdout_eq(indoc! {r"
783783
Success: Account deleted
784784
785785
Account successfully removed
@@ -834,7 +834,7 @@ pub async fn test_happy_case_default_name_generation() {
834834
}
835835
);
836836

837-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
837+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
838838
}
839839

840840
fn get_formatted_account_type(account_type: &str) -> &str {
@@ -1010,7 +1010,7 @@ pub async fn test_json_output_format() {
10101010
let snapbox = runner(&args)
10111011
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
10121012
.current_dir(temp_dir.path());
1013-
snapbox.assert().stdout_matches(indoc! {r#"
1013+
snapbox.assert().stdout_eq(indoc! {r#"
10141014
{"add_profile":"Profile my_account successfully added to [..]/snfoundry.toml","address":"0x[..]","command":"account create","estimated_fee":"[..]","message":"Account successfully created but it needs to be deployed. The estimated deployment fee is [..] STRK. Prefund the account to cover deployment transaction fee/n/nAfter prefunding the account, run:/nsncast --accounts-file accounts.json account deploy --url [..] --name my_account","type":"response"}
10151015
{"links":"account: https://sepolia.starkscan.co/contract/0x[..]","title":"account creation","type":"notification"}
10161016
"#});

crates/sncast/tests/e2e/account/delete.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub fn test_happy_case() {
106106
// Run test with an affirmative user input
107107
let snapbox = runner(&args).current_dir(temp_dir.path()).stdin("Y");
108108

109-
snapbox.assert().success().stdout_matches(indoc! {r"
109+
snapbox.assert().success().stdout_eq(indoc! {r"
110110
Success: Account deleted
111111
112112
Account successfully removed
@@ -131,7 +131,7 @@ pub fn test_happy_case_url() {
131131

132132
let snapbox = runner(&args).current_dir(temp_dir.path()).stdin("Y");
133133

134-
snapbox.assert().success().stdout_matches(indoc! {r"
134+
snapbox.assert().success().stdout_eq(indoc! {r"
135135
Success: Account deleted
136136
137137
Account successfully removed
@@ -162,7 +162,7 @@ pub fn test_happy_case_with_yes_flag() {
162162
let output = snapbox.assert().success();
163163

164164
assert!(output.as_stderr().is_empty());
165-
output.stdout_matches(indoc! {r"
165+
output.stdout_eq(indoc! {r"
166166
Success: Account deleted
167167
168168
Account successfully removed

crates/sncast/tests/e2e/account/deploy.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub async fn test_valid_class_hash() {
181181
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
182182
.current_dir(tempdir.path());
183183

184-
snapbox.assert().success().stdout_matches(indoc! {r"
184+
snapbox.assert().success().stdout_eq(indoc! {r"
185185
Success: Account deployed
186186
187187
Transaction Hash: 0x[..]
@@ -213,7 +213,7 @@ pub async fn test_valid_no_max_fee() {
213213
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
214214
.current_dir(tempdir.path());
215215

216-
snapbox.assert().success().stdout_matches(indoc! {r"
216+
snapbox.assert().success().stdout_eq(indoc! {r"
217217
Success: Account deployed
218218
219219
Transaction Hash: 0x[..]
@@ -311,7 +311,7 @@ pub async fn test_happy_case_keystore(account_type: &str) {
311311
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
312312
.current_dir(tempdir.path());
313313

314-
snapbox.assert().stdout_matches(indoc! {r"
314+
snapbox.assert().stdout_eq(indoc! {r"
315315
Success: Account deployed
316316
317317
Transaction Hash: 0x[..]
@@ -576,7 +576,7 @@ pub async fn test_deploy_keystore_other_args() {
576576
let snapbox = runner(&args)
577577
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
578578
.current_dir(tempdir.path());
579-
snapbox.assert().stdout_matches(indoc! {r"
579+
snapbox.assert().stdout_eq(indoc! {r"
580580
Success: Account deployed
581581
582582
Transaction Hash: 0x[..]
@@ -607,7 +607,7 @@ pub async fn test_json_output_format() {
607607
let snapbox = runner(&args)
608608
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
609609
.current_dir(tempdir.path());
610-
snapbox.assert().stdout_matches(indoc! {r#"
610+
snapbox.assert().stdout_eq(indoc! {r#"
611611
{"command":"account deploy","transaction_hash":"0x0[..]","type":"response"}
612612
{"links":"transaction: https://sepolia.starkscan.co/tx/0x0[..]","title":"account deployment","type":"notification"}
613613
"#});

0 commit comments

Comments
 (0)