Skip to content

feat(xmss): deterministic fake prover for Shadow sims (ZEAM_SHADOW_XMSS_FAKE)#1007

Open
GrapeBaBa wants to merge 1 commit into
mainfrom
feat/shadow-xmss-fake-prover
Open

feat(xmss): deterministic fake prover for Shadow sims (ZEAM_SHADOW_XMSS_FAKE)#1007
GrapeBaBa wants to merge 1 commit into
mainfrom
feat/shadow-xmss-fake-prover

Conversation

@GrapeBaBa

Copy link
Copy Markdown
Member

Summary

Adds an opt-in deterministic fake XMSS prover for Shadow simulation, gated behind the ZEAM_SHADOW_XMSS_FAKE env var (off by default). When enabled, the five leanMultisig STARK FFI wrappers — aggregateType1, mergeType1ToType2, splitType2ByMessage, verifyType1, verifyType2 — return a deterministic SHA-256 counter-mode stub instead of calling the real prover/verifier.

Why

Under Shadow, the real STARK prove/verify runs as native compute and is charged to virtual time as an uncontrollable baseline on top of the injected --shadow-xmss-*-rate sleep. That contaminates prover-cost-sweep experiments — you can't isolate the effect of the injected rate. Replacing the prover with a deterministic stub removes the baseline, leaving the injected rate as the sole, clean prover-cost knob.

The existing --shadow-xmss-*-rate sim-cost sleeps are preserved and still run on the virtual clock; only the real STARK compute is bypassed.

Safety / determinism

  • Off by default: with no rate set and the fake toggle off, behavior is byte-identical to before. No production path is affected.
  • The stub is seeded only from wire-bound inputs (message hash, slot, child-proof bytes, participant counts) — never per-process pointer/handle addresses — so every node produces identical proof bytes for identical inputs. Consensus-safe across the network.
  • One process-global toggle (not per-op): all five wrappers are uniformly fake or uniformly real, so a fake aggregate/split can never feed a real merge/verify and corrupt the byte format.

Scope

zeam-side only. The Shadow operator tooling that delivers the env var to nodes (the lean-shadow-fuzzer generate-shadow-yaml.sh patch) lives in a separate repo and is a follow-up.

Test plan

  • zig build test-shadow-cost (Zig 0.16.0) — fake toggle + delay model
  • zig build test -Dprover=dummy (Zig 0.16.0) — xmss tests including 4 new fake-path tests:
    • aggregate → verify round-trip with no FFI setup
    • deterministic bytes for identical inputs; differ on message hash / slot
    • merge → verifyType2 round-trip
    • split → verifyType1 round-trip

…SS_FAKE)

Opt-in stub that replaces the real leanMultisig STARK prove/verify FFI with a
deterministic SHA-256 counter-mode proof when ZEAM_SHADOW_XMSS_FAKE is set.
Under Shadow the real prover runs as native compute charged to virtual time,
an uncontrollable baseline on top of the injected --shadow-xmss-*-rate sleep;
the stub removes that baseline so the injected rate is the sole prover-cost
knob for cost-sweep experiments.

- shadow_cost: one process-global fake toggle, env-only, off by default.
- aggregation: aggregateType1 / mergeType1ToType2 / splitType2ByMessage /
  verifyType1 / verifyType2 emit the stub; the sim-cost sleeps still run on
  the virtual clock, only the real prove/verify is bypassed.
- Stub bytes are seeded only from wire-bound inputs (message hash, slot,
  child-proof bytes, participant counts), never per-process pointer handles,
  so every node yields identical bytes for identical inputs (consensus-safe).

Off by default: with no rate set and fake off, behavior is byte-identical to
before. Verified on Zig 0.16.0: test-shadow-cost + zig build test
(-Dprover=dummy) green, including 4 new fake-path tests.
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