signet-sim
What’s in this crate?
- Bundle Simulation - Simulate bundle execution before submission
- State Transitions - Preview state changes from transactions
- Gas Estimation - Accurate gas usage predictions for Signet transactions
- Order Validation - Check if orders can be fulfilled given current state
- Failure Analysis - Detailed diagnostics when simulations fail
The simulation crate helps developers test their transactions and bundles before submitting them on-chain. This is especially useful for bundle builders who need to ensure their bundles will execute successfully.
Core Features
Pre-flight Checks: Validate that your bundle meets all requirements before spending gas on submission.
State Forking: Create a local fork of Signet state to test complex transaction sequences.
MEV Analysis: Simulate different ordering strategies to maximize bundle profitability.
Usage Example
1use signet_sim::{BundleSimulator, SimulationConfig};
2
3// Create a simulator
4let simulator = BundleSimulator::new(rpc_url)?;
5
6// Configure simulation parameters
7let config = SimulationConfig {
8 block_number: None, // Use latest
9 timestamp: None, // Use current
10 base_fee: None, // Use current
11};
12
13// Simulate your bundle
14let result = simulator.simulate_bundle(&bundle, config).await?;
15
16match result {
17 SimulationResult::Success(receipt) => {
18 println!("Bundle will succeed, gas used: {}", receipt.gas_used);
19 }
20 SimulationResult::Failure(reason) => {
21 println!("Bundle will fail: {}", reason);
22 }
23}
Perfect for builders who want confidence their bundles will land successfully.