From 4ce845e2ccdf0c74eb89fad9d352a9d3382ff6e8 Mon Sep 17 00:00:00 2001 From: chengxuncc Date: Thu, 14 Mar 2024 19:01:23 +0800 Subject: [PATCH] add opcodes blobhash and blobbasefee --- huff_utils/src/evm.rs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/huff_utils/src/evm.rs b/huff_utils/src/evm.rs index 12da3f82..97523465 100644 --- a/huff_utils/src/evm.rs +++ b/huff_utils/src/evm.rs @@ -6,7 +6,7 @@ use strum_macros::EnumString; /// They are arranged in a particular order such that all the opcodes that have common /// prefixes are ordered by decreasing length to avoid mismatch when lexing. /// Example : [origin, or] or [push32, ..., push3] -pub const OPCODES: [&str; 148] = [ +pub const OPCODES: [&str; 150] = [ "lt", "gt", "slt", @@ -29,6 +29,8 @@ pub const OPCODES: [&str; 148] = [ "codesize", "codecopy", "basefee", + "blobhash", + "blobbasefee", "blockhash", "coinbase", "timestamp", @@ -39,7 +41,6 @@ pub const OPCODES: [&str; 148] = [ "chainid", "selfbalance", "pop", - "mcopy", "mload", "mstore8", "mstore", @@ -80,6 +81,7 @@ pub const OPCODES: [&str; 148] = [ "log4", "tload", "tstore", + "mcopy", "create2", "create", "callcode", @@ -181,6 +183,8 @@ pub static OPCODES_MAP: phf::Map<&'static str, Opcode> = phf_map! { "codesize" => Opcode::Codesize, "codecopy" => Opcode::Codecopy, "basefee" => Opcode::Basefee, + "blobhash" => Opcode::Blobhash, + "blobbasefee" => Opcode::Blobbasefee, "blockhash" => Opcode::Blockhash, "coinbase" => Opcode::Coinbase, "timestamp" => Opcode::Timestamp, @@ -295,8 +299,8 @@ pub static OPCODES_MAP: phf::Map<&'static str, Opcode> = phf_map! { "log2" => Opcode::Log2, "log3" => Opcode::Log3, "log4" => Opcode::Log4, - "tload" => Opcode::TLoad, - "tstore" => Opcode::TStore, + "tload" => Opcode::Tload, + "tstore" => Opcode::Tstore, "create" => Opcode::Create, "call" => Opcode::Call, "callcode" => Opcode::Callcode, @@ -418,6 +422,10 @@ pub enum Opcode { Selfbalance, /// Base Fee Basefee, + /// Versioned hashes of blobs associated with the transaction. + Blobhash, + /// Blob base fee of the current block. + Blobbasefee, /// Removes an Item from the Stack Pop, /// Loads a word from Memory @@ -442,8 +450,6 @@ pub enum Opcode { Gas, /// Marks a valid destination for jumps Jumpdest, - /// Copies an area of memory from src to dst. Areas can overlap. - Mcopy, /// Places a zero on top of the stack Push0, /// Places 1 byte item on top of the stack @@ -585,9 +591,11 @@ pub enum Opcode { /// Append Log Record with 4 Topics Log4, /// Transaction-persistent, but storage-ephemeral variable load - TLoad, + Tload, /// Transaction-persistent, but storage-ephemeral variable store - TStore, + Tstore, + /// Copies an area of memory from src to dst. Areas can overlap. + Mcopy, /// Create a new account with associated code Create, /// Message-call into an account @@ -670,6 +678,8 @@ impl Opcode { Opcode::Chainid => "46", Opcode::Selfbalance => "47", Opcode::Basefee => "48", + Opcode::Blobhash => "49", + Opcode::Blobbasefee => "4a", Opcode::Pop => "50", Opcode::Mload => "51", Opcode::Mstore => "52", @@ -682,8 +692,8 @@ impl Opcode { Opcode::Msize => "59", Opcode::Gas => "5a", Opcode::Jumpdest => "5b", - Opcode::TLoad => "5c", - Opcode::TStore => "5d", + Opcode::Tload => "5c", + Opcode::Tstore => "5d", Opcode::Mcopy => "5e", Opcode::Push0 => "5f", Opcode::Push1 => "60",