PR: #41 (feat/executor: transaction builder + eth_call simulator)
File: crates/charon-executor/src/simulation.rs — simulate()
Refs #41
Problem
On revert, simulate() logs:
warn!(error = %msg, "eth_call simulation reverted — opportunity dropped");
Venus, Aave V3, and PancakeSwap V3 all use ABI-encoded 4-byte custom errors. The raw err from alloy's provider.call() returns an opaque hex blob. Operators will see WARN lines like "simulation reverted: 0x..." with no way to distinguish:
- Venus position no longer liquidatable (expected, discard)
- Aave flash loan paused (circuit breaker, alert)
- PancakeSwap insufficient output (slippage, adjust)
- onlyOwner firing (misconfigured sender, bug — must alert)
Fix
Extract and log the 4-byte selector from the revert data, and implement a lookup table for known selectors from Venus Comptroller, vToken, Aave V3 Pool, and PancakeSwap V3 Router. At minimum, log the hex selector so it can be cross-referenced against ABI files:
// Extract leading 4 bytes from revert data if present
if let Some(selector) = extract_4byte_selector(&msg) {
warn!(selector = %selector, error = %msg, "eth_call reverted");
} else {
warn!(error = %msg, "eth_call reverted");
}
PR: #41 (feat/executor: transaction builder + eth_call simulator)
File: crates/charon-executor/src/simulation.rs — simulate()
Refs #41
Problem
On revert, simulate() logs:
Venus, Aave V3, and PancakeSwap V3 all use ABI-encoded 4-byte custom errors. The raw err from alloy's provider.call() returns an opaque hex blob. Operators will see WARN lines like "simulation reverted: 0x..." with no way to distinguish:
Fix
Extract and log the 4-byte selector from the revert data, and implement a lookup table for known selectors from Venus Comptroller, vToken, Aave V3 Pool, and PancakeSwap V3 Router. At minimum, log the hex selector so it can be cross-referenced against ABI files: