Skip to content
Merged
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
6 changes: 0 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bin/node/src/commands/modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ impl SequencerCommand {
ntx_builder,
self.block_producer.block_prover.url,
runtime.database_options,
runtime.internal_grpc_options,
runtime.external_grpc_options,
runtime.storage_options,
self.block_producer.block.max_concurrent_proofs,
Expand Down Expand Up @@ -103,7 +102,6 @@ impl FullNodeCommand {
runtime.rpc_listen,
runtime.data_directory,
runtime.database_options,
runtime.internal_grpc_options,
runtime.external_grpc_options,
runtime.storage_options,
source_rpc,
Expand Down
16 changes: 3 additions & 13 deletions bin/node/src/commands/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ use std::net::SocketAddr;
use std::num::{NonZeroU32, NonZeroU64};
use std::time::Duration;

use miden_node_utils::clap::{
GrpcOptionsExternal,
GrpcOptionsInternal,
duration_to_human_readable_string,
};
use miden_node_utils::clap::{GrpcOptionsExternal, duration_to_human_readable_string};
use url::Url;

// RPC OPTIONS
Expand All @@ -28,7 +24,7 @@ pub struct RpcOptions {
pub network_tx_auth_header_value: Option<String>,

#[command(flatten)]
pub grpc: RpcGrpcOptions,
pub grpc: GrpcOptions,

#[command(flatten)]
pub rate_limit: RpcRateLimitOptions,
Expand All @@ -47,7 +43,7 @@ impl RpcOptions {
}

#[derive(clap::Args, Clone, Debug)]
pub struct RpcGrpcOptions {
pub struct GrpcOptions {
/// Maximum duration a gRPC request is allocated before being dropped by the server.
#[arg(
long = "rpc.grpc.timeout",
Expand All @@ -71,12 +67,6 @@ pub struct RpcGrpcOptions {
pub max_connection_age: Duration,
}

impl RpcGrpcOptions {
pub(super) fn internal_grpc_options(&self) -> GrpcOptionsInternal {
GrpcOptionsInternal { request_timeout: self.timeout }
}
}

#[derive(clap::Args, Clone, Debug)]
pub struct RpcRateLimitOptions {
/// Number of RPC request credits available per IP before replenishment.
Expand Down
4 changes: 1 addition & 3 deletions bin/node/src/commands/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::net::SocketAddr;
use std::path::PathBuf;

use miden_node_store::DatabaseOptions;
use miden_node_utils::clap::{GrpcOptionsExternal, GrpcOptionsInternal, StorageOptions};
use miden_node_utils::clap::{GrpcOptionsExternal, StorageOptions};
use miden_node_utils::logging::OpenTelemetry;

use super::ENV_DATA_DIRECTORY;
Expand Down Expand Up @@ -48,7 +48,6 @@ impl RuntimeOptions {
data_directory: self.data_directory.clone(),
rpc_listen: self.rpc.listen,
database_options: store.sqlite.database_options(),
internal_grpc_options: self.rpc.grpc.internal_grpc_options(),
external_grpc_options: self.rpc.external_grpc_options(),
storage_options: store.storage.clone().into(),
}
Expand All @@ -60,7 +59,6 @@ pub(super) struct RuntimeConfig {
pub data_directory: PathBuf,
pub rpc_listen: SocketAddr,
pub database_options: DatabaseOptions,
pub internal_grpc_options: GrpcOptionsInternal,
pub external_grpc_options: GrpcOptionsExternal,
pub storage_options: StorageOptions,
}
33 changes: 0 additions & 33 deletions bin/ntx-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,36 +425,3 @@ impl NtxBuilderConfig {
))
}
}

#[cfg(test)]
mod tests {
use std::path::PathBuf;

use tonic::metadata::AsciiMetadataValue;
use url::Url;

use super::NtxBuilderConfig;

#[test]
fn ntx_builder_config_default_has_no_rpc_auth_header() {
let config = NtxBuilderConfig::new(
Url::parse("http://127.0.0.1:57291").expect("valid url"),
PathBuf::from("ntx-builder.sqlite3"),
);

assert_eq!(config.rpc_auth_header, None);
}

#[test]
fn ntx_builder_config_with_rpc_auth_header_stores_value() {
let secret_token = AsciiMetadataValue::from_static("secret-token");

let config = NtxBuilderConfig::new(
Url::parse("http://127.0.0.1:57291").expect("valid url"),
PathBuf::from("ntx-builder.sqlite3"),
)
.with_rpc_auth_header(secret_token.clone());

assert_eq!(config.rpc_auth_header, Some(secret_token));
}
}
2 changes: 0 additions & 2 deletions bin/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ miden-standards = { workspace = true }
rand = { workspace = true }
rayon = { workspace = true }
tokio = { workspace = true }
tonic = { default-features = true, workspace = true }
url = { workspace = true }
54 changes: 6 additions & 48 deletions bin/stress-test/src/seeding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ use std::time::Instant;

use metrics::SeedingMetrics;
use miden_node_proto::domain::batch::BatchInputs;
use miden_node_proto::generated::store::rpc_client::RpcClient;
use miden_node_store::state::State;
use miden_node_store::{DataDirectory, GenesisState, Store, StoreMode};
use miden_node_utils::clap::{GrpcOptionsInternal, StorageOptions};
use miden_node_utils::tracing::grpc::OtelInterceptor;
use miden_node_store::{DataDirectory, GenesisState, Store};
use miden_node_utils::clap::StorageOptions;
use miden_protocol::account::auth::AuthScheme;
use miden_protocol::account::delta::AccountUpdateDetails;
use miden_protocol::account::{
Expand Down Expand Up @@ -71,12 +69,8 @@ use rand::Rng;
use rand::seq::SliceRandom;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use rayon::prelude::ParallelSlice;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpListener;
use tokio::{fs, task};
use tonic::service::interceptor::InterceptedService;
use tonic::transport::Channel;
use url::Url;

mod metrics;
#[cfg(test)]
Expand Down Expand Up @@ -838,45 +832,9 @@ async fn get_block_inputs(
inputs
}

/// Runs the store with the given data directory. Returns a tuple with:
/// - a gRPC client to access the store
/// - the URL of the store
///
/// The store uses a local prover.
pub async fn start_store(
data_directory: PathBuf,
) -> (RpcClient<InterceptedService<Channel, OtelInterceptor>>, Url) {
let rpc_listener = TcpListener::bind("127.0.0.1:0")
.await
.expect("Failed to bind store RPC gRPC endpoint");
let store_addr = rpc_listener.local_addr().expect("Failed to get store RPC address");
let dir = data_directory.clone();

task::spawn(async move {
Store {
rpc_listener,
mode: StoreMode::Sequencer {
block_prover_url: None,
max_concurrent_proofs: miden_node_store::DEFAULT_MAX_CONCURRENT_PROOFS,
},
data_directory: dir,
database_options: miden_node_store::DatabaseOptions::default(),
grpc_options: GrpcOptionsInternal::bench(),
storage_options: StorageOptions::bench(),
}
.serve()
.await
.expect("Failed to start serving store");
});

let channel = tonic::transport::Endpoint::try_from(format!("http://{store_addr}",))
.unwrap()
.connect()
.await
.expect("Failed to connect to store");

let store_url = Url::parse(&format!("http://{store_addr}")).unwrap();
(RpcClient::with_interceptor(channel, OtelInterceptor), store_url)
/// Loads the store state from the given data directory.
pub async fn start_store(data_directory: PathBuf) -> Arc<State> {
load_state(data_directory).await
}

async fn load_state(data_directory: PathBuf) -> Arc<State> {
Expand Down
Loading
Loading