Skip to content

fix(staking): validator-deposit/exit work through the CLI#382

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
fix/cli-validator-deposit-exit
Jul 9, 2026
Merged

fix(staking): validator-deposit/exit work through the CLI#382
MuncleUscles merged 1 commit into
v0.40-devfrom
fix/cli-validator-deposit-exit

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Problem

genlayer staking validator-deposit and staking validator-exit fail from the CLI. The genlayer-e2e cli-driver hard-skips both with a "SDK bug (msg.sender must be ValidatorWallet contract)" note.

Root cause — CLI bug, not an SDK bug

The keystore paths of these two commands were the only staking commands that called viem's walletClient.writeContract directly (via getViemClients) instead of going through the genlayer-js staking client.

viem's writeContract negotiates its own fee/transaction-type against the RPC. The GenLayer consensus chain (defineChain, id 61127) declares no EIP-1559 / fees config and no custom serializer, so viem's default fee estimation / tx-type selection fails and the write never lands.

The SDK's executeWrite compensates by pinning type: "legacy", computing nonce/gas manually, and doing sign + sendRawTransaction. Every other staking command — and both vesting validator deposit/exit commands — already use this path. The "SDK bug" note is a misdiagnosis: the SDK exposes correct client.validatorDeposit / client.validatorExit actions that forward through the ValidatorWallet's own functions (so msg.sender == ValidatorWallet on re-entry into Staking). The CLI simply wasn't calling them.

Fix

Route both staking commands' keystore paths through client.validatorDeposit({validator, amount}) / client.validatorExit({validator, shares}). Browser-wallet paths are unchanged (MetaMask handles tx-type; they already build txs against the ValidatorWallet). No genlayer-js change required.

Scope check

  • vesting validator deposit / vesting validator exit: already use the SDK client — not affected, no change.
  • staking validator-deposit / validator-exit: fixed here.

Tests

Added keystore-path tests asserting both commands call the SDK client and never touch getViemClients, plus error-path and shares-validation coverage. Full suite green (752 tests). Build clean; no new tsc errors vs baseline.

Follow-up for genlayer-e2e

The cli-driver can now implement validatorDeposit / validatorExit via runWrite(["validator-deposit", ...]) / runWrite(["validator-exit", ...]) instead of throwing.

The `staking validator-deposit` and `staking validator-exit` keystore
paths called viem's `walletClient.writeContract` directly. viem then
negotiates its own fee/tx-type against the GenLayer consensus RPC, which
has no EIP-1559 fee support, so the write fails. Every other staking
command (and both `vesting validator` commands) instead go through the
SDK's staking client, whose `executeWrite` pins `type: "legacy"` and does
manual nonce/gas + sign + sendRawTransaction.

Route both commands through `client.validatorDeposit` /
`client.validatorExit`, which forward to the ValidatorWallet's own
functions (preserving msg.sender == ValidatorWallet on re-entry into
Staking) over the correct legacy-tx path. The genlayer-e2e cli-driver
hard-skips these two with a "SDK bug" note; that was a misdiagnosis — the
SDK actions exist and are correct, the CLI just wasn't using them.

Add keystore-path tests asserting both commands call the SDK client and
never touch getViemClients.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3906eb19-4919-451f-97a8-41607591f76b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cli-validator-deposit-exit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MuncleUscles
MuncleUscles merged commit 3de9a6a into v0.40-dev Jul 9, 2026
10 of 11 checks passed
@MuncleUscles
MuncleUscles deleted the fix/cli-validator-deposit-exit branch July 9, 2026 20:48
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.

1 participant