Skip to content

Commit 4e015ac

Browse files
committed
fix: update handling (changeover completed checks)
1 parent 9109c78 commit 4e015ac

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

x/ccv/consumer/keeper/changeover.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// ChangeoverIsComplete returns whether the standalone to consumer changeover process is complete.
1010
func (k Keeper) ChangeoverIsComplete(ctx sdk.Context) bool {
1111
if !k.IsPrevStandaloneChain(ctx) {
12-
panic("ChangeoverIsComplete should only be called on previously standalone consumers")
12+
return true
1313
}
1414
return ctx.BlockHeight() >= k.FirstConsumerHeight(ctx)
1515
}

x/ccv/consumer/keeper/validators.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ func (k Keeper) IterateValidators(context.Context, func(index int64, validator s
8787
// Validator - unimplemented on CCV keeper but implemented on standalone keeper
8888
func (k Keeper) Validator(sdkCtx context.Context, addr sdk.ValAddress) (stakingtypes.ValidatorI, error) {
8989
ctx := sdk.UnwrapSDKContext(sdkCtx)
90-
if k.IsPrevStandaloneChain(ctx) && k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
90+
if k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
9191
return k.standaloneStakingKeeper.Validator(ctx, addr)
9292
}
9393

94-
panic("unimplemented on CCV keeper")
94+
return stakingtypes.Validator{}, errors.New("unimplemented on CCV keeper")
9595
}
9696

9797
// IsJailed returns the outstanding slashing flag for the given validator address
@@ -184,7 +184,7 @@ func (k Keeper) Jail(context.Context, sdk.ConsAddress) error { return nil }
184184
// This method should be a no-op for consumer chains that launched with the CCV module first.
185185
func (k Keeper) Unjail(sdkCtx context.Context, addr sdk.ConsAddress) error {
186186
ctx := sdk.UnwrapSDKContext(sdkCtx)
187-
if k.IsPrevStandaloneChain(ctx) && k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
187+
if k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
188188
return k.standaloneStakingKeeper.Unjail(ctx, addr)
189189
}
190190
return nil
@@ -193,10 +193,10 @@ func (k Keeper) Unjail(sdkCtx context.Context, addr sdk.ConsAddress) error {
193193
// Delegation - unimplemented on CCV keeper but implemented on standalone keeper
194194
func (k Keeper) Delegation(sdkCtx context.Context, addr sdk.AccAddress, valAddr sdk.ValAddress) (stakingtypes.DelegationI, error) {
195195
ctx := sdk.UnwrapSDKContext(sdkCtx)
196-
if k.IsPrevStandaloneChain(ctx) && k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
196+
if k.ChangeoverIsComplete(ctx) && k.standaloneStakingKeeper != nil {
197197
return k.standaloneStakingKeeper.Delegation(ctx, addr, valAddr)
198198
}
199-
panic("unimplemented on CCV keeper")
199+
return stakingtypes.Delegation{}, errors.New("unimplemented on CCV keeper")
200200
}
201201

202202
// MaxValidators - unimplemented on CCV keeper

0 commit comments

Comments
 (0)