fix(infra): add aleo-sdk to service Dockerfiles and update post-bundle scripts#7730
fix(infra): add aleo-sdk to service Dockerfiles and update post-bundle scripts#7730paulbalaji merged 1 commit intomainfrom
Conversation
…e scripts - Add aleo-sdk package.json and source copy to ccip-server, rebalancer, and warp-monitor Dockerfiles - Update rebalancer and warp-monitor ncc.post-bundle.mjs with WASM init patching from CLI The deploy-sdk now depends on aleo-sdk after #7522, which broke Docker builds for services that depend on deploy-sdk.
|
♻️ Rebalancer Docker Image Built SuccessfullyImage Tags: |
🕵️ Warp Monitor Docker Image Built SuccessfullyImage Tags: |
🐳 Monorepo Docker Image Built SuccessfullyImage Tags: |
🔍 CCIP Server Docker Image Built SuccessfullyImage Tags: |
📝 WalkthroughWalkthroughThis PR weaves the aleo-sdk package into the Docker build pipelines for three TypeScript services (ccip-server, rebalancer, and warp-monitor) by adding it to their Dockerfile copy steps. Additionally, the post-bundle patching scripts for rebalancer and warp-monitor get refactored with improved constants and a renamed patching function that handles WASM and Worker URL initialization using file:// protocol paths. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
typescript/warp-monitor/scripts/ncc.post-bundle.mjs (2)
35-45: Consider validating that patches actually matched.The WASM and Worker patching logic looks correct, but there's no feedback if the regex/replacement didn't find anything. In a bundled environment this is probably fine since the patterns are predictable, but logging what was actually patched would make debugging easier if the bundle structure changes.
Optional: Add logging for patch results
// Patch WASM init to use file:// URLs - content = content.replace( + const wasmPatched = content.replace( /await __wbg_init\(\{ module_or_path: (module\$\d+) \}\)/g, 'await __wbg_init({ module_or_path: pathToFileURL($1).href })', ); + if (wasmPatched !== content) { + console.log(' → Patched WASM initialization'); + } + content = wasmPatched; // Patch Worker creation to accept file:// URLs - content = content.replace( + const workerPatched = content.replace( 'const worker = new Worker(url,', 'const worker = new Worker(pathToFileURL(url),', ); + if (workerPatched !== content) { + console.log(' → Patched Worker creation'); + } + content = workerPatched;
42-45: Worker replacement pattern might be too literal.The string match
'const worker = new Worker(url,'works for the current bundle but could break if the bundler changes variable names or formatting. Since you're already using regex for WASM, a more flexible pattern might be safer for the long haul.Optional: Use a more flexible regex pattern
- content = content.replace( - 'const worker = new Worker(url,', - 'const worker = new Worker(pathToFileURL(url),', - ); + content = content.replace( + /new Worker\(([^,]+),/g, + 'new Worker(pathToFileURL($1),', + );This pattern matches
new Worker(<anything>,and wraps the first argument withpathToFileURL(), making it resilient to variable naming changes.typescript/rebalancer/scripts/ncc.post-bundle.mjs (1)
9-60: Consistent patching logic across services.This script is identical to the warp-monitor version, which is good for maintainability. The same optional improvements mentioned for warp-monitor apply here (logging patch results, more flexible Worker regex).
If this pattern gets used in more services, might be worth extracting to a shared utility script, but two instances isn't worth the hassle yet.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
typescript/ccip-server/Dockerfiletypescript/rebalancer/Dockerfiletypescript/rebalancer/scripts/ncc.post-bundle.mjstypescript/warp-monitor/Dockerfiletypescript/warp-monitor/scripts/ncc.post-bundle.mjs
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
📚 Learning: 2025-12-18T22:36:13.445Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-18T22:36:13.445Z
Learning: Follow existing naming conventions and code organization in both Solidity and TypeScript
Applied to files:
typescript/ccip-server/Dockerfiletypescript/warp-monitor/Dockerfiletypescript/rebalancer/Dockerfile
📚 Learning: 2025-12-18T22:36:13.445Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-18T22:36:13.445Z
Learning: Applies to typescript/**/*.{ts,tsx} : Import types from `hyperlane-xyz/sdk` when using TypeScript SDK types
Applied to files:
typescript/ccip-server/Dockerfiletypescript/warp-monitor/Dockerfiletypescript/rebalancer/Dockerfile
📚 Learning: 2025-12-22T16:50:19.890Z
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 7565
File: typescript/ccip-server/Dockerfile:10-11
Timestamp: 2025-12-22T16:50:19.890Z
Learning: Standardize Foundry installation in Dockerfiles by using the official curl -L https://foundry.paradigm.xyz | bash followed by foundryup. This pattern is already used across multiple Dockerfiles in the repo and should be retained for consistency and reliability wherever Foundry is installed.
Applied to files:
typescript/ccip-server/Dockerfiletypescript/warp-monitor/Dockerfiletypescript/rebalancer/Dockerfile
🔇 Additional comments (4)
typescript/warp-monitor/scripts/ncc.post-bundle.mjs (1)
9-18: Constants look solid.The OUTPUT_FILE path construction is correct, and the DIRNAME_SHIM properly imports
pathToFileURLwhich is needed for the patches below.typescript/ccip-server/Dockerfile (1)
38-38: Clean addition of aleo-sdk to the build.The package follows the same pattern as the other SDK dependencies (cosmos-sdk, radix-sdk, etc.) with both package.json and source copied at the appropriate stages. Placement is logical and consistent.
Also applies to: 66-66
typescript/warp-monitor/Dockerfile (1)
38-38: Dockerfile changes look proper.The aleo-sdk is correctly included in both the package.json copy stage and the source copy stage, matching the pattern used for other SDKs. The bundled output from the post-bundle script will include the necessary aleo-sdk dependencies.
Also applies to: 57-57
typescript/rebalancer/Dockerfile (1)
38-38: All three services now include aleo-sdk consistently.The rebalancer Dockerfile follows the same pattern as ccip-server and warp-monitor. With the updated post-bundle script from earlier in this PR, the aleo-sdk dependency should now be properly included in the bundled output.
Also applies to: 57-57
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7730 +/- ##
=======================================
Coverage 77.02% 77.02%
=======================================
Files 117 117
Lines 2651 2651
Branches 244 244
=======================================
Hits 2042 2042
Misses 593 593
Partials 16 16
🚀 New features to boost your workflow:
|
Summary
aleo-sdkpackage.json and source copy to ccip-server, rebalancer, and warp-monitor Dockerfilesncc.post-bundle.mjswith WASM init patching from CLI (as discussed in feat: aleo cli support #7522)Context
The
deploy-sdknow depends on@hyperlane-xyz/aleo-sdkafter #7522, which broke Docker builds for services that depend on deploy-sdk (ccip-server, rebalancer, warp-monitor).The ncc post-bundle scripts were also updated to include WASM compatibility patches for Aleo and any future WASM-based packages, as discussed in #7522 (comment).
Changes
Dockerfiles: Added
aleo-sdkto the COPY commands for:typescript/ccip-server/Dockerfiletypescript/rebalancer/Dockerfiletypescript/warp-monitor/DockerfilePost-bundle scripts: Updated to match CLI's patching logic:
typescript/rebalancer/scripts/ncc.post-bundle.mjstypescript/warp-monitor/scripts/ncc.post-bundle.mjsfile://URLsfile://URLspathToFileURLimportTesting
pnpm -C typescript/deploy-sdk buildpassesSummary by CodeRabbit
Chores
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.