feat(staking): validator eligibility warnings + clean validator-info view#394
Merged
Merged
Conversation
Add a shared self-stake eligibility gate (BaseAction.assertOrWarnSelfStakeMinimum) used by the four validator write commands (staking validator-join/deposit, vesting validator-create/deposit). Eligibility counts self-stake only; the minimum is read from getEpochInfo().validatorMinStakeRaw (never hardcoded) and mirrors the wizard's epoch-0 carve-out. Below-min blocks by default and is overridable with --force; epoch-0 and eligible cases only inform. Add liquid/vesting mixing hard-guards (no override) to the two deposit commands: staking validator-deposit fails when the wallet is owned by a vesting contract; vesting validator-deposit fails when the wallet was not created by the vesting contract (isValidatorWallet). Both would revert on-chain otherwise. Add informational source notes on join/create, --force flags on the four write commands, and a best-effort primed-below-minimum note on validator-prime. Adjust existing action/command tests to mock getEpochInfo/getValidatorInfo for the new pre-submit checks (min driven from mocked epochInfo, not hardcoded) and make the test parseStakingAmount mock exact at the integer-GEN boundary.
…n validator-info view Add unit tests driving the minimum from mocked epochInfo (never hardcoded): below-min blocks without --force; --force proceeds with a warning; epoch-0 does not block; deposit counts still-pending self-stake toward the resulting stake; liquid-into-vesting and vesting-into-liquid mixing hard-blocks (not overridable); validator-info --json returns the raw object; the clean grouped view keeps load-bearing values (addresses, GEN amounts, moniker, 'Not banned', live boolean) as plain substrings and never relabels live as 'active'; display-only below-min warning never blocks; pending-deposit crossing shows the activation epoch.
|
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 |
Member
Author
|
/run-e2e |
2 similar comments
Member
Author
|
/run-e2e |
Member
Author
|
/run-e2e |
…the minimum The self-stake below-minimum check called getEpochInfo() unconditionally in the validator-join/deposit + vesting create/deposit preflights. On a chain that can't report epoch/minStake (a minimal or stub staking contract, or a transient read failure) that read reverts and HARD-FAILS the write — e.g. the Tier-2 browser-signing lanes join against a StakingStub without epoch(), so validator-join died with 'The contract function "epoch" reverted'. Wrap the getEpochInfo() read: on failure, skip the (advisory) min check and proceed, rather than blocking the operation. The mixing guard (owner / isValidatorWallet) stays a hard, always-enforced check. Also pass --force on the Tier-2 lanes' deliberately-sub-minimum test joins. Verified: Tier-2 browser-signing suite 6/6 green; 786 unit tests pass.
Member
Author
|
/run-e2e |
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.
Description
Validator eligibility warnings + a clean
validator-infoview (three related improvements):vStake) reaches the on-chainvalidatorMinStake(read dynamically viagetEpochInfo, never hardcoded). Warn everywhere self-stake is set/shown; the write commands (validator-join,validator-deposit,vesting validator-create,vesting validator-deposit) block below-minimum with a--forceoverride, epoch-0-aware (mirrors the wizard).validator-infodisplays the warning (counting pending deposits by activation). Delegated stake never counts toward the minimum.getValidatorInfo().owner/isValidatorWallet); join/create add an informational "source is fixed" note.validator-infoview replacing the rawutil.inspectdump — grouped Identity / Addresses+source / Stake / Status / pending sections. Raw machine output stays available behind--json.liveis shown as-is (never presented as "active").Release Notes
genlayer validator-infonow prints a clean, grouped view (use--jsonfor machine output). The CLI warns — and the write commands block (override with--force) — when a validator's self-stake is below the on-chain minimum required to become active, and refuses to mix liquid and vesting tokens for self-stake.Types of Changes
Checklist
Depends-On: genlayerlabs/genlayer-e2e@fix/cli-driver-validator-info-json