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

staging branch #298

Merged
merged 9 commits into from
Apr 21, 2024
Prev Previous commit
Next Next commit
add opcodes blobhash and blobbasefee (#311)
chengxuncc authored Mar 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f13f7de05749544e0e5679a296d792d90cf57422
30 changes: 20 additions & 10 deletions huff_utils/src/evm.rs
Original file line number Diff line number Diff line change
@@ -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",