Skip to content

feat: add authenticated Zone benchmarking and scenarios#155

Merged
Rjected merged 5 commits into
mainfrom
dan/per-sender-http-auth
Jul 22, 2026
Merged

feat: add authenticated Zone benchmarking and scenarios#155
Rjected merged 5 commits into
mainfrom
dan/per-sender-http-auth

Conversation

@Rjected

@Rjected Rjected commented Jul 20, 2026

Copy link
Copy Markdown
Member

Adds authenticated Zone benchmarking and a reusable multi-chain scenario runner on top of the existing workload/template system.

Authenticated RPC traffic

Generated and extracted transaction records now carry the logical on-chain sender. bench send can map that address to a configurable HTTP header, reload atomically replaced maps, and route aggregate block and txpool queries through a separate --query-rpc-url. The selected credential follows submissions, retries, setup and inclusion receipt polling, reconciliation, and receipt collection while aggregate queries remain unauthenticated. Missing sender metadata or mappings fail before dispatch; malformed replacements leave the last valid map active. Legacy NDJSON remains accepted when sender authentication is disabled.

Tempo keychain transactions use the authorized root user for authentication, while sponsored transactions use the transaction sender rather than the sponsor. txgen-tempo auth-token-map derives protocol-compatible tokens for an exact workload account pool, supports one-shot and watched refresh modes, and writes a sorted secret map through mode-0600 atomic replacement without contacting the Zone RPC.

Scenario execution and composition

Both chain binaries gain versioned scenario run, scenario validate, and scenario render commands. Named chains reuse ordinary workload files and split rpc_url submission traffic from optional query_rpc_url chain, nonce, checkpoint, confirmation, log, and adapter-query traffic. Per-chain request_auth applies the same sender-header map to submissions and sender-scoped receipt or transaction lookups.

Scenarios compose checkpoint, adapter invoke, template submit, wait_receipt, and decoded wait_log steps through immutable typed saves, ABI encoding, and hash expressions. The runner preflights chain IDs, pending nonce state, templates, and setup materialization before mutating a chain, then submits and confirms setup in order. Runtime controls cover journey and transaction pacing, bounded concurrency, account leases, confirmations, step timeouts, and continue or fail-fast policies. Ambiguous post-dispatch outcomes disable further submissions on that chain to avoid unsafe nonce reuse. Failed or timed-out journeys are reported before the command exits nonzero.

Reusable fragments support relative includes, typed parameters and outputs, nested aliases, namespaced saves, recursion and cycle detection, and source provenance in reports. Validation expands and checks composition, workloads, templates, ABIs, events, filters, and references without RPC access; rendering emits deterministic flattened YAML. Long-running generation, benchmark setup, scenario initialization, and active steps report progress on stderr.

Zone actions and receipt reporting

Tempo scenarios expose prepare_encrypted_deposit, a query-only action that reads a stable ZonePortal encryption key and creates a fresh OS-random secp256k1/AES-GCM payload compatible with viem’s encrypted-deposit tuple format.

Confirmed outer-transaction receipts feed distributions for gas_used, effective_gas_price, and fee_paid = gas_used * effective_gas_price. Bench results group them by workload input; scenarios group them by chain, template, and expanded step. Each distribution includes count, min, mean, p50, p95, and p99. Missing fee fields do not discard gas usage, and collection remains receipt-based without tracing or internal-call attribution.

Scenario JSON reports also include one client-generated run_id, execution configuration, journey and step outcomes, latency distributions, sanitized failures, optional lifecycle samples, and fragment provenance.

ClickHouse rollout and library impact

Migrations 006_txgen_scenario_runs.sql and 007_txgen_scenario_steps.sql must be deployed before enabling scenario ClickHouse reporting. Publication writes JSON first, then synchronously inserts step rows, the scenario aggregate, and finally txgen_runs as the visibility marker. Complete-run queries should begin at txgen_runs and join by run_id. Receipt metrics are not persisted by the ClickHouse reporters in this change.

The public Rust surface adds sender metadata, request-auth and authenticated RPC primitives, receipt aggregation, scenario schema/runtime/report types, online materialization helpers, nonce reservation rollback, and adapter scenario hooks. txgen-cli::run now requires NetworkAdapter + Default, and fixed-size ABI byte values must match their declared length instead of being padded or truncated.

@Rjected
Rjected marked this pull request as ready for review July 22, 2026 16:30
Rjected added a commit that referenced this pull request Jul 22, 2026
Adds stderr progress reporting across benchmark setup, transaction
generation, and scenario execution on top of #155, #156, and #157.

It:

- reports nonce discovery, total setup and workload transaction counts,
and submission milestones;
- reports generation progress for file output and stdout without mixing
progress into generated output; and
- reports scenario initialization, elapsed runtime, completed journeys,
and active steps.

This consolidates the standalone progress changes from #167 and #168
into #169.
Adds a Tempo-only `auth-token-map` command that derives a selected
logical or root account pool from `WorkloadSpec` and writes the flat
sender-to-token JSON consumed by Zone private-RPC authentication.

It implements the canonical Zone digest and secp256k1 token encoding
with fixed conformance vectors, one shared validity window per refresh,
local signer recovery, scope and TTL validation, and rejection of maps
that expire before publication. Output is deterministic lowercase JSON;
files are atomically published with Unix mode `0600`, symlinks rejected,
and one-shot replacement requires `--force`.

Watch mode refreshes the complete map before expiry with bounded
retries, retains the last valid file after failures, and handles SIGINT
and SIGTERM. The command does not submit RPC requests.

---------

Co-authored-by: zhygis <5236121+Zygimantass@users.noreply.github.com>
@socket-security

socket-security Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedaes-gcm@​0.10.310010093100100
Addedaxum@​0.8.99710093100100
Addedhkdf@​0.12.410010093100100

View full report

@Rjected Rjected changed the title feat(bench): add per-sender request authentication feat: add authenticated Zone benchmarking and scenarios Jul 22, 2026
@Rjected
Rjected merged commit 0304693 into main Jul 22, 2026
8 checks passed
@Rjected
Rjected deleted the dan/per-sender-http-auth branch July 22, 2026 17:01
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