feat: implement cli commands to unstake#3201
Conversation
|
Warning: This PR modifies the Walrus CLI. Please consider the following:
|
|
Hi @mlegner , sending a few CLI commands that help with unstake. The motivation is that the list of operations in the runbook to unstake no longer works because sui objects now only return BCS encoded field data, so it's hard to find the StakedWal object matching a particular node. |
There was a problem hiding this comment.
Pull request overview
Adds end-user CLI support for unstaking/withdrawing WAL via Sui contract interactions, and aligns local Move struct decoding with the on-chain StakedWalState layout.
Changes:
- Introduces CLI commands:
request-withdraw-stake,withdraw-stake, andlist-staked-walwith corresponding JSON/CLI outputs. - Updates Sui client APIs to return
TransactionDigestfor stake-withdrawal transactions and adds a helper to fetch ownedStakedWals. - Fixes
StakedWalState::Withdrawing(BCS) deserialization by removing the extraOption<u64>payload.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/walrus-sui/src/types/move_structs.rs | Updates StakedWalState::Withdrawing variant and its Display output. |
| crates/walrus-sui/src/client/read_client.rs | Adds tracing span context to get_owned_objects conversions/warnings. |
| crates/walrus-sui/src/client.rs | Returns TransactionDigest from withdraw-related calls; adds owned_staked_wals(). |
| crates/walrus-service/src/client/responses.rs | Adds structured outputs for new unstake/withdraw/list CLI commands. |
| crates/walrus-service/src/client/cli/runner.rs | Implements command handlers for requesting withdrawal, withdrawing, and listing StakedWals. |
| crates/walrus-service/src/client/cli/cli_output.rs | Adds human-readable CLI printers for the new command outputs. |
| crates/walrus-service/src/client/cli/args.rs | Adds clap args and command-name mapping for the new CLI commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b7fcc3ced
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
mlegner
left a comment
There was a problem hiding this comment.
Thanks for these additions. They are definitely much nicer than my jq-based scripts... 😅
A few optional suggestions (can also be done in a follow-up).
Description
request-withdraw-stake <node-id> [staked-wal-id] [--dry-run]requests withdrawal of staked WAL from a storage node. Auto-selects when only one StakedWal exists for the node; lists options when multiple exist.withdraw-stake <staked-wal-id>completes withdrawal of a StakedWal that was previously requestedlist-staked-wal [--staked-only] [--withdrawing-only]lists all StakedWal objects in the wallet with optional state filteringClose WAL-569
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that
a user might notice and any actions they must take to implement updates. (Add release notes after the colon for each item)