From 3c2e0339ee954684f3e747adfb19d65b824f4a15 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Fri, 26 Jan 2024 21:39:21 +0000 Subject: [PATCH] dstTag -> inTag for SET to match YP. Hex opcode prints in encoder --- .../acir-simulator/src/avm/opcodes/encode_to_bytecode.ts | 4 ++-- yarn-project/acir-simulator/src/avm/opcodes/memory.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn-project/acir-simulator/src/avm/opcodes/encode_to_bytecode.ts b/yarn-project/acir-simulator/src/avm/opcodes/encode_to_bytecode.ts index 186706847d39..7e91ef471c1b 100644 --- a/yarn-project/acir-simulator/src/avm/opcodes/encode_to_bytecode.ts +++ b/yarn-project/acir-simulator/src/avm/opcodes/encode_to_bytecode.ts @@ -11,12 +11,12 @@ import { Opcode } from './opcodes.js'; export function encodeToBytecode(opcode: Opcode, args: number[]): Buffer { const instructionType = INSTRUCTION_SET.get(opcode); if (instructionType === undefined) { - throw new Error(`Opcode ${opcode} not implemented`); + throw new Error(`Opcode 0x${opcode.toString(16)} not implemented`); } const numberOfOperands = instructionType.numberOfOperands; if (args.length !== numberOfOperands) { - throw new Error(`Opcode ${opcode} expects ${numberOfOperands} arguments, but ${args.length} were provided`); + throw new Error(`Opcode 0x${opcode.toString(16)} expects ${numberOfOperands} arguments, but ${args.length} were provided`); } const bytecode = Buffer.alloc(AVM_OPCODE_BYTE_LENGTH + numberOfOperands * AVM_OPERAND_BYTE_LENGTH); diff --git a/yarn-project/acir-simulator/src/avm/opcodes/memory.ts b/yarn-project/acir-simulator/src/avm/opcodes/memory.ts index 6463b496175f..2524684dc029 100644 --- a/yarn-project/acir-simulator/src/avm/opcodes/memory.ts +++ b/yarn-project/acir-simulator/src/avm/opcodes/memory.ts @@ -7,12 +7,12 @@ export class Set extends Instruction { static type: string = 'SET'; static numberOfOperands = 3; - constructor(private dstTag: TypeTag, private value: bigint, private dstOffset: number) { + constructor(private inTag: TypeTag, private value: bigint, private dstOffset: number) { super(); } async execute(machineState: AvmMachineState, _journal: AvmJournal): Promise { - const res = TaggedMemory.integralFromTag(this.value, this.dstTag); + const res = TaggedMemory.integralFromTag(this.value, this.inTag); machineState.memory.set(this.dstOffset, res);