diff --git a/Cargo.lock b/Cargo.lock index 5f9f613..867ccd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1542,12 +1542,6 @@ version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - [[package]] name = "libredox" version = "0.1.9" @@ -1736,8 +1730,8 @@ dependencies = [ [[package]] name = "neptune-cash" -version = "0.3.0" -source = "git+https://github.com/Neptune-Crypto/neptune-core.git?branch=master#1096a2935af9c023a3a737638c09195f4801881b" +version = "0.4.0" +source = "git+https://github.com/Neptune-Crypto/neptune-core.git?branch=master#c6b9a5020975ab21ca516dae2c83e177a67cf913" dependencies = [ "aead", "aes-gcm", @@ -1764,7 +1758,6 @@ dependencies = [ "num-traits", "priority-queue", "rand 0.9.2", - "rand_distr", "rayon", "readonly", "regex", @@ -1961,7 +1954,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -2457,16 +2449,6 @@ dependencies = [ "getrandom 0.3.3", ] -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - [[package]] name = "rand_xorshift" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 03d64ec..1c222c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ tokio = { version = "1.37.0", features = ["full", "tracing"] } tracing = "0.1" tracing-subscriber = "0.3" -neptune-cash = "0.3.0" +neptune-cash = "0.4.0" tarpc = { version = "^0.34", features = [ "tokio1", "serde-transport", @@ -27,7 +27,7 @@ html-escaper = "0.2.0" tower-http = { version = "0.5.2", features = ["fs"] } readonly = "0.2.12" url = "2.5.0" -lettre = {version = "0.11.7", features = ["tokio1-native-tls"]} +lettre = { version = "0.11.7", features = ["tokio1-native-tls"] } chrono = "0.4.34" # only should be used inside main.rs, for the binary. @@ -38,8 +38,8 @@ derive_more = { version = "1.0.0", features = ["display"] } # not a direct dep. workaround for weird "could not resolve" cargo error indexmap = "2.7.0" -blake3 = {version = "1.8.2", optional = true} -rand = {version = "0.9.2", optional = true} +blake3 = { version = "1.8.2", optional = true } +rand = { version = "0.9.2", optional = true } #[dev-dependencies] test-strategy = "0.4.3" @@ -51,4 +51,4 @@ proptest-arbitrary-interop = "0.1.0" neptune-cash = { git = "https://github.com/Neptune-Crypto/neptune-core.git", branch = "master" } [features] -mock = ["dep:blake3", "dep:rand"] \ No newline at end of file +mock = ["dep:blake3", "dep:rand"] diff --git a/src/alert_email.rs b/src/alert_email.rs index 57fd01e..11ed0c6 100644 --- a/src/alert_email.rs +++ b/src/alert_email.rs @@ -1,14 +1,15 @@ +use clap::Parser; +use lettre::AsyncSmtpTransport; +use lettre::AsyncTransport; +use lettre::Message; +use lettre::Tokio1Executor; +use tracing::info; +use tracing::warn; + use crate::model::app_state::AppState; use crate::model::config::AlertConfig; use crate::model::config::Config; use crate::model::config::SmtpMode; -use clap::Parser; -use lettre::{AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor}; -use tracing::{info, warn}; - -// pub fn alert_params_configured() -> bool { -// Config::parse().alert_config().is_some() -// } pub fn check_alert_params() -> bool { match Config::parse().alert_config() { diff --git a/src/html/component/header.rs b/src/html/component/header.rs index b340b79..41994da 100644 --- a/src/html/component/header.rs +++ b/src/html/component/header.rs @@ -1,6 +1,7 @@ -use crate::model::app_state::AppStateInner; use html_escaper::Escape; +use crate::model::app_state::AppStateInner; + #[derive(Debug, Clone, boilerplate::Boilerplate)] #[boilerplate(filename = "web/html/components/header.html")] pub struct HeaderHtml<'a> { diff --git a/src/html/page/announcement.rs b/src/html/page/announcement.rs index a9a5ed7..23010a2 100644 --- a/src/html/page/announcement.rs +++ b/src/html/page/announcement.rs @@ -1,10 +1,6 @@ -use crate::html::component::header::HeaderHtml; -use crate::html::page::not_found::not_found_html_response; -use crate::http_util::rpc_method_err; -use crate::model::announcement_selector::AnnouncementSelector; -use crate::model::announcement_type::AnnouncementType; -use crate::model::app_state::AppState; -use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; +use std::collections::HashMap; +use std::sync::Arc; + use axum::extract::rejection::PathRejection; use axum::extract::Path; use axum::extract::State; @@ -17,10 +13,16 @@ use neptune_cash::prelude::tasm_lib::prelude::Digest; use neptune_cash::prelude::triton_vm::prelude::BFieldCodec; use neptune_cash::prelude::twenty_first::tip5::Tip5; use neptune_cash::util_types::mutator_set::addition_record::AdditionRecord; -use std::collections::HashMap; -use std::sync::Arc; use tarpc::context; +use crate::html::component::header::HeaderHtml; +use crate::html::page::not_found::not_found_html_response; +use crate::http_util::rpc_method_err; +use crate::model::announcement_selector::AnnouncementSelector; +use crate::model::announcement_type::AnnouncementType; +use crate::model::app_state::AppState; +use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; + #[axum::debug_handler] pub async fn announcement_page( maybe_path: Result, PathRejection>, diff --git a/src/html/page/block.rs b/src/html/page/block.rs index ad62066..9a9639a 100644 --- a/src/html/page/block.rs +++ b/src/html/page/block.rs @@ -1,8 +1,5 @@ -use crate::html::component::header::HeaderHtml; -use crate::html::page::not_found::not_found_html_response; -use crate::http_util::rpc_method_err; -use crate::model::app_state::AppState; -use crate::model::block_selector_extended::BlockSelectorExtended; +use std::sync::Arc; + use axum::extract::rejection::PathRejection; use axum::extract::Path; use axum::extract::State; @@ -10,10 +7,15 @@ use axum::response::Html; use axum::response::Response; use html_escaper::Escape; use html_escaper::Trusted; -use neptune_cash::models::blockchain::block::block_info::BlockInfo; -use std::sync::Arc; +use neptune_cash::protocol::consensus::block::block_info::BlockInfo; use tarpc::context; +use crate::html::component::header::HeaderHtml; +use crate::html::page::not_found::not_found_html_response; +use crate::http_util::rpc_method_err; +use crate::model::app_state::AppState; +use crate::model::block_selector_extended::BlockSelectorExtended; + #[axum::debug_handler] pub async fn block_page( user_input_maybe: Result, PathRejection>, diff --git a/src/html/page/not_found.rs b/src/html/page/not_found.rs index a6b4dde..a301b32 100644 --- a/src/html/page/not_found.rs +++ b/src/html/page/not_found.rs @@ -1,11 +1,12 @@ -use crate::http_util::not_found_html_err; -use crate::http_util::not_found_html_handler; -use crate::model::app_state::AppStateInner; use axum::http::StatusCode; use axum::response::Html; use axum::response::Response; use html_escaper::Escape; +use crate::http_util::not_found_html_err; +use crate::http_util::not_found_html_handler; +use crate::model::app_state::AppStateInner; + pub fn not_found_page(error_msg: Option) -> Html { #[derive(boilerplate::Boilerplate)] #[boilerplate(filename = "web/html/page/not_found.html")] diff --git a/src/html/page/redirect_qs_to_path.rs b/src/html/page/redirect_qs_to_path.rs index 32302ad..7a8e99e 100644 --- a/src/html/page/redirect_qs_to_path.rs +++ b/src/html/page/redirect_qs_to_path.rs @@ -1,17 +1,14 @@ +use std::collections::HashSet; +use std::sync::Arc; + use axum::extract::RawQuery; use axum::extract::State; +use axum::response::IntoResponse; use axum::response::Redirect; use axum::response::Response; -use std::sync::Arc; -// use axum::routing::get; -// use axum::routing::Router; + use super::not_found::not_found_html_response; -use axum::response::IntoResponse; -use std::collections::HashSet; -// use super::root::root; -// use super::utxo::utxo_page; use crate::model::app_state::AppState; -// use neptune_explorer::model::config::Config; /// This converts a query string into a path and redirects browser. /// diff --git a/src/html/page/root.rs b/src/html/page/root.rs index 7629c23..fd056e2 100644 --- a/src/html/page/root.rs +++ b/src/html/page/root.rs @@ -1,15 +1,17 @@ -use crate::html::page::not_found::not_found_html_response; -use crate::http_util::rpc_method_err; -use crate::model::app_state::AppState; -use crate::model::app_state::AppStateInner; +use std::sync::Arc; + use axum::extract::State; use axum::response::Html; use axum::response::Response; use html_escaper::Escape; -use neptune_cash::models::blockchain::block::block_height::BlockHeight; -use std::sync::Arc; +use neptune_cash::api::export::BlockHeight; use tarpc::context; +use crate::html::page::not_found::not_found_html_response; +use crate::http_util::rpc_method_err; +use crate::model::app_state::AppState; +use crate::model::app_state::AppStateInner; + #[axum::debug_handler] pub async fn root(State(state_rw): State>) -> Result, Response> { #[derive(boilerplate::Boilerplate)] diff --git a/src/html/page/utxo.rs b/src/html/page/utxo.rs index 9fbd9ec..67cdc05 100644 --- a/src/html/page/utxo.rs +++ b/src/html/page/utxo.rs @@ -1,8 +1,5 @@ -use crate::html::component::header::HeaderHtml; -use crate::html::page::not_found::not_found_html_response; -use crate::http_util::rpc_method_err; -use crate::model::app_state::AppState; -use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; +use std::sync::Arc; + use axum::extract::rejection::PathRejection; use axum::extract::Path; use axum::extract::State; @@ -12,9 +9,14 @@ use html_escaper::Escape; use html_escaper::Trusted; use neptune_cash::api::export::Tip5; use neptune_cash::prelude::tasm_lib::prelude::Digest; -use std::sync::Arc; use tarpc::context; +use crate::html::component::header::HeaderHtml; +use crate::html::page::not_found::not_found_html_response; +use crate::http_util::rpc_method_err; +use crate::model::app_state::AppState; +use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; + #[axum::debug_handler] pub async fn utxo_page( index_maybe: Result, PathRejection>, diff --git a/src/http_util.rs b/src/http_util.rs index 9c1add6..5f09516 100644 --- a/src/http_util.rs +++ b/src/http_util.rs @@ -2,7 +2,7 @@ use axum::http::StatusCode; use axum::response::Html; use axum::response::IntoResponse; use axum::response::Response; -use neptune_cash::rpc_server::error::RpcError; +use neptune_cash::application::rpc::server::error::RpcError; use tarpc::client::RpcError as TarpcError; // note: http StatusCodes are defined at: diff --git a/src/model/announcement_selector.rs b/src/model/announcement_selector.rs index 278b400..2512a2d 100644 --- a/src/model/announcement_selector.rs +++ b/src/model/announcement_selector.rs @@ -1,11 +1,12 @@ +use std::fmt::Display; +use std::str::FromStr; + use neptune_cash::api::export::BlockHeight; -use neptune_cash::models::blockchain::block::block_selector::BlockSelector; use neptune_cash::prelude::tasm_lib::prelude::Digest; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelector; use serde::de::Error; use serde::Deserialize; use serde::Deserializer; -use std::fmt::Display; -use std::str::FromStr; /// newtype for `BlockSelector` that provides ability to parse `height_or_digest/value`. /// @@ -147,15 +148,18 @@ impl<'de> Deserialize<'de> for AnnouncementSelector { #[cfg(test)] mod tests { - use super::*; - - use arbitrary::{Arbitrary, Unstructured}; - use proptest::string::string_regex; - use proptest::{prop_assert, prop_assert_eq}; - use proptest_arbitrary_interop::arb; use std::str::FromStr; + + use arbitrary::Arbitrary; + use arbitrary::Unstructured; + use proptest::prop_assert; + use proptest::prop_assert_eq; + use proptest::string::string_regex; + use proptest_arbitrary_interop::arb; use test_strategy::proptest; + use super::*; + impl<'a> Arbitrary<'a> for AnnouncementSelector { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result { // Pick one of the variants randomly diff --git a/src/model/app_state.rs b/src/model/app_state.rs index 6d88ecb..bbb2af6 100644 --- a/src/model/app_state.rs +++ b/src/model/app_state.rs @@ -1,16 +1,18 @@ -use crate::model::config::Config; -use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; -use crate::neptune_rpc; +use std::sync::Arc; + use anyhow::Context; use arc_swap::ArcSwap; use clap::Parser; -use neptune_cash::config_models::network::Network; -use neptune_cash::models::blockchain::block::block_selector::BlockSelector; +use neptune_cash::api::export::Network; +use neptune_cash::application::rpc::auth; use neptune_cash::prelude::twenty_first::tip5::Digest; -use neptune_cash::rpc_auth; -use std::sync::Arc; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelector; use tokio::sync::Mutex; +use crate::model::config::Config; +use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; +use crate::neptune_rpc; + #[derive(Debug, Clone)] pub struct AppStateInner { pub network: Network, @@ -26,7 +28,7 @@ pub struct AppStateInner { } impl AppStateInner { - pub fn token(&self) -> rpc_auth::Token { + pub fn token(&self) -> auth::Token { self.rpc_client.token } } diff --git a/src/model/block_selector_extended.rs b/src/model/block_selector_extended.rs index da90971..a2377d9 100644 --- a/src/model/block_selector_extended.rs +++ b/src/model/block_selector_extended.rs @@ -1,10 +1,12 @@ -use super::height_or_digest::HeightOrDigest; -use neptune_cash::models::blockchain::block::block_selector::BlockSelector; -use neptune_cash::models::blockchain::block::block_selector::BlockSelectorParseError; +use std::str::FromStr; + +use neptune_cash::protocol::consensus::block::block_selector::BlockSelector; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelectorParseError; use serde::de::Error; use serde::Deserialize; use serde::Deserializer; -use std::str::FromStr; + +use super::height_or_digest::HeightOrDigest; /// newtype for `BlockSelector` that provides ability to parse `height_or_digest/value`. /// diff --git a/src/model/height_or_digest.rs b/src/model/height_or_digest.rs index 1b72165..1e0162e 100644 --- a/src/model/height_or_digest.rs +++ b/src/model/height_or_digest.rs @@ -1,10 +1,12 @@ -use neptune_cash::models::blockchain::block::block_height::BlockHeight; -use neptune_cash::models::blockchain::block::block_selector::BlockSelector; -use neptune_cash::models::blockchain::block::block_selector::BlockSelectorParseError; -use neptune_cash::prelude::tasm_lib::prelude::Digest; -use serde::{Deserialize, Serialize}; use std::str::FromStr; +use neptune_cash::api::export::BlockHeight; +use neptune_cash::prelude::tasm_lib::prelude::Digest; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelector; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelectorParseError; +use serde::Deserialize; +use serde::Serialize; + /// represents either a block-height or a block digest #[derive(Debug, Clone, Serialize, Deserialize)] pub enum HeightOrDigest { diff --git a/src/neptune_rpc.rs b/src/neptune_rpc.rs index fb5227c..0b3bc2f 100644 --- a/src/neptune_rpc.rs +++ b/src/neptune_rpc.rs @@ -1,32 +1,36 @@ -use crate::alert_email; -use crate::model::app_state::AppState; -use crate::model::config::Config; -use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use std::sync::Arc; + use anyhow::Context; use chrono::DateTime; use chrono::TimeDelta; use chrono::Utc; use clap::Parser; use neptune_cash::api::export::Announcement; -use neptune_cash::config_models::data_directory::DataDirectory; -use neptune_cash::config_models::network::Network; -use neptune_cash::models::blockchain::block::block_height::BlockHeight; -use neptune_cash::models::blockchain::block::block_info::BlockInfo; -use neptune_cash::models::blockchain::block::block_selector::BlockSelector; +use neptune_cash::api::export::Network; +use neptune_cash::application::config::data_directory::DataDirectory; +use neptune_cash::application::rpc::auth; +use neptune_cash::application::rpc::server::error::RpcError; +use neptune_cash::application::rpc::server::RPCClient; +use neptune_cash::application::rpc::server::RpcResult; use neptune_cash::prelude::tasm_lib::prelude::Digest; -use neptune_cash::rpc_auth; -use neptune_cash::rpc_server::error::RpcError; -use neptune_cash::rpc_server::RPCClient; -use neptune_cash::rpc_server::RpcResult; +use neptune_cash::protocol::consensus::block::block_height::BlockHeight; +use neptune_cash::protocol::consensus::block::block_info::BlockInfo; +use neptune_cash::protocol::consensus::block::block_selector::BlockSelector; use neptune_cash::util_types::mutator_set::addition_record::AdditionRecord; -use std::net::Ipv4Addr; -use std::net::SocketAddr; -use std::sync::Arc; use tarpc::client; use tarpc::context; use tarpc::tokio_serde::formats::Json as RpcJson; use tokio::sync::Mutex; -use tracing::{debug, info, warn}; +use tracing::debug; +use tracing::info; +use tracing::warn; + +use crate::alert_email; +use crate::model::app_state::AppState; +use crate::model::config::Config; +use crate::model::transparent_utxo_tuple::TransparentUtxoTuple; #[cfg(feature = "mock")] const MOCK_KEY: &str = "MOCK"; @@ -34,7 +38,7 @@ const MOCK_KEY: &str = "MOCK"; #[derive(Debug, Clone)] pub struct AuthenticatedClient { pub client: RPCClient, - pub token: rpc_auth::Token, + pub token: auth::Token, pub network: Network, } @@ -51,7 +55,7 @@ impl AuthenticatedClient { pub async fn block_info( &self, ctx: ::tarpc::context::Context, - token: rpc_auth::Token, + token: auth::Token, block_selector: BlockSelector, ) -> ::core::result::Result>, ::tarpc::client::RpcError> { let rpc_result = self.client.block_info(ctx, token, block_selector).await; @@ -94,7 +98,7 @@ impl AuthenticatedClient { pub async fn utxo_digest( &self, ctx: ::tarpc::context::Context, - token: rpc_auth::Token, + token: auth::Token, leaf_index: u64, _transparent_utxos_cache: Arc>>, ) -> ::core::result::Result>, ::tarpc::client::RpcError> { @@ -124,7 +128,7 @@ impl AuthenticatedClient { pub async fn announcements_in_block( &self, ctx: ::tarpc::context::Context, - token: rpc_auth::Token, + token: auth::Token, block_selector: BlockSelector, ) -> Result>, RpcError>, ::tarpc::client::RpcError> { let rpc_result = self @@ -190,7 +194,7 @@ impl AuthenticatedClient { pub async fn addition_record_indices_for_block( &self, ctx: ::tarpc::context::Context, - token: rpc_auth::Token, + token: auth::Token, block_selector: BlockSelector, _addition_records: &[AdditionRecord], ) -> ::core::result::Result< @@ -249,12 +253,12 @@ impl AuthenticatedClient { pub async fn gen_authenticated_rpc_client() -> Result { let client = gen_rpc_client().await?; - let rpc_auth::CookieHint { + let auth::CookieHint { data_directory, network, } = get_cookie_hint(&client, &None).await?; - let token: rpc_auth::Token = rpc_auth::Cookie::try_load(&data_directory).await?.into(); + let token: auth::Token = auth::Cookie::try_load(&data_directory).await?.into(); Ok(AuthenticatedClient { client, @@ -288,14 +292,14 @@ pub async fn gen_rpc_client() -> Result { async fn get_cookie_hint( client: &RPCClient, data_dir: &Option, -) -> anyhow::Result { +) -> anyhow::Result { async fn fallback( client: &RPCClient, data_dir: &Option, - ) -> anyhow::Result { + ) -> anyhow::Result { let network = client.network(context::current()).await??; let data_directory = DataDirectory::get(data_dir.to_owned(), network)?; - Ok(rpc_auth::CookieHint { + Ok(auth::CookieHint { data_directory, network, }) diff --git a/src/rpc/block_digest.rs b/src/rpc/block_digest.rs index 174cee5..34b7c93 100644 --- a/src/rpc/block_digest.rs +++ b/src/rpc/block_digest.rs @@ -1,16 +1,18 @@ -use crate::http_util::not_found_err; -use crate::http_util::rpc_err; -use crate::http_util::rpc_method_err; -use crate::model::app_state::AppState; -use crate::model::block_selector_extended::BlockSelectorExtended; +use std::sync::Arc; + use axum::extract::Path; use axum::extract::State; use axum::response::IntoResponse; use axum::response::Json; use neptune_cash::prelude::twenty_first::tip5::Digest; -use std::sync::Arc; use tarpc::context; +use crate::http_util::not_found_err; +use crate::http_util::rpc_err; +use crate::http_util::rpc_method_err; +use crate::model::app_state::AppState; +use crate::model::block_selector_extended::BlockSelectorExtended; + #[axum::debug_handler] pub async fn block_digest( Path(selector): Path, diff --git a/src/rpc/block_info.rs b/src/rpc/block_info.rs index 642099a..3eb02f4 100644 --- a/src/rpc/block_info.rs +++ b/src/rpc/block_info.rs @@ -1,15 +1,17 @@ +use std::sync::Arc; + +use axum::extract::Path; +use axum::extract::State; +use axum::response::Json; +use axum::response::Response; +use neptune_cash::protocol::consensus::block::block_info::BlockInfo; +use tarpc::context; + use crate::http_util::not_found_err; use crate::http_util::rpc_err; use crate::http_util::rpc_method_err; use crate::model::app_state::AppState; use crate::model::block_selector_extended::BlockSelectorExtended; -use axum::extract::Path; -use axum::extract::State; -use axum::response::Json; -use axum::response::Response; -use neptune_cash::models::blockchain::block::block_info::BlockInfo; -use std::sync::Arc; -use tarpc::context; #[axum::debug_handler] pub async fn block_info( diff --git a/src/rpc/pow_puzzle.rs b/src/rpc/pow_puzzle.rs index 109ae8b..ad84af7 100644 --- a/src/rpc/pow_puzzle.rs +++ b/src/rpc/pow_puzzle.rs @@ -1,11 +1,12 @@ +use std::sync::Arc; + use axum::extract::Path; use axum::extract::State; use axum::response::IntoResponse; use axum::response::Json; -use neptune_cash::models::state::wallet::address::generation_address::GenerationReceivingAddress; -use neptune_cash::rpc_server::error::RpcError; -use neptune_cash::rpc_server::ProofOfWorkPuzzle; -use std::sync::Arc; +use neptune_cash::application::rpc::server::error::RpcError; +use neptune_cash::application::rpc::server::proof_of_work_puzzle::ProofOfWorkPuzzle; +use neptune_cash::state::wallet::address::generation_address::GenerationReceivingAddress; use tarpc::context; use crate::http_util::not_found_err; diff --git a/src/rpc/provide_pow_solution.rs b/src/rpc/provide_pow_solution.rs index 44ffc68..c4c3ac5 100644 --- a/src/rpc/provide_pow_solution.rs +++ b/src/rpc/provide_pow_solution.rs @@ -1,16 +1,18 @@ -use crate::http_util::rpc_err; -use crate::http_util::rpc_method_err; -use crate::model::app_state::AppState; +use std::sync::Arc; + use axum::extract::State; use axum::response::Json; use axum::response::Response; -use neptune_cash::models::blockchain::block::block_header::BlockPow; use neptune_cash::prelude::twenty_first::tip5::Digest; +use neptune_cash::protocol::consensus::block::block_header::BlockPow; use serde::Deserialize; use serde::Serialize; -use std::sync::Arc; use tarpc::context; +use crate::http_util::rpc_err; +use crate::http_util::rpc_method_err; +use crate::model::app_state::AppState; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PowSolution { pow: BlockPow, diff --git a/src/rpc/utxo_digest.rs b/src/rpc/utxo_digest.rs index ee27c54..d90786f 100644 --- a/src/rpc/utxo_digest.rs +++ b/src/rpc/utxo_digest.rs @@ -1,16 +1,16 @@ +use std::sync::Arc; + use axum::extract::Path; use axum::extract::State; use axum::response::IntoResponse; use axum::response::Json; use neptune_cash::prelude::twenty_first::tip5::Digest; -use std::sync::Arc; use tarpc::context; +use crate::http_util::not_found_err; +use crate::http_util::rpc_err; use crate::http_util::rpc_method_err; -use crate::{ - http_util::{not_found_err, rpc_err}, - model::app_state::AppState, -}; +use crate::model::app_state::AppState; #[axum::debug_handler] pub async fn utxo_digest(