mod geth;
mod parity;
mod state_diff;
#[cfg(test)]
mod test_helpers;
pub(crate) mod types;
mod utils;
pub(super) use geth::*;
pub(super) use parity::*;
pub(crate) use state_diff::build_state_diff;
use super::lookup_eth_address;
use super::types::EthAddress;
use anyhow::Context;
use fvm_ipld_blockstore::Blockstore;
use types::EthTrace;
use crate::shim::{address::Address, state_tree::StateTree};
#[derive(Default)]
pub(super) struct Environment {
pub(super) caller: EthAddress,
pub(super) is_evm: bool,
pub(super) subtrace_count: i64,
pub(super) traces: Vec<EthTrace>,
pub(super) last_byte_code: Option<EthAddress>,
}
pub(super) fn base_environment<BS: Blockstore + Send + Sync>(
state: &StateTree<BS>,
from: &Address,
) -> anyhow::Result<Environment> {
let sender = lookup_eth_address(from, state)?
.with_context(|| format!("top-level message sender {from} could not be found"))?;
Ok(Environment {
caller: sender,
..Environment::default()
})
}