Skip to content

Spencer's suggestions - #1

Merged
jtriley2p merged 5 commits into
mainfrom
spengrah/suggestions
Aug 18, 2026
Merged

Spencer's suggestions#1
jtriley2p merged 5 commits into
mainfrom
spengrah/suggestions

Conversation

@spengrah

@spengrah spengrah commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

This PR contains the changes we agreed on in discussion. Each commit is a single change. Commits 1 and 2 apply independently on top of main; 3-5 apply sequentially.

Changes/Commits

  1. 0a56099 — payable sendMultichainActions allows ETH to enter the sender hub so that it can forward value to bridge calls.
  2. b944347 — native calldata slices in place of custom assembly in CalldataHandler.
  3. cd61654 — moves shared decoder errors into IDecoder, and module errors into respective module directories.
  4. f8e69a7 — adds receiverHub as an encode arg to avoid the encoder callback to the sender hub, and returns Call[] from IEncoder.encode — the existing Call type, whose shape already matches what the hub needs. The array return is a prerequisite for bridge aggregation if we want it later.
  5. 2cb85be — in the same modularity spirit as (3), splits and moves IBridgeCalls into each module's respective directory. Together, these make it so that new modules don't change any common files.

Not in this PR

  • As discussed, I've moved per-chain dispatch isolation to research/per-chain-dispatch for further exploration.
  • I've also moved a suggestion to emit the prior value in registry setter events (SetEncoder, SetReceiverHub, DecoderRegistered) to spengrah/setter-event-prior-values, pending further discussion.
  • I've removed the ReceiverHub codeless-target check, as discussed, for simplicity.

The hub forwards value on each bridge call, but no function could bring ETH in, so every value-bearing dispatch reverts. Payable lets a dispatch carry ETH.
@spengrah
spengrah force-pushed the spengrah/suggestions branch from f6df53b to 36b3b0e Compare August 17, 2026 19:45
I believe calldata slices are slightly more efficient here, since they keep everything in calldata without needing to copy to memory. That does require that module implementations store the result as calldata rather than memory to get the efficiency advantage.
The shared decoder errors are really part of the decoder protocol, so it's reasonable for them to be declared by the IDecoder interface. Moving them there, and then moving WormholeError into the modules/wormhole directory, also gives us slightly better operational modularity, since adding a new module no longer involves changing a protocol-level file.
Encoders that address a receiver (Fx, Inbox, Portal2) no longer need to call back into SenderHub. Instead, the hub passes receiverHubs[chainId] as an argument, which lets us avoid the staticcall back to SenderHub and the modules' dependency on ISenderHub. Encoders like Wormhole that don't need that value can ignore it.

`encode` now returns an array of `Call`s — the existing type, whose shape already matches what the hub needs — and the hub loops over it. This creates the possibility for a future composite encoder that creates encodings for multiple bridges to the same target chain, enabling multi-bridge sending if we ever decide we need bridge aggregation.
In the spirit of modularity, this moves the module-related selector definitions into the respective src/modules/{module} directories so that adding a new module doesn't involve changing a protocol-level file.

One downside of moving away from a single file with all selectors is that checking for collisions involves looking at multiple files. One way we could mitigate that is with a deploy-time script that checks a module against already-deployed modules, and/or a test that checks against other modules in the repo.
@spengrah
spengrah force-pushed the spengrah/suggestions branch from 005c731 to 2cb85be Compare August 18, 2026 19:40
@spengrah
spengrah marked this pull request as ready for review August 18, 2026 19:55
@spengrah
spengrah requested a review from jtriley2p August 18, 2026 19:55

@jtriley2p jtriley2p left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, shipping it 🫡

@jtriley2p
jtriley2p merged commit 5723fa4 into main Aug 18, 2026
5 checks passed
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