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
c2f67a9c
Commit
c2f67a9c
authored
Sep 24, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
challenge
parent
362a0e0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
CHALLENGE
CHALLENGE
+71
-0
No files found.
CHALLENGE
0 → 100644
View file @
c2f67a9c
Two oracles:
Implement as three MIPS instructions
InputOracle -- Preagreed upon inputs
$a0 = input choice
0 -- StateRoot(n)
1 -- Transactions(n+1)
2 -- Coinbase(n+1)
3 -- Uncles(n+1)
$a1 = shift amount
returns
$v0 = inputs[$a0] >> $a1
PreimageOracle -- key value store
$a0 = dword index in value
$t0 = hash[31:0]
$t1 = hash[63:32]
$t2 = hash[95:64]
$t3 = hash[127:96]
$t4 = hash[159:128]
$t5 = hash[191:160]
$t6 = hash[223:192]
$t7 = hash[255:224]
returns
$v0 = preimage[$t7...$t0] >> ($a0 * 32)
Program returns a hash in [$t7...$t0] and exits(special instruction) with the hash in the state
Challenge Flow:
C is challenger, D is defender
Super nice, the defender barely needs to spend gas!
C: InitiateChallenge(bytes blockHeaderN, bytes blockHeaderNp1,
bytes32 assertionHash, bytes32 finalSystemHash, string[] assertionProof, uint256 stepCount)
* checks hashes of the block headers
* saves inputs for input oracle
* confirms assertionHash != blockHeaderNp1.Hash
* expectCorrect = (assertionHash == blockHeaderNp1.Hash)
* confirm assertionProof proves the final state of [$t7...$t0] in finalSystemHash is assertionHash
* confirm assertionProof proves the final state of *$pc in finalSystemHash is special exit instruction
* L = 0, R = stepCount-1 # we agree at L=0, we disagree at R=stepCount
* return new challengeId
* assertedRiscState[0] = GlobalStartSystemHash
* assertedRiscState[stepCount-1] = finalSystemHash
C: ProposeRiscState(uint256 challengeId, uint256 riscState)
* stepNumber = GetStepNumber(uint256 challengeId) returns floor((L + R) / 2)
* assert assertedRiscState[stepNumber] == 0
* assertedRiscState[stepNumber] = riscState
D: RespondRiscState(uint256 challengeId, bool yes) onlyOwner
* off-chain: run to step = stepNumber, get state hash, check if it matches
* if yes:
L = stepNumber # we agree at stepNumber
else:
R = stepNumber # we disagree at stepNumber
# issue is between [L...R]
........
binary search until L+1 == R
the issue is with the L->R transition
aka assertedRiscState[L] -> assertedRiscState[R]
........
# call this at any time (global), adds them to a preimage lookup for PreimageOracle
C: ProposePreimage(bytes anything)
* preimageLookup[keccak256(anything)] = anything
C: ConfirmStateTransition(uint256 challengeId, ustrings proofs)
* assert L+1 == R
* validate all proofs in assertedRiscState[L]
* do the state transition
* if any needed pieces of start state are missing, challenge fails (it can try again)
* reconstruct the riscState after transition -> newRiscState
* assert assertedRiscState[R] == newRiscState
* pay out bounty
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