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(signer): resolve keystore path before retrieving private key #3076

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 8 additions & 7 deletions bin/sozo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dojo-utils.workspace = true
dojo-world.workspace = true
katana-rpc-api.workspace = true
notify = "7.0.0"
tabled = { version = "0.16.0", features = [ "ansi" ] }
resolve-path = "0.1.0"
scarb.workspace = true
scarb-metadata.workspace = true
scarb-ui.workspace = true
Expand All @@ -33,30 +33,31 @@ serde.workspace = true
serde_json.workspace = true
smol_str.workspace = true
sozo-ops.workspace = true
sozo-walnut = { workspace = true, optional = true }
sozo-scarbext.workspace = true
sozo-walnut = { workspace = true, optional = true }
starknet.workspace = true
starknet-crypto.workspace = true
tabled = { version = "0.16.0", features = ["ansi"] }
thiserror.workspace = true
toml.workspace = true
tracing.workspace = true
tracing-log.workspace = true
tracing-subscriber.workspace = true
url.workspace = true

reqwest = { workspace = true, features = [ "json" ], optional = true }
reqwest = { workspace = true, features = ["json"], optional = true }

[dev-dependencies]
dojo-test-utils = { workspace = true, features = [ "build-examples" ] }
dojo-test-utils = { workspace = true, features = ["build-examples"] }
katana-runner.workspace = true
serde_json.workspace = true
tokio.workspace = true

[features]
default = [ "controller", "walnut" ]
default = ["controller", "walnut"]

controller = [ "dep:reqwest", "dep:slot" ]
walnut = [ "dep:sozo-walnut", "sozo-ops/walnut" ]
controller = ["dep:reqwest", "dep:slot"]
walnut = ["dep:sozo-walnut", "sozo-ops/walnut"]

[[bench]]
harness = false
Expand Down
6 changes: 4 additions & 2 deletions bin/sozo/src/commands/options/signer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::path::Path;
use std::str::FromStr;

use anyhow::{anyhow, Result};
Expand All @@ -7,6 +8,7 @@ use dojo_utils::env::{
};
use dojo_utils::keystore::prompt_password_if_needed;
use dojo_world::config::Environment;
use resolve_path::PathResolveExt;
use starknet::core::types::Felt;
use starknet::signers::{LocalWallet, SigningKey};
use tracing::trace;
Expand Down Expand Up @@ -93,7 +95,7 @@ impl SignerOptions {

let password = prompt_password_if_needed(maybe_password, no_wait)?;

let private_key = SigningKey::from_keystore(path, &password)?;
let private_key = SigningKey::from_keystore(Path::new(path).resolve(), &password)?;
return Ok(Some(private_key));
}

Expand All @@ -116,7 +118,7 @@ impl SignerOptions {

let password = prompt_password_if_needed(maybe_password, no_wait)?;

let private_key = SigningKey::from_keystore(path, &password)?;
let private_key = SigningKey::from_keystore(Path::new(path).resolve(), &password)?;
return Ok(Some(private_key));
}

Expand Down
Loading