Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native hooks in the mailbox #2381

Closed
nambrot opened this issue Jun 13, 2023 · 1 comment
Closed

Native hooks in the mailbox #2381

nambrot opened this issue Jun 13, 2023 · 1 comment
Assignees

Comments

@nambrot
Copy link
Contributor

nambrot commented Jun 13, 2023

Hooks were conceived to support the use of other verification mechanisms to secure a Hyperlane message. E.g. in #2316, a message can be verified via the native L1-L2 Optimism bridge. However to support that, currently, the message sender has to explicitly do so via a hook contract on the origin chain (that the ISM on the destination chain permissions as the sender via the other verification mechanism).

When discussing the hooks, we thought of pulling the hooks into the Mailbox itself. That would allow message senders to not need to make contract bytecode change to support the change of an ISM on the destination. We started with the prototype outside since it would require no upgrade of the Mailbox.

In addition to supporting more ISMs on the desination for a message, there are other potential applications of native hooks in the mailbox:

  • There is a 1-to-1 relationship between a Mailbox and Merkle tree at the moment. However, as we learned in Mailbox: Support VMs without keccak/ecrecover #2258, that relationship should probably be an n-to-m one. I.e. depending on the destination of the message, there may be 0-n merkle trees that are suitable. It seems plausible to move merkle tree enqueueing into a hook that senders can opt out of.
  • Relatedly message senders may want different semantics for committing to a message on the origin chain. Again, by default they may want rely on the "merkle-tree-enqueueing" default hook, but for destination chains that do not support the hashing function, it may be required to store the whole message in storage to support slashing
  • IGPs potentially can be expressed in a hook. That would allow senders to specify different IGPs without needing to make accommodations in the sending contract. It would allow warp route/router contracts to not need that functionality built-in (and thus could support warp route deployments without a IGP as a required input)

Questions:

  • Does the native hook interface look the same to the one that is external?
  • How to reconcile that different hooks may need additional/different metadata? (i.e. for IGP payments, would need to pass gasAmount and refund address)

Tasks

Preview Give feedback
No tasks being tracked yet.
aroralanuk added a commit that referenced this issue Jun 20, 2023
### Description

- Adds support for the native Optimism bridge (L1->L2) to send messageID
to be verified by the custom ISM on the rollup.
- Only the smart contract component.
- Outside Mailbox and needs to be called separately.
- Uses Openzeppelin's CrossChainEnabled pattern for ensuring the right
cross chain sender address.

### Drive-by changes

- None

### Related issues

- Fixes hyperlane-xyz/issues#379
- Opens #2409
- Related to
#2381

### Backward compatibility

- Needs modifying the relayer to read OptimismISM's storage to wait for
`receivedEmitters` mapping to get updated before retrying `process` on
the mailbox.

### Testing

- Unit Tests with Foundry forks and Optimism's L1-L2 messenger
contracts.

---------

Co-authored-by: Asa Oines <[email protected]>
@nambrot
Copy link
Contributor Author

nambrot commented Jul 3, 2023

How to reconcile that different hooks may need additional/different metadata?

One option would be to use L0's adapter params https://layerzero.gitbook.io/docs/evm-guides/advanced/relayer-adapter-parameters

Another option would be to try to move anything that can't be deduced into the hook itself (i.e. make the hook very sender-specific)

@yorhodes yorhodes self-assigned this Jul 26, 2023
@yorhodes yorhodes moved this to Sprint in Hyperlane Tasks Jul 27, 2023
@yorhodes yorhodes moved this from Sprint to In Progress in Hyperlane Tasks Jul 27, 2023
@yorhodes yorhodes moved this from In Progress to In Review in Hyperlane Tasks Aug 16, 2023
@yorhodes yorhodes moved this from In Review to Done in Hyperlane Tasks Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants