From d626ea3cd6641ca9a81efdc33f2532199122235f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20Drwi=C4=99ga?= Date: Thu, 16 Jan 2025 08:51:53 +0100 Subject: [PATCH] Fresh memory at every reset. (#33) --- assembly/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assembly/api.ts b/assembly/api.ts index 6fed52b..af2b687 100644 --- a/assembly/api.ts +++ b/assembly/api.ts @@ -8,7 +8,6 @@ import { decodeProgram, liftBytes } from "./program"; import { NO_OF_REGISTERS, REG_SIZE_BYTES, Registers } from "./registers"; let interpreter: Interpreter | null = null; -const builder = new MemoryBuilder(); export function resetGeneric(program: u8[], flatRegisters: u8[], initialGas: Gas): void { const p = decodeProgram(liftBytes(program)); @@ -30,6 +29,7 @@ export function resetGenericWithMemory( const registers: Registers = new StaticArray(NO_OF_REGISTERS); fillRegisters(registers, flatRegisters); + const builder = new MemoryBuilder(); const memory = buildMemory(builder, readPages(pageMap), readChunks(chunks)); const int = new Interpreter(p, registers, memory);