Summary
Currently users must manually extract and compare values from SimulatedTx:
let sim = env.simulate(|| client.call());
assert!(sim.fee() < 5000, "fee too high: {}", sim.fee());
assert!(sim.instructions() < 1_000_000, "too many instructions: {}", sim.instructions());
This is verbose and produces unhelpful panic messages. We should add fluent assertion methods directly on SimulatedTx<T>.
Proposed API
env.simulate(|| client.call())
.assert_fee_below(5_000) // fails with detailed message if fee >= 5000
.assert_instructions_below(1_000_000) // fails with detailed message if instructions >= threshold
.commit();
Implementation Notes
- Methods should be chainable (return
&Self or Self)
- Panic messages must include actual vs expected values
- Add corresponding
assert_fee_above() / assert_instructions_above() for regression lower-bounds
Acceptance Criteria
Summary
Currently users must manually extract and compare values from
SimulatedTx:This is verbose and produces unhelpful panic messages. We should add fluent assertion methods directly on
SimulatedTx<T>.Proposed API
Implementation Notes
&SelforSelf)assert_fee_above()/assert_instructions_above()for regression lower-boundsAcceptance Criteria
SimulatedTx.commit()examples/