Skip to content

feat: add configurable flashbots simulation endpoint#225

Open
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1437-flashbots-sim-endpoint
Open

feat: add configurable flashbots simulation endpoint#225
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1437-flashbots-sim-endpoint

Conversation

@init4samwise
Copy link
Contributor

Summary

Add configuration option for an alternative Flashbots simulation endpoint. When FLASHBOTS_SIMULATION_ENDPOINT is configured, bundles are simulated against that endpoint before submission. Otherwise, it defaults to using the standard FLASHBOTS_ENDPOINT.

Changes

config.rs

  • Add flashbots_simulation_endpoint optional field to BuilderConfig
  • Add connect_flashbots_simulation() method to create an optional dedicated simulation provider

flashbots.rs

  • Add flashbots_simulation: Option<FlashbotsProvider> field to FlashbotsTask
  • Update new() to load the simulation endpoint configuration
  • Add simulate_bundle() method that:
    • Uses the dedicated simulation provider when configured
    • Falls back to the default flashbots provider when not configured
    • Uses eth_callBundle API for simulation
    • Logs simulation results (gas price, gas used, coinbase diff)
  • Update task_future() to call simulation before submission
    • Simulation failures are logged but do not block bundle submission
  • Add metrics counters:
    • signet.builder.flashbots.simulation_attempts
    • signet.builder.flashbots.simulation_success
    • signet.builder.flashbots.simulation_failures

README.md

  • Document new FLASHBOTS_SIMULATION_ENDPOINT environment variable

Testing

  • cargo fmt
  • Implementation follows existing patterns in the codebase
  • Maintains backward compatibility - no changes to existing behavior when env var is not set

Notes

This enables using a dedicated simulation endpoint (e.g., for testing or using a faster simulation service) while keeping the submission endpoint separate.

Closes ENG-1437

Add FLASHBOTS_SIMULATION_ENDPOINT config option for alternative bundle
simulation. When configured, bundles are simulated against this endpoint
instead of the default FLASHBOTS_ENDPOINT. Falls back to default when
not set.

Changes:
- Add flashbots_simulation_endpoint field to BuilderConfig (config.rs)
- Add connect_flashbots_simulation() method to create provider
- Add flashbots_simulation field to FlashbotsTask (flashbots.rs)
- Add simulate_bundle() method using eth_callBundle API
- Simulation failures are logged but don't block submission
- Add metrics: simulation_attempts, simulation_success, simulation_failures
- Update README with new environment variable documentation

Closes ENG-1437
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.

1 participant