fix(staking): preserve validator UX on the train - #412
Conversation
The staking contract withdrew the unpaged validator reads the CLI was built on. `activeValidators()` is gone outright, and the balanced-tree walk lost both of its footholds: `validatorsRoot()` no longer exists and `validatorView()` no longer carries the left/right/parent links. None of this degrades gracefully -- the calls revert rather than truncating, so `genlayer staking active-validators` exits non-zero against a deployment carrying the change. Read the append-only joined registry instead, one page at a time: `validatorsJoinedCount()` bounds the walk and `getValidatorsJoined(start, pageSize)` returns each page. The count is read first so a set that grows underneath the walk cannot spin the loop, and a short page means it shrank instead -- stop there and let the next read see the settled set. Page size is 64, matching the convention the contract's own paged reads are written around; committee capacity is 1,543 seats, which is why the unpaged read had to go in the first place. `staking validators` loses its one-call answer for "in the current draw", so the active marker is now derived from what is still readable: joined, and neither banned nor quarantined.
|
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
The four SDK-side items under What this does NOT fix are now covered by
One correction worth carrying across: the paged reads are not train-only. |
Present the SDK's stored-state lifecycle in ordinary receipt output and reserve raw stored/projected/action data for an explicit advanced lifecycle command with optional timestamp evaluation. Keep manual finalization under advanced recovery and preserve full raw receipts behind --raw.\n\nValidation: full 75-file Vitest suite (814 tests); build; generated docs; diff check.
MuncleUscles
left a comment
There was a problem hiding this comment.
Reviewed the stored/default versus advanced lifecycle UX, selectable/joined validator commands, and immutable JS SDK pin on this exact head. Native CI, wallet E2E, smoke, build, and typecheck are green. Approving.
Depends-On: genlayerlabs/genlayer-consensus#1307
Depends-On: genlayerlabs/genlayer-node#1800
Depends-On: genlayerlabs/genlayer-js#212
Decision
The CLI targets the train contracts without deployment-version fallbacks. Ordinary commands use the SDK's stored, consumer-oriented lifecycle; projection and manual finalization live under advanced/recovery commands.
--wait-until decided|finalized, not raw protocol statuses.Changes
staking active-validatorsstrict and addsstaking joined-validators.ReadyToFinalize.--rawoutput.8f72796efa6f1f52d420957bd253771c8583ca14.v0.40-devpull requests, matching the JS/Python train-line policy; scheduled/manual smoke and non-train PR smoke remain enabled.Validation
Current head:
030992dfc35f49ff19d4e9585d9ceac56a4dc8c3.npx tsc --noEmitnpm test -- --run: 814 passed across 75 files, including loopback wallet testsnpm run buildactionlintgit diff --checkLive composed behavior is qualified by genlayerlabs/genlayer-e2e#748; the 1,543-validator scenario remains gated.