Skip to content

Implement chain simulation for evm balance changes#600

Open
0xh3rman wants to merge 3 commits into
mainfrom
evm-balance-simulation
Open

Implement chain simulation for evm balance changes#600
0xh3rman wants to merge 3 commits into
mainfrom
evm-balance-simulation

Conversation

@0xh3rman

@0xh3rman 0xh3rman commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #589

Simulator Screenshot - iPhone 17 Pro - 2026-07-02 at 18 24 07 Simulator Screenshot - iPhone 17 Pro - 2026-07-02 at 19 45 34

Comment thread core/crates/gem_evm/src/provider/simulation_mapper.rs Outdated
Comment thread core/crates/gem_evm/src/jsonrpc.rs
@0xh3rman 0xh3rman force-pushed the evm-balance-simulation branch from 63cbe22 to 0ffc733 Compare July 2, 2026 08:39
@0xh3rman 0xh3rman force-pushed the evm-balance-simulation branch from a3789de to ed35f59 Compare July 2, 2026 10:36
@0xh3rman 0xh3rman self-assigned this Jul 2, 2026
let signer = transaction.from.as_deref().unwrap_or_default();

let trace = self.trace_call(&transaction).await?;
let mut result = map_simulation_result(self.get_chain(), signer, &trace);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid mut?

impl<C: Client + Clone> ChainSimulation for EthereumClient<C> {
async fn simulate_transaction(&self, input: SimulationInput) -> Result<SimulationResult, Box<dyn Error + Send + Sync>> {
let transaction: TransactionObject = serde_json::from_str(&input.encoded_transaction)?;
let signer = transaction.from.as_deref().unwrap_or_default();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not do .unwrap_or_default();

}
}

pub fn map_balance_change_asset(mut change: SimulationBalanceChange, asset: Asset) -> SimulationBalanceChange {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid mut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate EVM simulation

2 participants