Get started
Project layout
How the StateSync-GKR workspace is organized, from the eight member crates behind one facade package and their fixed dependency direction to the entry points that application code should use.
The repository is one Cargo workspace. Application code depends on a single package, the root facade statesync-gkr, which re-exports the eight member crates under crates/ as modules. This page maps those crates, the rules that keep them apart, and the parts of the API you are most likely to need.
Repository map#
| Path | Contents |
|---|---|
src/ | The facade (lib.rs), the host integration seam (oss_interface.rs) and three developer binaries: measure (measurement harness), profile (single-proof cost breakdown) and proof_digest (cross-build determinism check) |
crates/ | The eight member crates |
examples/ | state_sync_prove_verify, used in the Quickstart, and receipt_gated_transition_v1, a host-only reference that consumes recorded external-proof vectors and changes only an in-memory model |
tests/ | Public vectors with positive and negative controls |
docs/ | Architecture decisions, encoding specifications and frozen identifier definitions |
benches/ | Development measurement notes for the measure binary, plus the controlled CPU, memory and serving studies, each with its own caller, data summary and replay instructions |
formal/isabelle/ | Isabelle theory sources |
verif/ | Creusot and Why3 replay records |
spikes/zkvm-wrap/ | The selected zkVM integration source and its identity recipe |
release/ | The public-surface verifier, manifests and release evidence |
Workspace crates#
| Crate | Import path | Owns |
|---|---|---|
ssgkr-primitives | statesync_gkr::primitives | The KoalaBear base field, the degree-four extension field used for verifier challenges, the Poseidon2 hash gadget, digests and the Fiat-Shamir transcript. It is the only crate that names Plonky3 (p3-*) paths. |
ssgkr-sumcheck | statesync_gkr::sumcheck | A generic multilinear sumcheck prover and verifier. The verifier returns a residual subclaim for the caller to discharge. |
ssgkr-protocol | statesync_gkr::gkr | The layered-circuit representation with weighted linear, product and cube gates, multilinear extensions, sparse layer reduction, the wiring oracles, and GKR proving and verification. |
ssgkr-compiler | statesync_gkr::compiler | Sparse-Merkle types and native operation semantics, the circuit compiler, witness generation and PublicInputs. |
ssgkr-batching | statesync_gkr::batching | ProveJob, a witness queue with one lane per operation kind, a deadline-aware batch-size policy and a batch prover loop. |
ssgkr-commitment | statesync_gkr::wrap::commitment | The full circuit commitment and the layer-strategy identity. |
ssgkr-verification | Types re-exported at the facade root | The configuration, request, result and error types, circuit construction, the single prove and verify bodies, and the transcript preamble. |
ssgkr-wrap | statesync_gkr::wrap | The external proof boundary: inner-proof encoding, the wrap statement and backend trait, the prepared-material codec, and the route manifest, destination policy and settlement records. The last three are host-only. |
statesync-gkr | statesync_gkr | StateSyncProver, PreparedSync, the module re-exports and the developer binaries. |
Two import paths differ from the crate names: ssgkr-protocol is imported as gkr, and ssgkr-commitment is reached through wrap::commitment. The verification crate is not a module of the facade; its public types are re-exported at the root instead. These are the root-level items:
use statesync_gkr::{
DOMAIN_TAG_V01, MockOssCore, OssCoreInterface, PreparedSync, StateSyncGkrConfig,
StateSyncProver, SyncError, SyncRequest, SyncResult,
};Dependency direction#
ssgkr-primitives -> ssgkr-sumcheck -> ssgkr-protocol -> ssgkr-compiler
-> {ssgkr-batching, ssgkr-commitment}
-> {ssgkr-verification, ssgkr-wrap}
-> statesync-gkr facadeEach arrow points from a crate to the crates built on it. The workspace manifest records this graph as a design boundary, and a change to it goes through design review rather than an ordinary edit. Three rules follow from it:
ssgkr-sumcheckandssgkr-protocolnever depend onssgkr-compiler. They carry no sparse-Merkle assumptions, so another arithmetic-circuit frontend can build on them; see Custom frontends.- Only
ssgkr-primitivesmay name a Plonky3 crate. Plonky3 is pinned to exactly 0.4.3, and moving that pin touches this one adapter crate. ssgkr-verificationandssgkr-wraphave no edge between them. Both consumessgkr-commitment.
The direct dependencies inside the workspace, as each manifest declares them:
| Crate | Depends directly on |
|---|---|
ssgkr-primitives | Plonky3 crates only |
ssgkr-sumcheck | ssgkr-primitives |
ssgkr-protocol | ssgkr-primitives, ssgkr-sumcheck |
ssgkr-compiler | ssgkr-primitives, ssgkr-protocol |
ssgkr-batching | ssgkr-primitives, ssgkr-protocol, ssgkr-compiler |
ssgkr-commitment | ssgkr-primitives, ssgkr-protocol, ssgkr-compiler |
ssgkr-verification | ssgkr-primitives, ssgkr-protocol, ssgkr-compiler, ssgkr-batching, ssgkr-commitment |
ssgkr-wrap | ssgkr-primitives, ssgkr-sumcheck, ssgkr-protocol, ssgkr-compiler, ssgkr-commitment |
statesync-gkr | Every member crate except ssgkr-commitment, which it reaches through ssgkr-wrap |
Frozen interfaces#
The current release line binds its published external proof to an exact program identity, and six compatibility surfaces are frozen with that identity. Source comments label them SEAL[S-1] through SEAL[S-6]:
| Label | Surface | Canonical source |
|---|---|---|
S-1 | Crate graph and dependency direction | Cargo.toml |
S-2 | Sumcheck interface and round-message order | crates/sumcheck/src/lib.rs |
S-3 | Layered-circuit shape and gate semantics | crates/protocol/src/circuit.rs |
S-4 | Boundary between native sparse-Merkle semantics and circuit acceptance | crates/compiler/src/lib.rs |
S-5 | Transcript observation order and domain tag | crates/primitives/src/transcript.rs |
S-6 | Field set and declaration order of PublicInputs | crates/compiler/src/witness.rs |
For application code, these surfaces stay fixed for the current release line. For contributors, changing a protected byte, even a comment, produces a different candidate identity, and that is never resolved by updating an expected hash. The labels are historical annotations kept byte for byte; they are not runtime checks or approvals. In 1.1.1 the root Cargo license field is the one recorded change among the protected files, and the published external proof remains evidence for its recorded 1.1 program only.
Entry points for application code#
| Task | Use | Guide |
|---|---|---|
| Prove and verify one operation | StateSyncProver::prove_sync_op and verify_sync_op with a SyncRequest | Proving state operations |
| Serve repeated requests of one kind | prepare, then prove_sync_op_prepared and verify_sync_op_prepared | Prepared execution |
| Prove many independent requests | make_job_prepared, then prove_batch_prepared or prove_batch_parallel | Batching and parallelism |
| Send a proof to another process | encode_sync_result and verify_encoded_sync_op | Encoding and transport |
| Check an operation's semantics without a proof | compiler::smt_valid_native | Proving state operations |
| Build a different circuit frontend | The gkr and sumcheck modules | Custom frontends |
| Stand in for the host system in tests | The OssCoreInterface trait and its in-memory MockOssCore | API reference |
Other public items serve audits, tests and the recorded external-proof route. Examples are verify_sync_op_reference, a slower reference verifier that uses fully materialized wiring, the wrap::prepared codec, and the route and settlement records under wrap. Ordinary proving does not need them. The API reference covers the full surface.
Workspace conventions#
unsafecode is forbidden in every workspace crate.- Workspace lints warn on missing documentation and on
unwrap,expectandpanic, and CI runs Clippy with warnings denied. - Every package uses edition 2024, declares Rust 1.85 as its minimum version and is built with the pinned 1.96.1.
- The contract crate for the Creusot verifier is declared only for
cfg(creusot). Normal builds on every platform never compile it.
Versions#
Every package in the workspace carries the Cargo version 0.1.0-dev and sets publish = false. These docs describe the 1.1 component release line, which is numbered separately from the Cargo packages. Versioning explains how the two relate.
Next steps#
- Proving state operations: build and verify requests for all three operations.
- Circuits and layers: what the compiler produces and the protocol crate consumes.
- API reference: every public item, module by module.