From f6f3a060b1def1ff075c004324f951363560389c Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Mon, 2 Dec 2024 15:14:07 -0500 Subject: [PATCH] benchmark syncs --- Cargo.lock | 2 + Cargo.toml | 2 + dev/bench | 6 +- dev/flamegraph | 4 +- xmtp_debug/Cargo.toml | 4 +- xmtp_debug/src/app/clients.rs | 1 + xmtp_mls/Cargo.toml | 12 +++ xmtp_mls/benches/group_limit.rs | 12 +-- xmtp_mls/benches/identity.rs | 45 ++------ xmtp_mls/benches/sync.rs | 56 ++++++++++ .../src/groups/device_sync/message_sync.rs | 19 ++-- xmtp_mls/src/utils/bench/clients.rs | 72 +++++++++++++ .../utils/{bench.rs => bench/identity_gen.rs} | 101 +----------------- xmtp_mls/src/utils/bench/mod.rs | 99 +++++++++++++++++ xmtp_mls/src/utils/test/mod.rs | 6 ++ 15 files changed, 280 insertions(+), 161 deletions(-) create mode 100644 xmtp_mls/benches/sync.rs create mode 100644 xmtp_mls/src/utils/bench/clients.rs rename xmtp_mls/src/utils/{bench.rs => bench/identity_gen.rs} (54%) create mode 100644 xmtp_mls/src/utils/bench/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 51d6be477..b19d63c22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7275,6 +7275,7 @@ dependencies = [ "bincode", "chrono", "console_error_panic_hook", + "const_format", "criterion", "ctor", "diesel", @@ -7282,6 +7283,7 @@ dependencies = [ "diesel_migrations", "dyn-clone", "ethers", + "fdlimit", "futures", "getrandom", "gloo-timers 0.3.0", diff --git a/Cargo.toml b/Cargo.toml index 5398ef292..0c2025a8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,6 +89,8 @@ url = "2.5.0" zeroize = "1.8" bincode = "1.3" console_error_panic_hook = "0.1" +fdlimit = "0.3" +const_format = "0.2" # Internal Crate Dependencies xmtp_cryptography = { path = "xmtp_cryptography" } diff --git a/dev/bench b/dev/bench index c4ec1e38e..b7b8f89c7 100755 --- a/dev/bench +++ b/dev/bench @@ -2,7 +2,9 @@ set -eou pipefail if [[ -z "${1-}" ]]; then - cargo bench --no-fail-fast --features bench + cargo bench --no-fail-fast --features bench -p xmtp_mls else - cargo bench --no-fail-fast --features bench -- "$1" + cargo bench --no-fail-fast --features bench -p xmtp_mls -- "$1" fi + +echo "Open benchmarks at target/criterion/report.html" diff --git a/dev/flamegraph b/dev/flamegraph index cb0eba67f..872257321 100755 --- a/dev/flamegraph +++ b/dev/flamegraph @@ -7,9 +7,9 @@ if [[ "${OSTYPE}" == "darwin"* ]]; then fi if [[ -z "${1-}" ]]; then - XMTP_FLAMEGRAPH=trace cargo bench --no-fail-fast --features bench + XMTP_FLAMEGRAPH=trace cargo bench --no-fail-fast --features bench -p xmtp_mls else - XMTP_FLAMEGRAPH=trace cargo bench --no-fail-fast --features bench -- "$1" + XMTP_FLAMEGRAPH=trace cargo bench --no-fail-fast --features bench -p xmtp_mls -- "$1" fi cat xmtp_mls/tracing.foldeed | inferno-flamegraph > tracing-flamegraph.svg diff --git a/xmtp_debug/Cargo.toml b/xmtp_debug/Cargo.toml index d1ca81f23..f1ec81d46 100644 --- a/xmtp_debug/Cargo.toml +++ b/xmtp_debug/Cargo.toml @@ -23,7 +23,7 @@ owo-colors = "4.1" url.workspace = true redb = "2.2" directories = "5.0" -const_format = "0.2" +const_format.workspace = true speedy = "0.8" hex.workspace = true prost.workspace = true @@ -40,5 +40,5 @@ rand.workspace = true fs_extra = "1.3" ethers.workspace = true miniserde = "0.1" -fdlimit = "0.3" +fdlimit.workspace = true lipsum = "0.9" diff --git a/xmtp_debug/src/app/clients.rs b/xmtp_debug/src/app/clients.rs index fe07c5a9c..6824ca39e 100644 --- a/xmtp_debug/src/app/clients.rs +++ b/xmtp_debug/src/app/clients.rs @@ -1,4 +1,5 @@ //! Different ways to create a [`crate::DbgClient`] + use super::*; use crate::app::types::*; diff --git a/xmtp_mls/Cargo.toml b/xmtp_mls/Cargo.toml index 697914898..bcce43e45 100644 --- a/xmtp_mls/Cargo.toml +++ b/xmtp_mls/Cargo.toml @@ -23,6 +23,9 @@ bench = [ "once_cell", "dep:xmtp_api_grpc", "criterion", + "dep:fdlimit", + "dep:ethers", + "dep:const_format" ] default = ["grpc-api"] grpc-api = ["dep:xmtp_api_grpc"] @@ -74,6 +77,9 @@ console_error_panic_hook = { workspace = true, optional = true } toml = { version = "0.8.4", optional = true } tracing-wasm = { version = "0.2", optional = true } xmtp_api_http = { path = "../xmtp_api_http", optional = true } +fdlimit = { workspace = true, optional = true } +ethers = { workspace = true, features = ["openssl"], optional = true } +const_format = { workspace = true, optional = true } # Test/Bench Utils anyhow = { workspace = true, optional = true } @@ -132,6 +138,7 @@ mockall = "0.13.1" openmls_basic_credential.workspace = true xmtp_id = { path = "../xmtp_id", features = ["test-utils"] } xmtp_proto = { workspace = true, features = ["test-utils"] } +const_format.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] ctor.workspace = true @@ -181,3 +188,8 @@ harness = false name = "identity" required-features = ["bench"] +[[bench]] +harness = false +name = "sync" +required-features = ["bench"] + diff --git a/xmtp_mls/benches/group_limit.rs b/xmtp_mls/benches/group_limit.rs index 1a2bc954c..ba3027eb3 100755 --- a/xmtp_mls/benches/group_limit.rs +++ b/xmtp_mls/benches/group_limit.rs @@ -9,18 +9,12 @@ use tracing::{trace_span, Instrument}; use xmtp_mls::{ builder::ClientBuilder, groups::GroupMetadataOptions, - utils::{ - bench::{ - bench_async_setup, create_identities_if_dont_exist, init_logging, Identity, - BENCH_ROOT_SPAN, - }, - test::TestClient, + utils::bench::{ + bench_async_setup, create_identities_if_dont_exist, init_logging, BenchClient, Identity, + BENCH_ROOT_SPAN, }, - Client, }; -pub type BenchClient = Client; - pub const IDENTITY_SAMPLES: [usize; 9] = [10, 20, 40, 80, 100, 200, 300, 400, 450]; pub const MAX_IDENTITIES: usize = 1_000; pub const SAMPLE_SIZE: usize = 10; diff --git a/xmtp_mls/benches/identity.rs b/xmtp_mls/benches/identity.rs index 437e6af17..daecb3fdc 100644 --- a/xmtp_mls/benches/identity.rs +++ b/xmtp_mls/benches/identity.rs @@ -10,16 +10,17 @@ use xmtp_id::{ }, InboxOwner, }; -use xmtp_mls::utils::{bench::init_logging, test::TestClient as TestApiClient}; +use xmtp_mls::utils::{ + bench::{clients, init_logging}, + test::TestClient as TestApiClient, +}; use xmtp_mls::{ client::Client, identity::IdentityStrategy, - utils::bench::{bench_async_setup, BENCH_ROOT_SPAN}, + utils::bench::{bench_async_setup, BenchClient, BENCH_ROOT_SPAN}, }; use xmtp_proto::api_client::XmtpTestClient; -type BenchClient = Client; - #[macro_use] extern crate tracing; @@ -32,40 +33,6 @@ fn setup() -> Runtime { .unwrap() } -async fn new_client() -> (BenchClient, LocalWallet) { - let nonce = 1; - let wallet = xmtp_cryptography::utils::generate_local_wallet(); - let inbox_id = generate_inbox_id(&wallet.get_address(), &nonce).unwrap(); - - let dev = std::env::var("DEV_GRPC"); - let is_dev_network = matches!(dev, Ok(d) if d == "true" || d == "1"); - - let api_client = if is_dev_network { - tracing::info!("Using Dev GRPC"); - ::create_dev().await - } else { - tracing::info!("Using Local GRPC"); - ::create_local().await - }; - - let client = BenchClient::builder(IdentityStrategy::new( - inbox_id, - wallet.get_address(), - nonce, - None, - )); - - let client = client - .temp_store() - .await - .api_client(api_client) - .build() - .await - .unwrap(); - - (client, wallet) -} - async fn ecdsa_signature(client: &BenchClient, owner: impl InboxOwner) -> SignatureRequest { let mut signature_request = client.context().signature_request().unwrap(); let signature_text = signature_request.signature_text(); @@ -92,7 +59,7 @@ fn register_identity_eoa(c: &mut Criterion) { b.to_async(&runtime).iter_batched( || { bench_async_setup(|| async { - let (client, wallet) = new_client().await; + let (client, wallet) = clients::new_unregistered_client(false).await; let signature_request = ecdsa_signature(&client, wallet).await; (client, signature_request, span.clone()) diff --git a/xmtp_mls/benches/sync.rs b/xmtp_mls/benches/sync.rs new file mode 100644 index 000000000..3dd215f88 --- /dev/null +++ b/xmtp_mls/benches/sync.rs @@ -0,0 +1,56 @@ +//! Benchmarking for syncing functions +use crate::tracing::Instrument; +use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; +use tokio::runtime::{Builder, Runtime}; +use xmtp_mls::utils::bench::{bench_async_setup, BENCH_ROOT_SPAN}; +use xmtp_mls::utils::bench::{clients, init_logging}; + +#[macro_use] +extern crate tracing; + +fn setup() -> Runtime { + Builder::new_multi_thread() + .enable_time() + .enable_io() + .thread_name("xmtp-bencher") + .build() + .unwrap() +} + +fn start_sync_worker(c: &mut Criterion) { + init_logging(); + + let runtime = setup(); + let mut benchmark_group = c.benchmark_group("start_sync_worker"); + benchmark_group.sample_size(10); + benchmark_group.bench_function("start_sync_worker", |b| { + let span = trace_span!(BENCH_ROOT_SPAN); + b.to_async(&runtime).iter_batched( + || { + bench_async_setup(|| async { + let client = clients::new_client(true).await; + let provider = client.mls_provider().unwrap(); + // set history sync URL + (client, provider, span.clone()) + }) + }, + |(client, provider, span)| async move { + client + .start_sync_worker(&provider) + .instrument(span) + .await + .unwrap() + }, + BatchSize::SmallInput, + ) + }); + + benchmark_group.finish(); +} + +criterion_group!( + name = sync; + config = Criterion::default().sample_size(10); + targets = start_sync_worker +); +criterion_main!(sync); diff --git a/xmtp_mls/src/groups/device_sync/message_sync.rs b/xmtp_mls/src/groups/device_sync/message_sync.rs index 44748ff61..1bc41f796 100644 --- a/xmtp_mls/src/groups/device_sync/message_sync.rs +++ b/xmtp_mls/src/groups/device_sync/message_sync.rs @@ -47,21 +47,19 @@ pub(crate) mod tests { #[cfg(target_arch = "wasm32")] wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_dedicated_worker); - const HISTORY_SERVER_HOST: &str = "localhost"; - const HISTORY_SERVER_PORT: u16 = 5558; - use super::*; - use crate::{assert_ok, builder::ClientBuilder, groups::GroupMetadataOptions}; + use crate::{ + assert_ok, builder::ClientBuilder, groups::GroupMetadataOptions, + utils::test::HISTORY_SYNC_URL, + }; use std::time::{Duration, Instant}; use xmtp_cryptography::utils::generate_local_wallet; use xmtp_id::InboxOwner; #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_message_history_sync() { - let history_sync_url = format!("http://{}:{}", HISTORY_SERVER_HOST, HISTORY_SERVER_PORT); - let wallet = generate_local_wallet(); - let amal_a = ClientBuilder::new_test_client_with_history(&wallet, &history_sync_url).await; + let amal_a = ClientBuilder::new_test_client_with_history(&wallet, HISTORY_SYNC_URL).await; let amal_a_provider = amal_a.mls_provider().unwrap(); let amal_a_conn = amal_a_provider.conn_ref(); @@ -87,7 +85,7 @@ pub(crate) mod tests { assert_eq!(syncable_messages.len(), 2); // welcome message, and message that was just sent // Create a second installation for amal. - let amal_b = ClientBuilder::new_test_client_with_history(&wallet, &history_sync_url).await; + let amal_b = ClientBuilder::new_test_client_with_history(&wallet, &HISTORY_SYNC_URL).await; let amal_b_provider = amal_b.mls_provider().unwrap(); let amal_b_conn = amal_b_provider.conn_ref(); @@ -161,16 +159,15 @@ pub(crate) mod tests { #[tokio::test] async fn test_externals_cant_join_sync_group() { - let history_sync_url = format!("http://{}:{}", HISTORY_SERVER_HOST, HISTORY_SERVER_PORT); let wallet = generate_local_wallet(); - let amal = ClientBuilder::new_test_client_with_history(&wallet, &history_sync_url).await; + let amal = ClientBuilder::new_test_client_with_history(&wallet, &HISTORY_SYNC_URL).await; amal.sync_welcomes(&amal.store().conn().unwrap()) .await .expect("sync welcomes"); let external_wallet = generate_local_wallet(); let external_client = - ClientBuilder::new_test_client_with_history(&external_wallet, &history_sync_url).await; + ClientBuilder::new_test_client_with_history(&external_wallet, &HISTORY_SYNC_URL).await; external_client .sync_welcomes(&external_client.store().conn().unwrap()) diff --git a/xmtp_mls/src/utils/bench/clients.rs b/xmtp_mls/src/utils/bench/clients.rs new file mode 100644 index 000000000..90eaaf666 --- /dev/null +++ b/xmtp_mls/src/utils/bench/clients.rs @@ -0,0 +1,72 @@ +use crate::utils::test::{TestClient as TestApiClient, HISTORY_SYNC_URL}; +use crate::{client::Client, identity::IdentityStrategy}; +use ethers::signers::LocalWallet; +use xmtp_id::{ + associations::{ + builder::SignatureRequest, + generate_inbox_id, + unverified::{UnverifiedRecoverableEcdsaSignature, UnverifiedSignature}, + }, + InboxOwner, +}; +use xmtp_proto::api_client::XmtpTestClient; + +pub type BenchClient = Client; + +/// Create a new, yet-unregistered client +pub async fn new_unregistered_client(history_sync: bool) -> (BenchClient, LocalWallet) { + let _ = fdlimit::raise_fd_limit(); + + let nonce = 1; + let wallet = xmtp_cryptography::utils::generate_local_wallet(); + let inbox_id = generate_inbox_id(&wallet.get_address(), &nonce).unwrap(); + + let dev = std::env::var("DEV_GRPC"); + let is_dev_network = matches!(dev, Ok(d) if d == "true" || d == "1"); + + let api_client = if is_dev_network { + tracing::info!("Using Dev GRPC"); + ::create_dev().await + } else { + tracing::info!("Using Local GRPC"); + ::create_local().await + }; + + let client = BenchClient::builder(IdentityStrategy::new( + inbox_id, + wallet.get_address(), + nonce, + None, + )); + + let mut client = client.temp_store().await.api_client(api_client); + if history_sync { + client = client.history_sync_url(HISTORY_SYNC_URL); + } + let client = client.build().await.unwrap(); + + (client, wallet) +} + +/// Add ECDSA Signature to a client +pub async fn ecdsa_signature(client: &BenchClient, owner: impl InboxOwner) -> SignatureRequest { + let mut signature_request = client.context().signature_request().unwrap(); + let signature_text = signature_request.signature_text(); + let unverified_signature = UnverifiedSignature::RecoverableEcdsa( + UnverifiedRecoverableEcdsaSignature::new(owner.sign(&signature_text).unwrap().into()), + ); + signature_request + .add_signature(unverified_signature, client.scw_verifier()) + .await + .unwrap(); + + signature_request +} + +/// Create a new registered client with an EOA +pub async fn new_client(history_sync: bool) -> BenchClient { + let (client, wallet) = new_unregistered_client(history_sync).await; + let signature_request = ecdsa_signature(&client, wallet).await; + client.register_identity(signature_request).await.unwrap(); + client +} diff --git a/xmtp_mls/src/utils/bench.rs b/xmtp_mls/src/utils/bench/identity_gen.rs similarity index 54% rename from xmtp_mls/src/utils/bench.rs rename to xmtp_mls/src/utils/bench/identity_gen.rs index 1416b83d9..8c1b42489 100644 --- a/xmtp_mls/src/utils/bench.rs +++ b/xmtp_mls/src/utils/bench/identity_gen.rs @@ -1,104 +1,12 @@ -//! Utilities for xmtp_mls benchmarks -//! Utilities mostly include pre-generating identities in order to save time when writing/testing -//! benchmarks. -#![allow(clippy::unwrap_used)] +//! Identity Generation -use crate::{builder::ClientBuilder, Client}; +use crate::builder::ClientBuilder; use indicatif::{ProgressBar, ProgressStyle}; -use once_cell::sync::OnceCell; use serde::{Deserialize, Serialize}; -use std::sync::Once; -use thiserror::Error; -use tracing::{Metadata, Subscriber}; -use tracing_flame::{FlameLayer, FlushGuard}; -use tracing_subscriber::{ - layer::{Context, Filter, Layer, SubscriberExt}, - registry::LookupSpan, - util::SubscriberInitExt, - EnvFilter, -}; use xmtp_cryptography::utils::generate_local_wallet; use xmtp_id::InboxOwner; -use super::test::TestClient; - -pub const BENCH_ROOT_SPAN: &str = "xmtp-trace-bench"; - -/// Re-export of functions in private modules for benchmarks -pub mod re_export { - pub use crate::hpke::encrypt_welcome; -} - -#[derive(Debug, Error)] -pub enum BenchError { - #[error(transparent)] - Serde(#[from] serde_json::Error), - #[error(transparent)] - Io(#[from] std::io::Error), -} - -static INIT: Once = Once::new(); - -static LOGGER: OnceCell>> = OnceCell::new(); - -/// initializes logging for benchmarks -/// - FMT logging is enabled by passing the normal `RUST_LOG` environment variable options. -/// - Generate a flamegraph from tracing data by passing `XMTP_FLAMEGRAPH=trace` -pub fn init_logging() { - INIT.call_once(|| { - let (flame_layer, guard) = FlameLayer::with_file("./tracing.folded").unwrap(); - let flame_layer = flame_layer - .with_threads_collapsed(true) - .with_module_path(true); - // .with_empty_samples(false); - - tracing_subscriber::registry() - .with(tracing_subscriber::fmt::layer().with_filter(EnvFilter::from_default_env())) - .with( - flame_layer - .with_filter(BenchFilter) - .with_filter(EnvFilter::from_env("XMTP_FLAMEGRAPH")), - ) - .init(); - - LOGGER.set(guard).unwrap(); - }) -} - -/// criterion `batch_iter` surrounds the closure in a `Runtime.block_on` despite being a sync -/// function, even in the async 'to_async` setup. Therefore we do this (only _slightly_) hacky -/// workaround to allow us to async setup some groups. -pub fn bench_async_setup(fun: F) -> T -where - F: Fn() -> Fut, - Fut: futures::future::Future, -{ - use tokio::runtime::Handle; - tokio::task::block_in_place(move || Handle::current().block_on(async move { fun().await })) -} - -/// Filters for only spans where the root span name is "bench" -pub struct BenchFilter; - -impl Filter for BenchFilter -where - S: Subscriber + for<'lookup> LookupSpan<'lookup> + std::fmt::Debug, - for<'lookup> >::Data: std::fmt::Debug, -{ - fn enabled(&self, meta: &Metadata<'_>, cx: &Context<'_, S>) -> bool { - if meta.name() == BENCH_ROOT_SPAN { - return true; - } - if let Some(id) = cx.current_span().id() { - if let Some(s) = cx.span_scope(id) { - if let Some(s) = s.from_root().take(1).collect::>().first() { - return s.name() == BENCH_ROOT_SPAN; - } - } - } - false - } -} +use super::{BenchClient, BenchError}; pub fn file_path(is_dev_network: bool) -> String { if is_dev_network { @@ -188,9 +96,10 @@ async fn create_identities(n: usize, is_dev_network: bool) -> Vec { /// node still has those identities. pub async fn create_identities_if_dont_exist( identities: usize, - client: &Client, + client: &BenchClient, is_dev_network: bool, ) -> Vec { + let _ = fdlimit::raise_fd_limit(); match load_identities(is_dev_network) { Ok(identities) => { tracing::info!( diff --git a/xmtp_mls/src/utils/bench/mod.rs b/xmtp_mls/src/utils/bench/mod.rs new file mode 100644 index 000000000..5466c6dd9 --- /dev/null +++ b/xmtp_mls/src/utils/bench/mod.rs @@ -0,0 +1,99 @@ +//! Utilities for xmtp_mls benchmarks +//! Utilities mostly include pre-generating identities in order to save time when writing/testing +//! benchmarks. +#![allow(clippy::unwrap_used)] + +mod identity_gen; +pub use identity_gen::*; +pub mod clients; +pub use clients::*; + +use once_cell::sync::OnceCell; +use std::sync::Once; +use thiserror::Error; +use tracing::{Metadata, Subscriber}; +use tracing_flame::{FlameLayer, FlushGuard}; +use tracing_subscriber::{ + layer::{Context, Filter, Layer, SubscriberExt}, + registry::LookupSpan, + util::SubscriberInitExt, + EnvFilter, +}; + +pub const BENCH_ROOT_SPAN: &str = "xmtp-trace-bench"; + +/// Re-export of functions in private modules for benchmarks +pub mod re_export { + pub use crate::hpke::encrypt_welcome; +} + +#[derive(Debug, Error)] +pub enum BenchError { + #[error(transparent)] + Serde(#[from] serde_json::Error), + #[error(transparent)] + Io(#[from] std::io::Error), +} + +static INIT: Once = Once::new(); + +static LOGGER: OnceCell>> = OnceCell::new(); + +/// initializes logging for benchmarks +/// - FMT logging is enabled by passing the normal `RUST_LOG` environment variable options. +/// - Generate a flamegraph from tracing data by passing `XMTP_FLAMEGRAPH=trace` +pub fn init_logging() { + INIT.call_once(|| { + let (flame_layer, guard) = FlameLayer::with_file("./tracing.folded").unwrap(); + let flame_layer = flame_layer + .with_threads_collapsed(true) + .with_module_path(true); + // .with_empty_samples(false); + + tracing_subscriber::registry() + .with(tracing_subscriber::fmt::layer().with_filter(EnvFilter::from_default_env())) + .with( + flame_layer + .with_filter(BenchFilter) + .with_filter(EnvFilter::from_env("XMTP_FLAMEGRAPH")), + ) + .init(); + + LOGGER.set(guard).unwrap(); + }) +} + +/// criterion `batch_iter` surrounds the closure in a `Runtime.block_on` despite being a sync +/// function, even in the async 'to_async` setup. Therefore we do this (only _slightly_) hacky +/// workaround to allow us to async setup some groups. +pub fn bench_async_setup(fun: F) -> T +where + F: Fn() -> Fut, + Fut: futures::future::Future, +{ + use tokio::runtime::Handle; + tokio::task::block_in_place(move || Handle::current().block_on(async move { fun().await })) +} + +/// Filters for only spans where the root span name is "bench" +pub struct BenchFilter; + +impl Filter for BenchFilter +where + S: Subscriber + for<'lookup> LookupSpan<'lookup> + std::fmt::Debug, + for<'lookup> >::Data: std::fmt::Debug, +{ + fn enabled(&self, meta: &Metadata<'_>, cx: &Context<'_, S>) -> bool { + if meta.name() == BENCH_ROOT_SPAN { + return true; + } + if let Some(id) = cx.current_span().id() { + if let Some(s) = cx.span_scope(id) { + if let Some(s) = s.from_root().take(1).collect::>().first() { + return s.name() == BENCH_ROOT_SPAN; + } + } + } + false + } +} diff --git a/xmtp_mls/src/utils/test/mod.rs b/xmtp_mls/src/utils/test/mod.rs index 952b31988..29d55febb 100755 --- a/xmtp_mls/src/utils/test/mod.rs +++ b/xmtp_mls/src/utils/test/mod.rs @@ -31,6 +31,11 @@ pub use traced_test::traced_test; pub type FullXmtpClient = Client; +const HISTORY_SERVER_HOST: &str = "localhost"; +const HISTORY_SERVER_PORT: u16 = 5558; +pub const HISTORY_SYNC_URL: &str = + const_format::concatcp!("http://", HISTORY_SERVER_HOST, ":", HISTORY_SERVER_PORT); + #[cfg(not(any(feature = "http-api", target_arch = "wasm32")))] pub type TestClient = xmtp_api_grpc::grpc_api_helper::Client; @@ -92,6 +97,7 @@ impl EncryptedMessageStore { impl ClientBuilder { pub async fn temp_store(self) -> Self { let tmpdb = tmp_path(); + tracing::info!("Opening Database at [{}]", tmpdb); self.store( EncryptedMessageStore::new( StorageOption::Persistent(tmpdb),