Skip to content

fix: avoid invalid gas estimation for dependent bundle steps - #101

Merged
mikaelbjorn merged 1 commit into
mainfrom
fix/sequential-bundle-gas-estimation
Aug 21, 2026
Merged

fix: avoid invalid gas estimation for dependent bundle steps#101
mikaelbjorn merged 1 commit into
mainfrom
fix/sequential-bundle-gas-estimation

Conversation

@mikaelbjorn

Copy link
Copy Markdown
Contributor

Problem

Multi-step execution bundles were estimating gas for every step independently against the current chain state.

For sequential bundles such as:

  1. Approve tokenIn for PanoramaExecutor
  2. Execute swap through PanoramaExecutor

the second transaction depends on state created by the first transaction. Estimating the swap before the approval has executed can therefore revert even though the complete bundle is valid when executed sequentially.

This was observed on the Avalanche TraderJoe swap flow as TransferFromFailed (0x7939f424) during bundle preparation.

Fix

Gas estimation now respects sequential bundle dependencies:

  • Single-step bundles continue to be estimated normally.
  • For multi-step bundles, the first independent step is estimated.
  • Subsequent state-dependent steps are returned without a gas estimate and left for execution-time handling.
  • Failure to estimate the first step does not prevent the bundle from being returned.

Verification

Full backend test suite:

  • 10 test files passed
  • 190 tests passed

Live local Avalanche preparation test:

  • execution service health: HTTP 200
  • approval step generated with gas estimate
  • TraderJoe swap step generated successfully
  • state-dependent swap gas estimation skipped
  • no TransferFromFailed / 0x7939f424 during preparation

This preserves gas estimation where it is valid while preventing preparation from failing on transactions whose preconditions are established by earlier bundle steps.

@mikaelbjorn
mikaelbjorn merged commit 1259efe into main Aug 21, 2026
1 check passed
@mikaelbjorn
mikaelbjorn deleted the fix/sequential-bundle-gas-estimation branch August 21, 2026 18:07
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