fix(balances): wallet-only view when consensus infra is not deployed#391
Merged
Merged
Conversation
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.
|
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 |
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.
What
Follow-up to #389. That PR stopped the staking scan from crashing
genlayer balanceson 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:(e2e
090_cli_network_and_balancesscenario 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. Probeeth_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
(a'')no-consensus degradation + reframed(a')).genlayer balancesexits 0 with wallet-only output; cucumber090both scenarios green on the studio target.Depends-On: genlayerlabs/genlayer-consensus#1179