Skip to content

About

scope-contestation-value-fidelity

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

value-fidelity-leg — PR files for TMerlini/hack-ens-recovery

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.

What goes where

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

Run

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-complete a with adversarial values (boundary-split 3-3-1) passes guards 1–2 but is rejected by guard 3.

  • test_contest_valueFidelity_fullHappyPath_separates — honest a committed at resolution time; genuine absent X; all four guards pass; separated = true.

Guard order (final)

verifyAbsence → verifyScopeComplete → verifyValueFidelity → isolation → classify

All are require() — they revert, never encoded in separated.

Layer2PreCheck constructor change

// before (236b66a)
constructor(IScopeContestation _scope)

// after (this PR)
constructor(IScopeContestation _scope, IResolutionCommitment _resolution)

Two-phase market lifecycle:

  1. commitScope() — at market creation (before readings exist)
  2. commitResolution() — at resolution time (after readings final, before outcome published)
  3. contest() — any time after resolution

Pre-outcome MUST

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).

What this does NOT close

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?"

About

scope-contestation-value-fidelity

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages