Skip to content

🔨 contracts: support hyperlane on redeployer#860

Open
itofarina wants to merge 9 commits intomainfrom
hyperlane
Open

🔨 contracts: support hyperlane on redeployer#860
itofarina wants to merge 9 commits intomainfrom
hyperlane

Conversation

@itofarina
Copy link
Copy Markdown
Member

@itofarina itofarina commented Mar 3, 2026

Summary by CodeRabbit

  • New Features

    • Deployable, upgradeable EXA routers with utilities to enroll remote routers and a timelock-backed flow for granting bridge roles.
  • Tests

    • New multi-chain integration tests for round-trip transfers, access-control failures, timelock scheduling, and updated gas snapshot baselines; one deployment test now expects zero token supply.
  • Chores

    • Added mailbox/exactly account mappings, updated dev dependencies and import remappings, and adjusted pnpm build settings.
  • Style/Docs

    • Extended spellings list and added a changelog entry.

Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 3, 2026

🦋 Changeset detected

Latest commit: 4bfb441

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 3, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Hyperlane/mailbox remappings and addresses, updates dev dependencies and pnpm config, refreshes gas snapshots, extends Redeployer with EXA/router deploy/upgrade plus timelock-based role scheduling, adds forked multi-chain HypEXA tests with revert coverage, tweaks a Redeployer test, plus small spellcheck/changeset edits.

Changes

Cohort / File(s) Summary
Gas snapshots
contracts/.gas-snapshot
Refreshed many gas values, added HypEXATest snapshots, and increased redeployer-related snapshot numbers.
Redeployer & scripts
contracts/script/Redeployer.s.sol
Extended deploy flow to call initialize2, added deployEXAImpl(), deployRouter(address), setupRouter(uint32), proposeBridgeRole(address,bytes32), timelock scheduling, router-existence checks, and errors AlreadyGranted / RouterNotDeployed.
New integration tests
contracts/test/HypEXA.t.sol
New forked HypEXATest covering multi-hop transfers, role-revert cases, router setup/propose timelock scheduling, and negative coverage for missing BRIDGE_ROLE.
Updated tests
contracts/test/Redeployer.t.sol
Adjusted test_deployEXA_deploysAtSameAddress_onBase to expect totalSupply() == 0 (removed prior minted supply/proxy-admin balance assertions).
Deployment metadata
contracts/deploy.json
Added accounts.exactly and accounts.mailbox chain-to-address mappings (chains: 10, 137, 8453 / 8453 per group).
Dependencies & remappings
contracts/package.json, contracts/remappings.txt, package.json
Pinned @exactly/protocol to a commit, added @hyperlane-xyz/core devDependency, added remappings for @exactly/protocol → OpenZeppelin and @hyperlane-xyz/, and changed pnpm to onlyBuiltDependencies: ["@exactly/protocol"].
Misc config
cspell.json, .changeset/beige-sails-worry.md
Added spellcheck words (hyperlane, XERC) and added an empty changeset file.

Sequence Diagram

sequenceDiagram
    autonumber
    participant User as "User (EOA)"
    participant Redeployer as "Redeployer script"
    participant ProxyAdmin as "ProxyAdmin"
    participant EXA as "EXA Proxy/Impl"
    participant Router as "Router (domain)"
    participant Timelock as "Timelock"
    participant Mailbox as "Hyperlane Mailbox"

    User->>Redeployer: deployEXA / deployRouter
    Redeployer->>ProxyAdmin: upgradeAndCall(EXA.initialize)
    ProxyAdmin->>EXA: call initialize()
    Redeployer->>ProxyAdmin: upgradeAndCall(EXA.initialize2(acct))
    ProxyAdmin->>EXA: call initialize2(acct)
    User->>Redeployer: proposeBridgeRole(token, salt)
    Redeployer->>Router: ensure deployed
    Redeployer->>Timelock: schedule(grantRole(BRIDGE_ROLE, router))
    Timelock-->>Redeployer: operation scheduled
    User->>Router: transferRemote(amount, remoteDomain, payload)
    Router->>Mailbox: sendMessage(payload)
    Mailbox->>Router: deliverMessage(payload) (remote)
    Router->>EXA: handle -> mint/credit or revert if no BRIDGE_ROLE
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • cruzdanilo
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Hyperlane support to the redeployer contract with new deployment and router management functions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hyperlane

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's interoperability by integrating Hyperlane, a cross-chain communication protocol. The changes enable the EXA token to be bridged and managed across different blockchain domains, expanding its utility and reach. This involved updating core dependencies, modifying deployment processes to include Hyperlane-specific components, and adding comprehensive tests to ensure the robustness of the new cross-chain capabilities.

Highlights

  • Hyperlane Integration: Integrated Hyperlane for cross-chain functionality, enabling the EXA token to be transferred and managed across multiple blockchain networks.
  • Deployment and Configuration Updates: Introduced new deployment scripts and configuration settings to facilitate the deployment and setup of Hyperlane routers and an Hyperlane-compatible EXA token.
  • New Cross-Chain Test Suite: Added a dedicated test suite to verify the end-to-end functionality of cross-chain EXA token transfers via Hyperlane, including round-trip scenarios and access control.
  • Dependency Management: Updated project dependencies to include the Hyperlane core library and adjusted existing dependency configurations for compatibility.
Changelog
  • contracts/.gas-snapshot
    • Updated gas consumption benchmarks for various ExaPluginTest and RedeployerTest functions.
  • contracts/deploy.json
    • Added Hyperlane mailbox addresses for Optimism (10), Polygon (137), and Base (8453) domains.
  • contracts/package.json
    • Updated the @exactly/protocol dependency to a specific commit hash.
    • Added the @hyperlane-xyz/core dependency for Hyperlane integration.
  • contracts/remappings.txt
    • Added a remapping for @exactly/protocol to @openzeppelin/contracts.
    • Configured a remapping for @hyperlane-xyz to its node_modules path.
  • contracts/script/Redeployer.s.sol
    • Imported HypERC20Collateral and HypXERC20 from the Hyperlane core library.
    • Modified deployEXA to include an initialize2 call for the EXA token.
    • Added deployEXAImpl to deploy the latest EXA implementation.
    • Implemented upgradeEXA to upgrade an existing EXA proxy.
    • Introduced deployRouter to deploy a HypXERC20 router for cross-chain transfers.
    • Added setupRouter to configure the Hyperlane router with remote domains and grant necessary roles.
  • contracts/test/HypEXA.t.sol
    • Added a new test file for HypEXA to validate cross-chain functionality.
    • Included tests for test_roundTrip_opToBaseToOp and test_roundTrip_opToPolygonToBaseToOp to verify token bridging.
    • Added tests to ensure transferRemote and handle revert without the BRIDGE_ROLE.
  • contracts/test/Redeployer.t.sol
    • Adjusted the assertion for totalSupply in test_deployEXA_deploysAtSameAddress_onBase to expect zero initial supply.
  • cspell.json
    • Added 'hyperlane' and 'XERC' to the spellcheck dictionary.
  • package.json
    • Changed neverBuiltDependencies to onlyBuiltDependencies for @exactly/protocol.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@cruzdanilo cruzdanilo changed the title Hyperlane 🔨 contracts: support hyperlane on redeployer Mar 3, 2026
@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 3, 2026

✅ All tests passed.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (3)
contracts/script/Redeployer.s.sol (3)

96-149: ⚠️ Potential issue | 🟠 Major

Run forge fmt on this file to unblock CI.

The pipeline is currently failing nx run @exactly/plugin:test:fmt due to formatting differences in this file.

As per coding guidelines **/*.sol: Follow Solhint rules strictly and use Forge fmt for code formatting.


113-121: ⚠️ Potential issue | 🟠 Major

Fail fast when EXA implementation is missing before upgradeEXA.

Line 120 upgrades to address(exa) without checking code presence, which defers failure to a less actionable downstream revert.

Proposed fix
 function upgradeEXA(address proxy) external {
   address admin = acct("admin");
+  if (address(exa).code.length == 0) revert EXAImplementationNotDeployed();
   ProxyAdmin p = ProxyAdmin(address(uint160(uint256(
       vm.load(proxy, bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1))
   ))));
   vm.broadcast(p.owner());
   p.upgradeAndCall(
     ITransparentUpgradeableProxy(proxy), address(exa), abi.encodeCall(EXA.initialize2, (admin))
   );
 }
@@
 error ProxyAdminNotDeployed();
 error TargetNonceTooLow();
+error EXAImplementationNotDeployed();

124-130: 🛠️ Refactor suggestion | 🟠 Major

Align CREATE3 salt derivation with token (or remove token from the API).

Line 129 hardcodes "HypEXA" even though the function accepts a token; that creates deterministic-slot collisions for multi-token use, and Line 145 resolves that same fixed slot.

Proposed refactor
 function deployRouter(address token) external returns (HypXERC20 router) {
@@
-        keccak256(abi.encode("HypEXA")),
+        keccak256(abi.encode("HypEXA", token)),
@@
 function setupRouter(address token, uint32 remoteDomain) external {
   address admin = acct("admin");
-  address router = CREATE3_FACTORY.getDeployed(admin, keccak256(abi.encode("HypEXA")));
+  address router = CREATE3_FACTORY.getDeployed(admin, keccak256(abi.encode("HypEXA", token)));

Also applies to: 145-145


ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between adceeef and 7727570.

📒 Files selected for processing (5)
  • .changeset/beige-sails-worry.md
  • contracts/.gas-snapshot
  • contracts/deploy.json
  • contracts/script/Redeployer.s.sol
  • contracts/test/HypEXA.t.sol

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (3)
contracts/script/Redeployer.s.sol (3)

121-127: 🛠️ Refactor suggestion | 🟠 Major

deployRouter ignores token in the deterministic salt, making reuse collision-prone.

The function accepts token but always uses the fixed "HypEXA" slot. Reusing it for another token collides on the same CREATE3 address.

Proposed refactor
-        keccak256(abi.encode("HypEXA")),
+        keccak256(abi.encode("HypEXA", token)),
@@
-    address router = CREATE3_FACTORY.getDeployed(admin, keccak256(abi.encode("HypEXA")));
+    address router = CREATE3_FACTORY.getDeployed(admin, keccak256(abi.encode("HypEXA", token)));

Also applies to: 142-142


140-146: ⚠️ Potential issue | 🟠 Major

setupRouter should fail fast if the deterministic router address is not deployed.

getDeployed can resolve an address before code exists. Without a code-length guard, role/config steps can silently target an undeployed address path.

Proposed fix
 function setupRouter(address token, uint32 remoteDomain) external {
   address admin = acct("admin");
   address router = CREATE3_FACTORY.getDeployed(admin, keccak256(abi.encode("HypEXA")));
+  if (router.code.length == 0) revert RouterNotDeployed();
   vm.startBroadcast(admin);
   EXA(token).grantRole(keccak256("BRIDGE_ROLE"), router);
   HypXERC20(router).enrollRemoteRouter(remoteDomain, bytes32(uint256(uint160(router))));
   vm.stopBroadcast();
 }
@@
 error TargetNonceTooLow();
+error RouterNotDeployed();

113-119: ⚠️ Potential issue | 🟠 Major

upgradeEXA should guard against missing EXA implementation deployment.

The upgrade path uses address(exa) directly; adding an explicit code-length guard gives a clearer, earlier failure mode.

Proposed fix
 function upgradeEXA(address proxy) external {
   address admin = acct("admin");
+  if (address(exa).code.length == 0) revert EXAImplementationNotDeployed();
   ProxyAdmin p =
     ProxyAdmin(address(uint160(uint256(vm.load(proxy, bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1))))));
   vm.broadcast(p.owner());
   p.upgradeAndCall(ITransparentUpgradeableProxy(proxy), address(exa), abi.encodeCall(EXA.initialize2, (admin)));
 }
@@
 error TargetNonceTooLow();
+error EXAImplementationNotDeployed();

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7727570 and c7187e5.

📒 Files selected for processing (5)
  • .changeset/beige-sails-worry.md
  • contracts/.gas-snapshot
  • contracts/deploy.json
  • contracts/script/Redeployer.s.sol
  • contracts/test/HypEXA.t.sol

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@itofarina itofarina marked this pull request as ready for review April 15, 2026 19:27
@itofarina itofarina requested a review from cruzdanilo as a code owner April 15, 2026 19:27
devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

Comment thread package.json
]
},
"neverBuiltDependencies": [],
"onlyBuiltDependencies": ["@exactly/protocol"],
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot Apr 15, 2026

Choose a reason for hiding this comment

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

🚩 onlyBuiltDependencies restricts install scripts to @exactly/protocol only

The change from "neverBuiltDependencies": [] (empty blocklist — all packages can run scripts) to "onlyBuiltDependencies": ["@exactly/protocol"] (allowlist — only @exactly/protocol runs scripts) is a significant behavioral shift. This blocks install/build scripts for ALL other dependencies including the newly added @hyperlane-xyz/core. This is likely intentional since @exactly/protocol changed from an npm published package (^0.2.22) to a git commit reference (exactly/protocol#5833408) that needs a build step, and @hyperlane-xyz/core is a Solidity library that typically doesn't need post-install scripts. However, if any future dependency requires build scripts, they would silently fail to run.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

1 similar comment
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@itofarina itofarina force-pushed the hyperlane branch 2 times, most recently from 476de3b to ac57e92 Compare April 24, 2026 01:20
chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
contracts/script/Redeployer.s.sol (1)

195-203: 🧹 Nitpick | 🔵 Trivial

deployEXA double upgradeAndCall works but is slightly wasteful.

The second upgradeAndCall at line 199–201 re-points the proxy to the same implementation just to invoke initialize2 via the privileged path. It is correct (initialize2 as reinitializer(2) runs cleanly after initialize() as initializer), but the upgrade step itself is redundant. An alternative is to call EXA(proxy).initialize2(acct("exactly")) directly from a non-admin EOA after the first upgrade — the transparent proxy will route it through the fallback to the implementation.

Not blocking; only flagging in case you prefer the cheaper path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6659ecaa-8dbf-4b6f-9d9e-f57252b80a7c

📥 Commits

Reviewing files that changed from the base of the PR and between 476de3b and 3cf9649.

📒 Files selected for processing (3)
  • contracts/.gas-snapshot
  • contracts/script/Redeployer.s.sol
  • contracts/test/HypEXA.t.sol

coderabbitai[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

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