Skip to content

fix(balances): wallet-only view when consensus infra is not deployed#391

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
fix/balances-studio-no-consensus
Jul 10, 2026
Merged

fix(balances): wallet-only view when consensus infra is not deployed#391
MuncleUscles merged 1 commit into
v0.40-devfrom
fix/balances-studio-no-consensus

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

What

Follow-up to #389. That PR stopped the staking scan from crashing genlayer balances on studio; this fixes the next consensus-dependent read that then surfaced — the vesting-factory lookup (ConsensusMain → AddressManager). On a network without consensus infrastructure deployed (studio, or a custom profile on a bare RPC) that read decodes garbage and the command died with:

Position `32` is out of bounds — Contract Call: 0x00…01, function name()

(e2e 090_cli_network_and_balances scenario 2, studio stack.)

Fix — one capability probe for the whole class

Custom networks inherit the base chain's ConsensusMain address even without --consensus-main, so a studio profile carries a non-null (localnet) address that simply isn't deployed on the studio RPC — a static check can't distinguish them. Probe eth_getCode(consensusMain) once up front: if empty (0x), consensus infra isn't deployed → skip the whole consensus-dependent section (vesting and staking) and render the wallet balance only, with a clear note. One check covers the entire missing-infra class instead of one revert at a time. dev-env (real deployed address) is unaffected.

Verification

  • 772/772 unit tests (added (a'') no-consensus degradation + reframed (a')).
  • Ran against a live studio stack with this build: genlayer balances exits 0 with wallet-only output; cucumber 090 both scenarios green on the studio target.

Depends-On: genlayerlabs/genlayer-consensus#1179

After #389 stopped the staking scan from crashing balances on studio, the
next consensus-dependent read surfaced: the vesting-factory lookup resolves
through ConsensusMain → AddressManager, and on a network without that
infrastructure deployed (studio, or a custom profile on a bare RPC) it decodes
garbage — `genlayer balances` died with 'Position 32 is out of bounds ...
name()' (e2e 090 scenario 2 on the studio stack).

Custom networks inherit the base chain's ConsensusMain address even without a
--consensus-main override, so a studio profile carries a non-null (localnet)
address that simply isn't deployed on the studio RPC — a static check can't
tell them apart. Probe eth_getCode(consensusMain) once up front: if empty, the
consensus infra isn't deployed, so skip the whole consensus-dependent section
(vesting + staking) and render the wallet balance only, with a clear note.
Handles the entire missing-infra class in one capability check rather than one
revert at a time. dev-env (real deployed address) is unaffected.

Verified against a live studio stack: e2e 090 (both scenarios) green.
772/772 unit tests pass.
@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: 76a1624f-d1d3-4549-9461-281b99834544

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/balances-studio-no-consensus

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

@MuncleUscles MuncleUscles merged commit f2d9c98 into v0.40-dev Jul 10, 2026
9 of 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