Summary
Add support for eth_call state overrides, allowing users to simulate transactions against modified blockchain state without forking a node.
Motivation
Searchers need to simulate "what if" scenarios: what if this token balance was X? What if this pool had Y liquidity? State overrides let you answer these questions with a single RPC call instead of running a local fork.
This is critical for:
- Simulating sandwich attacks with modified token balances
- Testing liquidation scenarios with modified collateral ratios
- Evaluating arb profitability under different pool states
Proposed API
const eth = @import("eth");
// Override state for a specific contract
var overrides = eth.provider.StateOverrides.init(allocator);
defer overrides.deinit();
try overrides.setBalance(target_address, new_balance);
try overrides.setStorageAt(pool_address, slot, new_value);
try overrides.setCode(contract_address, new_bytecode);
const result = try provider.call(.{
.to = target,
.data = calldata,
}, .{ .state_overrides = &overrides });
Implementation Notes
References
Summary
Add support for
eth_callstate overrides, allowing users to simulate transactions against modified blockchain state without forking a node.Motivation
Searchers need to simulate "what if" scenarios: what if this token balance was X? What if this pool had Y liquidity? State overrides let you answer these questions with a single RPC call instead of running a local fork.
This is critical for:
Proposed API
Implementation Notes
stateOverrideparameter ineth_call(Geth docs)balance,nonce,code,state(full storage),stateDiff(partial storage)eth_call(Deprecated allocator initialization + tests fix LLVM crash by AI #10)References