Skip to content

fix(staking): route set-operator/validator-claim/set-identity/trace through the SDK - #387

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
fix/cli-route-through-sdk
Jul 9, 2026
Merged

MuncleUscles merged 1 commit into
v0.40-devfrom
fix/cli-route-through-sdk

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Problem

The keystore paths of staking set-operator, staking validator-claim, staking set-identity and transactions trace bypassed the genlayer-js SDK and hit the chain directly via raw viem (walletClient.writeContract) or client.request. viem negotiates its own EIP-1559 fee/tx-type against the GenLayer consensus RPC, which has no EIP-1559 fee support, so these writes fail. Same latently-broken class already fixed for validator-deposit/validator-exit (#382).

Fix — route each keystore path through the SDK client

Command Before After
set-operator raw writeContract(setOperator) client.setOperator({validator, operator})
validator-claim raw writeContract(validatorClaim) client.validatorClaim({validator}) — surfaces claimedAmount
set-identity raw writeContract(setIdentity) + hand-rolled toHex(TextEncoder) extraCid client.setIdentity({validator, moniker, ...}) — SDK owns extraCid encoding
trace client.request({method: "gen_dbg_traceTransaction"}) client.debugTraceTransaction({hash, round}) (typed action, same wire call)

The SDK client's executeWrite pins type: "legacy" and does manual nonce/gas + sign + sendRawTransaction, which the consensus RPC requires.

Notes

  • Browser-wallet paths are unchanged — the bridge signs, so they were already correct-by-construction.
  • setOperator/setIdentity exist on the client at runtime (route through executeWrite) but are missing from the installed genlayer-js StakingActions .d.ts — a narrow cast bridges that type gap (pre-existing gap; wizard.ts already hits it).
  • With every caller gone, StakingAction.getViemClients is deleted along with its now-unused viem imports.

Tests

  • Keystore-path tests for set-operator / validator-claim / set-identity asserting the SDK client method is called (validator-claim asserts claimedAmount surfaced).
  • New tests/actions/trace.test.ts covering debugTraceTransaction, round default, no-trace, and error paths.
  • npm run build clean; npx tsc --noEmit unchanged at 32 pre-existing errors (zero new); npx vitest run → 786 passed / 74 files.

…hrough the SDK

The keystore paths of `staking set-operator`, `staking validator-claim`,
`staking set-identity` and `transactions trace` used raw viem
`walletClient.writeContract` / `client.request`. viem negotiates its own
EIP-1559 fee/tx-type against the GenLayer consensus RPC, which has no
EIP-1559 fee support, so those writes fail. This is the same latently-broken
class already fixed for validator-deposit/exit.

Route each keystore path through the genlayer-js client instead:
- set-operator   -> client.setOperator({validator, operator})
- validator-claim-> client.validatorClaim({validator}) (surfaces claimedAmount)
- set-identity   -> client.setIdentity({validator, moniker, ...}); the SDK now
                    owns extraCid encoding (drop the hand-rolled toHex/TextEncoder)
- trace          -> client.debugTraceTransaction({hash, round}) (typed action,
                    same wire call as gen_dbg_traceTransaction)

setOperator/setIdentity exist on the client at runtime (route through the SDK's
legacy-tx executeWrite) but are missing from the installed genlayer-js
StakingActions .d.ts; a narrow cast bridges that type gap.

Browser-wallet paths are unchanged (the bridge signs, so they were already
correct). With every caller gone, StakingAction.getViemClients is deleted along
with its now-unused viem imports.

Add keystore-path tests asserting each command calls the SDK client, and a
trace test using debugTraceTransaction.
@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: 0dec4394-f3d6-41da-b9da-c28fb36443f0

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-route-through-sdk

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 e70b31b into v0.40-dev Jul 9, 2026
10 of 11 checks passed
@MuncleUscles
MuncleUscles deleted the fix/cli-route-through-sdk branch July 9, 2026 21:08
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