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

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

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
[workspace]
members = ["bin/cli", "bin/node", "crates/node", "crates/proto", "crates/rust-client", "crates/web-client"]
members = [
"bin/cli",
"bin/load-test",
"bin/node",
"crates/node",
"crates/proto",
"crates/rust-client",
"crates/web-client",
]
resolver = "2"

[workspace.package]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ check: ## Check all targets and features for errors without code generation

.PHONY: build
build: ## Builds all crates and re-builds protobuf bindings for proto crates
cargo build --locked --workspace
BUILD_PROTO=1 cargo build --locked --workspace --all-targets --exclude miden-private-transport-client-web


# --- node-docker ---------------------------------------------------------------------------------
Expand Down
21 changes: 16 additions & 5 deletions bin/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ enum Commands {
/// Recipient account ID
#[arg(long)]
recipient: String,
/// Split header / details
#[arg(long)]
split: bool,
},

/// Random address (bech32) for testing purposes
Expand Down Expand Up @@ -146,8 +149,8 @@ async fn main() -> Result<()> {
client.register_tag(tag.into())?;
println!("✅ Tag {tag} registered successfully");
},
Commands::TestNote { recipient } => {
mock_note(&recipient)?;
Commands::TestNote { recipient, split } => {
mock_note(&recipient, split)?;
},
Commands::TestAddress => {
test_address();
Expand Down Expand Up @@ -261,13 +264,21 @@ async fn cleanup_old_data(client: &TransportLayerClient, days: u32) -> Result<()
Ok(())
}

fn mock_note(recipient_address_bech32: &str) -> Result<()> {
fn mock_note(recipient_address_bech32: &str, split: bool) -> Result<()> {
use miden_objects::utils::Serializable;
let (_, address) = Address::from_bech32(recipient_address_bech32)
.map_err(|e| anyhow!("Invalid recipient address {recipient_address_bech32}: {e}"))?;
let note = mock_note_p2id_with_addresses(&mock_address(), &address);
let hex_note = hex::encode(note.to_bytes());
info!("Test note: {}", hex_note);
if split {
let hex_note_header = hex::encode(note.header().to_bytes());
let hex_note_details = hex::encode(NoteDetails::from(note).to_bytes());
info!("Test note header: {}", hex_note_header);
info!("Test note details: {}", hex_note_details);
} else {
let hex_note = hex::encode(note.to_bytes());
info!("Test note: {}", hex_note);
}

Ok(())
}

Expand Down
29 changes: 29 additions & 0 deletions bin/load-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
authors.workspace = true
description = "Miden Private Transport Node Load-Testing Tool"
edition.workspace = true
homepage.workspace = true
keywords = ["messaging", "miden"]
license.workspace = true
name = "miden-private-transport-node-load-test"
readme.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[lints]
workspace = true

[dependencies]
# Workspace/local
miden-private-transport-client = { features = ["sqlite", "tonic"], workspace = true }

# Miden
miden-objects = { workspace = true }

# External
anyhow = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
rand = { workspace = true }
tokio = { workspace = true }
11 changes: 11 additions & 0 deletions bin/load-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Miden Private Transport Node Load-Test Tool

Tests the node implementation by flooding it with different requests.
Success rate, latency, and throughput are measured for each testing scenario.

## Scenarios

- `send-note`: Issue "SendNote" requests (one note) to the server;
- `fetch-notes`: Issue "FetchNotes" requests to the server (responses will have `n`-configured notes);
- `mixed`: Issue "SendNote" + "FetchNotes" requests in random order. "FetchNotes" may yield some response notes;
- `req-rep`: Issue one "SendNote" to one "FetchNotes" requests. "FetchNotes" response will yield one note.
Loading
Loading