Skip to content

perf(sdk): reuse immutable action hashing and wire serialization - #166

Merged
joeblau merged 2 commits into
mainfrom
perf/reuse-action-signing-and-wire-json
Oct 6, 2026
Merged

joeblau merged 2 commits into
mainfrom
perf/reuse-action-signing-and-wire-json

Conversation

@joeblau

@joeblau joeblau commented Oct 6, 2026

Copy link
Copy Markdown

Reusing a validated bulk action currently repeats serialization, hashing, and deep copying on every signature. This change keeps SDK-owned immutable action payloads reusable across execution and separate signing/submission, while generating a fresh nonce, signature, vault address, and expiration for each request.

  • Add canonical action builders and explicit signAction / submitAction / executeAction stages, including client equivalents. Existing exchange methods keep their behavior. Required narrow exports and published-package build support preserve shared nonce, error, and ownership identities across entry points.
  • Reuse MessagePack bytes and lazy Keccak prefix state for immutable L1 actions. Noble uses cloned state; WASM checkpoints are independently validated and rebuilt when the provider changes.
  • Cache immutable bulk action JSON for HTTP and WebSocket envelopes. Fresh signature and metadata fields are serialized each time; mutable or customized serialization falls back to native JSON.
  • Include rotating prototype benchmarks, paired SDK verification, recorded results, and differential conformance tests. The proposed MessagePack ASCII/key-cache variants were slower and are omitted.

Measured locally with reused 1,000-order actions and fresh WASM signatures, staged HTTP signing/submission fell from 1.01 ms to 73 µs on Bun and 1.41 ms to 158 µs on Node. These are CPU measurements using mocks that materialize outgoing UTF-8, excluding network latency; changed order fields require rebuilding the action.

Validation: 2,008 offline tests passed (242 live tests skipped), aggregate formatting/lint/docs checks, TypeScript 5 and 7, JSDoc/export/import-graph gates, and the build with relocated consumer checks on Bun and Node. CI also runs the unchanged paired performance regression suite.

Unrelated runtime injection, bounded dispatch, batching, and docs tooling changes in the original working tree are preserved outside this PR.

@joeblau
joeblau merged commit aedbc31 into main Oct 6, 2026
6 checks passed
@joeblau
joeblau deleted the perf/reuse-action-signing-and-wire-json branch October 6, 2026 23:29
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