diff --git a/app/app.go b/app/app.go index fdcd402ed8..c401b2f243 100644 --- a/app/app.go +++ b/app/app.go @@ -332,6 +332,7 @@ func New( keys[zetaObserverModuleTypes.MemStoreKey], app.GetSubspace(zetaObserverModuleTypes.ModuleName), &stakingKeeper, + app.SlashingKeeper, ) // register the staking hooks diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index ae13471986..d4d271afa1 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -51095,6 +51095,8 @@ definitions: type: object observerMsgUpdateKeygenResponse: type: object + observerMsgUpdateObserverResponse: + type: object observerNode: type: object properties: @@ -51158,6 +51160,13 @@ definitions: type: string is_supported: type: boolean + observerObserverUpdateReason: + type: string + enum: + - EmptyObserverUpdateReason + - Tombstoned + - AdminUpdate + default: EmptyObserverUpdateReason observerPolicy_Type: type: string enum: diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index 5373e16993..d931b66fac 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -14,6 +14,17 @@ message MsgAddObserver { } ``` +## MsgUpdateObserver + +```proto +message MsgUpdateObserver { + string creator = 1; + string old_observer_address = 2; + string new_observer_address = 3; + ObserverUpdateReason update_reason = 4; +} +``` + ## MsgUpdateCoreParams UpdateCoreParams updates core parameters for a specific chain. Core parameters include diff --git a/proto/observer/observer.proto b/proto/observer/observer.proto index 2ad3ffb3bf..f57185d0bb 100644 --- a/proto/observer/observer.proto +++ b/proto/observer/observer.proto @@ -15,6 +15,13 @@ enum ObservationType { TSSKeySign = 4; } +enum ObserverUpdateReason { + option (gogoproto.goproto_enum_stringer) = true; + EmptyObserverUpdateReason = 0; + Tombstoned = 1; + AdminUpdate = 2; +} + message ObserverMapper { string index = 1; common.Chain observer_chain = 2; diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto index 441fa01b8b..f5a3fa4259 100644 --- a/proto/observer/tx.proto +++ b/proto/observer/tx.proto @@ -13,6 +13,7 @@ option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; // Msg defines the Msg service. service Msg { rpc AddObserver(MsgAddObserver) returns (MsgAddObserverResponse); + rpc UpdateObserver(MsgUpdateObserver) returns (MsgUpdateObserverResponse); rpc UpdateCoreParams(MsgUpdateCoreParams) returns (MsgUpdateCoreParamsResponse); rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse); rpc UpdateCrosschainFlags(MsgUpdateCrosschainFlags) returns (MsgUpdateCrosschainFlagsResponse); @@ -20,6 +21,14 @@ service Msg { rpc AddBlockHeader(MsgAddBlockHeader) returns (MsgAddBlockHeaderResponse); } +message MsgUpdateObserver { + string creator = 1; + string old_observer_address = 2; + string new_observer_address = 3; + ObserverUpdateReason update_reason = 4; +} +message MsgUpdateObserverResponse {} + message MsgAddBlockHeader { string creator = 1; int64 chain_id = 2; diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index f96dc7e87c..4d8a4e2062 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -54,6 +54,7 @@ func CrosschainKeeperWithMocks( db, stateStore, sdkKeepers.StakingKeeper, + sdkKeepers.SlashingKeeper, sdkKeepers.ParamsKeeper, ) fungiblekeeperTmp := initFungibleKeeper( diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index 6f26a2733e..b4caebbc88 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -80,6 +80,7 @@ func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*ke db, stateStore, sdkKeepers.StakingKeeper, + sdkKeepers.SlashingKeeper, sdkKeepers.ParamsKeeper, ) zetaKeepers := ZetaKeepers{ diff --git a/testutil/keeper/keeper.go b/testutil/keeper/keeper.go index 2868f86941..b67e310544 100644 --- a/testutil/keeper/keeper.go +++ b/testutil/keeper/keeper.go @@ -5,6 +5,9 @@ import ( "testing" "time" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -81,6 +84,7 @@ type SDKKeepers struct { AuthKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper EvmKeeper *evmkeeper.Keeper } @@ -199,6 +203,13 @@ func StakingKeeper( ) } +// SlashingKeeper instantiates a slashing keeper for testing purposes +func SlashingKeeper(cdc codec.Codec, db *tmdb.MemDB, ss store.CommitMultiStore, stakingKeeper stakingkeeper.Keeper, paramKeeper paramskeeper.Keeper) slashingkeeper.Keeper { + storeKey := sdk.NewKVStoreKey(slashingtypes.StoreKey) + ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + return slashingkeeper.NewKeeper(cdc, storeKey, stakingKeeper, paramKeeper.Subspace(slashingtypes.ModuleName)) +} + // DistributionKeeper instantiates a distribution keeper for testing purposes func DistributionKeeper( cdc codec.Codec, @@ -319,7 +330,7 @@ func NewSDKKeepers( stakingKeeper := StakingKeeper(cdc, db, ss, authKeeper, bankKeeper, paramsKeeper) feeMarketKeeper := FeeMarketKeeper(cdc, db, ss, paramsKeeper) evmKeeper := EVMKeeper(cdc, db, ss, authKeeper, bankKeeper, stakingKeeper, feeMarketKeeper, paramsKeeper) - + slashingKeeper := SlashingKeeper(cdc, db, ss, stakingKeeper, paramsKeeper) return SDKKeepers{ ParamsKeeper: paramsKeeper, AuthKeeper: authKeeper, @@ -327,6 +338,7 @@ func NewSDKKeepers( StakingKeeper: stakingKeeper, FeeMarketKeeper: feeMarketKeeper, EvmKeeper: evmKeeper, + SlashingKeeper: slashingKeeper, } } diff --git a/testutil/keeper/observer.go b/testutil/keeper/observer.go index 417decd0ca..946dac84c6 100644 --- a/testutil/keeper/observer.go +++ b/testutil/keeper/observer.go @@ -3,6 +3,8 @@ package keeper import ( "testing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -20,6 +22,7 @@ func initObserverKeeper( db *tmdb.MemDB, ss store.CommitMultiStore, stakingKeeper stakingkeeper.Keeper, + slashingKeeper slashingkeeper.Keeper, paramKeeper paramskeeper.Keeper, ) *keeper.Keeper { storeKey := sdk.NewKVStoreKey(types.StoreKey) @@ -33,6 +36,7 @@ func initObserverKeeper( memKey, paramKeeper.Subspace(types.ModuleName), stakingKeeper, + slashingKeeper, ) } @@ -68,6 +72,7 @@ func ObserverKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { memStoreKey, sdkKeepers.ParamsKeeper.Subspace(types.ModuleName), sdkKeepers.StakingKeeper, + sdkKeepers.SlashingKeeper, ) k.SetParams(ctx, types.DefaultParams()) diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 2eef2b61b0..e28f191476 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -53,6 +53,10 @@ func AccAddress() string { return sdk.AccAddress(addr).String() } +func ConsAddress() sdk.ConsAddress { + return sdk.ConsAddress(PubKey(newRandFromSeed(1)).Address()) +} + // ValAddress returns a sample validator operator address func ValAddress(r *rand.Rand) sdk.ValAddress { return sdk.ValAddress(PubKey(r).Address()) diff --git a/x/emissions/types/events.pb.go b/x/emissions/types/events.pb.go index a1a96178cc..201211e96f 100644 --- a/x/emissions/types/events.pb.go +++ b/x/emissions/types/events.pb.go @@ -51,8 +51,8 @@ func (EmissionType) EnumDescriptor() ([]byte, []int) { } type ObserverEmission struct { - EmissionType EmissionType `protobuf:"varint,1,opt,name=emission_type,json=emissionType,proto3,enum=zetachain.zetacore.emissions.EmissionType" json:"emission_type,omitempty"` - ObserverAddress string `protobuf:"bytes,2,opt,name=observer_address,json=observerAddress,proto3" json:"observer_address,omitempty"` + EmissionType EmissionType `protobuf:"varint,1,opt,name=emission_type,json=emissionType,proto3,enum=zetachain.zetacore.emissions.EmissionType" json:"emission_type,omitempty"` + ObserverAddress string `protobuf:"bytes,2,opt,name=observer_address,json=observerAddress,proto3" json:"observer_address,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` } diff --git a/x/observer/client/cli/cli_node_account.go b/x/observer/client/cli/cli_node_account.go index ae745e26a1..199cf87e70 100644 --- a/x/observer/client/cli/cli_node_account.go +++ b/x/observer/client/cli/cli_node_account.go @@ -44,7 +44,7 @@ func CmdListNodeAccount() *cobra.Command { func CmdShowNodeAccount() *cobra.Command { cmd := &cobra.Command{ - Use: "show-node-account [index]", + Use: "show-node-account [operator_address]", Short: "shows a NodeAccount", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/observer/client/cli/tx.go b/x/observer/client/cli/tx.go index 5b94a365a7..dd886894aa 100644 --- a/x/observer/client/cli/tx.go +++ b/x/observer/client/cli/tx.go @@ -26,6 +26,7 @@ func GetTxCmd() *cobra.Command { CmdUpdateCrosschainFlags(), CmdUpdateKeygen(), CmdAddBlameVote(), + CmdUpdateObserver(), CmdEncode(), ) diff --git a/x/observer/client/cli/tx_update_observer.go b/x/observer/client/cli/tx_update_observer.go new file mode 100644 index 0000000000..ed2b377c5f --- /dev/null +++ b/x/observer/client/cli/tx_update_observer.go @@ -0,0 +1,62 @@ +package cli + +import ( + "strconv" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdUpdateObserver() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-observer [old-observer-address] [new-observer-address] [update-reason]", + Short: "Broadcast message add-observer", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + updateReasonInt, err := strconv.ParseInt(args[2], 10, 32) + if err != nil { + return err + } + updateReason, err := ParseUpdateReason(int32(updateReasonInt)) + if err != nil { + return err + } + msg := types.NewMsgUpdateObserver( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + updateReason, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func ParseUpdateReason(i int32) (types.ObserverUpdateReason, error) { + if _, ok := types.ObserverUpdateReason_name[i]; ok { + switch i { + case 1: + return types.ObserverUpdateReason_Tombstoned, nil + case 2: + return types.ObserverUpdateReason_AdminUpdate, nil + } + } + return types.ObserverUpdateReason_Tombstoned, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid update reason") +} diff --git a/x/observer/keeper/hooks.go b/x/observer/keeper/hooks.go index e81f9c38aa..2659eeb95c 100644 --- a/x/observer/keeper/hooks.go +++ b/x/observer/keeper/hooks.go @@ -73,7 +73,6 @@ func (k Keeper) CleanSlashedValidator(ctx sdk.Context, valAddress sdk.ValAddress if !found { return types.ErrNotValidator } - accAddress, err := types.GetAccAddressFromOperatorAddress(valAddress.String()) if err != nil { return err diff --git a/x/observer/keeper/keeper.go b/x/observer/keeper/keeper.go index 10c8c9e21f..ddece0be3b 100644 --- a/x/observer/keeper/keeper.go +++ b/x/observer/keeper/keeper.go @@ -14,20 +14,30 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - stakingKeeper types.StakingKeeper + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + paramstore paramtypes.Subspace + stakingKeeper types.StakingKeeper + slashingKeeper types.SlashingKeeper } ) +func (k Keeper) GetSlashingKeeper() types.SlashingKeeper { + return k.slashingKeeper +} + +func (k Keeper) GetStakingKeeper() types.StakingKeeper { + return k.stakingKeeper +} + func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, stakingKeeper types.StakingKeeper, + slashinKeeper types.SlashingKeeper, ) *Keeper { // set KeyTable if it has not already been set @@ -36,11 +46,12 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - stakingKeeper: stakingKeeper, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + stakingKeeper: stakingKeeper, + slashingKeeper: slashinKeeper, } } diff --git a/x/observer/keeper/keeper_test.go b/x/observer/keeper/keeper_test.go index f876c90563..7c13b7b0f2 100644 --- a/x/observer/keeper/keeper_test.go +++ b/x/observer/keeper/keeper_test.go @@ -3,6 +3,8 @@ package keeper import ( "testing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" @@ -42,6 +44,7 @@ func SetupKeeper(t testing.TB) (*Keeper, sdk.Context) { memStoreKey, paramsSubspace, stakingkeeper.Keeper{}, + slashingkeeper.Keeper{}, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, nil) diff --git a/x/observer/keeper/keeper_utils.go b/x/observer/keeper/keeper_utils.go index 8424985d31..978d1de541 100644 --- a/x/observer/keeper/keeper_utils.go +++ b/x/observer/keeper/keeper_utils.go @@ -85,7 +85,23 @@ func (k Keeper) IsValidator(ctx sdk.Context, creator string) error { return types.ErrValidatorStatus } return nil +} + +func (k Keeper) IsOperatorTombstoned(ctx sdk.Context, creator string) (bool, error) { + valAddress, err := types.GetOperatorAddressFromAccAddress(creator) + if err != nil { + return false, err + } + validator, found := k.stakingKeeper.GetValidator(ctx, valAddress) + if !found { + return false, types.ErrNotValidator + } + consAddress, err := validator.GetConsAddr() + if err != nil { + return false, err + } + return k.slashingKeeper.IsTombstoned(ctx, consAddress), nil } func (k Keeper) CheckObserverDelegation(ctx sdk.Context, accAddress string, chain *common.Chain) error { diff --git a/x/observer/keeper/msg_server_add_observer.go b/x/observer/keeper/msg_server_add_observer.go new file mode 100644 index 0000000000..d15da59040 --- /dev/null +++ b/x/observer/keeper/msg_server_add_observer.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "context" + "math" + + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) (*types.MsgAddObserverResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) { + return &types.MsgAddObserverResponse{}, types.ErrNotAuthorizedPolicy + } + pubkey, err := common.NewPubKey(msg.ZetaclientGranteePubkey) + if err != nil { + return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) + } + granteeAddress, err := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) + if err != nil { + return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) + } + k.DisableInboundOnly(ctx) + // AddNodeAccountOnly flag usage + // True: adds observer into the Node Account list but returns without adding to the observer list + // False: adds observer to the observer list, and not the node account list + // Inbound is disabled in both cases and needs to be enabled manually using an admin TX + if msg.AddNodeAccountOnly { + pubkeySet := common.PubKeySet{Secp256k1: pubkey, Ed25519: ""} + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: msg.ObserverAddress, + GranteeAddress: granteeAddress.String(), + GranteePubkey: &pubkeySet, + NodeStatus: types.NodeStatus_Active, + }) + k.SetKeygen(ctx, types.Keygen{BlockNumber: math.MaxInt64}) + return &types.MsgAddObserverResponse{}, nil + } + + observerMappers := k.GetAllObserverMappers(ctx) + totalObserverCountCurrentBlock := uint64(0) + for _, mapper := range observerMappers { + mapper.ObserverList = append(mapper.ObserverList, msg.ObserverAddress) + totalObserverCountCurrentBlock += uint64(len(mapper.ObserverList)) + k.SetObserverMapper(ctx, mapper) + } + k.SetLastObserverCount(ctx, &types.LastObserverCount{Count: totalObserverCountCurrentBlock}) + EmitEventAddObserver(ctx, totalObserverCountCurrentBlock, msg.ObserverAddress, granteeAddress.String(), msg.ZetaclientGranteePubkey) + return &types.MsgAddObserverResponse{}, nil +} diff --git a/x/observer/keeper/msg_server_update_observer.go b/x/observer/keeper/msg_server_update_observer.go new file mode 100644 index 0000000000..99aa802ca2 --- /dev/null +++ b/x/observer/keeper/msg_server_update_observer.go @@ -0,0 +1,94 @@ +package keeper + +import ( + "context" + "fmt" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k msgServer) UpdateObserver(goCtx context.Context, msg *types.MsgUpdateObserver) (*types.MsgUpdateObserverResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + chains := k.GetParams(ctx).GetSupportedChains() + for _, chain := range chains { + if !k.IsAuthorized(ctx, msg.OldObserverAddress, chain) { + return nil, errorsmod.Wrap(types.ErrNotAuthorized, fmt.Sprintf("Observer address is not authorized for chain : %s", chain.String())) + } + } + + ok, err := k.CheckUpdateReason(ctx, msg) + if err != nil { + return nil, errorsmod.Wrap(types.ErrUpdateObserver, err.Error()) + } + if !ok { + return nil, errorsmod.Wrap(types.ErrUpdateObserver, fmt.Sprintf("Unable to update observer with update reason : %s", msg.UpdateReason)) + } + + // Update all mappers so that ballots can be created for the new observer address + k.UpdateObserverAddress(ctx, msg.OldObserverAddress, msg.NewObserverAddress) + + // Update the node account with the new operator address + nodeAccount, found := k.GetNodeAccount(ctx, msg.OldObserverAddress) + if !found { + return nil, errorsmod.Wrap(types.ErrNodeAccountNotFound, fmt.Sprintf("Observer node account not found : %s", msg.Creator)) + } + newNodeAccount := nodeAccount + newNodeAccount.Operator = msg.NewObserverAddress + + // Remove an old node account, so that number of node accounts remains the same as the number of observers in the system + k.RemoveNodeAccount(ctx, msg.OldObserverAddress) + k.SetNodeAccount(ctx, newNodeAccount) + + // Check LastBlockObserver count just to be safe + observerMappers := k.GetAllObserverMappers(ctx) + totalObserverCountCurrentBlock := uint64(0) + for _, mapper := range observerMappers { + totalObserverCountCurrentBlock += uint64(len(mapper.ObserverList)) + } + lastBlockCount, found := k.GetLastObserverCount(ctx) + if !found { + return nil, errorsmod.Wrap(types.ErrLastObserverCountNotFound, fmt.Sprintf("Observer count not found")) + } + if lastBlockCount.Count != totalObserverCountCurrentBlock { + return nil, errorsmod.Wrap(types.ErrUpdateObserver, fmt.Sprintf("Observer count mismatch")) + } + return &types.MsgUpdateObserverResponse{}, nil +} + +func (k Keeper) CheckUpdateReason(ctx sdk.Context, msg *types.MsgUpdateObserver) (bool, error) { + switch msg.UpdateReason { + case types.ObserverUpdateReason_Tombstoned: + { + if msg.Creator != msg.OldObserverAddress { + return false, errorsmod.Wrap(types.ErrUpdateObserver, fmt.Sprintf("Creator address and old observer address need to be same for updating tombstoned observer")) + } + return k.IsOperatorTombstoned(ctx, msg.Creator) + } + case types.ObserverUpdateReason_AdminUpdate: + { + if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) { + return false, types.ErrNotAuthorizedPolicy + } + return true, nil + } + } + return false, nil +} + +func (k Keeper) UpdateObserverAddress(ctx sdk.Context, oldObserverAddress, newObserverAddress string) { + observerMappers := k.GetAllObserverMappers(ctx) + for _, om := range observerMappers { + UpdateObserverList(om.ObserverList, oldObserverAddress, newObserverAddress) + } +} + +func UpdateObserverList(list []string, oldObserverAddresss, newObserverAddress string) { + for i, observer := range list { + if observer == oldObserverAddresss { + list[i] = newObserverAddress + } + } +} diff --git a/x/observer/keeper/msg_server_update_observer_test.go b/x/observer/keeper/msg_server_update_observer_test.go new file mode 100644 index 0000000000..16a0344674 --- /dev/null +++ b/x/observer/keeper/msg_server_update_observer_test.go @@ -0,0 +1,311 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/stretchr/testify/assert" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/keeper" + "github.com/zeta-chain/zetacore/x/observer/types" + "math/rand" + "testing" + "time" +) + +func TestMsgServer_UpdateObserver(t *testing.T) { + t.Run("update tombstoned observer", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: true, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: accAddressOfValidator.String(), + }) + + k.SetLastObserverCount(ctx, &types.LastObserverCount{ + Count: count, + }) + + newOperatorAddress := sample.AccAddress() + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: accAddressOfValidator.String(), + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_Tombstoned, + }) + assert.NoError(t, err) + acc, found := k.GetNodeAccount(ctx, newOperatorAddress) + assert.True(t, found) + assert.Equal(t, newOperatorAddress, acc.Operator) + }) + t.Run("unable to update non-tombstoned observer with update reason tombstoned", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: false, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: accAddressOfValidator.String(), + }) + + k.SetLastObserverCount(ctx, &types.LastObserverCount{ + Count: count, + }) + + newOperatorAddress := sample.AccAddress() + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: accAddressOfValidator.String(), + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_Tombstoned, + }) + assert.ErrorIs(t, err, types.ErrUpdateObserver) + }) + t.Run("unable to update observer with no node account", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: true, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + + k.SetLastObserverCount(ctx, &types.LastObserverCount{ + Count: count, + }) + + newOperatorAddress := sample.AccAddress() + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: accAddressOfValidator.String(), + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_Tombstoned, + }) + assert.ErrorIs(t, err, types.ErrNodeAccountNotFound) + }) + t.Run("unable to update observer when last observer count is missing", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: true, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: accAddressOfValidator.String(), + }) + + newOperatorAddress := sample.AccAddress() + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: accAddressOfValidator.String(), + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_Tombstoned, + }) + assert.ErrorIs(t, err, types.ErrLastObserverCountNotFound) + }) + t.Run("update observer using admin policy", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + + setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group2) + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: false, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: accAddressOfValidator.String(), + }) + + newOperatorAddress := sample.AccAddress() + + k.SetLastObserverCount(ctx, &types.LastObserverCount{ + Count: count, + }) + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: admin, + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }) + assert.NoError(t, err) + acc, found := k.GetNodeAccount(ctx, newOperatorAddress) + assert.True(t, found) + assert.Equal(t, newOperatorAddress, acc.Operator) + }) + t.Run("fail to update observer using regular account and update type admin", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + srv := keeper.NewMsgServerImpl(*k) + + // #nosec G404 test purpose - weak randomness is not an issue here + r := rand.New(rand.NewSource(9)) + + // Set validator in the store + validator := sample.Validator(t, r) + k.GetStakingKeeper().SetValidator(ctx, validator) + consAddress, err := validator.GetConsAddr() + assert.NoError(t, err) + k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ + Address: consAddress.String(), + StartHeight: 0, + JailedUntil: ctx.BlockHeader().Time.Add(1000000 * time.Second), + Tombstoned: false, + MissedBlocksCounter: 1, + }) + + chains := k.GetParams(ctx).GetSupportedChains() + accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) + assert.NoError(t, err) + count := uint64(0) + for _, chain := range chains { + k.SetObserverMapper(ctx, &types.ObserverMapper{ + ObserverChain: chain, + ObserverList: []string{accAddressOfValidator.String()}, + }) + count += 1 + } + + k.SetNodeAccount(ctx, types.NodeAccount{ + Operator: accAddressOfValidator.String(), + }) + + newOperatorAddress := sample.AccAddress() + + k.SetLastObserverCount(ctx, &types.LastObserverCount{ + Count: count, + }) + + _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + OldObserverAddress: accAddressOfValidator.String(), + NewObserverAddress: newOperatorAddress, + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }) + assert.ErrorIs(t, err, types.ErrUpdateObserver) + }) +} diff --git a/x/observer/keeper/observer_mapper.go b/x/observer/keeper/observer_mapper.go index e3c2e58d06..ca42fb3618 100644 --- a/x/observer/keeper/observer_mapper.go +++ b/x/observer/keeper/observer_mapper.go @@ -3,13 +3,9 @@ package keeper import ( "context" "fmt" - "math" - - cosmoserrors "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" @@ -91,47 +87,6 @@ func (k Keeper) GetAllObserverMappersForAddress(ctx sdk.Context, address string) // AddObserver adds in a new observer to the store.It can be executed using an admin policy account // Once added, the function also resets keygen and pauses inbound so that a new TSS can be generated. -func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) (*types.MsgAddObserverResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) { - return &types.MsgAddObserverResponse{}, types.ErrNotAuthorizedPolicy - } - pubkey, err := common.NewPubKey(msg.ZetaclientGranteePubkey) - if err != nil { - return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) - } - granteeAddress, err := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) - if err != nil { - return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) - } - k.DisableInboundOnly(ctx) - // AddNodeAccountOnly flag usage - // True: adds observer into the Node Account list but returns without adding to the observer list - // False: adds observer to the observer list, and not the node account list - // Inbound is disabled in both cases and needs to be enabled manually using an admin TX - if msg.AddNodeAccountOnly { - pubkeySet := common.PubKeySet{Secp256k1: pubkey, Ed25519: ""} - k.SetNodeAccount(ctx, types.NodeAccount{ - Operator: msg.ObserverAddress, - GranteeAddress: granteeAddress.String(), - GranteePubkey: &pubkeySet, - NodeStatus: types.NodeStatus_Active, - }) - k.SetKeygen(ctx, types.Keygen{BlockNumber: math.MaxInt64}) - return &types.MsgAddObserverResponse{}, nil - } - - observerMappers := k.GetAllObserverMappers(ctx) - totalObserverCountCurrentBlock := uint64(0) - for _, mapper := range observerMappers { - mapper.ObserverList = append(mapper.ObserverList, msg.ObserverAddress) - totalObserverCountCurrentBlock += uint64(len(mapper.ObserverList)) - k.SetObserverMapper(ctx, mapper) - } - k.SetLastObserverCount(ctx, &types.LastObserverCount{Count: totalObserverCountCurrentBlock}) - EmitEventAddObserver(ctx, totalObserverCountCurrentBlock, msg.ObserverAddress, granteeAddress.String(), msg.ZetaclientGranteePubkey) - return &types.MsgAddObserverResponse{}, nil -} //Queries diff --git a/x/observer/types/errors.go b/x/observer/types/errors.go index 3767712e34..15a28bd54b 100644 --- a/x/observer/types/errors.go +++ b/x/observer/types/errors.go @@ -25,9 +25,12 @@ var ( ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "keygen already completed") ErrNotAuthorized = errorsmod.Register(ModuleName, 1116, "not authorized") - ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1117, "block header not found") - ErrUnrecognizedBlockHeader = errorsmod.Register(ModuleName, 1118, "unrecognized block header") - ErrBlockAlreadyExist = errorsmod.Register(ModuleName, 1119, "block already exists") - ErrNoParentHash = errorsmod.Register(ModuleName, 1120, "no parent hash") - ErrInvalidTimestamp = errorsmod.Register(ModuleName, 1121, "invalid timestamp") + ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1117, "block header not found") + ErrUnrecognizedBlockHeader = errorsmod.Register(ModuleName, 1118, "unrecognized block header") + ErrBlockAlreadyExist = errorsmod.Register(ModuleName, 1119, "block already exists") + ErrNoParentHash = errorsmod.Register(ModuleName, 1120, "no parent hash") + ErrInvalidTimestamp = errorsmod.Register(ModuleName, 1121, "invalid timestamp") + ErrLastObserverCountNotFound = errorsmod.Register(ModuleName, 1122, "last observer count not found") + ErrUpdateObserver = errorsmod.Register(ModuleName, 1123, "unable to update observer") + ErrNodeAccountNotFound = errorsmod.Register(ModuleName, 1124, "node account not found") ) diff --git a/x/observer/types/expected_keepers.go b/x/observer/types/expected_keepers.go index a2e71f26c0..d6fa8010db 100644 --- a/x/observer/types/expected_keepers.go +++ b/x/observer/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -22,6 +23,12 @@ type StakingKeeper interface { GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) + SetValidator(ctx sdk.Context, validator stakingtypes.Validator) +} + +type SlashingKeeper interface { + IsTombstoned(ctx sdk.Context, addr sdk.ConsAddress) bool + SetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) } type StakingHooks interface { diff --git a/x/observer/types/message_update_observer.go b/x/observer/types/message_update_observer.go new file mode 100644 index 0000000000..9bab5e2766 --- /dev/null +++ b/x/observer/types/message_update_observer.go @@ -0,0 +1,60 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdateObserver = "update_observer" + +var _ sdk.Msg = &MsgUpdateObserver{} + +func NewMsgUpdateObserver(creator string, oldObserverAddress string, newObserverAddress string, updateReason ObserverUpdateReason) *MsgUpdateObserver { + return &MsgUpdateObserver{ + Creator: creator, + OldObserverAddress: oldObserverAddress, + NewObserverAddress: newObserverAddress, + UpdateReason: updateReason, + } +} + +func (msg *MsgUpdateObserver) Route() string { + return RouterKey +} + +func (msg *MsgUpdateObserver) Type() string { + return TypeMsgUpdateObserver +} + +func (msg *MsgUpdateObserver) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateObserver) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateObserver) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + _, err = sdk.AccAddressFromBech32(msg.OldObserverAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid old observer address (%s)", err) + } + _, err = sdk.AccAddressFromBech32(msg.NewObserverAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid new observer address (%s)", err) + } + if msg.UpdateReason == ObserverUpdateReason_Tombstoned && msg.OldObserverAddress != msg.Creator { + return errorsmod.Wrapf(ErrUpdateObserver, "invalid old observer address (%s)", msg.OldObserverAddress) + } + return nil +} diff --git a/x/observer/types/message_update_observer_test.go b/x/observer/types/message_update_observer_test.go new file mode 100644 index 0000000000..1e2d716375 --- /dev/null +++ b/x/observer/types/message_update_observer_test.go @@ -0,0 +1,77 @@ +package types_test + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" + "testing" +) + +func TestNewMsgUpdateObserver(t *testing.T) { + tests := []struct { + name string + msg types.MsgUpdateObserver + err error + }{ + { + name: "invalid creator", + msg: types.MsgUpdateObserver{ + Creator: "invalid_address", + OldObserverAddress: sample.AccAddress(), + NewObserverAddress: sample.AccAddress(), + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid old observer address", + msg: types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + OldObserverAddress: "invalid_address", + NewObserverAddress: sample.AccAddress(), + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid new observer address", + msg: types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + OldObserverAddress: sample.AccAddress(), + NewObserverAddress: "invalid_address", + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "old observer address is not creator", + msg: types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + OldObserverAddress: sample.AccAddress(), + NewObserverAddress: sample.AccAddress(), + UpdateReason: types.ObserverUpdateReason_Tombstoned, + }, + err: types.ErrUpdateObserver, + }, + { + name: "valid message", + msg: types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + OldObserverAddress: sample.AccAddress(), + NewObserverAddress: sample.AccAddress(), + UpdateReason: types.ObserverUpdateReason_AdminUpdate, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/observer/types/observer.pb.go b/x/observer/types/observer.pb.go index 6fec7d7b3d..473388b771 100644 --- a/x/observer/types/observer.pb.go +++ b/x/observer/types/observer.pb.go @@ -59,6 +59,34 @@ func (ObservationType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_3004233a4a5969ce, []int{0} } +type ObserverUpdateReason int32 + +const ( + ObserverUpdateReason_EmptyObserverUpdateReason ObserverUpdateReason = 0 + ObserverUpdateReason_Tombstoned ObserverUpdateReason = 1 + ObserverUpdateReason_AdminUpdate ObserverUpdateReason = 2 +) + +var ObserverUpdateReason_name = map[int32]string{ + 0: "EmptyObserverUpdateReason", + 1: "Tombstoned", + 2: "AdminUpdate", +} + +var ObserverUpdateReason_value = map[string]int32{ + "EmptyObserverUpdateReason": 0, + "Tombstoned": 1, + "AdminUpdate": 2, +} + +func (x ObserverUpdateReason) String() string { + return proto.EnumName(ObserverUpdateReason_name, int32(x)) +} + +func (ObserverUpdateReason) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3004233a4a5969ce, []int{1} +} + type ObserverMapper struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` ObserverChain *common.Chain `protobuf:"bytes,2,opt,name=observer_chain,json=observerChain,proto3" json:"observer_chain,omitempty"` @@ -173,6 +201,7 @@ func (m *LastObserverCount) GetLastChangeHeight() int64 { func init() { proto.RegisterEnum("zetachain.zetacore.observer.ObservationType", ObservationType_name, ObservationType_value) + proto.RegisterEnum("zetachain.zetacore.observer.ObserverUpdateReason", ObserverUpdateReason_name, ObserverUpdateReason_value) proto.RegisterType((*ObserverMapper)(nil), "zetachain.zetacore.observer.ObserverMapper") proto.RegisterType((*LastObserverCount)(nil), "zetachain.zetacore.observer.LastObserverCount") } @@ -180,30 +209,34 @@ func init() { func init() { proto.RegisterFile("observer/observer.proto", fileDescriptor_3004233a4a5969ce) } var fileDescriptor_3004233a4a5969ce = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x51, 0xcf, 0x6a, 0x22, 0x31, - 0x1c, 0x9e, 0xe8, 0xec, 0x82, 0xd9, 0xd5, 0x1d, 0xb3, 0x96, 0x8a, 0x85, 0x20, 0xf6, 0x22, 0xa5, - 0x9d, 0x40, 0xdb, 0x27, 0x50, 0x4a, 0x2b, 0xb5, 0x08, 0xa3, 0x50, 0xe8, 0x45, 0x46, 0x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x8b, 0x62, 0xa9, 0x93, 0x94, 0x03, 0x4f, 0x39, 0x7d, 0x6d, 0xdc, 0x69, 0xfd, - 0x6c, 0x09, 0xff, 0x99, 0x4f, 0x43, 0xc9, 0x04, 0x9f, 0x14, 0x09, 0x45, 0x47, 0xb0, 0x7e, 0xb3, - 0x4a, 0x64, 0x61, 0x87, 0x29, 0xd1, 0x73, 0x50, 0x15, 0x56, 0x06, 0xbc, 0x27, 0x72, 0xbe, 0x98, - 0xac, 0x3d, 0x80, 0x6a, 0x10, 0x8e, 0x72, 0x69, 0x79, 0x49, 0xd9, 0x93, 0xf1, 0xf8, 0x9e, 0x16, - 0xb7, 0x94, 0x7b, 0x65, 0x65, 0x1b, 0x3a, 0x66, 0x11, 0xf7, 0xdc, 0x96, 0xfb, 0xf1, 0x8e, 0x41, - 0x6f, 0xf0, 0xb9, 0xc5, 0x60, 0xb3, 0xc5, 0xe0, 0x7b, 0x8b, 0xc1, 0xdb, 0x0e, 0x3b, 0x9b, 0x1d, - 0x76, 0xbe, 0x76, 0xd8, 0x79, 0x22, 0x11, 0x93, 0x71, 0x3e, 0x53, 0x9b, 0x22, 0xaa, 0xad, 0x0b, - 0xbd, 0x40, 0x62, 0x8b, 0x23, 0xeb, 0x43, 0xbb, 0x44, 0x16, 0x09, 0xcd, 0x66, 0xbf, 0x75, 0x39, - 0x57, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xad, 0xb9, 0x91, 0xff, 0x01, 0x00, 0x00, + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x52, 0xd1, 0x8a, 0x13, 0x31, + 0x14, 0x9d, 0xb4, 0xa3, 0xd0, 0xac, 0xed, 0x66, 0x63, 0xc5, 0x5a, 0x71, 0x28, 0xeb, 0x4b, 0x59, + 0x74, 0x02, 0xea, 0x0f, 0xb8, 0x45, 0x74, 0x71, 0x65, 0x61, 0x5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xfd, 0x59, 0x3d, 0x2b, 0x5d, 0x02, 0x00, + 0x00, } func (m *ObserverMapper) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index e7cfe8f234..69e89af688 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -30,6 +30,110 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgUpdateObserver struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + OldObserverAddress string `protobuf:"bytes,2,opt,name=old_observer_address,json=oldObserverAddress,proto3" json:"old_observer_address,omitempty"` + NewObserverAddress string `protobuf:"bytes,3,opt,name=new_observer_address,json=newObserverAddress,proto3" json:"new_observer_address,omitempty"` + UpdateReason ObserverUpdateReason `protobuf:"varint,4,opt,name=update_reason,json=updateReason,proto3,enum=zetachain.zetacore.observer.ObserverUpdateReason" json:"update_reason,omitempty"` +} + +func (m *MsgUpdateObserver) Reset() { *m = MsgUpdateObserver{} } +func (m *MsgUpdateObserver) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateObserver) ProtoMessage() {} +func (*MsgUpdateObserver) Descriptor() ([]byte, []int) { + return fileDescriptor_1bcd40fa296a2b1d, []int{0} +} +func (m *MsgUpdateObserver) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateObserver) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateObserver.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateObserver) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateObserver.Merge(m, src) +} +func (m *MsgUpdateObserver) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateObserver) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateObserver.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateObserver proto.InternalMessageInfo + +func (m *MsgUpdateObserver) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateObserver) GetOldObserverAddress() string { + if m != nil { + return m.OldObserverAddress + } + return "" +} + +func (m *MsgUpdateObserver) GetNewObserverAddress() string { + if m != nil { + return m.NewObserverAddress + } + return "" +} + +func (m *MsgUpdateObserver) GetUpdateReason() ObserverUpdateReason { + if m != nil { + return m.UpdateReason + } + return ObserverUpdateReason_EmptyObserverUpdateReason +} + +type MsgUpdateObserverResponse struct { +} + +func (m *MsgUpdateObserverResponse) Reset() { *m = MsgUpdateObserverResponse{} } +func (m *MsgUpdateObserverResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateObserverResponse) ProtoMessage() {} +func (*MsgUpdateObserverResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1bcd40fa296a2b1d, []int{1} +} +func (m *MsgUpdateObserverResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateObserverResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateObserverResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateObserverResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateObserverResponse.Merge(m, src) +} +func (m *MsgUpdateObserverResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateObserverResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateObserverResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateObserverResponse proto.InternalMessageInfo + type MsgAddBlockHeader struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -42,7 +146,7 @@ func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} } func (m *MsgAddBlockHeader) String() string { return proto.CompactTextString(m) } func (*MsgAddBlockHeader) ProtoMessage() {} func (*MsgAddBlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{0} + return fileDescriptor_1bcd40fa296a2b1d, []int{2} } func (m *MsgAddBlockHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,7 +217,7 @@ func (m *MsgAddBlockHeaderResponse) Reset() { *m = MsgAddBlockHeaderResp func (m *MsgAddBlockHeaderResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddBlockHeaderResponse) ProtoMessage() {} func (*MsgAddBlockHeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{1} + return fileDescriptor_1bcd40fa296a2b1d, []int{3} } func (m *MsgAddBlockHeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -151,7 +255,7 @@ func (m *MsgUpdateCoreParams) Reset() { *m = MsgUpdateCoreParams{} } func (m *MsgUpdateCoreParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCoreParams) ProtoMessage() {} func (*MsgUpdateCoreParams) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{2} + return fileDescriptor_1bcd40fa296a2b1d, []int{4} } func (m *MsgUpdateCoreParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -201,7 +305,7 @@ func (m *MsgUpdateCoreParamsResponse) Reset() { *m = MsgUpdateCoreParams func (m *MsgUpdateCoreParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCoreParamsResponse) ProtoMessage() {} func (*MsgUpdateCoreParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{3} + return fileDescriptor_1bcd40fa296a2b1d, []int{5} } func (m *MsgUpdateCoreParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -241,7 +345,7 @@ func (m *MsgAddObserver) Reset() { *m = MsgAddObserver{} } func (m *MsgAddObserver) String() string { return proto.CompactTextString(m) } func (*MsgAddObserver) ProtoMessage() {} func (*MsgAddObserver) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{4} + return fileDescriptor_1bcd40fa296a2b1d, []int{6} } func (m *MsgAddObserver) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -305,7 +409,7 @@ func (m *MsgAddObserverResponse) Reset() { *m = MsgAddObserverResponse{} func (m *MsgAddObserverResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddObserverResponse) ProtoMessage() {} func (*MsgAddObserverResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{5} + return fileDescriptor_1bcd40fa296a2b1d, []int{7} } func (m *MsgAddObserverResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -344,7 +448,7 @@ func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} } func (m *MsgAddBlameVote) String() string { return proto.CompactTextString(m) } func (*MsgAddBlameVote) ProtoMessage() {} func (*MsgAddBlameVote) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{6} + return fileDescriptor_1bcd40fa296a2b1d, []int{8} } func (m *MsgAddBlameVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -401,7 +505,7 @@ func (m *MsgAddBlameVoteResponse) Reset() { *m = MsgAddBlameVoteResponse func (m *MsgAddBlameVoteResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddBlameVoteResponse) ProtoMessage() {} func (*MsgAddBlameVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{7} + return fileDescriptor_1bcd40fa296a2b1d, []int{9} } func (m *MsgAddBlameVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -441,7 +545,7 @@ func (m *MsgUpdateCrosschainFlags) Reset() { *m = MsgUpdateCrosschainFla func (m *MsgUpdateCrosschainFlags) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCrosschainFlags) ProtoMessage() {} func (*MsgUpdateCrosschainFlags) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{8} + return fileDescriptor_1bcd40fa296a2b1d, []int{10} } func (m *MsgUpdateCrosschainFlags) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -505,7 +609,7 @@ func (m *MsgUpdateCrosschainFlagsResponse) Reset() { *m = MsgUpdateCross func (m *MsgUpdateCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCrosschainFlagsResponse) ProtoMessage() {} func (*MsgUpdateCrosschainFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{9} + return fileDescriptor_1bcd40fa296a2b1d, []int{11} } func (m *MsgUpdateCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -543,7 +647,7 @@ func (m *MsgUpdateKeygen) Reset() { *m = MsgUpdateKeygen{} } func (m *MsgUpdateKeygen) String() string { return proto.CompactTextString(m) } func (*MsgUpdateKeygen) ProtoMessage() {} func (*MsgUpdateKeygen) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{10} + return fileDescriptor_1bcd40fa296a2b1d, []int{12} } func (m *MsgUpdateKeygen) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -593,7 +697,7 @@ func (m *MsgUpdateKeygenResponse) Reset() { *m = MsgUpdateKeygenResponse func (m *MsgUpdateKeygenResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateKeygenResponse) ProtoMessage() {} func (*MsgUpdateKeygenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{11} + return fileDescriptor_1bcd40fa296a2b1d, []int{13} } func (m *MsgUpdateKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -623,6 +727,8 @@ func (m *MsgUpdateKeygenResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateKeygenResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgUpdateObserver)(nil), "zetachain.zetacore.observer.MsgUpdateObserver") + proto.RegisterType((*MsgUpdateObserverResponse)(nil), "zetachain.zetacore.observer.MsgUpdateObserverResponse") proto.RegisterType((*MsgAddBlockHeader)(nil), "zetachain.zetacore.observer.MsgAddBlockHeader") proto.RegisterType((*MsgAddBlockHeaderResponse)(nil), "zetachain.zetacore.observer.MsgAddBlockHeaderResponse") proto.RegisterType((*MsgUpdateCoreParams)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParams") @@ -640,56 +746,61 @@ func init() { func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) } var fileDescriptor_1bcd40fa296a2b1d = []byte{ - // 774 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4d, 0x4f, 0xdb, 0x48, - 0x18, 0x8e, 0x97, 0xcf, 0xbc, 0x41, 0x7c, 0x18, 0x02, 0x4e, 0x10, 0x21, 0xf2, 0x65, 0xb3, 0xbb, - 0x6c, 0xcc, 0x86, 0xdd, 0x55, 0x55, 0xa9, 0x87, 0xd0, 0x0f, 0x88, 0x2a, 0x0a, 0xb2, 0xd4, 0x1e, - 0x7a, 0xb1, 0xc6, 0x9e, 0xc1, 0xb6, 0x48, 0x66, 0x22, 0x8f, 0x53, 0x25, 0x3d, 0xf4, 0xde, 0x43, - 0xa5, 0xfe, 0x95, 0xfe, 0x87, 0x1e, 0x38, 0x72, 0xec, 0xa9, 0xaa, 0xe0, 0xd2, 0x9f, 0xd0, 0x63, - 0xe5, 0xf1, 0x47, 0x12, 0x92, 0x9a, 0x84, 0x13, 0x33, 0xef, 0x3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0x12, - 0xdf, 0x83, 0xa5, 0xa1, 0xc5, 0xd8, 0x9b, 0x20, 0x89, 0x04, 0x5d, 0xfc, 0x77, 0x1a, 0x74, 0x12, - 0xf3, 0x83, 0x04, 0xf9, 0xf1, 0x63, 0xfe, 0xdf, 0x84, 0x79, 0x0c, 0xbb, 0x15, 0x1f, 0xdd, 0xcb, - 0x6d, 0xb0, 0x06, 0x43, 0x73, 0xb5, 0x37, 0x19, 0x5d, 0x88, 0xbe, 0xbb, 0x06, 0xe3, 0x06, 0x4e, - 0xee, 0xc2, 0xf2, 0xad, 0x6f, 0x5b, 0x75, 0xa2, 0x5a, 0x26, 0xf8, 0xe2, 0xff, 0xd3, 0xe1, 0xe3, - 0xc8, 0x87, 0x8d, 0xcb, 0xeb, 0x92, 0x74, 0x75, 0x5d, 0x92, 0xbe, 0x5d, 0x97, 0xa4, 0x8f, 0x37, - 0xa5, 0xcc, 0xd5, 0x4d, 0x29, 0xf3, 0xe5, 0xa6, 0x94, 0x79, 0xad, 0xd9, 0xae, 0xef, 0x74, 0xcc, - 0xe0, 0x3b, 0xa7, 0x05, 0x8c, 0x7f, 0x0b, 0x72, 0x2d, 0x26, 0xd7, 0xba, 0x5a, 0xff, 0x67, 0x45, - 0xaf, 0x4d, 0xb8, 0x39, 0x2f, 0xbe, 0xd5, 0x07, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x60, - 0xf7, 0xb4, 0x6f, 0x08, 0x00, 0x00, + // 855 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x36, 0xeb, 0xc4, 0x71, 0xc6, 0xae, 0x63, 0x33, 0x76, 0x2c, 0xc9, 0x88, 0x22, 0xf0, 0x52, + 0xb7, 0x75, 0x49, 0x47, 0x69, 0x8b, 0xa2, 0x40, 0x0f, 0x72, 0x7f, 0x1c, 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66, 0xbe, 0xaa, 0xe6, 0x52, 0xb5, 0x54, 0xf8, 0x9b, 0x27, 0x6e, 0xf1, 0x27, + 0xf0, 0xac, 0xfb, 0x6a, 0xdc, 0xd4, 0x5e, 0x8f, 0x9b, 0xda, 0xbf, 0xe3, 0xa6, 0xf6, 0xc7, 0x75, + 0x73, 0xed, 0xf5, 0x75, 0x73, 0xed, 0xef, 0xeb, 0xe6, 0xda, 0x4f, 0x96, 0x1f, 0x26, 0xc1, 0xc0, + 0x4d, 0xbf, 0xb0, 0x56, 0xca, 0xf8, 0x89, 0x24, 0xb7, 0x0a, 0x72, 0x6b, 0x68, 0x4d, 0xfe, 0xd9, + 0x8d, 0xfa, 0x28, 0xdc, 0x0d, 0xf9, 0x77, 0xe9, 0xc9, 0x9b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0c, + 0x76, 0xfe, 0xbe, 0xf2, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -705,6 +816,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { AddObserver(ctx context.Context, in *MsgAddObserver, opts ...grpc.CallOption) (*MsgAddObserverResponse, error) + UpdateObserver(ctx context.Context, in *MsgUpdateObserver, opts ...grpc.CallOption) (*MsgUpdateObserverResponse, error) UpdateCoreParams(ctx context.Context, in *MsgUpdateCoreParams, opts ...grpc.CallOption) (*MsgUpdateCoreParamsResponse, error) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error) @@ -729,6 +841,15 @@ func (c *msgClient) AddObserver(ctx context.Context, in *MsgAddObserver, opts .. return out, nil } +func (c *msgClient) UpdateObserver(ctx context.Context, in *MsgUpdateObserver, opts ...grpc.CallOption) (*MsgUpdateObserverResponse, error) { + out := new(MsgUpdateObserverResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateObserver", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateCoreParams(ctx context.Context, in *MsgUpdateCoreParams, opts ...grpc.CallOption) (*MsgUpdateCoreParamsResponse, error) { out := new(MsgUpdateCoreParamsResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateCoreParams", in, out, opts...) @@ -777,6 +898,7 @@ func (c *msgClient) AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, o // MsgServer is the server API for Msg service. type MsgServer interface { AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error) + UpdateObserver(context.Context, *MsgUpdateObserver) (*MsgUpdateObserverResponse, error) UpdateCoreParams(context.Context, *MsgUpdateCoreParams) (*MsgUpdateCoreParamsResponse, error) AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) UpdateCrosschainFlags(context.Context, *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error) @@ -791,6 +913,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) AddObserver(ctx context.Context, req *MsgAddObserver) (*MsgAddObserverResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddObserver not implemented") } +func (*UnimplementedMsgServer) UpdateObserver(ctx context.Context, req *MsgUpdateObserver) (*MsgUpdateObserverResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateObserver not implemented") +} func (*UnimplementedMsgServer) UpdateCoreParams(ctx context.Context, req *MsgUpdateCoreParams) (*MsgUpdateCoreParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateCoreParams not implemented") } @@ -829,6 +954,24 @@ func _Msg_AddObserver_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Msg_UpdateObserver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateObserver) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateObserver(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/UpdateObserver", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateObserver(ctx, req.(*MsgUpdateObserver)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateCoreParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateCoreParams) if err := dec(in); err != nil { @@ -927,6 +1070,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "AddObserver", Handler: _Msg_AddObserver_Handler, }, + { + MethodName: "UpdateObserver", + Handler: _Msg_UpdateObserver_Handler, + }, { MethodName: "UpdateCoreParams", Handler: _Msg_UpdateCoreParams_Handler, @@ -952,6 +1099,78 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "observer/tx.proto", } +func (m *MsgUpdateObserver) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateObserver) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateObserver) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.UpdateReason != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.UpdateReason)) + i-- + dAtA[i] = 0x20 + } + if len(m.NewObserverAddress) > 0 { + i -= len(m.NewObserverAddress) + copy(dAtA[i:], m.NewObserverAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewObserverAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.OldObserverAddress) > 0 { + i -= len(m.OldObserverAddress) + copy(dAtA[i:], m.OldObserverAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OldObserverAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateObserverResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateObserverResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateObserverResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgAddBlockHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1398,6 +1617,39 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *MsgUpdateObserver) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OldObserverAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewObserverAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.UpdateReason != 0 { + n += 1 + sovTx(uint64(m.UpdateReason)) + } + return n +} + +func (m *MsgUpdateObserverResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgAddBlockHeader) Size() (n int) { if m == nil { return 0 @@ -1583,6 +1835,221 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *MsgUpdateObserver) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateObserver: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateObserver: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldObserverAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OldObserverAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewObserverAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewObserverAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateReason", wireType) + } + m.UpdateReason = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UpdateReason |= ObserverUpdateReason(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateObserverResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateObserverResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateObserverResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgAddBlockHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0