Skip to content

Conversation

@tejasbadadare
Copy link
Contributor

@tejasbadadare tejasbadadare commented Jul 15, 2025

Summary

Fix a bug preventing contract reverts during simulation from being captured correctly.

Rationale

client.fill_transaction does a couple things including estimating gas usage and fetching the current gas price. If the contract reverts during the estimating gas phase via simulation, the code expects the error to be propagated as a GasUsageEstimateError(ContractError::Revert(bytes)). However, the error handler for the client.fill_transaction call wraps the error in a GasPriceEstimateError, which prevents the calling code from handling the contract revert properly. We can see this happening in the logs, example:

Failed to process event: Gas price estimate error: (code: 3, message: execution reverted, data: Some(String(\"0xc4237352\")))

This causes the wrong reason to get stored in the DB. Instead of storing Reverted: <bytes>, it stores Unable to estimate gas price, and it prevents retry functionality from working as intended.

This PR wraps the revert data in a GasUsageEstimateError as expected if there is revert data in the error. Else, we assume it's a gas price polling error.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:17pm

@tejasbadadare tejasbadadare changed the title Tb/fortuna/propagate simulation contract err fix(fortuna): correctly propagate contract reverts in simulation Jul 15, 2025
@tejasbadadare tejasbadadare merged commit b508485 into main Jul 15, 2025
11 checks passed
@tejasbadadare tejasbadadare deleted the tb/fortuna/propagate-simulation-contract-err branch July 15, 2025 21:50
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.

2 participants