Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pluralize EOFCreateInput #1523

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/interpreter/src/instructions/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
gas::{self, cost_per_word, EOF_CREATE_GAS, KECCAK256WORD},
interpreter::Interpreter,
primitives::{Address, Bytes, Eof, Spec, SpecId::*, U256},
CallInputs, CallScheme, CallValue, CreateInputs, CreateScheme, EOFCreateInput, Host,
CallInputs, CallScheme, CallValue, CreateInputs, CreateScheme, EOFCreateInputs, Host,
InstructionResult, InterpreterAction, InterpreterResult, LoadAccountResult, MAX_INITCODE_SIZE,
};
use core::cmp::max;
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn eofcreate<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H)

// Send container for execution container is preverified.
interpreter.next_action = InterpreterAction::EOFCreate {
inputs: Box::new(EOFCreateInput::new(
inputs: Box::new(EOFCreateInputs::new(
interpreter.contract.target_address,
created_address,
value,
Expand Down
4 changes: 2 additions & 2 deletions crates/interpreter/src/interpreter_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use call_inputs::{CallInputs, CallScheme, CallValue};
pub use call_outcome::CallOutcome;
pub use create_inputs::{CreateInputs, CreateScheme};
pub use create_outcome::CreateOutcome;
pub use eof_create_inputs::EOFCreateInput;
pub use eof_create_inputs::EOFCreateInputs;
pub use eof_create_outcome::EOFCreateOutcome;

use crate::InterpreterResult;
Expand All @@ -24,7 +24,7 @@ pub enum InterpreterAction {
/// CREATE or CREATE2 instruction called.
Create { inputs: Box<CreateInputs> },
/// EOF CREATE instruction called.
EOFCreate { inputs: Box<EOFCreateInput> },
EOFCreate { inputs: Box<EOFCreateInputs> },
/// Interpreter finished execution.
Return { result: InterpreterResult },
/// No action
Expand Down
10 changes: 5 additions & 5 deletions crates/interpreter/src/interpreter_action/eof_create_inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::boxed::Box;
/// Inputs for EOF create call.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct EOFCreateInput {
pub struct EOFCreateInputs {
/// Caller of Eof Craate
pub caller: Address,
/// New contract address.
Expand All @@ -19,7 +19,7 @@ pub struct EOFCreateInput {
pub gas_limit: u64,
}

impl EOFCreateInput {
impl EOFCreateInputs {
/// Returns boxed EOFCreateInput or error.
/// Internally calls [`Self::new_tx`].
pub fn new_tx_boxed(tx: &TxEnv, nonce: u64) -> Result<Box<Self>, EofDecodeError> {
Expand All @@ -31,7 +31,7 @@ impl EOFCreateInput {
/// Legacy transaction still have optional nonce so we need to obtain it.
pub fn new_tx(tx: &TxEnv, nonce: u64) -> Result<Self, EofDecodeError> {
let (eof_init_code, input) = Eof::decode_dangling(tx.data.clone())?;
Ok(EOFCreateInput {
Ok(EOFCreateInputs {
caller: tx.caller,
created_address: tx.caller.create(nonce),
value: tx.value,
Expand All @@ -49,8 +49,8 @@ impl EOFCreateInput {
eof_init_code: Eof,
gas_limit: u64,
input: Bytes,
) -> EOFCreateInput {
EOFCreateInput {
) -> EOFCreateInputs {
EOFCreateInputs {
caller,
created_address,
value,
Expand Down
2 changes: 1 addition & 1 deletion crates/interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub use interpreter::{
};
pub use interpreter_action::{
CallInputs, CallOutcome, CallScheme, CallValue, CreateInputs, CreateOutcome, CreateScheme,
EOFCreateInput, EOFCreateOutcome, InterpreterAction,
EOFCreateInputs, EOFCreateOutcome, InterpreterAction,
};
pub use opcode::{Instruction, OpCode, OPCODE_INFO_JUMPTABLE};
pub use primitives::{MAX_CODE_SIZE, MAX_INITCODE_SIZE};
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/context/inner_evm_context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
db::Database,
interpreter::{
analysis::to_analysed, gas, return_ok, Contract, CreateInputs, EOFCreateInput, Gas,
analysis::to_analysed, gas, return_ok, Contract, CreateInputs, EOFCreateInputs, Gas,
InstructionResult, Interpreter, InterpreterResult, LoadAccountResult, SStoreResult,
SelfDestructResult, MAX_CODE_SIZE,
},
Expand Down Expand Up @@ -245,7 +245,7 @@ impl<DB: Database> InnerEvmContext<DB> {
pub fn make_eofcreate_frame(
&mut self,
spec_id: SpecId,
inputs: &EOFCreateInput,
inputs: &EOFCreateInputs,
) -> Result<FrameOrResult, EVMError<DB::Error>> {
let return_error = |e| {
Ok(FrameOrResult::new_eofcreate_result(
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
db::{Database, DatabaseCommit, EmptyDB},
handler::Handler,
interpreter::{
analysis::validate_eof, CallInputs, CreateInputs, EOFCreateInput, EOFCreateOutcome, Gas,
analysis::validate_eof, CallInputs, CreateInputs, EOFCreateInputs, EOFCreateOutcome, Gas,
Host, InstructionResult, InterpreterAction, InterpreterResult, SharedMemory,
},
primitives::{
Expand Down Expand Up @@ -374,7 +374,7 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
});

// Create EOFCreateInput from transaction initdata.
let eofcreate = EOFCreateInput::new_tx_boxed(&ctx.evm.env.tx, nonce)
let eofcreate = EOFCreateInputs::new_tx_boxed(&ctx.evm.env.tx, nonce)
.ok()
.and_then(|eofcreate| {
// validate EOF initcode
Expand Down
6 changes: 3 additions & 3 deletions crates/revm/src/handler/handle_types/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
CallFrame, Context, CreateFrame, Frame, FrameOrResult, FrameResult,
};
use revm_interpreter::{
opcode::InstructionTables, CallOutcome, CreateOutcome, EOFCreateInput, EOFCreateOutcome,
opcode::InstructionTables, CallOutcome, CreateOutcome, EOFCreateInputs, EOFCreateOutcome,
InterpreterAction, InterpreterResult,
};
use std::{boxed::Box, sync::Arc};
Expand Down Expand Up @@ -91,7 +91,7 @@ pub type InsertCreateOutcomeHandle<'a, EXT, DB> = Arc<
pub type FrameEOFCreateHandle<'a, EXT, DB> = Arc<
dyn Fn(
&mut Context<EXT, DB>,
Box<EOFCreateInput>,
Box<EOFCreateInputs>,
) -> Result<FrameOrResult, EVMError<<DB as Database>::Error>>
+ 'a,
>;
Expand Down Expand Up @@ -255,7 +255,7 @@ impl<'a, EXT, DB: Database> ExecutionHandler<'a, EXT, DB> {
pub fn eofcreate(
&self,
context: &mut Context<EXT, DB>,
inputs: Box<EOFCreateInput>,
inputs: Box<EOFCreateInputs>,
) -> Result<FrameOrResult, EVMError<DB::Error>> {
(self.eofcreate)(context, inputs)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/handler/mainnet/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use core::mem;
use revm_interpreter::{
opcode::InstructionTables, CallOutcome, EOFCreateInput, EOFCreateOutcome, InterpreterAction,
opcode::InstructionTables, CallOutcome, EOFCreateInputs, EOFCreateOutcome, InterpreterAction,
InterpreterResult, EMPTY_SHARED_MEMORY,
};
use std::boxed::Box;
Expand Down Expand Up @@ -164,7 +164,7 @@ pub fn insert_create_outcome<EXT, DB: Database>(
#[inline]
pub fn eofcreate<SPEC: Spec, EXT, DB: Database>(
context: &mut Context<EXT, DB>,
inputs: Box<EOFCreateInput>,
inputs: Box<EOFCreateInputs>,
) -> Result<FrameOrResult, EVMError<DB::Error>> {
context.evm.make_eofcreate_frame(SPEC::SPEC_ID, &inputs)
}
Expand Down
6 changes: 3 additions & 3 deletions crates/revm/src/inspector.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
interpreter::{CallInputs, CreateInputs, EOFCreateInput, EOFCreateOutcome, Interpreter},
interpreter::{CallInputs, CreateInputs, EOFCreateInputs, EOFCreateOutcome, Interpreter},
primitives::{db::Database, Address, Log, U256},
EvmContext,
};
Expand Down Expand Up @@ -141,7 +141,7 @@ pub trait Inspector<DB: Database> {
fn eofcreate(
&mut self,
context: &mut EvmContext<DB>,
inputs: &mut EOFCreateInput,
inputs: &mut EOFCreateInputs,
) -> Option<EOFCreateOutcome> {
let _ = context;
let _ = inputs;
Expand All @@ -152,7 +152,7 @@ pub trait Inspector<DB: Database> {
fn eofcreate_end(
&mut self,
context: &mut EvmContext<DB>,
inputs: &EOFCreateInput,
inputs: &EOFCreateInputs,
outcome: EOFCreateOutcome,
) -> EOFCreateOutcome {
let _ = context;
Expand Down
Loading