Commit a01e998c authored by Willem Olding's avatar Willem Olding Committed by norswap

updates tests with new call format

parent 25273b2f
...@@ -79,7 +79,7 @@ test_challenge: ...@@ -79,7 +79,7 @@ test_challenge:
minigeth/go-ethereum 13284469 minigeth/go-ethereum 13284469
# Generate initial (generic) MIPS memory checkpoint and final checkpoint for # Generate initial (generic) MIPS memory checkpoint and final checkpoint for
# block 13284469. # block 13284469.
mipsevm/mipsevm && mipsevm/mipsevm 13284469 mipsevm/mipsevm --outputGolden && mipsevm/mipsevm --blockNumber=13284469
npx hardhat test test/challenge_test.js npx hardhat test test/challenge_test.js
.PHONY: test_challenge .PHONY: test_challenge
......
...@@ -101,7 +101,7 @@ mkdir -p /tmp/cannon /tmp/cannon_fault && rm -rf /tmp/cannon/* /tmp/cannon_fault ...@@ -101,7 +101,7 @@ mkdir -p /tmp/cannon /tmp/cannon_fault && rm -rf /tmp/cannon/* /tmp/cannon_fault
# stored in /tmp/cannon/golden.json # stored in /tmp/cannon/golden.json
shout "GENERATING INITIAL MEMORY STATE CHECKPOINT" shout "GENERATING INITIAL MEMORY STATE CHECKPOINT"
mipsevm/mipsevm mipsevm/mipsevm --outputGolden
shout "DEPLOYING CONTRACTS" shout "DEPLOYING CONTRACTS"
npx hardhat run scripts/deploy.js --network $NETWORK npx hardhat run scripts/deploy.js --network $NETWORK
...@@ -113,7 +113,7 @@ shout "FETCHING PREIMAGES FOR REAL BLOCK" ...@@ -113,7 +113,7 @@ shout "FETCHING PREIMAGES FOR REAL BLOCK"
minigeth/go-ethereum $BLOCK minigeth/go-ethereum $BLOCK
shout "COMPUTING REAL MIPS FINAL MEMORY CHECKPOINT" shout "COMPUTING REAL MIPS FINAL MEMORY CHECKPOINT"
mipsevm/mipsevm $BLOCK mipsevm/mipsevm --blockNumber=$BLOCK
# these are the preimages for the real block (but go into a different basedir) # these are the preimages for the real block (but go into a different basedir)
shout "FETCHING PREIMAGES FOR FAULTY BLOCK" shout "FETCHING PREIMAGES FOR FAULTY BLOCK"
...@@ -122,10 +122,10 @@ BASEDIR=/tmp/cannon_fault minigeth/go-ethereum $BLOCK ...@@ -122,10 +122,10 @@ BASEDIR=/tmp/cannon_fault minigeth/go-ethereum $BLOCK
# since the computation includes a fault, the output file will be different than # since the computation includes a fault, the output file will be different than
# for the real block # for the real block
shout "COMPUTE FAKE MIPS CHECKPOINT" shout "COMPUTE FAKE MIPS CHECKPOINT"
OUTPUTFAULT=1 BASEDIR=/tmp/cannon_fault mipsevm/mipsevm $BLOCK OUTPUTFAULT=1 BASEDIR=/tmp/cannon_fault mipsevm/mipsevm --blockNumber=$BLOCK
# alternatively, to inject a fault in registers instead of memory # alternatively, to inject a fault in registers instead of memory
# REGFAULT=13240000 BASEDIR=/tmp/cannon_fault mipsevm/mipsevm $BLOCK # REGFAULT=13240000 BASEDIR=/tmp/cannon_fault mipsevm/mipsevm --blockNumber=$BLOCK
# --- BINARY SEARCH ------------------------------------------------------------ # --- BINARY SEARCH ------------------------------------------------------------
......
...@@ -97,7 +97,7 @@ mkdir -p /tmp/cannon /tmp/cannon_fault && rm -rf /tmp/cannon/* /tmp/cannon_fault ...@@ -97,7 +97,7 @@ mkdir -p /tmp/cannon /tmp/cannon_fault && rm -rf /tmp/cannon/* /tmp/cannon_fault
# stored in /tmp/cannon/golden.json # stored in /tmp/cannon/golden.json
shout "GENERATING INITIAL MEMORY STATE CHECKPOINT" shout "GENERATING INITIAL MEMORY STATE CHECKPOINT"
mipsevm/mipsevm mipsevm/mipsevm --outputGolden
shout "DEPLOYING CONTRACTS" shout "DEPLOYING CONTRACTS"
npx hardhat run scripts/deploy.js --network $NETWORK npx hardhat run scripts/deploy.js --network $NETWORK
...@@ -109,13 +109,13 @@ shout "FETCHING PREIMAGES FOR REAL BLOCK" ...@@ -109,13 +109,13 @@ shout "FETCHING PREIMAGES FOR REAL BLOCK"
minigeth/go-ethereum $BLOCK minigeth/go-ethereum $BLOCK
shout "COMPUTING REAL MIPS FINAL MEMORY CHECKPOINT" shout "COMPUTING REAL MIPS FINAL MEMORY CHECKPOINT"
mipsevm/mipsevm $BLOCK mipsevm/mipsevm --blockNumber=$BLOCK
shout "FETCHING PREIMAGES FOR WRONG BLOCK" shout "FETCHING PREIMAGES FOR WRONG BLOCK"
BASEDIR=/tmp/cannon_fault minigeth/go-ethereum $WRONG_BLOCK BASEDIR=/tmp/cannon_fault minigeth/go-ethereum $WRONG_BLOCK
shout "COMPUTING FAKE MIPS FINAL MEMORY CHECKPOINT" shout "COMPUTING FAKE MIPS FINAL MEMORY CHECKPOINT"
BASEDIR=/tmp/cannon_fault mipsevm/mipsevm $WRONG_BLOCK BASEDIR=/tmp/cannon_fault mipsevm/mipsevm --blockNumber=$WRONG_BLOCK
# pretend the wrong block's input, checkpoints and preimages are the right block's # pretend the wrong block's input, checkpoints and preimages are the right block's
ln -s /tmp/cannon_fault/0_$WRONG_BLOCK /tmp/cannon_fault/0_$BLOCK ln -s /tmp/cannon_fault/0_$WRONG_BLOCK /tmp/cannon_fault/0_$BLOCK
......
...@@ -59,6 +59,7 @@ func main() { ...@@ -59,6 +59,7 @@ func main() {
lastStep := 1 lastStep := 1
if evm { if evm {
// TODO: fix this // TODO: fix this
log.Fatal("EVM execution currently not supported")
/*ZeroRegisters(ram) /*ZeroRegisters(ram)
LoadMappedFile(programPath, ram, 0) LoadMappedFile(programPath, ram, 0)
WriteCheckpoint(ram, "/tmp/cannon/golden.json", -1) WriteCheckpoint(ram, "/tmp/cannon/golden.json", -1)
......
...@@ -112,7 +112,7 @@ function getTrieAtStep(blockNumberN, step) { ...@@ -112,7 +112,7 @@ function getTrieAtStep(blockNumberN, step) {
if (!fs.existsSync(fn)) { if (!fs.existsSync(fn)) {
console.log("running mipsevm") console.log("running mipsevm")
child_process.execSync("mipsevm/mipsevm "+blockNumberN.toString()+" "+step.toString(), {stdio: 'inherit'}) child_process.execSync("mipsevm/mipsevm --blockNumber="+blockNumberN.toString()+" --target="+step.toString(), {stdio: 'inherit'})
} }
return JSON.parse(fs.readFileSync(fn)) return JSON.parse(fs.readFileSync(fn))
......
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