Repository navigation
fix(staking): route set-operator/validator-claim/set-identity/trace through the SDK - #387
Merged
Merged
Conversation
…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.
|
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
The keystore paths of
staking set-operator,staking validator-claim,staking set-identityandtransactions tracebypassed the genlayer-js SDK and hit the chain directly via raw viem (walletClient.writeContract) orclient.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 forvalidator-deposit/validator-exit(#382).Fix — route each keystore path through the SDK client
set-operatorwriteContract(setOperator)client.setOperator({validator, operator})validator-claimwriteContract(validatorClaim)client.validatorClaim({validator})— surfacesclaimedAmountset-identitywriteContract(setIdentity)+ hand-rolledtoHex(TextEncoder)extraCidclient.setIdentity({validator, moniker, ...})— SDK owns extraCid encodingtraceclient.request({method: "gen_dbg_traceTransaction"})client.debugTraceTransaction({hash, round})(typed action, same wire call)The SDK client's
executeWritepinstype: "legacy"and does manual nonce/gas + sign +sendRawTransaction, which the consensus RPC requires.Notes
setOperator/setIdentityexist on the client at runtime (route throughexecuteWrite) but are missing from the installed genlayer-jsStakingActions.d.ts — a narrow cast bridges that type gap (pre-existing gap;wizard.tsalready hits it).StakingAction.getViemClientsis deleted along with its now-unused viem imports.Tests
claimedAmountsurfaced).tests/actions/trace.test.tscoveringdebugTraceTransaction, round default, no-trace, and error paths.npm run buildclean;npx tsc --noEmitunchanged at 32 pre-existing errors (zero new);npx vitest run→ 786 passed / 74 files.