Add deposit & withdraw for OP.#774
Conversation
|
|
@copilot review |
There was a problem hiding this comment.
Pull request overview
Adds OP Stack bridge support to the Celo CLI to move CELO between Ethereum L1 and Celo L2, including end-to-end withdraw lifecycle commands and supporting utilities/docs.
Changes:
- Introduces new
bridge:*CLI commands for deposit and multi-step withdrawals (init/prove/status/finalize). - Adds shared bridge network/config utilities (chain definitions, ABIs, status labels) plus unit tests.
- Adds CLI topic metadata and end-user documentation for bridge workflows.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/utils/bridge.ts | Adds bridge network config, OP Stack chain definitions, ABIs, and status labels used by commands. |
| packages/cli/src/utils/bridge.test.ts | Unit tests for network validation, config constants, chain selection, and status labels. |
| packages/cli/src/commands/bridge/deposit.ts | Implements L1βL2 CELO deposit flow (token lookup, approve, deposit). |
| packages/cli/src/commands/bridge/deposit.test.ts | Flag-validation tests for bridge:deposit. |
| packages/cli/src/commands/bridge/withdraw-init.ts | Implements L2 withdrawal initiation transaction. |
| packages/cli/src/commands/bridge/withdraw-prove.ts | Implements proof waiting/building and L1 prove submission. |
| packages/cli/src/commands/bridge/withdraw-status.ts | Implements human-readable withdrawal status + next-step guidance. |
| packages/cli/src/commands/bridge/withdraw-finalize.ts | Implements finalization/claim on L1 after challenge period. |
| packages/cli/src/commands/bridge/withdraw.test.ts | Flag-validation tests for all withdrawal commands. |
| packages/cli/package.json | Registers the bridge command topic in CLI metadata. |
| packages/cli/docs/bridge.md | Adds user documentation for deposit/withdraw workflows and status meanings. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1f4a70ce9
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59211d4e1b
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
size-limit report π¦
|
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #774 +/- ##
==========================================
+ Coverage 66.21% 70.16% +3.94%
==========================================
Files 172 114 -58
Lines 9987 5905 -4082
Branches 1871 1201 -670
==========================================
- Hits 6613 4143 -2470
+ Misses 3280 1691 -1589
+ Partials 94 71 -23
π New features to boost your workflow:
|
|
@copilot review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbd643bcde
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 709a92eadd
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6017ecd28f
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cde87409c
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77131c7050
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const l2NodeUrl = await this.getNodeUrl() | ||
| const l2Client = createPublicClient({ | ||
| chain: l2Chain, | ||
| transport: http(l2NodeUrl), |
There was a problem hiding this comment.
Preserve --node transport scheme in withdraw status
Use the same scheme-aware transport selection as BaseCommand instead of forcing http(...) here. With --node ws://... or an IPC path, this wraps the endpoint in an HTTP transport and the command fails before any status checks, even though global CLI node handling explicitly supports http, ws, and .ipc; this is a regression in bridge:withdraw-status for users relying on non-HTTP endpoints.
Useful? React with πΒ / π.
| const l2NodeUrl = await this.getNodeUrl() | ||
| const l2Client = createPublicClient({ | ||
| chain: l2Chain, | ||
| transport: http(l2NodeUrl), |
There was a problem hiding this comment.
Preserve --node transport scheme in withdraw finalize
This command also hardcodes http(l2NodeUrl) for the L2 client, so --node values like ws://... or .../.ipc cannot work here even though the CLIβs base transport logic supports them. In practice, bridge:withdraw-finalize will fail for those valid node configurations before finalization logic runs, breaking expected global flag behavior.
Useful? React with πΒ / π.
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b755313ab
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| if (proveReceipt.status === 'success') { | ||
| console.log('\nWithdrawal proof submitted! Next steps:') | ||
| console.log(' 1. Wait 7 days for the challenge period to pass') |
There was a problem hiding this comment.
Avoid hardcoding a seven-day finalize wait
For --network sepolia (and any Celo deployment with a shorter finalization window), this tells users to wait 7 days even though the withdrawal can become finalizable much sooner; users may leave funds unclaimed for days after a successful proof. Since the command already relies on viem status APIs, prefer directing users to bridge:withdraw-status/getTimeToFinalize or wording this as waiting until the status is ready rather than a fixed duration.
Useful? React with πΒ / π.
Description
Adds bridge commands to the Celo CLI for moving CELO tokens between Ethereum (L1) and Celo (L2) via the OP Stack bridge. This PR extends CLI with:
bridge:depositβ Deposit CELO from Ethereum L1 to Celo L2 (~15 min)bridge:withdraw-initβ Initiate a withdrawal from Celo L2 to Ethereum L1bridge:withdraw-proveβ Build and submit withdrawal proof on L1 (~1hr after init)bridge:withdraw-statusβ Check withdrawal status with human-readable output and next-step guidancebridge:withdraw-finalizeβ Claim funds on L1 after 7-day challenge periodTested
src/utils/bridge.test.tsβ validates network config, contract addresses, chain IDs, status labelssrc/commands/bridge/deposit.test.tsβ flag validation, address parsing, network rejection, signing requirementssrc/commands/bridge/withdraw.test.tsβ flag validation for all 4 withdrawal commands (init, prove, status, finalize)How to QA
Prerequisites:
Test deposit (L1 β L2):
Verify: CELO appears on Celo Sepolia within ~15 minutes.
Test withdrawal (L2 β L1):
Related issues
PR-Codex overview
This PR enhances the
bridgefunctionality in the CLI for transferring CELO between Ethereum (L1) and Celo (L2). It introduces new commands, validation checks, and tests to ensure secure and reliable interactions with the bridge.Detailed summary
bridgesection inpackage.jsonwith description.deposit,withdraw-init,withdraw-prove,withdraw-finalize, andwithdraw-statuscommands.