diff --git a/mipsevm/full.go b/mipsevm/full.go index d218878ef3615d9caa20d41e751bb60f6deaff09..61fe910c74cfe4cbd41f5ab06bf454876ac259b5 100644 --- a/mipsevm/full.go +++ b/mipsevm/full.go @@ -48,6 +48,16 @@ func addTrieNode(str []byte, interpreter *vm.EVMInterpreter, statedb *StateDB) { check(err) } +func RunTest() { + ram := make(map[uint32](uint32)) + LoadMappedFile("test/bin/add.bin", ram, 0) + ZeroRegisters(ram) + ram[0xC000007C] = 0x5EAD0000 + + RunWithRam(ram, 1, 0, nil) + +} + func RunFull() { interpreter, statedb := GetInterpreter(0, true) deploy(interpreter, statedb) @@ -55,6 +65,7 @@ func RunFull() { ram := make(map[uint32](uint32)) //LoadMappedFile("../mipigo/test/test.bin", ram, 0) LoadMappedFile("test/bin/add.bin", ram, 0) + ZeroRegisters(ram) ram[0xC000007C] = 0x5EAD0000 root := RamToTrie(ram) @@ -69,7 +80,7 @@ func RunFull() { fmt.Println("trie is ready, let's run") fmt.Println("state root", root, "nodes", len(Preimages)) - for step := 0; step < 10; step++ { + for step := 0; step < 40; step++ { // it's run o clock from := common.Address{} to := common.HexToAddress("0x1337") diff --git a/mipsevm/full_test.go b/mipsevm/full_test.go index 96b72f7ffd902ff7616135e284e3bf3ec70e5f65..ca2192c79c686463cedb80a8e5be44dbaad930ed 100644 --- a/mipsevm/full_test.go +++ b/mipsevm/full_test.go @@ -1,9 +1,23 @@ package main import ( + "fmt" "testing" ) func TestFull(t *testing.T) { RunFull() } + +func TestFullEvm(t *testing.T) { + ram := make(map[uint32](uint32)) + LoadMappedFile("test/bin/add.bin", ram, 0) + ZeroRegisters(ram) + ram[0xC000007C] = 0x5EAD0000 + + for step := 0; step < 12; step++ { + RunWithRam(ram, 1, 0, nil) + root := RamToTrie(ram) + fmt.Println(step, root) + } +} diff --git a/test/mips_test_trie.js b/test/mips_test_trie.js index 68feb7c768a6fc2e002c5d1e1009efe7f2d1ba5d..d400615abf75417e94b9d521e594f9ffbd17fc99 100644 --- a/test/mips_test_trie.js +++ b/test/mips_test_trie.js @@ -14,7 +14,8 @@ describe("MIPS contract", function () { } let root = trieAdd['root'] - for (let i = 0; i < 15; i++) { + console.log("start", root) + for (let i = 0; i < 12; i++) { ret = await m.Step(root) const receipt = await ret.wait() for (l of receipt.logs) {