forest/rpc/methods/eth/trace/
mod.rs1mod geth;
15mod parity;
16mod state_diff;
17#[cfg(test)]
18mod test_helpers;
19pub(crate) mod types;
20mod utils;
21
22pub(super) use geth::*;
23pub(super) use parity::*;
24pub(crate) use state_diff::build_state_diff;
25
26use super::lookup_eth_address;
27use super::types::EthAddress;
28use anyhow::Context;
29use fvm_ipld_blockstore::Blockstore;
30use types::EthTrace;
31
32use crate::shim::{address::Address, state_tree::StateTree};
33
34#[derive(Default)]
39pub(super) struct Environment {
40 pub(super) caller: EthAddress,
41 pub(super) is_evm: bool,
42 pub(super) subtrace_count: i64,
43 pub(super) traces: Vec<EthTrace>,
44 pub(super) last_byte_code: Option<EthAddress>,
45}
46
47pub(super) fn base_environment<BS: Blockstore + Send + Sync>(
48 state: &StateTree<BS>,
49 from: &Address,
50) -> anyhow::Result<Environment> {
51 let sender = lookup_eth_address(from, state)?
52 .with_context(|| format!("top-level message sender {from} could not be found"))?;
53 Ok(Environment {
54 caller: sender,
55 ..Environment::default()
56 })
57}