Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
702eb6ba
Unverified
Commit
702eb6ba
authored
Sep 06, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update FPA docs based on review feedback.
parent
932a9bc9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
36 deletions
+38
-36
README.md
docs/fault-proof-alpha/README.md
+1
-1
manual.md
docs/fault-proof-alpha/manual.md
+25
-24
run-challenger.md
docs/fault-proof-alpha/run-challenger.md
+12
-11
No files found.
docs/fault-proof-alpha/README.md
View file @
702eb6ba
...
@@ -10,7 +10,7 @@ finalized and may change without notice.
...
@@ -10,7 +10,7 @@ finalized and may change without notice.
### Contents
### Contents
*
Overview
*
Overview
*
Deployment Details
*
[
Deployment Details
](
./deployments.md
)
*
[
Manual Usage
](
./manual.md
)
*
[
Manual Usage
](
./manual.md
)
*
[
Creating Traces with Cannon
](
./cannon.md
)
*
[
Creating Traces with Cannon
](
./cannon.md
)
*
[
Automation with `op-challenger`
](
./run-challenger.md
)
*
[
Automation with `op-challenger`
](
./run-challenger.md
)
docs/fault-proof-alpha/manual.md
View file @
702eb6ba
...
@@ -14,22 +14,22 @@ look up the full details in the L2 output oracle.
...
@@ -14,22 +14,22 @@ look up the full details in the L2 output oracle.
The agreed output root is defined as the output root immediately prior to the disputed output root in the L2 output
The agreed output root is defined as the output root immediately prior to the disputed output root in the L2 output
oracle. Therefore, a dispute game should only be created for the first invalid output root. If it is successfully
oracle. Therefore, a dispute game should only be created for the first invalid output root. If it is successfully
disputed, all output roots after it
would b
e considered invalid by inference.
disputed, all output roots after it
ar
e considered invalid by inference.
The L1 head block can be any L1 block where the disputed output root is present in the L2 output oracle. Proposers
The L1 head block can be any L1 block where the disputed output root is present in the L2 output oracle. Proposers
should therefore ensure that all batch data has been submitted to L1 before submitting a proposal. The L1 head block is
should therefore ensure that all batch data has been submitted to L1 before submitting a proposal. The L1 head block is
recorded in the
`BlockOracle`
and then referenced by its block number.
recorded in the
`BlockOracle`
and then referenced by its block number.
Creating a game requires two separate transactions. First the L1 head block is recorded in the
`BlockOracle`
by calling
Creating a game requires two separate transactions. First the L1 head block is recorded in the
`BlockOracle`
by calling
its
`checkpoint`
function. This record
the parent of the block the transaction is included in. The
`BlockOracle`
emits a
its
`checkpoint`
function. This record
s the parent of the block the transaction is included in. The
`BlockOracle`
emits
log
`Checkpoint(blockNumber, blockHash, childTimestamp)`
.
a
log
`Checkpoint(blockNumber, blockHash, childTimestamp)`
.
Now
the L1 head, along with the information on the output roots from the L2 output oracle can be used to execute cannon
Now
, using the L1 head along with output root info available in the L2 output oracle, cannon can be executed to
and determine the root claim to use when creating the game. In simple cases, where the claim is expected to be
determine the root claim to use when creating the game. In simple cases, where the claim is expected to be incorrect, an
incorrect, an arbitrary hash can be used for claim values. For more advanced cases
[
cannon can be used
](
./cannon.md
)
to
arbitrary hash can be used for claim values. For more advanced cases
[
cannon can be used
](
./cannon.md
)
to generate a
generate a trace, including the claim values to use at specific steps. Note that it is not valid to create a game that
trace, including the claim values to use at specific steps. Note that it is not valid to create a game that disputes an
disputes an output root, using the final hash from a trace that confirms the output root is valid. To dispute an outpu
t
output root, using the final hash from a trace that confirms the output root is valid. To dispute an output roo
t
root
successfully, the trace must resolve that the disputed output root is invalid.
successfully, the trace must resolve that the disputed output root is invalid.
The game can then be created by calling the
`create`
method on the
`DisputeGameFactory`
contract. This requires three
The game can then be created by calling the
`create`
method on the
`DisputeGameFactory`
contract. This requires three
parameters:
parameters:
...
@@ -45,27 +45,28 @@ parameters:
...
@@ -45,27 +45,28 @@ parameters:
This emits a log event
`DisputeGameCreated(gameAddress, gameType, rootClaim)`
where
`gameAddress`
is the address of the
This emits a log event
`DisputeGameCreated(gameAddress, gameType, rootClaim)`
where
`gameAddress`
is the address of the
newly created dispute game.
newly created dispute game.
A simple helper script,
[
create_game.sh
](
../../op-challenger#create_gamesh
)
has been created to easily create a new
The helper script,
[
create_game.sh
](
../../op-challenger#create_gamesh
)
can be used to easily create a new dispute
dispute game and also provide
s an example of using
`cast`
to manually create a game.
game and also acts a
s an example of using
`cast`
to manually create a game.
## Performing Moves
## Performing Moves
The dispute game progresses by actors
by
countering existing claims via either the
`attack`
or
`defend`
methods in
The dispute game progresses by actors countering existing claims via either the
`attack`
or
`defend`
methods in
the
`FaultDisputeGame`
contract. Note that only
`attack`
can be used to counter the root claim. In both cases, there are
the
`FaultDisputeGame`
contract. Note that only
`attack`
can be used to counter the root claim. In both cases, there are
two inputs required:
two inputs required:
-
`parentIndex`
- the index in the claims array of the parent claim that is being countered
-
`parentIndex`
- the index in the claims array of the parent claim that is being countered
.
-
`claim`
- a
`bytes32`
hash of the state at the trace index corresponding to the new claim’s position.
-
`claim`
- a
`bytes32`
hash of the state at the trace index corresponding to the new claim’s position.
A simple helper script,
[
move.sh
](
../../op-challenger#movesh
)
, has been creat
ed to easily perform moves and also
The helper script,
[
move.sh
](
../../op-challenger#movesh
)
, can be us
ed to easily perform moves and also
provide
s an example of using
`cast`
to manually call
`attack`
and
`defend`
.
acts a
s an example of using
`cast`
to manually call
`attack`
and
`defend`
.
## Performing Steps
## Performing Steps
Attack and defend can only be used until the maximum depth of the game is reached. To counter claims at the maximum
Attacking or defending are teh only available actions before the maximum depth of the game is reached. To counter claims
depth, a step must be performed instead. Calling the
`step`
method in the
`FaultDisputeGame`
contract counters a claim
at the maximum depth, a step must be performed instead. Calling the
`step`
method in the
`FaultDisputeGame`
contract
at the maximum depth by running a single step of the cannon VM on chain. The
`step`
method will revert unless the cannon
counters a claim at the maximum depth by running a single step of the cannon VM on chain. The
`step`
method will revert
execution confirms the claim being countered is invalid.
unless the cannon execution confirms the claim being countered is invalid. Note, if an actor's clock runs out at any
point, the game can be
[
resolved
](
#resolving-a-game
)
.
The inputs for step are:
The inputs for step are:
...
@@ -74,14 +75,14 @@ The inputs for step are:
...
@@ -74,14 +75,14 @@ The inputs for step are:
-
`stateData`
- the full cannon state witness to use as the starting state for execution
-
`stateData`
- the full cannon state witness to use as the starting state for execution
-
`proof`
- the additional proof data for the state witness required by cannon to perform the step
-
`proof`
- the additional proof data for the state witness required by cannon to perform the step
When a step is attacking, the caller is
making the claim
that the claim at
`claimIndex`
is incorrect, and the claim for
When a step is attacking, the caller is
asserting
that the claim at
`claimIndex`
is incorrect, and the claim for
the previous trace index (made at a previous level in the game) was correct. The
`stateData`
must be the pre-image for
the previous trace index (made at a previous level in the game) was correct. The
`stateData`
must be the pre-image for
the agreed correct hash at the previous trace index. The call to
`step`
will revert if the post-state from cannon
the agreed correct hash at the previous trace index. The call to
`step`
will revert if the post-state from cannon
matches the claim at
`claimIndex`
since the on-chain execution has proven the claim correct and it should not be
matches the claim at
`claimIndex`
since the on-chain execution has proven the claim correct and it should not be
countered.
countered.
When a step is defending, the caller is
making the claim
that the claim at
`claimIndex`
is correct, and the claim for
When a step is defending, the caller is
asserting
that the claim at
`claimIndex`
is correct, and the claim for
the next trac index (made at a previous level in the game) is incorrect. The
`stateData`
must be the pre-image for the
the next trac
e
index (made at a previous level in the game) is incorrect. The
`stateData`
must be the pre-image for the
hash in the claim at
`claimIndex`
.
hash in the claim at
`claimIndex`
.
The
`step`
function will revert with
`ValidStep()`
if the cannon execution proves that the claim attempting to be
The
`step`
function will revert with
`ValidStep()`
if the cannon execution proves that the claim attempting to be
...
@@ -106,5 +107,5 @@ be resolved once.
...
@@ -106,5 +107,5 @@ be resolved once.
There are no inputs required for the
`resolve`
method. When successful, a log event is emitted with the game’s final
There are no inputs required for the
`resolve`
method. When successful, a log event is emitted with the game’s final
status.
status.
A helper script,
[
resolve.sh
](
../../op-challenger#resolvesh
)
, has been created to easily resolve a game and also
The helper script,
[
resolve.sh
](
../../op-challenger#resolvesh
)
, can be used to easily resolve a game and also acts as an
provides an
example of using
`cast`
to manually call
`resolve`
and understand the result.
example of using
`cast`
to manually call
`resolve`
and understand the result.
docs/fault-proof-alpha/run-challenger.md
View file @
702eb6ba
...
@@ -18,7 +18,18 @@
...
@@ -18,7 +18,18 @@
### Starting op-challenger
### Starting op-challenger
In the top level of the monorepo, replace the placeholders and then run:
When executing
`op-challenger`
, there are a few placeholders that need to be set to concreate values:
-
`<L1_URL>`
the Goerli L1 JSON RPC endpoint
-
`<DISPUTE_GAME_FACTORY_ADDRESS>`
the address of the dispute game factory contract (see
the
[
Goerli deployment details
](
./deployments.md#goerli
)
)
-
`<PRESTATE>`
the prestate.json downloaded above. Note that this needs to precisely match the prestate used on-chain so
must be the downloaded version and not a version built locally (see the
[
Goerli deployment details
](
./deployments.md#goerli
)
)
-
`<L2_URL>`
the OP-Goerli L2 archive node JSON RPC endpoint
-
`<PRIVATE_KEY>`
the private key for a funded Goerli account. For other ways to specify the account to use
see
`./op-challenger/bin/op-challenger --help`
From inside the monorepo directory, run the challenger with these placeholders set.
```
bash
```
bash
# Build the required components
# Build the required components
...
@@ -39,16 +50,6 @@ make op-challenger op-program cannon
...
@@ -39,16 +50,6 @@ make op-challenger op-program cannon
--private-key
<PRIVATE_KEY>
--private-key
<PRIVATE_KEY>
```
```
The placeholders are:
-
`<L1_URL>`
the Goerli L1 JSON RPC endpoint
-
`<DISPUTE_GAME_FACTORY_ADDRESS>`
the address of the dispute game factory contract (see
the
[
Goerli deployment details
](
./deployments.md#goerli
)
)
-
`<PRESTATE>`
the prestate.json downloaded above. Note that this needs to precisely match the prestate used on-chain so
must be the downloaded version and not a version built locally (see the
[
Goerli deployment details
](
./deployments.md#goerli
)
)
-
`<L2_URL>`
the OP-Goerli L2 archive node JSON RPC endpoint
-
`<PRIVATE_KEY>`
the private key for a funded Goerli account. For other ways to specify the account to use
see
`./op-challenger/bin/op-challenger --help`
### Restricting Games to Play
### Restricting Games to Play
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment