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

refactor: add StateSync component #646

Closed
wants to merge 5 commits into from
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
12 changes: 8 additions & 4 deletions bin/miden-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@ impl Cli {
let authenticator = StoreAuthenticator::new_with_rng(store.clone() as Arc<dyn Store>, rng);

let client = Client::new(
Box::new(TonicRpcClient::new(
cli_config.rpc.endpoint.clone().into(),
cli_config.rpc.timeout_ms,
)),
Arc::new(
TonicRpcClient::new(
cli_config.rpc.endpoint.clone().into(),
cli_config.rpc.timeout_ms,
)
.await
.map_err(ClientError::RpcError)?,
),
rng,
store as Arc<dyn Store>,
Arc::new(authenticator),
Expand Down
11 changes: 8 additions & 3 deletions bin/miden-cli/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{
fs::File,
io::Read,
path::{Path, PathBuf},
sync::Arc,
};

use assert_cmd::Command;
Expand Down Expand Up @@ -621,7 +622,7 @@ async fn create_test_client_with_store_path(store_path: &Path) -> TestClient {

let store = {
let sqlite_store = SqliteStore::new(PathBuf::from(store_path)).await.unwrap();
std::sync::Arc::new(sqlite_store)
Arc::new(sqlite_store)
};

let mut rng = rand::thread_rng();
Expand All @@ -631,10 +632,14 @@ async fn create_test_client_with_store_path(store_path: &Path) -> TestClient {

let authenticator = StoreAuthenticator::new_with_rng(store.clone(), rng);
TestClient::new(
Box::new(TonicRpcClient::new(rpc_config.endpoint.into(), rpc_config.timeout_ms)),
Arc::new(
TonicRpcClient::new(rpc_config.endpoint.into(), rpc_config.timeout_ms)
.await
.unwrap(),
),
rng,
store,
std::sync::Arc::new(authenticator),
Arc::new(authenticator),
true,
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ idxdb = ["dep:base64", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-b
sqlite = ["dep:rusqlite", "dep:deadpool-sqlite", "std"]
std = ["miden-objects/std"]
testing = ["miden-objects/testing", "miden-lib/testing", "miden-tx/testing"]
tonic = ["dep:hex", "dep:prost", "dep:tonic", "std", "tonic/transport"]
tonic = ["dep:hex", "dep:prost", "dep:tonic", "std", "tonic/transport", "tokio"]
web-tonic = ["dep:hex", "dep:prost", "dep:tonic", "dep:tonic-web-wasm-client"]

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions crates/rust-client/src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod sync_state;
Loading
Loading