Files
amethyst/relayBench/run.sh
Claude 9afa8127da refactor!: take quartz from vitorpamplona/quartz
Quartz moves to its own repo, the way the crypto primitives moved to
crypto-kmp. Every module depends on com.vitorpamplona.quartz:quartz
2.0.0 (libs.quartz) instead of :quartz, and -PquartzDir=../quartz
builds a local checkout instead of the artifact, for every module and
for quic's own quartz dependency (which replaces the root build's
substitution of the published quartz with :quartz).

What moved with quartz: its CI jobs (lint tasks, test-quartz-linux-native,
test-quartz-ios), the Maven Central publish step of the release
workflow, jitpack.yml, tools/unicode-nfkc, the nostr-expert and
event-store-semantics skills, the agent-skill check, and the README's
library usage docs.

What stays here:
- The four quartz client tests that need a real Ktor socket relay
  (TrustNetworkSync*, GiantReqStreamTest, BulkDownloadBenchmark) move to
  geode's tests; geode forwards -PprodRelayBench for the latter. quartz's
  other relay-client tests now use a test relay of its own, which ends
  quartz's test dependency on geode.
- The benchmark module's resources (previously read from quartz's
  androidDeviceTest resources) move into benchmark/; relayBench --real
  reads the corpus from there.
- NoteComposeKindCoverageTest reads EventFactory.kt from quartz's JVM
  sources jar, or from the -PquartzDir checkout, passed by commonsUI's
  build.
- commons and commonsUI declare crypto-kmp (and commons mls-kmp), which
  they import directly. Through quartz's api alone, a -PcryptoKmpDir
  checkout never reached the common metadata compile.
- The catalog drops what only quartz used (kchesslib, negentropy,
  jackson-databind, sqlite-bundled, secp256k1-kmp common, compose
  runtime-annotation, the maven-publish plugin).

agent_config_check checks a skill's quartz/... paths against a ../quartz
checkout when there is one and skips them otherwise. AGENTS.md, the
skills, CONTRIBUTING, BUILDING, RELEASE_OPS, PLANS and the READMEs point
at the new repo.

Needs quartz 2.0.0 (and crypto-kmp 1.0.0) on Maven Central before CI can
resolve it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEkJaDWYrcTbGvT8JLQCrG
2026-10-21 16:32:25 +00:00

99 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# relaybench — one-command Nostr relay benchmark (geode vs strfry vs anything).
#
# ./relayBench/run.sh # deterministic 10k synthetic corpus
# ./relayBench/run.sh --quick # 2k-event smoke run
# ./relayBench/run.sh --real # replay the checked-in real-event dump
# ./relayBench/run.sh --corpus f.gz --limit 50000
# ./relayBench/run.sh --relay 'myrelay=/path/bin --port {port} --db {dir}'
#
# strfry resolution order: $STRFRY_BIN → `strfry` on PATH → build from
# source into relayBench/.cache (needs the deps listed in the error text).
# Skip strfry entirely with SKIP_STRFRY=1; skip geode with SKIP_GEODE=1.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(dirname "$HERE")"
CACHE="$HERE/.cache"
ARGS=()
for arg in "$@"; do
case "$arg" in
--real)
ARGS+=("--corpus" "$ROOT/benchmark/src/androidTest/resources/nostr_vitor_startup_data.json.gz")
;;
*)
ARGS+=("$arg")
;;
esac
done
# ---------- strfry ----------
resolve_strfry() {
if [[ -n "${STRFRY_BIN:-}" ]]; then
echo "$STRFRY_BIN"
return
fi
if command -v strfry > /dev/null 2>&1; then
command -v strfry
return
fi
if [[ -x "$CACHE/strfry/strfry" ]]; then
echo "$CACHE/strfry/strfry"
return
fi
echo "building strfry from source (first run only — a few minutes)…" >&2
mkdir -p "$CACHE"
if [[ ! -d "$CACHE/strfry" ]]; then
git clone --depth 1 https://github.com/hoytech/strfry.git "$CACHE/strfry" >&2
fi
(
cd "$CACHE/strfry"
git submodule update --init --depth 1 >&2
make setup-golpe >&2
make -j"$(nproc)" >&2
) || {
cat >&2 << 'EOF'
strfry build failed. On Debian/Ubuntu install its deps with:
sudo apt install build-essential libyaml-perl libtemplate-perl \
libregexp-grammars-perl libssl-dev zlib1g-dev liblmdb-dev \
libflatbuffers-dev libsecp256k1-dev libzstd-dev
or point STRFRY_BIN at an existing binary, or SKIP_STRFRY=1 to bench without it.
EOF
return 1
}
echo "$CACHE/strfry/strfry"
}
STRFRY=""
if [[ "${SKIP_STRFRY:-0}" != "1" ]]; then
STRFRY="$(resolve_strfry)" || exit 1
echo "strfry: $STRFRY"
fi
# ---------- build geode + harness ----------
echo "building geode + relaybench…"
GRADLE_TASKS=(":relayBench:installDist")
if [[ "${SKIP_GEODE:-0}" != "1" ]]; then
GRADLE_TASKS+=(":geode:installDist")
fi
(cd "$ROOT" && ./gradlew -q "${GRADLE_TASKS[@]}")
RELAY_FLAGS=()
if [[ "${SKIP_GEODE:-0}" != "1" ]]; then
RELAY_FLAGS+=("--geode-bin" "$ROOT/geode/build/install/geode/bin/geode")
fi
if [[ -n "$STRFRY" ]]; then
RELAY_FLAGS+=("--strfry-bin" "$STRFRY")
fi
# ---------- run ----------
cd "$ROOT"
exec "$ROOT/relayBench/build/install/relaybench/bin/relaybench" \
"${RELAY_FLAGS[@]}" \
"${ARGS[@]}"