Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
add opcodes blobhash and blobbasefee (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengxuncc authored Mar 14, 2024
1 parent 08531a9 commit f13f7de
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions huff_utils/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -29,6 +29,8 @@ pub const OPCODES: [&str; 148] = [
"codesize",
"codecopy",
"basefee",
"blobhash",
"blobbasefee",
"blockhash",
"coinbase",
"timestamp",
Expand All @@ -39,7 +41,6 @@ pub const OPCODES: [&str; 148] = [
"chainid",
"selfbalance",
"pop",
"mcopy",
"mload",
"mstore8",
"mstore",
Expand Down Expand Up @@ -80,6 +81,7 @@ pub const OPCODES: [&str; 148] = [
"log4",
"tload",
"tstore",
"mcopy",
"create2",
"create",
"callcode",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit f13f7de

Please sign in to comment.