Merged
Conversation
Add the ability to run backtests for a specific transaction by passing its hash. This is useful for debugging specific transactions or testing assertions against known exploit transactions. Changes: - Add transactionHash field to BacktestingConfig struct - Add executeBacktestForTransaction() convenience function - Add internal helpers to fetch and parse transaction by hash via RPC - Update existing tests to include new field - Add example tests demonstrating the new feature Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When an assertion fails during backtesting, the transaction is now re-executed without try/catch so Foundry prints the full execution trace. This helps users debug why their assertions failed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove assertion setup from trace replay - just fork at the tx hash (state before tx) and make the raw call. This lets Foundry show the actual execution trace without any wrapper interference. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove verbose separators and banners - Simplify single line status messages - Add clear ">>> TRANSACTION TRACE BELOW <<<" marker - Remove redundant _printSingleTransactionResults function - Keep trace replay minimal - just the call Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The decodeRevertReason function now handles: - Panic(uint256) errors with human-readable panic code descriptions - Error(string) standard revert messages - Custom errors (shows selector hex) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Return empty array instead of reverting when no transactions found. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevents StringsInvalidChar error when parsing transaction count. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d8abf4a to
3b08642
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove transactionHash from BacktestingConfig struct to maintain backward compatibility with existing projects. Single transaction backtesting is now only available via the executeBacktestForTransaction() function. API: - executeBacktest(config) - for block range backtesting (unchanged) - executeBacktestForTransaction(txHash, ...) - for single transaction Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add comprehensive NatSpec documentation to all source files - Add @title, @author, @notice, @dev, @param, @return tags - Add code examples in contract-level documentation - Configure forge doc with proper title and repository URL - Add GitHub Pages workflow for automatic documentation deployment - Documentation will be available at the repo's GitHub Pages URL Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Reorganize documentation structure for clarity - Add documentation link to GitHub Pages - Update Quick Start with simpler examples - Add PhEvm cheatcodes reference table - Add trigger types documentation - Update backtesting section with new APIs: - executeBacktestForTransaction() for single tx mode - Updated BacktestingConfig struct (no transactionHash field) - Trace replay feature documentation - Result categorization explanation - Add StateChanges helper documentation - Update resource links Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
czepluch
previously approved these changes
Jan 22, 2026
Contributor
czepluch
left a comment
There was a problem hiding this comment.
lgtm, did you have time to try it out yet? I can give it a shot a bit later or tomorrow if not
Add automatic path detection for transaction_fetcher.sh using find command as fallback when standard paths fail. This removes the need to manually set CREDIBLE_STD_PATH in most cases. - Add more standard search paths (Soldeer, git submodules, monorepo) - Add _autoDetectScriptPath() that uses find to locate the script - Cache results to avoid repeated filesystem lookups Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove useTraceFilter option - trace detection is now automatic. The system tries trace_filter first, then falls back to debug_traceBlockByNumber, debug_traceTransaction, and finally direct-calls-only if no trace APIs are supported. - Remove useTraceFilter from BacktestingConfig struct - Always enable trace detection in _fetchTransactions() - Improve logging to show which detection method is used - Add warnings when falling back to direct-calls-only mode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use "|| status=$?" pattern to capture exit codes without triggering set -e exit, allowing the fallback chain to work properly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Track version history following Keep a Changelog format. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add 18 unit tests for BacktestingUtils parsing functions - Fix broken integration tests (remove useTraceFilter field) - Unit tests run in CI without RPC access - Integration tests skip gracefully when RPC not available Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tests for all precompile addresses to prevent accidental changes - Add tests for mapping slot calculation (used in StateChanges) - 7 new unit tests that run without external dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds single transaction backtesting and automatic internal call detection to the backtesting framework.
New Features
executeBacktestForTransaction()trace_filter(fastest, requires Erigon/archive node)debug_traceBlockByNumber(slower but widely supported)debug_traceTransaction(slowest, per-transaction)CREDIBLE_STD_PATH- the script path is automatically discoveredAPI Changes
Removed:
useTraceFilterfromBacktestingConfig- trace detection is now automatic with fallback.Example Output
Bug Fixes
set -eblocking trace method fallbackTest Plan
🤖 Generated with Claude Code