-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial StateTransitioner & FraudProver (#156)
* WIP partial state manager * Move associate code contract into SM deploy * Sketch out more of the partial state mgr * Add outlines of partial state mgr & fraud verifier * Add onlyFraudVerifier / EM modifiers * Remove saftey checker from PSM & add setStateMgr to EM * Split up state manager into StateTransitioner * Make the prestate transition index more explicit * Begin adding pre & post tx execution * Add a basic SafeContractRegistry * Remove unneeded SafeContractRegistry * Add TransitionPhases & PreTransition functions * Add Stub EM & finish phases of Transitioner * Lint * Rename ensureValid.. with flagIfInvalid * Move contract deployment back into the EM * Small fixes - Remove extra TODO comment - Remvoe unneeded functions from the PartialStateManager
- Loading branch information
1 parent
7c08e11
commit 88f93e2
Showing
11 changed files
with
737 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
packages/rollup-contracts/contracts/PartialStateManager.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import {StateTransitioner} from "./StateTransitioner.sol"; | ||
|
||
/** | ||
* @title FraudVerifier | ||
* @notice The contract which is able to delete invalid state roots. | ||
*/ | ||
contract FraudVerifier { | ||
mapping(uint=>StateTransitioner) stateTransitioners; | ||
|
||
function initNewStateTransitioner(uint _preStateTransitionIndex) public returns(bool) { | ||
// TODO: | ||
// Create a new state transitioner for some specific pre-state transition index (assuming one hasn't already been made). | ||
// Note that the invalid state root that we are verifying is at _preStateTransitionIndex+1. | ||
// Add it to the stateTransitioners mapping! -- stateTransitioners[_preStateTransitionIndex] = newStateTransitioner; | ||
return true; | ||
} | ||
|
||
|
||
function verifyFraud(uint _transitionIndex) public returns(bool) { | ||
// TODO: | ||
// Simply verify that the state transitioner has completed, and that the state root | ||
// at _preStateTransitionIndex+1 is not equal to the state root which was committed for that index. | ||
return true; | ||
} | ||
} |
Oops, something went wrong.