Skip to content
Draft
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
94 changes: 81 additions & 13 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const_format = "=0.2.35"
const-hex = "=1.19.0"
derive_more = "=2.0.1"
derive-new = "=0.7.0"
foldhash = "=0.2.0"
hash_hasher = "=2.0.4"
hex_fmt = "=0.3.0"
hex-literal = "=1.1.0"
Expand All @@ -36,7 +37,7 @@ rustc-hash = "=2.1.1"
smallvec = "=1.15.1"
static_assertions = "=1.1.0"
strum = { version = "=0.27.2", features = ["derive"] }
quick_cache = "=0.6.22"
TinyUFO = "=0.8.1"
sugars = "=3.0.1"
thiserror = "=2.0.18"
uuid = { version = "=1.23.3", features = ["v7"]}
Expand Down
10 changes: 5 additions & 5 deletions src/eth/executor/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Evm<TransactionExecutionInput> {
.into();

// CREATE transactions need to be traced for blockscout to work correctly
if tx.result.deployed_contract_address.is_none() && trace_unsuccessful_only && matches!(tx.result.result, ExecutionResult::Success) {
if tx.output.deployed_contract_address.is_none() && trace_unsuccessful_only && matches!(tx.output.result, ExecutionResult::Success) {
return Ok(default_trace(tracer_type, tx));
}

Expand All @@ -137,10 +137,10 @@ impl Evm<TransactionExecutionInput> {
.journaled_state
.database
.storage
.read_block(BlockFilter::Number(tx.evm_input.block_number))?
.read_block(BlockFilter::Number(tx.input.block_number))?
.ok_or_else(|| {
StratusError::Storage(StorageError::BlockNotFound {
filter: BlockFilter::Number(tx.evm_input.block_number),
filter: BlockFilter::Number(tx.input.block_number),
})
})?;

Expand All @@ -152,7 +152,7 @@ impl Evm<TransactionExecutionInput> {
block_number: Some(block.number().as_u64()),
base_fee: None,
};
let inspect_input: TransactionExecutionInput = tx.evm_input;
let inspect_input: TransactionExecutionInput = tx.input;
let target = inspect_input.block_number.prev().unwrap_or_default();
self.evm.journaled_state.database.reset(ExecutionKind::CallPast(target));

Expand All @@ -166,7 +166,7 @@ impl Evm<TransactionExecutionInput> {
if tx.info.hash == tx_hash {
break;
}
let tx_input: TransactionExecutionInput = tx.execution.evm_input;
let tx_input: TransactionExecutionInput = tx.execution.input;

// Configure EVM state
evm.fill_env(tx_input);
Expand Down
11 changes: 11 additions & 0 deletions src/eth/executor/evm/session.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::Arc;

use alloy_primitives::Uint;
use anyhow::anyhow;
use revm::Database;
use revm::DatabaseRef;
Expand Down Expand Up @@ -73,13 +74,23 @@ impl DatabaseRef for RevmSession {
fn basic_ref(&self, address: revm::primitives::Address) -> Result<Option<AccountInfo>, Self::Error> {
// retrieve account
let address: Address = address.into();

if address.is_ignored() {
return Ok(None);
}

let account = self.storage.read_account(address, self.kind)?;
Ok(Some(account.into()))
}

fn storage_ref(&self, address: revm::primitives::Address, index: U256) -> Result<U256, Self::Error> {
// convert slot
let address: Address = address.into();

if address.is_ignored() {
return Ok(Uint::default());
}

let index: SlotIndex = index.into();

// load slot from storage
Expand Down
15 changes: 0 additions & 15 deletions src/eth/executor/evm/types/input/call_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ use crate::eth::executor::evm::types::EvmInput;
use crate::eth::executor::evm::types::GAS_MAX_LIMIT;
use crate::eth::executor::evm::types::GeneralRevm;
use crate::eth::storage::ExecutionKind;
use crate::eth::storage::TxCount;
use crate::eth::types::Address;
use crate::eth::types::Block;
use crate::eth::types::BlockNumber;
use crate::eth::types::Bytes;
use crate::eth::types::CallInput;
use crate::eth::types::PendingBlockHeader;
use crate::eth::types::PointInTime;
use crate::eth::types::StratusError;
use crate::eth::types::UnixTime;
Expand Down Expand Up @@ -64,19 +62,6 @@ pub struct CallExecutionInput {
}

impl CallExecutionInput {
/// Creates from a call that was sent directly to Stratus with `eth_call` or `eth_estimateGas` for a pending block.
pub fn from_pending_block(input: CallInput, pending_header: PendingBlockHeader, tx_count: TxCount) -> Self {
Self {
from: input.from.unwrap_or(Address::ZERO),
to: input.to.map_into(),
value: input.value,
data: input.data,
block_number: pending_header.number,
block_timestamp: *pending_header.timestamp,
kind: ExecutionKind::CallPending(pending_header.number, tx_count),
}
}

/// Creates from a call that was sent directly to Stratus with `eth_call` or `eth_estimateGas` for a mined block.
pub fn try_from_mined_block(input: CallInput, block: Block, point_in_time: PointInTime) -> anyhow::Result<Self, StratusError> {
let kind = match point_in_time {
Expand Down
1 change: 1 addition & 0 deletions src/eth/executor/evm/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub use input::transaction_execution::TransactionExecutionInput;
pub use output::access_list::AccessListOutput;
pub use output::call_execution::CallExecutionOutput;
pub use output::transaction_execution::TransactionExecutionOutput;
pub use output::transaction_execution::TransactionExecutionResult;

/// Maximum gas limit allowed for a transaction. Prevents a transaction from consuming too many resources.
#[cfg(feature = "dev")]
Expand Down
4 changes: 4 additions & 0 deletions src/eth/executor/evm/types/output/call_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ pub struct CallExecutionOutput {
}

impl CallExecutionOutput {
pub fn is_success(&self) -> bool {
self.success
}

fn parse_revm_result(result: RevmExecutionResult) -> (Bytes, Gas, bool) {
match result {
RevmExecutionResult::Success { output, gas, .. } => {
Expand Down
Loading
Loading