From 4a5d6c3bdea3ff1fafa0f673a135b6c380b2089f Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Mon, 11 Mar 2024 09:56:25 +0000 Subject: [PATCH] address comments --- avm-transpiler/src/opcodes.rs | 28 ++++++++++++------- .../instruction_serialization.ts | 9 +++++- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/avm-transpiler/src/opcodes.rs b/avm-transpiler/src/opcodes.rs index 6c4fa503a9f..ccc47caa71d 100644 --- a/avm-transpiler/src/opcodes.rs +++ b/avm-transpiler/src/opcodes.rs @@ -2,6 +2,7 @@ /// Keep updated with TS and yellow paper! #[derive(Copy, Clone)] pub enum AvmOpcode { + // Compute ADD, SUB, MUL, @@ -16,6 +17,7 @@ pub enum AvmOpcode { SHL, SHR, CAST, + // Execution environment ADDRESS, STORAGEADDRESS, ORIGIN, @@ -34,35 +36,41 @@ pub enum AvmOpcode { BLOCKL2GASLIMIT, BLOCKDAGASLIMIT, CALLDATACOPY, + // Gas L1GASLEFT, L2GASLEFT, DAGASLEFT, + // Control flow JUMP, JUMPI, INTERNALCALL, INTERNALRETURN, + // Memory SET, MOV, CMOV, - SLOAD, // Public Storage - SSTORE, // Public Storage - NOTEHASHEXISTS, // Notes & Nullifiers - EMITNOTEHASH, // Notes & Nullifiers - NULLIFIEREXISTS, // Notes & Nullifiers - EMITNULLIFIER, // Notes & Nullifiers - L1TOL2MSGEXISTS, // Messages - HEADERMEMBER, // Archive tree & Headers + // World state + SLOAD, + SSTORE, + NOTEHASHEXISTS, + EMITNOTEHASH, + NULLIFIEREXISTS, + EMITNULLIFIER, + L1TOL2MSGEXISTS, + HEADERMEMBER, EMITUNENCRYPTEDLOG, SENDL2TOL1MSG, + // External calls CALL, STATICCALL, DELEGATECALL, RETURN, REVERT, + // Gadgets KECCAK, POSEIDON, - SHA256, - PEDERSEN, + SHA256, // temp - may be removed, but alot of contracts rely on it + PEDERSEN, // temp - may be removed, but alot of contracts rely on it } impl AvmOpcode { diff --git a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts index 684db9c6505..167070cd0b2 100644 --- a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts +++ b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts @@ -7,6 +7,7 @@ import { BufferCursor } from './buffer_cursor.js'; * Source: https://yp-aztec.netlify.app/docs/public-vm/instruction-set */ export enum Opcode { + // Compute ADD, SUB, MUL, @@ -21,6 +22,7 @@ export enum Opcode { SHL, SHR, CAST, + // Execution environment ADDRESS, STORAGEADDRESS, ORIGIN, @@ -39,16 +41,20 @@ export enum Opcode { BLOCKL2GASLIMIT, BLOCKDAGASLIMIT, CALLDATACOPY, + // Gas L1GASLEFT, L2GASLEFT, DAGASLEFT, + // Control flow JUMP, JUMPI, INTERNALCALL, INTERNALRETURN, + // Memory SET, MOV, CMOV, + // World state SLOAD, SSTORE, NOTEHASHEXISTS, @@ -59,16 +65,17 @@ export enum Opcode { HEADERMEMBER, EMITUNENCRYPTEDLOG, SENDL2TOL1MSG, + // External calls CALL, STATICCALL, DELEGATECALL, RETURN, REVERT, + // Gadgets KECCAK, POSEIDON, SHA256, // temp - may be removed, but alot of contracts rely on it PEDERSEN, // temp - may be removed, but alot of contracts rely on it - TOTAL_OPCODES_NUMBER, } // Possible types for an instruction's operand in its wire format. (Keep in sync with CPP code.