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 69.61% 69.61%
=======================================
Files 150 150
Lines 7075 7075
Branches 1163 1138 -25
=======================================
Hits 4925 4925
+ Misses 2080 2076 -4
- Partials 70 74 +4
๐ 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 ๐ย / ๐.
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 focuses on enhancing the
bridgefunctionality within the CLI for managing CELO token transfers between Ethereum (L1) and Celo (L2). It introduces new commands, modifies existing ones, and adds tests for improved reliability and user guidance.Detailed summary
bridgecommand with deposit and withdrawal functionalities.BridgeDeposit,BridgeWithdrawInit,BridgeWithdrawProve,BridgeWithdrawFinalize, andBridgeWithdrawStatusclasses.package.jsonto includebridgedescription.