Skip to content

Fix dispatchSuccess initialization in Gateway.v2_submit#1685

Merged
yrong merged 2 commits intoron/multi-contract-callsfrom
copilot/sub-pr-1676
Jan 26, 2026
Merged

Fix dispatchSuccess initialization in Gateway.v2_submit#1685
yrong merged 2 commits intoron/multi-contract-callsfrom
copilot/sub-pr-1676

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

Addresses review feedback on the dispatchSuccess flag initialization in the v2_submit function. When v2_dispatch fails with an error that's caught but not rethrown (e.g., unexpected revert data, out-of-gas), the emitted event must reflect the failure.

Changes

  • Initialize dispatchSuccess to false instead of true in Gateway.v2_submit

Technical Details

The try-catch block in v2_submit selectively rethrows only AtomicCommandFailed and InsufficientGasLimit errors. Other failures are silently caught:

// Before: dispatchSuccess defaults to true, incorrectly reports success on silent failures
bool dispatchSuccess = true;
try Gateway(this).v2_dispatch(message) returns (bool success) {
    dispatchSuccess = success;
} catch (bytes memory reason) {
    // Only rethrow specific errors
    if (reason.length >= 4 && (bytes4(reason) == AtomicCommandFailed.selector || ...)) {
        assembly { revert(add(reason, 32), mload(reason)) }
    }
    // Silent catch: dispatchSuccess remains true ❌
}

// After: dispatchSuccess defaults to false, correctly reports failure
bool dispatchSuccess = false;  // Remains false if catch path executes without rethrowing

This ensures InboundMessageDispatched events accurately reflect dispatch outcomes in all error scenarios.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: yrong <4383920+yrong@users.noreply.github.com>
@yrong yrong marked this pull request as ready for review January 26, 2026 12:54
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • foundry.paradigm.xyz
    • Triggering command: /usr/bin/curl curl -L REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@yrong yrong merged commit 71939ab into ron/multi-contract-calls Jan 26, 2026
2 checks passed
Copilot AI changed the title [WIP] Address feedback on multiple contract calls implementation Fix dispatchSuccess initialization in Gateway.v2_submit Jan 26, 2026
@yrong yrong deleted the copilot/sub-pr-1676 branch January 26, 2026 12:54
@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.04%. Comparing base (f418da7) to head (99dfacd).
⚠️ Report is 1 commits behind head on ron/multi-contract-calls.

Additional details and impacted files
@@                    Coverage Diff                    @@
##           ron/multi-contract-calls    #1685   +/-   ##
=========================================================
  Coverage                     81.04%   81.04%           
=========================================================
  Files                            22       22           
  Lines                          1029     1029           
  Branches                        191      191           
=========================================================
  Hits                            834      834           
  Misses                          178      178           
  Partials                         17       17           
Flag Coverage Δ
solidity 81.04% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI requested a review from yrong January 26, 2026 12:54
Copilot stopped work on behalf of yrong due to an error January 26, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants