broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('two verified envelopes / withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v1', 'v1', 'v1', 'v1', 'v1']), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2'])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawal-tombstone'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] and x["opened"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('two verified envelopes / withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v1', 'v1', 'v1', 'v1', 'v1']), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2']), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['v2', 'v2', 'v2', 'v2', 'v2'])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawal-tombstone'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Withdrawal fails to invalidate an unopened sealed commitment.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision withdrawal-tombstone: Apply the withdrawal tombstone before opening status.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('two verified envelopes / opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['replay-disclosure'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] and x["reveal_count"] == 1 else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('two verified envelopes / opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [[], [], [], [], []]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [['red'], ['red'], ['red'], ['red'], ['red']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['replay-disclosure'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A repeated opening emits the sealed payload again.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision replay-disclosure: Suppress payload emission once opened, regardless of replay count.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = x["payloads"][0] if x["payloads"] else None
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('two verified envelopes / valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue'])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['first-valid-reveal'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = x["payloads"][-1] if x["payloads"] else None
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('two verified envelopes / valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['red', 'red', 'red', 'red', 'red']), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [None, None, None, None, None]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue']), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, ['blue', 'blue', 'blue', 'blue', 'blue'])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['first-valid-reveal'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Payload retention uses position without checking reveal verification.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision first-valid-reveal: Retain the first verified reveal payload.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = bool(x["nonce"])
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('two verified envelopes / wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['nonce-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"] or not x["opened"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('two verified envelopes / wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['nonce-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A nonempty nonce is treated as proof of binding to this envelope.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision nonce-binding: Require exact commitment nonce equality.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = bool(x["signer"])
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong bidder', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / wrong bidder', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('first envelope only / wrong bidder', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['signer-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"] or x["reveal_count"] == 1
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong bidder', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / wrong bidder', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('first envelope only / wrong bidder', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'bob', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['signer-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Reveal authentication admits a different bidder for a single reveal.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision signer-binding: Bind the revealing signer to the envelope owner on every reveal.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [9, 18, 27, 36, 45]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['preopening-secrecy'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["reveal_count"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [9, 18, 27, 36, 45]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['preopening-secrecy'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Receiving a reveal is confused with authorized public opening.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision preopening-secrecy: Expose the sealed value only after the opening state transition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = True
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('two verified envelopes / wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('first envelope only / wrong lot and nonce', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['lot-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"] or len(x["commits"]) == 1
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('two verified envelopes / wrong lot and nonce', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('first envelope only / wrong lot and nonce', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'bad', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'B'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['lot-binding'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A reveal can be replayed against a different lot.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision lot-binding: Check the committed lot identifier even for one envelope.

split: open-access