Commit 5244cf21 authored by George Hotz's avatar George Hotz

remove atob, make test fail

parent 1b3bc386
...@@ -43,7 +43,9 @@ contract MIPS { ...@@ -43,7 +43,9 @@ contract MIPS {
function WriteMemory(bytes32 stateHash, uint32 addr, uint32 value) internal returns (bytes32) { function WriteMemory(bytes32 stateHash, uint32 addr, uint32 value) internal returns (bytes32) {
if (address(m) != address(0)) { if (address(m) != address(0)) {
emit DidWriteMemory(addr, value); emit DidWriteMemory(addr, value);
return m.WriteMemory(stateHash, addr, value); bytes32 newStateHash = m.WriteMemory(stateHash, addr, value);
require(ReadMemory(newStateHash, addr) == value, "memory readback check failed");
return newStateHash;
} else { } else {
assembly { assembly {
// TODO: this is actually doing an SLOAD first // TODO: this is actually doing an SLOAD first
......
...@@ -9,7 +9,7 @@ describe("MIPS contract", function () { ...@@ -9,7 +9,7 @@ describe("MIPS contract", function () {
const mm = await ethers.getContractAt("MIPSMemory", await m.m()) const mm = await ethers.getContractAt("MIPSMemory", await m.m())
for (k in trieAdd['preimages']) { for (k in trieAdd['preimages']) {
const bin = Uint8Array.from(atob(trieAdd['preimages'][k]), c => c.charCodeAt(0)) const bin = Uint8Array.from(Buffer.from(trieAdd['preimages'][k], 'base64').toString('binary'), c => c.charCodeAt(0))
await mm.AddTrieNode(bin) await mm.AddTrieNode(bin)
} }
......
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