Skip to content

feat(staking): validator eligibility warnings + clean validator-info view#394

Merged
MuncleUscles merged 3 commits into
v0.40-devfrom
feat/validator-eligibility-warnings
Jul 10, 2026
Merged

feat(staking): validator eligibility warnings + clean validator-info view#394
MuncleUscles merged 3 commits into
v0.40-devfrom
feat/validator-eligibility-warnings

Conversation

@MuncleUscles

@MuncleUscles MuncleUscles commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

Validator eligibility warnings + a clean validator-info view (three related improvements):

  1. Below-minimum self-stake warning. A validator only becomes active once its SELF-stake (vStake) reaches the on-chain validatorMinStake (read dynamically via getEpochInfo, 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 --force override, epoch-0-aware (mirrors the wizard). validator-info displays the warning (counting pending deposits by activation). Delegated stake never counts toward the minimum.
  2. Liquid/vesting mixing guard. Self-stake source is fixed at creation by the ValidatorWallet owner (EOA = liquid, Vesting contract = vesting); a cross-source deposit reverts on-chain. The deposit commands now hard-block a mismatch pre-submit with an actionable message (detected via getValidatorInfo().owner / isValidatorWallet); join/create add an informational "source is fixed" note.
  3. Clean validator-info view replacing the raw util.inspect dump — grouped Identity / Addresses+source / Stake / Status / pending sections. Raw machine output stays available behind --json. live is shown as-is (never presented as "active").

Release Notes

genlayer validator-info now prints a clean, grouped view (use --json for 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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change
  • Chore

Checklist

  • My code follows the code style of this project
  • I have added tests (if appropriate)
  • I have added the necessary documentation (if appropriate)

Depends-On: genlayerlabs/genlayer-e2e@fix/cli-driver-validator-info-json

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.
@coderabbitai

coderabbitai Bot commented Jul 10, 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: ea3336f0-c59c-4894-8688-b8582fbea37a

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 feat/validator-eligibility-warnings

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

Copy link
Copy Markdown
Member Author

/run-e2e

2 similar comments
@MuncleUscles

Copy link
Copy Markdown
Member Author

/run-e2e

@MuncleUscles

Copy link
Copy Markdown
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.
@MuncleUscles

Copy link
Copy Markdown
Member Author

/run-e2e

@MuncleUscles
MuncleUscles merged commit dd77d5b into v0.40-dev Jul 10, 2026
10 checks passed
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