Challenge an Exit
The process of challenging exits takes place during a defined 'challenge period' after an exit has started. The challenge period exists to provide time for other users to challenge dishonest exits.
Lifecycle
A challenge lifecycle includes the following:
Standard exit or in-flight exit is initiated.
The challenge period starts.
If the exit is dishonest, the Watcher will report a byzantine event.
Users on the network challenge and respond to reported byzantine events.
The challenge period expires. Any exit that is unchallenged is finalized, while any exit that is successfully challenged is canceled. Bonds are rewarded to successful challengers or returned to users who committed them.
Watcher Alerts
The Watcher broadcasts any byzantine event it detects on the OMG Network. Users can decide whether or not to "challenge" said event based on the information provided.
These events are reported in the Watcher's
/status.get
endpoint providing an array of byzantine events.omg-js
provides a helper function to get this report.
Challenging Standard Exits
The following is a byzantine event reported by the Watcher on invalid standard exits and requires action by users.
invalid_exit
invalid_exit
Indicates that an invalid standard exit is occurring. It should be challenged.
Scenario
Alice sends
UTXO1
to Bob. The associated transaction is included in a block.Alice initiates a standard exit on
UTXO1
.
Event
Watcher reports an invalid_exit
:
Solution
Anyone can challenge Alice’s exit by proving that Alice has already spent the UTXO in another transaction.
If the challenge is successful, Alice does not exit the tokens and the challenger is awarded the exit bond that Alice put up when starting the exit.
Implementation
1. Install omg-js
omg-js
To access network features from your application, use our official libraries:
Requires Node >= 8.11.3 < 13.0.0
Add omg-js
to a website using a script tag:
Integrate omg-js
with React Native projects. First, add this postinstall script to your project's package.json
:
Then install the react native compatible library:
2. Import dependencies
Challenging exits involves using 3 omg-js
objects. Here's an example of how to instantiate them:
web3_provider_url
- the URL to a full Ethereum RPC node (local or from infrastructure provider, e.g. Infura).
plasmaContractAddress
-CONTRACT_ADDRESS_PLASMA_FRAMEWORK
for defined environment.
watcherUrl
- the Watcher Info URL for defined environment (personal or from OMG Network).
3. Challange invalid exit
We can use the byzantine event information reported by the Watcher to retrieve the data required to challenge the exit. We then can make a call to the Payment Exit Game
contract calling challengeStandardExit()
.
In the example below, Bob has seen the reported invalid_exit
event and proceeds to challenge the exit. He will receive Alice's posted bond if the challenge is successful.
Challenging In-Flight Exits
The following are byzantine events reported by the Watcher on invalid in-flight exits and require action by users.
noncanonical_ife
noncanonical_ife
Indicates an in-flight exit of a non-canonical transaction has been started. It should be challenged.
Scenario
Alice creates a transaction
TX1
to Bob, usingUTXO1
as an input.TX1
is included in a block.Alice then creates a non-canonical transaction
TX2
to Carol with the same inputUTXO1
(double spend).TX2
is not included in a block.Alice initiates an in-flight exit on
TX2
.
Event
Watcher reports a
noncanonical_ife
:
Solution
Bob sees that Alice has initiated an in-flight exit on a non-canonical transaction.
Bob challenges Alice's in-flight exit by showing that
UTXO1
was spent inTX1
.Alice is unable to exit
UTXO1
and loses her exit bond to Bob.
Implementation
invalid_ife_challenge
invalid_ife_challenge
Indicates a canonical in-flight exit has been challenged. The challenge should be responded to.
Scenario
Alice sends
UTXO1
to Bob but Bob does not see the transactionTX1
get included in a block. He assumes the operator is withholding so he attempts to exit his output via an in-flight exit.Bob starts his in-flight exit on
TX1
.Alice sends a transaction
TX2
to Carol using the sameUTXO1
(double spend). This transaction is not included in a block.TX1
is eventually included in a block.Carol sees that Bob is trying to exit a transaction with the same input that Alice has sent her.
Carol uses
TX2
to challenge Bob's IFE as non-canonical.
Event
The Watcher reports an invalid_ife_challenge
:
Solution
Bob uses
TX1
(along with its inclusion proof) to prove that the challenge is invalid.
Implementation
invalid_piggyback
invalid_piggyback
Indicates an invalid piggyback is in process. Should be challenged.
Scenario
Alice sends
UTXO1
to Bob inTX1
.TX1
is included in a block.Bob initiates an in-flight exit on
TX1
and places anexit_bond
.Bob piggybacks onto the exit referencing
UTXO1
and committing to apiggyback bond
.Bob sends
UTXO1
to Carol inTX2
.TX2
is included in a block.
Event
The Watcher reports an invalid_piggyback
event:
Notes:
The Watcher does not report a
noncanonical_ife
event asTX1
is a canonical transaction included in a valid block.The
invalid_piggyback
event can be reported only onceTX2
has been detected by the Watcher, either as part of a valid block (as in the scenario above) or if referenced by another in-flight exit.
Solution
Carol uses
TX2
to challenge Bob's piggyback.Bob does not exit his output, Carol receives the
piggyback bond
committed by Bob.
Implementation
Last updated