Skip to main content

Crate wickra_verify_core

Crate wickra_verify_core 

Source
Expand description

§wickra-verify-core

Verify any backtest: given a Claim — a strategy, the candle data it ran on, and the report it is said to have produced — recompute the report with the pinned wickra-backtest engine and confirm or refute the claim field by field. A doctored claimed_report cannot pass, because verification recomputes rather than trusting the supplied numbers.

The result is a Verdict: matches plus every Mismatch, the engine version, and three blake3 hashes. Canonicalization is byte-for-byte identical to wickra-proof, so a verdict’s inputs_hash equals the proof hash of the same inputs — a verify result and a proof are cross-checkable.

canonicalize/hash are the single source of hash stability; verify and explain are the core operations; Verifier exposes the same command_json boundary the ten language bindings forward verbatim.

Structs§

BacktestReport
The result of a backtest run.
Candle
One OHLCV bar. time is the bar’s open time (engine-defined epoch unit; it is passed straight through to indicators that need a timestamp).
Claim
A claim to verify: a strategy, the data it ran on, and the report it is said to have produced. claimed_report is untrusted — verification recomputes the report from strategy + data and compares, so a doctored claimed_report cannot pass.
Config
The comparison tolerances a Verifier is built with.
Mismatch
A single field where the claimed report disagrees with the recomputed one, beyond tolerance. field is a dotted/indexed path (metrics.sharpe, trades[3].pnl, trades[len]). delta is actual - claimed, rounded to the 1e-8 display grid — human-facing only, never part of a hash.
StrategySpec
A complete strategy specification.
Verdict
The result of verifying a claim. Deterministic and self-contained: the same (claim, data) yields a byte-identical verdict in every language, and the three hashes let a verdict be cross-checked against a wickra-proof proof of the same inputs.
Verifier
Command-JSON handle carrying the comparison tolerances. Holds no other state, but is handle-shaped so the ten language bindings share the same surface as screener/proof/terminal.

Enums§

DatasetRef
Where the candle data behind a claim comes from.
Error
Everything that can go wrong while verifying a claim.

Functions§

canonicalize
Produce the canonical string form of any serializable value (a report, a verdict, or the (strategy, data) inputs). The value is first converted to a serde_json::Value and then canonicalized, so the output is independent of struct field order and depends only on the data.
compare
Compare claimed against actual (both a report as a JSON value) field by field, returning every numeric disagreement (and any array-length disagreement) beyond the given tolerance, stably sorted by field path. An empty result means the claim holds.
explain
A human-readable, deterministic one-shot summary of a verdict.
hash
The lowercase 64-hex blake3 of a canonical string (no prefix). Pairs with canonicalize: hash(&canonicalize(x)?) is the stable digest of x.
verify
Verify a claim against candle data with the default tolerances (atol = 1e-9, rtol = 1e-6). Recomputes the report and compares — a doctored claimed_report is refuted, an honest one is confirmed.
version
The wickra-verify-core crate version.

Type Aliases§

Result
The result of a wickra-verify-core operation.