Adds the value-fidelity guard: the third Layer 1 leg closing the VALUE half of
the adversarial-a gap. verifyScopeComplete (236b66a) closed the coordinate half;
this closes the value half.
Drop these into scope-contestation-demo/contracts/:
| File in this zip | Destination | Action |
|---|---|---|
| src/IResolutionCommitment.sol | src/ | ADD |
| src/ResolutionCommitment.sol | src/ | ADD |
| src/Layer2PreCheck.sol | src/Layer2PreCheck.sol | REPLACE |
| test/ContestFlow.t.sol | test/ContestFlow.t.sol | REPLACE |
cd scope-contestation-demo/contracts
forge test -vv
Expected: 9/9 green. Tests 1–7 are Tiago's existing suite (adapted for the new Layer2PreCheck constructor). Tests 8–9 are the value-fidelity tests:
-
test_contest_valueFidelity_adversarialA_reverts— the key test: a coordinate-completeawith adversarial values (boundary-split 3-3-1) passes guards 1–2 but is rejected by guard 3. -
test_contest_valueFidelity_fullHappyPath_separates— honestacommitted at resolution time; genuine absent X; all four guards pass; separated = true.
verifyAbsence → verifyScopeComplete → verifyValueFidelity → isolation → classify
All are require() — they revert, never encoded in separated.
// before (236b66a)
constructor(IScopeContestation _scope)
// after (this PR)
constructor(IScopeContestation _scope, IResolutionCommitment _resolution)Two-phase market lifecycle:
commitScope()— at market creation (before readings exist)commitResolution()— at resolution time (after readings final, before outcome published)contest()— any time after resolution
commitResolution() MUST be called before the outcome is published.
An observation commitment (ERC-8281) carries this property for free — use it as
the commitment vehicle for production deployments. ResolutionCommitment.sol is
the type-2 reference impl for off-chain readings; a type-1 (chain-native) impl
recomputes values from chain state directly (no resolutionRoot needed — Fede's offer).
Source authenticity (are the committed readings from the real sources?) is the
oracle / zkTLS layer — orthogonal to this guard. This guard closes "does a
reproduce the committed readings?" not "are those readings authentic?"