Skip to content

Commit

Permalink
fix(sozo): resolve keystore path before retrieving private key (#3076)
Browse files Browse the repository at this point in the history
* fix(signer): resolve keystore path before retrieving private key

* style: formatting
  • Loading branch information
bengineer42 authored Mar 5, 2025
1 parent 296162d commit dd5a79d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
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

0 comments on commit dd5a79d

Please sign in to comment.