diff --git a/crates/core/src/contract.rs b/crates/core/src/contract.rs index f5cdaa5da..e099436a9 100644 --- a/crates/core/src/contract.rs +++ b/crates/core/src/contract.rs @@ -10,8 +10,8 @@ mod handler; pub mod storages; pub(crate) use executor::{ - executor_channel, mock_runtime::MockRuntime, Callback, ExecutorToEventLoopChannel, UpsertResult, - NetworkEventListenerHalve, + executor_channel, mock_runtime::MockRuntime, Callback, ExecutorToEventLoopChannel, + NetworkEventListenerHalve, UpsertResult, }; pub(crate) use handler::{ client_responses_channel, contract_handler_channel, in_memory::MemoryContractHandler, @@ -87,22 +87,30 @@ where } => { let put_result = contract_handler .executor() - .upsert_contract_state(key, Either::Left(state.clone()), related_contracts, contract) + .upsert_contract_state( + key, + Either::Left(state.clone()), + related_contracts, + contract, + ) .instrument(tracing::info_span!("upsert_contract_state", %key)) .await; let event_result = match put_result { - Ok(UpsertResult::NoChange) => ContractHandlerEvent::PutResponse {new_value: Ok(state)}, - Ok(UpsertResult::Updated(state)) => ContractHandlerEvent::PutResponse {new_value: Ok(state)}, - Err(err) => ContractHandlerEvent::PutResponse {new_value: Err(err)}, + Ok(UpsertResult::NoChange) => ContractHandlerEvent::PutResponse { + new_value: Ok(state), + }, + Ok(UpsertResult::Updated(state)) => ContractHandlerEvent::PutResponse { + new_value: Ok(state), + }, + Err(err) => ContractHandlerEvent::PutResponse { + new_value: Err(err), + }, }; contract_handler .channel() - .send_to_sender( - id, - event_result, - ) + .send_to_sender(id, event_result) .await .map_err(|error| { tracing::debug!(%error, "shutting down contract handler"); @@ -129,16 +137,17 @@ where let event_result = match update_result { Ok(UpsertResult::NoChange) => ContractHandlerEvent::UpdateNoChange { key }, - Ok(UpsertResult::Updated(state)) => ContractHandlerEvent::UpdateResponse {new_value: Ok(state)}, - Err(err) => ContractHandlerEvent::UpdateResponse {new_value: Err(err)}, + Ok(UpsertResult::Updated(state)) => ContractHandlerEvent::UpdateResponse { + new_value: Ok(state), + }, + Err(err) => ContractHandlerEvent::UpdateResponse { + new_value: Err(err), + }, }; contract_handler .channel() - .send_to_sender( - id, - event_result, - ) + .send_to_sender(id, event_result) .await .map_err(|error| { tracing::debug!(%error, "shutting down contract handler"); diff --git a/crates/core/src/contract/executor.rs b/crates/core/src/contract/executor.rs index 50b63a0b7..34aabf0ae 100644 --- a/crates/core/src/contract/executor.rs +++ b/crates/core/src/contract/executor.rs @@ -19,6 +19,7 @@ use freenet_stdlib::prelude::*; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc::{self}; +use super::storages::Storage; use crate::config::Config; use crate::message::Transaction; use crate::node::OpManager; @@ -32,7 +33,6 @@ use crate::{ client_events::{ClientId, HostResult}, operations::{self, Operation}, }; -use super::storages::Storage; pub(super) mod mock_runtime; pub(super) mod runtime;