Commit b71f7661 authored by George Hotz's avatar George Hotz

respond works

parent 690f9803
......@@ -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
......
......@@ -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;
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment