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
b71f7661
Commit
b71f7661
authored
Nov 08, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
respond works
parent
690f9803
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
README.md
README.md
+3
-1
Challenge.sol
contracts/Challenge.sol
+1
-0
respond.js
scripts/respond.js
+27
-0
No files found.
README.md
View file @
b71f7661
...
...
@@ -60,9 +60,11 @@ process done with hash 0x5c45998dfbf9ce70bcbb80574ed7a622922d2c775e0a2331fe5a8b8
# only works for pre fork blocks
minigeth/go-ethereum 1171895
(cd mipsevm && ./mipsevm 1171895)
npx hardhat run scripts/deploy.js
BLOCK=1171895 npx hardhat run scripts/challenge.js
(cd mipsevm && ./mipsevm 1171896 11226379)
ID=0 BLOCK=1171896 npx hardhat run scripts/respond.js
```
## State Oracle API
...
...
contracts/Challenge.sol
View file @
b71f7661
...
...
@@ -34,6 +34,7 @@ contract Challenge {
mapping(uint256 => bytes32) assertedState;
mapping(uint256 => bytes32) defendedState;
address payable challenger;
// TODO: add the block here?
}
mapping(uint256 => Chal) challenges;
...
...
scripts/respond.js
0 → 100644
View file @
b71f7661
const
fs
=
require
(
"
fs
"
)
const
{
deployed
,
getTrieNodesForCall
}
=
require
(
"
../scripts/lib
"
)
async
function
main
()
{
let
[
c
,
m
,
mm
]
=
await
deployed
()
const
blockNumberN
=
parseInt
(
process
.
env
.
BLOCK
)
const
challengeId
=
parseInt
(
process
.
env
.
ID
)
let
step
=
(
await
c
.
getStepNumber
(
challengeId
)).
toNumber
()
console
.
log
(
"
searching step
"
,
step
,
"
in block
"
,
blockNumberN
)
let
thisTrie
=
JSON
.
parse
(
fs
.
readFileSync
(
"
/tmp/cannon/0_
"
+
blockNumberN
.
toString
()
+
"
/checkpoint_
"
+
step
.
toString
()
+
"
.json
"
))
const
root
=
thisTrie
[
'
root
'
]
console
.
log
(
"
new root
"
,
root
)
let
ret
=
await
c
.
ProposeState
(
challengeId
,
root
)
let
receipt
=
await
ret
.
wait
()
console
.
log
(
receipt
)
}
main
()
.
then
(()
=>
process
.
exit
(
0
))
.
catch
((
error
)
=>
{
console
.
error
(
error
);
process
.
exit
(
1
);
});
\ No newline at end of file
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