From 489746160a2d4657480e741902a52f5dbabf1bc2 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Fri, 7 Jul 2023 13:22:52 +0100 Subject: [PATCH] quietly ignore nil validator updates, without erroring, to avoid blocking icq (#488) --- x/interchainstaking/keeper/keeper.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x/interchainstaking/keeper/keeper.go b/x/interchainstaking/keeper/keeper.go index b791291fb..c1f6bb5d3 100644 --- a/x/interchainstaking/keeper/keeper.go +++ b/x/interchainstaking/keeper/keeper.go @@ -235,6 +235,13 @@ func (k *Keeper) SetValidatorsForZone(ctx sdk.Context, data []byte, icqQuery icq } func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []byte) error { + if data == nil { + k.Logger(ctx).Error("expected validator state, got nil") + // return nil here, as if we receive nil we fail to unmarshal (as nil validators are invalid), + // so we can never hope to resolve this query. Possibly received a valset update from a + // different chain. + return nil + } validator, err := k.UnmarshalValidator(data) if err != nil { k.Logger(ctx).Error("unable to unmarshal validator info for zone", "zone", zone.ChainId, "err", err)