Commit e32d3502 authored by George Hotz's avatar George Hotz

ugh, still failing

parent dc8ce147
......@@ -659,6 +659,7 @@ library Lib_MerkleTrie {
if (itemType == Lib_RLPReader.RLPItemType.DATA_ITEM) {
return Lib_RLPReader._copy(_in.ptr, itemOffset, itemLength);
} else {
require(_in.length < 32, "bad _getNodeValue other");
return Lib_RLPReader._copy(_in.ptr, 0, _in.length);
}
}
......
......@@ -22,23 +22,33 @@ func TestTrie(t *testing.T) {
ioutil.WriteFile("/tmp/eth/ramtrie", dat, 0644)
}
func TestBuggedTrie(t *testing.T) {
ram := make(map[uint32](uint32))
ram[0] = 1
ram[4] = 2
func printRoot(ram map[uint32](uint32)) {
root := RamToTrie(ram)
fmt.Println("root =", root)
}
func printTrie(ram map[uint32](uint32)) {
root := RamToTrie(ram)
fmt.Println("root(0,4) =", root)
fmt.Println("root =", root)
ParseNode(root, 0, func(t common.Hash) []byte {
return Preimages[t]
})
}
ram[0x40] = 3
func TestBuggedTrie(t *testing.T) {
ram := make(map[uint32](uint32))
root = RamToTrie(ram)
fmt.Println("root(0,4,0x40) =", root)
ParseNode(root, 0, func(t common.Hash) []byte {
return Preimages[t]
})
ram[0] = 1
ram[4] = 2
printTrie(ram)
ram[0x40] = 3
printTrie(ram)
ram = make(map[uint32](uint32))
ram[0x7fffd00c] = 1
ram[0x7fffd010] = 2
printTrie(ram)
ram[0x7fffcffc] = 3
printTrie(ram)
}
......@@ -39,11 +39,10 @@ describe("MIPSMemory contract", function () {
expect(await mm.ReadMemory(root, 4)).to.equal(2)
expect(await mm.ReadMemory(root, 0x40)).to.equal(3)
})
it("write four should work", async function() {
it("write other three should work", async function() {
await mm.AddTrieNode(new Uint8Array([0x80]))
let root = "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
root = await write(mm, root, 0xc0000080, 0xaa)
root = await write(mm, root, 0x7fffd00c, 1)
root = await write(mm, root, 0x7fffd010, 2)
root = await write(mm, root, 0x7fffcffc, 3)
......
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