Record all gateways in ERC7786OpenBridge outbox#252
Conversation
Fill the outbox with an entry for every gateway (including those that return a zero id) instead of leaving gaps, so OutboxDetails and the derived sendId reflect the complete set of gateways the message was posted to.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Walkthrough
ChangesOpenBridge outbox tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/crosschain/ERC7786OpenBridge.test.js`:
- Around line 175-176: Await both state-changing setSendId calls in the test
setup before invoking sendMessage, ensuring the gateway-ID configuration
transactions for this.protocoles[0] and this.protocoles[2] are mined and
observable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 77cae731-36f9-4420-bc8a-cc5cc8ef4b26
📒 Files selected for processing (3)
contracts/crosschain/ERC7786OpenBridge.solcontracts/mocks/crosschain/ERC7786GatewayMock.soltest/crosschain/ERC7786OpenBridge.test.js
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Inspired by https://audits.openzeppelin.com/openzeppelin-solidity/project/openzeppelin-community-contracts/e2bb51d8-df7a-4d26-934a-be65c637d4e5/issue/sendid-and-outboxdetails-omit-gateways-that-return-bytes32-0
Summary
In
ERC7786OpenBridge.sendMessage, theoutboxis now populated with an entry for every gateway the message is posted to, instead of only the gateways that return a non-zero id.Previously, a gateway returning a zero id left its outbox slot as the default
Outbox(address(0), 0), producing gaps in the array emitted viaOutboxDetailsand hashed intosendId. Now each slot holdsOutbox(gateway, id)regardless of the returned id, soOutboxDetailsand the derivedsendIdfaithfully reflect the complete set of gateways.needsIdis unchanged in meaning: asendIdis still only computed/emitted when at least one gateway returns a non-zero id.Tests
ERC7786GatewayMockdirectly (synchronous delivery), removing the Axelar dependency from these tests.ERC7786GatewayMockgains a configurablesendId(setSendId, default0) so the non-zero-id path can be exercised.outbox trackingtests:OutboxDetailsto be emitted with an outbox listing every gateway (including zero-id ones with their address), and a matchingsendId;OutboxDetailsis not emitted andsendIdstays zero.All tests pass; prettier / eslint / solhint clean.
Summary by CodeRabbit
Bug Fixes
Tests