Uh oh!
There was an error while loading. Please reload this page.
fix(staking): validator-deposit/exit work through the CLI - #382
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 |
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.