Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into eof
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Apr 9, 2024
2 parents 4c60857 + 1edfeb6 commit 55c19ad
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 68 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 0 additions & 58 deletions crates/interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,64 +78,6 @@ pub struct InterpreterResult {
pub gas: Gas,
}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub enum InterpreterAction {
/// CALL, CALLCODE, DELEGATECALL or STATICCALL instruction called.
Call {
/// Call inputs
inputs: Box<CallInputs>,
},
/// CREATE or CREATE2 instruction called.
Create {
inputs: Box<CreateInputs>,
},
EOFCreate {
inputs: Box<EOFCreateInput>,
},
/// Interpreter finished execution.
Return {
result: InterpreterResult,
},
/// No action
#[default]
None,
}

impl InterpreterAction {
/// Returns true if action is call.
pub fn is_call(&self) -> bool {
matches!(self, InterpreterAction::Call { .. })
}

/// Returns true if action is create.
pub fn is_create(&self) -> bool {
matches!(self, InterpreterAction::Create { .. })
}

/// Returns true if action is return.
pub fn is_return(&self) -> bool {
matches!(self, InterpreterAction::Return { .. })
}

/// Returns true if action is none.
pub fn is_none(&self) -> bool {
matches!(self, InterpreterAction::None)
}

/// Returns true if action is some.
pub fn is_some(&self) -> bool {
!self.is_none()
}

/// Returns result if action is return.
pub fn into_result_return(self) -> Option<InterpreterResult> {
match self {
InterpreterAction::Return { result } => Some(result),
_ => None,
}
}
}

impl Interpreter {
/// Create new interpreter
pub fn new(contract: Contract, gas_limit: u64, is_static: bool) -> Self {
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ optional_eip3607 = []
optional_gas_refund = []
optional_no_base_fee = []
optional_beneficiary_reward = []
rand = ["alloy-primitives/rand"]

# See comments in `revm-precompile`
c-kzg = ["dep:c-kzg", "dep:once_cell", "dep:derive_more"]
2 changes: 1 addition & 1 deletion crates/primitives/src/specification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub enum SpecId {
GRAY_GLACIER = 14, // Gray Glacier 15050000
MERGE = 15, // Paris/Merge 15537394 (TTD: 58750000000000000000000)
SHANGHAI = 16, // Shanghai 17034870 (Timestamp: 1681338455)
CANCUN = 17, // Cancun TBD (Timestamp: 1710338135)
CANCUN = 17, // Cancun 19426587 (Timestamp: 1710338135)
PRAGUE = 18, // Praque TBD
#[default]
LATEST = u8::MAX,
Expand Down
Empty file.
Empty file removed crates/revm/src/frame/result.rs
Empty file.
2 changes: 0 additions & 2 deletions documentation/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
- [result](./crates/primitives/result.md)
- [environment](./crates/primitives/environment.md)
- [specifications](./crates/primitives/specifications.md)
- [bits](./crates/primitives/bits.md)
- [bytecode](./crates/primitives/bytecode.md)
- [constants](./crates/primitives/constants.md)
- [log](./crates/primitives/log.md)
- [precompile](./crates/primitives/precompile.md)
- [state](./crates/primitives/state.md)
- [utils](./crates/primitives/utils.md)
Expand Down
8 changes: 1 addition & 7 deletions documentation/src/crates/primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ It is set up to be compatible with environments that do not include Rust's stand

### Modules:

- [bits](./primitives/bits.md): This module provides types for handling specific sizes of byte arrays (Address and B256).
- [bytecode](./primitives/bytecode.md): This module provides functionality related to EVM bytecode.
- [constants](./primitives/constants.md): This module contains constant values used throughout the EVM implementation.
- [db](./primitives/database.md): This module contains data structures and functions related to the EVM's database implementation.
- [env](./primitives/environment.md): This module contains types and functions related to the EVM's environment, including block headers, and environment values.
- [log](./primitives/log.md): This module provides types and functionality for Ethereum logs.
- [precompile](./primitives/precompile.md): This module contains types related to Ethereum's precompiled contracts.
- [result](./primitives/result.md): This module provides types for representing execution results and errors in the EVM.
- [specification](./primitives/specifications.md): This module defines types related to Ethereum specifications (also known as hard forks).
Expand All @@ -30,10 +28,6 @@ It is set up to be compatible with environments that do not include Rust's stand
- `ruint`: The ruint crate provides types and functions for big unsigned integer arithmetic.
- `c-kzg`: A minimal implementation of the Polynomial Commitments API for EIP-4844, written in C. (With rust bindings)

### Type Aliases:

- `Hash`: An alias for B256, typically used to represent 256-bit hashes or integer values in Ethereum.

### Re-exported Types:

- `Address`: A type representing a 160-bit (or 20-byte) array, typically used for Ethereum addresses.
Expand All @@ -43,4 +37,4 @@ It is set up to be compatible with environments that do not include Rust's stand
- `HashMap` and `HashSet`: High-performance hash map and hash set data structures from the hashbrown crate.

Re-exported Modules:
All types, constants, and functions from the `bytecode`, `constants`, `env`, `log`, `precompile`, `result`, `specification`, `state`, `utilities`, `KzgSettings`, `EnvKzgSettings`, `trusted_setup_points` types and methods were all re-exported, allowing users to import these items directly from the `primitives` crate.
All types, constants, and functions from the `bytecode`, `constants`, `env`, `precompile`, `result`, `specification`, `state`, `utilities`, `KzgSettings`, `EnvKzgSettings`, `trusted_setup_points` types and methods were all re-exported, allowing users to import these items directly from the `primitives` crate.
2 changes: 2 additions & 0 deletions documentation/src/crates/primitives/log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Log

> NOTE: This module's types have been replaced by [`alloy_primitives`](https://github.com/alloy-rs/core)'s `Log` and `LogData`.
This piece of Rust code defines a structure called Log which represents an Ethereum log entry. These logs are integral parts of the Ethereum network and are typically produced by smart contracts during execution. Each Log has three components:

- `address`: This field represents the address of the log originator, typically the smart contract that generated the log. The `Address` data type signifies a 160-bit Ethereum address.
Expand Down

0 comments on commit 55c19ad

Please sign in to comment.