Repository navigation
Commit 8a414bb
committed
fix(balances): degrade gracefully when staking is unavailable
The balances command scans the global validator set (active + quarantined +
banned) to compute delegated committed principal per vesting. Those SDK reads
throw on networks with no staking contract ("Staking is not supported on
studio-based networks"), so `genlayer balances` failed outright on studio —
even though wallet balance and vesting totals need no staking data.
Gate the scan on staking availability, mirroring the SDK's own guard (missing
or zero staking address ⇒ unsupported): when absent, use an empty validator set
so delegated principal is 0 (correct — there is no delegation without staking)
and still render wallet + vesting holdings. Self-stake, vested/withdrawable and
available-to-stake all come from vesting/wallet reads and are unaffected.
Fixes genlayer-cli (studio) e2e 090_cli_network_and_balances #2.1 parent e35a57d commit 8a414bb
2 files changed
Lines changed: 63 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| |||
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
121 | 139 | | |
122 | 140 | | |
123 | 141 | | |
124 | 142 | | |
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
| 146 | + | |
128 | 147 | | |
129 | 148 | | |
130 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
98 | 135 | | |
99 | 136 | | |
100 | 137 | | |
| |||
109 | 146 | | |
110 | 147 | | |
111 | 148 | | |
112 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
113 | 152 | | |
114 | 153 | | |
115 | 154 | | |
| |||
164 | 203 | | |
165 | 204 | | |
166 | 205 | | |
167 | | - | |
| 206 | + | |
168 | 207 | | |
169 | 208 | | |
170 | 209 | | |
| |||
202 | 241 | | |
203 | 242 | | |
204 | 243 | | |
205 | | - | |
| 244 | + | |
206 | 245 | | |
207 | 246 | | |
208 | 247 | | |
| |||
0 commit comments