diff --git a/x/lightclient/types/errors.go b/x/lightclient/types/errors.go index fe53871821..b4f5d93d94 100644 --- a/x/lightclient/types/errors.go +++ b/x/lightclient/types/errors.go @@ -13,4 +13,5 @@ var ( ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1108, "block header not found") ErrProofVerificationFailed = errorsmod.Register(ModuleName, 1109, "proof verification failed") ErrInvalidHeight = errorsmod.Register(ModuleName, 1110, "invalid height") + ErrInvalidBlockHeader = errorsmod.Register(ModuleName, 1111, "invalid block header") ) diff --git a/x/observer/keeper/msg_server_vote_block_header.go b/x/observer/keeper/msg_server_vote_block_header.go index c14c56a06b..a9050e7ebc 100644 --- a/x/observer/keeper/msg_server_vote_block_header.go +++ b/x/observer/keeper/msg_server_vote_block_header.go @@ -5,6 +5,7 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -26,7 +27,7 @@ func (k msgServer) VoteBlockHeader(goCtx context.Context, msg *types.MsgVoteBloc // check the new block header is valid parentHash, err := k.lightclientKeeper.CheckNewBlockHeader(ctx, msg.ChainId, msg.BlockHash, msg.Height, msg.Header) if err != nil { - return nil, cosmoserrors.Wrap(types.ErrInvalidBlockHeader, err.Error()) + return nil, cosmoserrors.Wrap(lightclienttypes.ErrInvalidBlockHeader, err.Error()) } // add vote to ballot diff --git a/x/observer/keeper/msg_server_vote_block_header_test.go b/x/observer/keeper/msg_server_vote_block_header_test.go index ae89bd984b..161d26ff5a 100644 --- a/x/observer/keeper/msg_server_vote_block_header_test.go +++ b/x/observer/keeper/msg_server_vote_block_header_test.go @@ -12,6 +12,7 @@ import ( keepertest "github.com/zeta-chain/zetacore/testutil/keeper" mocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/observer" "github.com/zeta-chain/zetacore/testutil/sample" + lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" "github.com/zeta-chain/zetacore/x/observer/keeper" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -118,7 +119,7 @@ func TestMsgServer_VoteBlockHeader(t *testing.T) { Header: proofs.HeaderData{}, }) - require.ErrorIs(t, err, types.ErrInvalidBlockHeader) + require.ErrorIs(t, err, lightclienttypes.ErrInvalidBlockHeader) }) t.Run("can create a new ballot, vote and finalize", func(t *testing.T) { diff --git a/x/observer/types/errors.go b/x/observer/types/errors.go index 5e90558d34..1c03f9bbf9 100644 --- a/x/observer/types/errors.go +++ b/x/observer/types/errors.go @@ -20,19 +20,17 @@ var ( ErrKeygenBlockTooLow = errorsmod.Register(ModuleName, 1114, "please set a block number at-least 10 blocks higher than the current block number") ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "keygen already completed") - ErrBlockHeaderVerificationDisabled = errorsmod.Register(ModuleName, 1122, "block header verification is disabled") - ErrLastObserverCountNotFound = errorsmod.Register(ModuleName, 1123, "last observer count not found") - ErrUpdateObserver = errorsmod.Register(ModuleName, 1124, "unable to update observer") - ErrNodeAccountNotFound = errorsmod.Register(ModuleName, 1125, "node account not found") - ErrInvalidChainParams = errorsmod.Register(ModuleName, 1126, "invalid chain params") - ErrChainParamsNotFound = errorsmod.Register(ModuleName, 1127, "chain params not found") - ErrParamsMinObserverDelegation = errorsmod.Register(ModuleName, 1128, "min observer delegation cannot be nil") - ErrMinDelegationNotFound = errorsmod.Register(ModuleName, 1129, "min delegation not found") - ErrObserverSetNotFound = errorsmod.Register(ModuleName, 1130, "observer set not found") - ErrTssNotFound = errorsmod.Register(ModuleName, 1131, "tss not found") + ErrLastObserverCountNotFound = errorsmod.Register(ModuleName, 1123, "last observer count not found") + ErrUpdateObserver = errorsmod.Register(ModuleName, 1124, "unable to update observer") + ErrNodeAccountNotFound = errorsmod.Register(ModuleName, 1125, "node account not found") + ErrInvalidChainParams = errorsmod.Register(ModuleName, 1126, "invalid chain params") + ErrChainParamsNotFound = errorsmod.Register(ModuleName, 1127, "chain params not found") + ErrParamsMinObserverDelegation = errorsmod.Register(ModuleName, 1128, "min observer delegation cannot be nil") + ErrMinDelegationNotFound = errorsmod.Register(ModuleName, 1129, "min delegation not found") + ErrObserverSetNotFound = errorsmod.Register(ModuleName, 1130, "observer set not found") + ErrTssNotFound = errorsmod.Register(ModuleName, 1131, "tss not found") ErrInboundDisabled = errorsmod.Register(ModuleName, 1132, "inbound tx processing is disabled") ErrInvalidZetaCoinTypes = errorsmod.Register(ModuleName, 1133, "invalid zeta coin types") ErrNotObserver = errorsmod.Register(ModuleName, 1134, "sender is not an observer") - ErrInvalidBlockHeader = errorsmod.Register(ModuleName, 1135, "invalid block header") )