Skip to content

Commit

Permalink
added EOF opcodes to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
faramozzayw committed Dec 18, 2023
1 parent 345dfd4 commit 5ddd560
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions evm_loader/program/src/evm/opcode_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,15 @@ macro_rules! eof_opcode_table {
}
}
}

#[cfg(not(target_os = "solana"))]
pub const EOF_OPNAMES: [&str; 256] = {
let mut opnames: [&str; 256] = ["<invalid>"; 256];

$(opnames[$opcode as usize] = $opname;)*

opnames
};
}
}

Expand Down
6 changes: 4 additions & 2 deletions evm_loader/program/src/evm/tracing/tracers/struct_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ethnum::U256;
use serde::Serialize;
use serde_json::Value;

use crate::evm::opcode_table::OPNAMES;
use crate::evm::opcode_table::{EOF_OPNAMES, OPNAMES};
use crate::evm::tracing::TraceConfig;
use crate::evm::tracing::{EmulationResult, Event, EventListener};
use crate::types::hexbytes::HexBytes;
Expand Down Expand Up @@ -77,7 +77,9 @@ impl StructLog {
memory: Option<Vec<String>>,
stack: Option<Vec<U256>>,
) -> Self {
let op = OPNAMES[opcode as usize];
let op = *EOF_OPNAMES
.get(opcode as usize)
.unwrap_or(&OPNAMES[opcode as usize]);
Self {
pc,
op,
Expand Down

0 comments on commit 5ddd560

Please sign in to comment.