fix(staking): validator-deposit/exit work through the CLI#382
Merged
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
genlayer staking validator-depositandstaking validator-exitfail 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.writeContractdirectly (viagetViemClients) instead of going through the genlayer-js staking client.viem's
writeContractnegotiates its own fee/transaction-type against the RPC. The GenLayer consensus chain (defineChain, id 61127) declares no EIP-1559 /feesconfig and no custom serializer, so viem's default fee estimation / tx-type selection fails and the write never lands.The SDK's
executeWritecompensates by pinningtype: "legacy", computing nonce/gas manually, and doing sign +sendRawTransaction. Every other staking command — and bothvesting validator deposit/exitcommands — already use this path. The"SDK bug"note is a misdiagnosis: the SDK exposes correctclient.validatorDeposit/client.validatorExitactions that forward through the ValidatorWallet's own functions (somsg.sender == ValidatorWalleton 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/validatorExitviarunWrite(["validator-deposit", ...])/runWrite(["validator-exit", ...])instead of throwing.