Skip to content

SDK: add HOP stress test tool#439

Open
x3c41a wants to merge 6 commits into
mainfrom
ndk/hop-stress-test
Open

SDK: add HOP stress test tool#439
x3c41a wants to merge 6 commits into
mainfrom
ndk/hop-stress-test

Conversation

@x3c41a
Copy link
Copy Markdown
Contributor

@x3c41a x3c41a commented Apr 22, 2026

TypeScript HOP stress test tool exercising hop_submit / hop_claim / hop_poolStatus. Reports p50 / p90 / p99 latency and writes a JSON results file via --output-json. See also #445 for the Rust counterpart.

Results (local 2-collator zombienet, --items 200)

Scenario Payload Items ops/s MB/s p50 p90 p99 Errors
submit-only 1 KB 200 2,151 2.1 1ms 1ms 8ms 0
submit-only 10 KB 200 1,905 18.6 1ms 2ms 9ms 0
submit-only 100 KB 200 489 47.8 7ms 8ms 15ms 0
submit-only 128 KB 200 375 46.8 9ms 12ms 20ms 0
submit-only 256 KB 200 203 50.8 18ms 21ms 30ms 0
submit-only 512 KB 200 104 51.9 37ms 41ms 54ms 0
submit-only 1 MB 200 53 52.8 73ms 79ms 101ms 0
group x10 100 KB 100 1,096 107.1 5ms 8ms 9ms 0
mixed 30s submit 10 KB 54,865 1,025 10.0 1ms 1ms 4ms 100
mixed 30s claim 10 KB 54,865 1,025 10.0 1ms 3ms 8ms 0

HOP TS stress test

The 100 errors in the mixed-submit phase come from the test seeding ineligible recipients in a tail batch. The submit RPC itself is fine.

Usage
cd sdk/typescript
npm install

# Single scenario
npx tsx test/stress/hop-stress.ts \
  --ws-url ws://127.0.0.1:10000,ws://127.0.0.1:12346 \
  --scenario submit-only \
  --items 200 --payload-size 262144 \
  --output-json test/stress/results/hop-ts-submit-256KB.json

# Plot (one or more JSON files)
python3 test/stress/plot-hop-results.py \
  test/stress/results/hop-ts-submit-*.json \
  -o test/stress/hop-results.png \
  --title "HOP Stress Test Results (TS, local zombienet, 2 collators)"

x3c41a and others added 3 commits April 22, 2026 10:06
Stress test for the Hand-off Protocol (HOP) RPC endpoints on Bulletin
Chain collators. Covers submit throughput, full cycle (submit/claim/ack),
group recipients, pool fill, mixed read/write, and error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated to match the real hop-base implementation in polkadot-sdk:
- hop_submit takes (data, recipients, signature, signer) with SCALE-encoded
  MultiSigner/MultiSignature and domain-separated signing
- hop_claim/hop_ack use domain-separated signatures (hop-claim-v1:/hop-ack-v1:)
- Recipients are SCALE-encoded MultiSigner, not raw pubkeys
- Updated error codes to match implementation (1001-1020)
- Added --submitter-seed flag for authorized account

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrote stress test to match polkadot-sdk hop-stable branch API:
- hop_submit(data, recipients, proof) — NoopVerifier, no auth needed
- hop_claim(hash, signature) — direct hash signing, no domain separation
- Removed hop_ack (not in hop-stable)
- Updated error codes to match hop-stable

Added results plot from local zombienet run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@x3c41a x3c41a force-pushed the ndk/hop-stress-test branch from 03be857 to a4a0aff Compare April 22, 2026 10:22
x3c41a added 2 commits April 27, 2026 07:42
printPhaseStats now emits a full LatencySummary (count/min/max/mean +
p50/p90/p95/p99) and appends each phase report to a global collector.
A new --output-json flag dumps the collector + config to disk.

Added plot-hop-results.py which reads one or more --output-json files
and renders a 4-panel chart: throughput, percentile bars, per-op
latency CDF (log-x), and a submit-only sweep.

Re-ran against a local 2-collator zombienet on hop-stable, --items 200:
  submit 1 KB:    2,151 ops/s,  2.1 MB/s   p50=1ms p90=1ms p95=2ms p99=8ms
  submit 10 KB:   1,905 ops/s, 18.6 MB/s   p50=1ms p90=2ms p95=2ms p99=9ms
  submit 100 KB:    489 ops/s, 47.8 MB/s   p50=7ms p90=8ms p95=8ms p99=15ms
  submit 1 MB:       53 ops/s, 52.8 MB/s   p50=73ms p90=79ms p95=82ms p99=101ms
  group ×10 100 KB: 1,096 ops/s, 107 MB/s  p50=5ms p90=8ms p95=8ms p99=9ms
  mixed 30s 10 KB submit: 1,025 ops/s, 10.0 MB/s  p50=1ms p90=1ms p99=4ms
  mixed 30s 10 KB claim:  1,025 ops/s, 10.0 MB/s  p50=1ms p90=3ms p99=8ms
Two-panel layout matching the Rust HOP plot: left = throughput
(ops/s + MB/s), right = stacked latency where each colour band shows
the additional time at the next percentile (p50 / p90-p50 / p95-p90 /
p99-p95). The total p99 is annotated above each bar.
LatencySummary now reports p50 / p90 / p99 only. The plot uses the
same stacked-bar style as the Rust HOP plot. Re-ran submit-only at
128/256/512 KB to fill in the curve between 100 KB and 1 MB.
@cla-bot-2021
Copy link
Copy Markdown

cla-bot-2021 Bot commented May 7, 2026

User @claude, please sign the CLA here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant