Skip to content

Conversation

@Ubuntu-Buddha
Copy link

Summary

Fixes forge verify-bytecode hanging indefinitely during runtime verification when RPCs are slow or don't support historical state queries.

Root cause: The fork provider wasn't using the eth_rpc_timeout from foundry.toml, and the default 8 retries at 45s each meant a single failing RPC call could take 6+ minutes.

Changes:

  • Add fork_timeout field to EvmOpts to pass config timeout to fork provider
  • Set fork_retries = 2 for verify-bytecode to fail fast on unresponsive RPCs
  • Add 300s overall timeout as a failsafe
  • Add trace logging at key points to help identify hang locations

Related Issue

Fixes #13184

Test Plan

  • cargo check -p forge-verify -p foundry-evm-core passes
  • No linter errors introduced
  • Manual test: Run forge verify-bytecode against a CREATE2 contract with slow RPC - should timeout instead of hanging indefinitely
  • Users can now configure eth_rpc_timeout in foundry.toml to adjust the timeout

The runtime verification phase of `forge verify-bytecode` could hang
indefinitely when RPCs are slow or don't support historical state queries.

Root cause: The fork provider was not using the `eth_rpc_timeout` from
foundry.toml, and the default 8 retries meant a failing request could
take 6+ minutes before timing out.

Changes:
- Add `fork_timeout` field to EvmOpts
- Pass config timeout to fork provider in verify-bytecode
- Limit retries to 2 for faster failure on unresponsive RPCs
- Add 300s overall timeout as failsafe
- Add trace logging to help identify hang points

Fixes foundry-rs#13184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

forge verify-bytecode hangs on runtime code match for contract deployed with CREATE2

1 participant