Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Mar 11, 2024
1 parent bec0963 commit 4a5d6c3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
28 changes: 18 additions & 10 deletions avm-transpiler/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// Keep updated with TS and yellow paper!
#[derive(Copy, Clone)]
pub enum AvmOpcode {
// Compute
ADD,
SUB,
MUL,
Expand All @@ -16,6 +17,7 @@ pub enum AvmOpcode {
SHL,
SHR,
CAST,
// Execution environment
ADDRESS,
STORAGEADDRESS,
ORIGIN,
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,6 +22,7 @@ export enum Opcode {
SHL,
SHR,
CAST,
// Execution environment
ADDRESS,
STORAGEADDRESS,
ORIGIN,
Expand All @@ -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,
Expand All @@ -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.
Expand Down

0 comments on commit 4a5d6c3

Please sign in to comment.