Bridge commands duplicate signer construction and miss new signer types
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- cli, developer-experience
Hướng nghiên cứu
Bắt đầu với BaseCommand.getWalletClient() trong packages/cli/src/base.ts:229-308, sau đó so sánh cách xây dựng wallet trong packages/cli/src/commands/bridge/deposit.ts, withdraw-prove.ts và withdraw-finalize.ts. Theo dõi cách mỗi command bỏ qua BaseCommand.init() và liên kết chain L1 cùng transport của nó. Hoàn thành khi cả ba command dùng chung việc lựa chọn signer với BaseCommand, đồng thời giữ nguyên hành vi L1 và hỗ trợ các loại signer được thêm tại đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Three bridge commands bypass BaseCommand's wallet construction and reimplement it, so any signer type added to BaseCommand silently does not work for them.
Detail
packages/cli/src/commands/bridge/deposit.ts, withdraw-prove.ts and withdraw-finalize.ts each declare async init() {} to skip BaseCommand.init(), then build their own wallet client in a private getL1WalletClient(). That method re-implements the --useLedger / --privateKey branching already present in BaseCommand.getWalletClient() (packages/cli/src/base.ts:229-308):
// packages/cli/src/commands/bridge/deposit.ts:149-162
} else if (res.flags.privateKey) {
const account = privateKeyToAccount(ensureLeading0x(res.flags.privateKey))
if (res.flags.from && !isAddressEqual(res.flags.from, account.address)) { ... }
return createWalletClient({ account, chain: config.l1Chain, transport: http(l1RpcUrl) })
}
The duplication is understandable — these commands sign against L1, not the L2 chain --node points at, so they need a different chain and transport. But the signer selection logic is identical and has been copied rather than shared.
Why it matters
The branching is an exhaustive if/else if over signer types. Any signer added to BaseCommand — a keystore option, a new HSM, anything — works everywhere except these three commands, with no compile-time error and no runtime warning. The user just silently gets a different (or no) signer.
Suggested fix
Extract signer selection from chain/transport binding in BaseCommand, so a command can ask for "the configured signer, bound to this chain and transport". The bridge commands then pass their L1 chain and transport into the shared helper instead of re-deriving the account. That collapses three copies into one and makes new signer types work everywhere by construction.
Context
Found while scoping a --keystore option (like cast --keystore). That work is deliberately scoped to BaseCommand and will not cover the bridge commands, so --keystore will not work with bridge:deposit, bridge:withdraw-prove or bridge:withdraw-finalize until this is addressed.
- Ngôn ngữ chính
- TypeScript
- Star
- 43
- Fork
- 36
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của celo-org/developer-tooling
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
celo-org/developer-tooling#793 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
celo-org/developer-tooling#786 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
celo-org/developer-tooling#800 · 1 bình luận ·
-
Zero CELO gas balance is reported as a contract revert: "gas required exceeds allowance (0)"Đang mởbug celocli
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
celo-org/developer-tooling#790 ·
-
--ledgerLiveMode iterates the BIP-44 change index instead of the hardened account indexCó thể đã có người làm @Steve0x2a đã nhận 46 ngày trước. Đang mởbug celocli
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
celo-org/developer-tooling#789 ·
Tất cả issue của celo-org/developer-tooling
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
farion1231/cc-switch#8829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverĐang mởdoc-audit enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100