Commit 70a1cd1f authored by George Hotz's avatar George Hotz

wee we did a challenge

parent 03413842
...@@ -67,6 +67,7 @@ minigeth/go-ethereum 1171895 && mipsevm/mipsevm 1171895 ...@@ -67,6 +67,7 @@ minigeth/go-ethereum 1171895 && mipsevm/mipsevm 1171895
minigeth/go-ethereum 10 && mipsevm/mipsevm 10 minigeth/go-ethereum 10 && mipsevm/mipsevm 10
BLOCK=1171895 npx hardhat run scripts/challenge.js BLOCK=1171895 npx hardhat run scripts/challenge.js
# do binary search
for i in {1..23} for i in {1..23}
do do
ID=0 BLOCK=10 CHALLENGER=1 npx hardhat run scripts/respond.js ID=0 BLOCK=10 CHALLENGER=1 npx hardhat run scripts/respond.js
...@@ -78,7 +79,6 @@ ID=0 BLOCK=10 CHALLENGER=1 npx hardhat run scripts/assert.js ...@@ -78,7 +79,6 @@ ID=0 BLOCK=10 CHALLENGER=1 npx hardhat run scripts/assert.js
# assert as defender (passes) # assert as defender (passes)
ID=0 BLOCK=1171895 npx hardhat run scripts/assert.js ID=0 BLOCK=1171895 npx hardhat run scripts/assert.js
``` ```
## State Oracle API ## State Oracle API
......
...@@ -36,19 +36,20 @@ func main() { ...@@ -36,19 +36,20 @@ func main() {
lastStep := 1 lastStep := 1
if evm { if evm {
ZeroRegisters(ram) // TODO: fix this
/*ZeroRegisters(ram)
LoadMappedFile("mipigo/minigeth.bin", ram, 0) LoadMappedFile("mipigo/minigeth.bin", ram, 0)
WriteCheckpoint(ram, "/tmp/cannon/golden.json", -1) WriteCheckpoint(ram, "/tmp/cannon/golden.json", -1)
LoadMappedFile(fmt.Sprintf("%s/input", root), ram, 0x30000000) LoadMappedFile(fmt.Sprintf("%s/input", root), ram, 0x30000000)
RunWithRam(ram, target-1, 0, root, nil) RunWithRam(ram, target-1, 0, root, nil)
lastStep += target - 1 lastStep += target - 1
fn := fmt.Sprintf("%s/checkpoint_%d.json", root, lastStep) fn := fmt.Sprintf("%s/checkpoint_%d.json", root, lastStep)
WriteCheckpoint(ram, fn, lastStep) WriteCheckpoint(ram, fn, lastStep)*/
} else { } else {
mu := GetHookedUnicorn(root, ram, func(lstep int, mu uc.Unicorn, ram map[uint32](uint32)) { mu := GetHookedUnicorn(root, ram, func(step int, mu uc.Unicorn, ram map[uint32](uint32)) {
step := lstep + 1 // it seems this runs before the actual step happens
// this can be raised to 10,000,000 if the files are too large // this can be raised to 10,000,000 if the files are too large
if step%10000000 == 0 || step == target { if (target == -1 && step%10000000 == 0) || step == target {
SyncRegs(mu, ram) SyncRegs(mu, ram)
fn := fmt.Sprintf("%s/checkpoint_%d.json", root, step) fn := fmt.Sprintf("%s/checkpoint_%d.json", root, step)
WriteCheckpoint(ram, fn, step) WriteCheckpoint(ram, fn, step)
...@@ -57,7 +58,8 @@ func main() { ...@@ -57,7 +58,8 @@ func main() {
mu.RegWrite(uc.MIPS_REG_PC, 0x5ead0004) mu.RegWrite(uc.MIPS_REG_PC, 0x5ead0004)
} }
} }
lastStep = step // TODO: is this where the plus 1 goes?
lastStep = step + 1
}) })
ZeroRegisters(ram) ZeroRegisters(ram)
...@@ -72,13 +74,6 @@ func main() { ...@@ -72,13 +74,6 @@ func main() {
// TODO: this is actually step 0->1. Renumber as appropriate // TODO: this is actually step 0->1. Renumber as appropriate
LoadMappedFileUnicorn(mu, fmt.Sprintf("%s/input", root), ram, 0x30000000) LoadMappedFileUnicorn(mu, fmt.Sprintf("%s/input", root), ram, 0x30000000)
if target == 0 {
// no actual running at step 0
fn := fmt.Sprintf("%s/checkpoint_%d.json", root, target)
WriteCheckpoint(ram, fn, target)
return
}
mu.Start(0, 0x5ead0004) mu.Start(0, 0x5ead0004)
SyncRegs(mu, ram) SyncRegs(mu, ram)
} }
......
...@@ -42,7 +42,7 @@ async function main() { ...@@ -42,7 +42,7 @@ async function main() {
} }
let receipt = await ret.wait() let receipt = await ret.wait()
console.log(receipt) console.log(receipt.events.map((x) => x.event))
} }
main() main()
......
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