chore: Update neptune-core dependency

Also: format imports.
This commit is contained in:
sword_smith 2025-10-02 15:56:49 +02:00
parent 817835302b
commit 552923ae40
No known key found for this signature in database
GPG Key ID: 02593B11D184AEC7
21 changed files with 164 additions and 153 deletions

22
Cargo.lock generated
View File

@ -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"

View File

@ -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",

View File

@ -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() {

View File

@ -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> {

View File

@ -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<Path<AnnouncementSelector>, PathRejection>,

View File

@ -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<Path<BlockSelectorExtended>, PathRejection>,

View File

@ -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<String>) -> Html<String> {
#[derive(boilerplate::Boilerplate)]
#[boilerplate(filename = "web/html/page/not_found.html")]

View File

@ -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.
///

View File

@ -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<Arc<AppState>>) -> Result<Html<String>, Response> {
#[derive(boilerplate::Boilerplate)]

View File

@ -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<Path<u64>, PathRejection>,

View File

@ -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:

View File

@ -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<Self> {
// Pick one of the variants randomly

View File

@ -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
}
}

View File

@ -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`.
///

View File

@ -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 {

View File

@ -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<RpcResult<Option<BlockInfo>>, ::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<Mutex<Vec<TransparentUtxoTuple>>>,
) -> ::core::result::Result<RpcResult<Option<Digest>>, ::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<Result<Option<Vec<Announcement>>, 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<AuthenticatedClient, anyhow::Error> {
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<RPCClient, anyhow::Error> {
async fn get_cookie_hint(
client: &RPCClient,
data_dir: &Option<std::path::PathBuf>,
) -> anyhow::Result<rpc_auth::CookieHint> {
) -> anyhow::Result<auth::CookieHint> {
async fn fallback(
client: &RPCClient,
data_dir: &Option<std::path::PathBuf>,
) -> anyhow::Result<rpc_auth::CookieHint> {
) -> anyhow::Result<auth::CookieHint> {
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,
})

View File

@ -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<BlockSelectorExtended>,

View File

@ -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(

View File

@ -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;

View File

@ -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,

View File

@ -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(