From 99f2b48e66dce7f49c9951ca3a9061f8a839f1f4 Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Krieger Date: Fri, 28 Jul 2023 18:19:54 -0300 Subject: [PATCH] refactor(state-server): update dependencies --- offchain/state-server/Cargo.toml | 8 +++----- offchain/state-server/src/error.rs | 2 +- offchain/state-server/src/lib.rs | 20 +++++++++++--------- offchain/state-server/src/main.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/offchain/state-server/Cargo.toml b/offchain/state-server/Cargo.toml index a237cbb09..073e945f8 100644 --- a/offchain/state-server/Cargo.toml +++ b/offchain/state-server/Cargo.toml @@ -10,15 +10,13 @@ path = "src/main.rs" [dependencies] types = { path = "../types" } +state-fold = { path = "../state-fold" } +state-fold-types = { path = "../state-fold-types"} -block-history.workspace = true serde.workspace = true snafu.workspace = true -state-fold.workspace = true -state-fold-types.workspace = true -state-server-lib.workspace = true tokio = { workspace = true, features = ["macros", "sync", "rt-multi-thread"] } -tonic = "0.8" # TODO: the state-fold still uses this version +tonic.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing.workspace = true url.workspace = true diff --git a/offchain/state-server/src/error.rs b/offchain/state-server/src/error.rs index 4b7d52087..248ca94a6 100644 --- a/offchain/state-server/src/error.rs +++ b/offchain/state-server/src/error.rs @@ -1,8 +1,8 @@ // (c) Cartesi and individual authors (see AUTHORS) // SPDX-License-Identifier: Apache-2.0 (see LICENSE) -use block_history::BlockArchiveError; use snafu::Snafu; +use state_fold::block_history::BlockArchiveError; use state_fold_types::ethers::providers::{Http, RetryClient}; use tonic::transport::Error as TonicError; use url::ParseError; diff --git a/offchain/state-server/src/lib.rs b/offchain/state-server/src/lib.rs index 67e375d2b..489892190 100644 --- a/offchain/state-server/src/lib.rs +++ b/offchain/state-server/src/lib.rs @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 (see LICENSE) use snafu::ResultExt; -use state_fold::{Foldable, StateFoldEnvironment}; -use state_fold_types::ethers::providers::{ - Http, HttpRateLimitRetryPolicy, Provider, RetryClient, -}; -use state_server_lib::{ +use state_fold::state_fold::{Foldable, StateFoldEnvironment}; +use state_fold::state_server_lib::{ config, grpc_server::StateServer, utils::{start_server, wait_for_signal}, }; +use state_fold_types::ethers::providers::{ + Http, HttpRateLimitRetryPolicy, Provider, RetryClient, +}; use std::sync::{Arc, Mutex}; use tokio::sync::oneshot; use types::UserData; @@ -80,7 +80,7 @@ fn create_provider( fn create_env( config: &config::StateServerConfig, provider: Arc, - block_archive: Arc>, + block_archive: Arc>, ) -> Result< Arc>>, StateServerError, @@ -102,9 +102,11 @@ fn create_env( async fn create_block_subscriber( config: &config::StateServerConfig, provider: Arc, -) -> Result>, StateServerError> -{ - let block_subscriber = block_history::BlockSubscriber::start( +) -> Result< + Arc>, + StateServerError, +> { + let block_subscriber = state_fold::block_history::BlockSubscriber::start( Arc::clone(&provider), config.block_history.ws_endpoint.to_owned(), config.block_history.block_timeout, diff --git a/offchain/state-server/src/main.rs b/offchain/state-server/src/main.rs index 1a1b9bf8b..8abf96621 100644 --- a/offchain/state-server/src/main.rs +++ b/offchain/state-server/src/main.rs @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box> { tracing_subscriber::fmt().with_env_filter(filter).init(); let config = - state_server_lib::config::StateServerConfig::initialize_from_args()?; + state_fold::state_server_lib::config::StateServerConfig::initialize_from_args()?; tracing::info!(?config, "starting state server");