Commit 95c7ef5c authored by inphi's avatar inphi

specs: Honest challenger for new resolution

parent 068c89b3
...@@ -64,7 +64,13 @@ then it must dispute claims positioned at odd depths in the game tree. ...@@ -64,7 +64,13 @@ then it must dispute claims positioned at odd depths in the game tree.
Otherwise, it disputes claims positioned at even depths in the game tree. Otherwise, it disputes claims positioned at even depths in the game tree.
This means an honest challenger only responds to claims made by the opposing team. This means an honest challenger only responds to claims made by the opposing team.
The next step is to determine whether the claim has a valid commitment (i.e. `ClaimHash`). The next step is to determine if the claim, now known to be for the opposing team,
disputes another claim the honest challenger _agrees_ with.
An honest challenger agrees with a claim iff every other claim along its path to the
root claim commits to a valid `ClaimHash`. Thus, an honest challenger avoids supporting
invalid claims on the same team.
The last step is to determine whether the claim has a valid commitment (i.e. `ClaimHash`).
If the `ClaimHash` matches the honest challenger's at the same trace index, then we If the `ClaimHash` matches the honest challenger's at the same trace index, then we
disagree with the claim's stance by moving to [defend](./fault-dispute-game.md#defend). disagree with the claim's stance by moving to [defend](./fault-dispute-game.md#defend).
Otherwise, the claim is [attacked](./fault-dispute-game.md#attack). Otherwise, the claim is [attacked](./fault-dispute-game.md#attack).
...@@ -77,18 +83,28 @@ class Team(Enum): ...@@ -77,18 +83,28 @@ class Team(Enum):
CHALLENGER = 1 CHALLENGER = 1
class Claim: class Claim:
parent: Claim
position: uint64 position: uint64
claim_hash: ClaimHash claim_hash: ClaimHash
MAX_TRACE = 2**MAX_GAME_DEPTH MAX_TRACE = 2**MAX_GAME_DEPTH
def agree_with(claim: Claim, chal_trace: List[ClaimHash, MAX_TRACE]):
if chal_trace[claim.trace_index] != claim.claim_hash:
return False
grand_parent = claim.parent.parent if claim.parent is not None else None
if grand_parent is not None:
return agree_with(grand_parent)
return True
def respond(claim: Claim, chal: Team, chal_trace: List[ClaimHash, MAX_TRACE]): def respond(claim: Claim, chal: Team, chal_trace: List[ClaimHash, MAX_TRACE]):
if depth(claim.position) % 2 != chal.value: if depth(claim.position) % 2 != chal.value:
if claim.parent is None or agree_with(claim.parent, chal_trace):
if chal_trace[trace_index(claim.position)] == claim.claim_hash: if chal_trace[trace_index(claim.position)] == claim.claim_hash:
defend() defend()
else: else:
attack() attack()
else: pass # no response else: pass # avoid supporting invalid claims on the same team
``` ```
In attack or defense, the honest challenger submit a `ClaimHash` corresponding to the In attack or defense, the honest challenger submit a `ClaimHash` corresponding to the
...@@ -111,10 +127,14 @@ invalid `ClaimHash` commitments. Otherwise, it issues a _defense step_. ...@@ -111,10 +127,14 @@ invalid `ClaimHash` commitments. Otherwise, it issues a _defense step_.
## Resolution ## Resolution
When the [chess clock](./fault-dispute-game.md#game-clock) of a `FaultDisputeGame` team When the [chess clock](./fault-dispute-game.md#game-clock) of a
runs out, the game can be resolved. [subgame root](./fault-dispute-game.md#resolution) has run out, the subgame can be resolved.
The honest challenger does this by calling the `resolve` function on the The honest challenger should resolve all subgames in bottom-up order, until the subgame
`FaultDisputeGame` contract. rooted at the FDG root is resolved.
The honest challenger accomplishes this by calling the `resolveClaim` function on the
`FaultDisputeGame` contract. Once the root claim's subgame is resolved,
the challenger then finally calls the `resolve` function to resolve the entire game.
The `FaultDisputeGame` does not put a time cap on resolution - because of the liveness The `FaultDisputeGame` does not put a time cap on resolution - because of the liveness
assumption on honest challengers and the bonds attached to the claims they’ve countered, assumption on honest challengers and the bonds attached to the claims they’ve countered,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment