@@ -169,23 +169,25 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
169169 strategyShares := operatorDelegatedSharesMap [strategy ]
170170 totalMagnitude := totalMagnitudeMap [strategy ]
171171 for _ , alloc := range allocations {
172- currentShares := slashableSharesMap [gethcommon .HexToAddress (strategy )][getUniqueKey (alloc .AvsAddress , alloc .OperatorSetId )]
173- currentSharesPercentage := getSharePercentage (currentShares , strategyShares )
174-
175- newMagnitudeBigInt := big .NewInt (0 )
176- if alloc .PendingDiff .Cmp (big .NewInt (0 )) != 0 {
177- newMagnitudeBigInt = big .NewInt (0 ).Add (alloc .CurrentMagnitude , alloc .PendingDiff )
178- }
179-
180- newShares , newSharesPercentage := getSharesFromMagnitude (
181- strategyShares ,
182- newMagnitudeBigInt .Uint64 (),
183- totalMagnitude ,
184- )
185172
186173 // Check if the operator set is not registered and add it to the unregistered list
187174 // Then skip the rest of the loop
188175 if _ , ok := registeredOperatorSetsMap [getUniqueKey (alloc .AvsAddress , alloc .OperatorSetId )]; ! ok {
176+ currentShares , currentSharesPercentage := getSharesFromMagnitude (
177+ strategyShares ,
178+ alloc .CurrentMagnitude .Uint64 (),
179+ totalMagnitude ,
180+ )
181+
182+ // If the operator set is not registered and has no shares, skip it
183+ // This comes as valid scenario since we iterate first over
184+ // strategy addresses and then over allocations.
185+ // This can be fixed by first going over allocations and then over strategy addresses
186+ // We will fix this in a subsequent PR and improve (TODO: shrimalmadhur)
187+ if currentShares == nil || currentShares .Cmp (big .NewInt (0 )) == 0 {
188+ continue
189+ }
190+
189191 dergisteredOpsets = append (dergisteredOpsets , DeregisteredOperatorSet {
190192 StrategyAddress : gethcommon .HexToAddress (strategy ),
191193 AVSAddress : alloc .AvsAddress ,
@@ -197,6 +199,20 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
197199 continue
198200 }
199201
202+ currentShares := slashableSharesMap [gethcommon .HexToAddress (strategy )][getUniqueKey (alloc .AvsAddress , alloc .OperatorSetId )]
203+ currentSharesPercentage := getSharePercentage (currentShares , strategyShares )
204+
205+ newMagnitudeBigInt := big .NewInt (0 )
206+ if alloc .PendingDiff .Cmp (big .NewInt (0 )) != 0 {
207+ newMagnitudeBigInt = big .NewInt (0 ).Add (alloc .CurrentMagnitude , alloc .PendingDiff )
208+ }
209+
210+ newShares , newSharesPercentage := getSharesFromMagnitude (
211+ strategyShares ,
212+ newMagnitudeBigInt .Uint64 (),
213+ totalMagnitude ,
214+ )
215+
200216 // Add the operator set to the registered list
201217 slashableMagnitudeHolders = append (slashableMagnitudeHolders , SlashableMagnitudesHolder {
202218 StrategyAddress : gethcommon .HexToAddress (strategy ),
0 commit comments