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
2e9f39fa
Commit
2e9f39fa
authored
Nov 20, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save the block number in the challenge
parent
48577497
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Challenge.sol
contracts/Challenge.sol
+4
-3
No files found.
contracts/Challenge.sol
View file @
2e9f39fa
...
@@ -34,7 +34,7 @@ contract Challenge {
...
@@ -34,7 +34,7 @@ contract Challenge {
mapping(uint256 => bytes32) assertedState;
mapping(uint256 => bytes32) assertedState;
mapping(uint256 => bytes32) defendedState;
mapping(uint256 => bytes32) defendedState;
address payable challenger;
address payable challenger;
// TODO: add the block here?
uint256 blockNumberN;
}
}
mapping(uint256 => Chal) challenges;
mapping(uint256 => Chal) challenges;
...
@@ -57,7 +57,7 @@ contract Challenge {
...
@@ -57,7 +57,7 @@ contract Challenge {
uint256 public lastChallengeId = 0;
uint256 public lastChallengeId = 0;
event ChallengeCreate(uint256 challengeId);
event ChallengeCreate(uint256 challengeId);
function newChallengeTrusted(bytes32 startState, bytes32 finalSystemState, uint256 stepCount) internal returns (uint256) {
function newChallengeTrusted(
uint256 blockNumberN,
bytes32 startState, bytes32 finalSystemState, uint256 stepCount) internal returns (uint256) {
uint256 challengeId = lastChallengeId;
uint256 challengeId = lastChallengeId;
Chal storage c = challenges[challengeId];
Chal storage c = challenges[challengeId];
lastChallengeId += 1;
lastChallengeId += 1;
...
@@ -66,6 +66,7 @@ contract Challenge {
...
@@ -66,6 +66,7 @@ contract Challenge {
c.challenger = msg.sender;
c.challenger = msg.sender;
// the state is set
// the state is set
c.blockNumberN = blockNumberN;
// NOTE: if they disagree on the start, 0->1 will fail
// NOTE: if they disagree on the start, 0->1 will fail
c.assertedState[0] = startState;
c.assertedState[0] = startState;
c.defendedState[0] = startState;
c.defendedState[0] = startState;
...
@@ -139,7 +140,7 @@ contract Challenge {
...
@@ -139,7 +140,7 @@ contract Challenge {
require(mem.ReadMemory(finalSystemState, 0x30000800) == 0x1337f00d, "state is not outputted");
require(mem.ReadMemory(finalSystemState, 0x30000800) == 0x1337f00d, "state is not outputted");
require(mem.ReadBytes32(finalSystemState, 0x30000804) == assertionRoot, "you are claiming a different state root in machine");
require(mem.ReadBytes32(finalSystemState, 0x30000804) == assertionRoot, "you are claiming a different state root in machine");
return newChallengeTrusted(startState, finalSystemState, stepCount);
return newChallengeTrusted(
blockNumberN,
startState, finalSystemState, stepCount);
}
}
// binary search
// binary search
...
...
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