Skip to content

feat: implement cli commands to unstake#3201

Merged
halfprice merged 2 commits intomainfrom
zhewu/unstake_command
Mar 30, 2026
Merged

feat: implement cli commands to unstake#3201
halfprice merged 2 commits intomainfrom
zhewu/unstake_command

Conversation

@halfprice
Copy link
Copy Markdown
Collaborator

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 requested
  • list-staked-wal [--staked-only] [--withdrawing-only] lists all StakedWal objects in the wallet with optional state filtering
  • Fix StakedWalState::Withdrawing BCS deserialization by removing the Option field

Close 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)

  • Storage node:
  • Aggregator:
  • Publisher:
  • CLI:

@halfprice halfprice requested review from Copilot and mlegner March 27, 2026 06:57
@github-actions
Copy link
Copy Markdown
Contributor

Warning: This PR modifies the Walrus CLI. Please consider the following:

  • Make sure the changes are backwards compatible. Consider deprecating options before
    removing them.
  • Generally only use long CLI options, not short ones to avoid conflicts in the
    future.
  • If you added new options or features, or modified the behavior, please document the
    changes in the release notes of the PR and update the documentation in the
    docs/content directory.

Comment thread crates/walrus-sui/src/types/move_structs.rs
@halfprice
Copy link
Copy Markdown
Collaborator Author

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and list-staked-wal with corresponding JSON/CLI outputs.
  • Updates Sui client APIs to return TransactionDigest for stake-withdrawal transactions and adds a helper to fetch owned StakedWals.
  • Fixes StakedWalState::Withdrawing (BCS) deserialization by removing the extra Option<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.

Comment thread crates/walrus-service/src/client/cli/runner.rs Outdated
Comment thread crates/walrus-service/src/client/cli/cli_output.rs Outdated
Comment thread crates/walrus-service/src/client/cli/cli_output.rs
Comment thread crates/walrus-service/src/client/cli/args.rs Outdated
Comment thread crates/walrus-service/src/client/responses.rs Outdated
@halfprice
Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/walrus-service/src/client/cli/runner.rs
Comment thread crates/walrus-service/src/client/cli/runner.rs Outdated
Copy link
Copy Markdown
Contributor

@mlegner mlegner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread crates/walrus-service/src/client/cli/runner.rs Outdated
Comment thread crates/walrus-service/src/client/cli/args.rs Outdated
Comment thread crates/walrus-service/src/client/cli/args.rs
@halfprice halfprice enabled auto-merge (squash) March 30, 2026 22:27
@halfprice halfprice merged commit c8bf21a into main Mar 30, 2026
26 checks passed
@halfprice halfprice deleted the zhewu/unstake_command branch March 30, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants