Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanks12 committed Jan 26, 2024
1 parent cf46086 commit 3298008
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ 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);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/acir-simulator/src/avm/opcodes/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const res = TaggedMemory.integralFromTag(this.value, this.dstTag);
const res = TaggedMemory.integralFromTag(this.value, this.inTag);

machineState.memory.set(this.dstOffset, res);

Expand Down

0 comments on commit 3298008

Please sign in to comment.