From 89ca461c7b15a339dd31be4dffb7f9e42ba8709e Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Wed, 29 May 2024 02:19:34 -0700 Subject: [PATCH 1/4] fix: remove quotes from e2e args (#2284) --- contrib/localnet/orchestrator/start-zetae2e.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index ead84ee4d1..a297be595b 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -136,9 +136,9 @@ if [ "$OPTION" == "upgrade" ]; then # When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up # Use light flag to skip advanced tests if [ "$UPGRADE_HEIGHT" -lt 100 ]; then - zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --light --skip-header-proof + zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml --light --skip-header-proof else - zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof + zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof fi ZETAE2E_EXIT_CODE=$? @@ -156,7 +156,7 @@ else echo "running e2e setup..." if [[ ! -f deployed.yml ]]; then - zetae2e "$ZETAE2E_CMD" --setup-only --config-out deployed.yml + zetae2e $ZETAE2E_CMD --setup-only --config-out deployed.yml if [ $? -ne 0 ]; then echo "e2e setup failed" exit 1 @@ -167,7 +167,7 @@ else echo "running e2e tests..." - zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml + zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml ZETAE2E_EXIT_CODE=$? # if e2e passed, exit with 0, otherwise exit with 1 From 42fe69cd9186aee8995d6a9f5e341fd9b2f32186 Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Wed, 29 May 2024 16:22:15 +0200 Subject: [PATCH 2/4] feat: add `ChainInfo` singleton state variable in `authority` (#2275) * add chain validate method * add chain info type * add chain info type proto * add chain info in genesis * generate * changelog * Update x/authority/types/chain_info.go Co-authored-by: Tanmay * revert is ZetaChain logic * fix name --------- Co-authored-by: Tanmay --- changelog.md | 1 + pkg/chains/chain.go | 33 ++ pkg/chains/chain_test.go | 127 +++++++ .../zetacore/authority/chain_info.proto | 14 + .../zetacore/authority/genesis.proto | 6 +- testutil/sample/authority.go | 19 +- testutil/sample/sample.go | 15 +- .../zetacore/authority/chain_info_pb.d.ts | 37 ++ .../zetacore/authority/genesis_pb.d.ts | 6 + .../zetachain/zetacore/authority/index.d.ts | 1 + x/authority/genesis.go | 6 + x/authority/genesis_test.go | 8 +- x/authority/keeper/chain_info.go | 26 ++ x/authority/keeper/chain_info_test.go | 33 ++ x/authority/types/chain_info.go | 30 ++ x/authority/types/chain_info.pb.go | 335 ++++++++++++++++++ x/authority/types/chain_info_test.go | 79 +++++ x/authority/types/genesis.go | 9 +- x/authority/types/genesis.pb.go | 78 +++- x/authority/types/genesis_test.go | 25 +- x/authority/types/keys.go | 3 + 21 files changed, 872 insertions(+), 19 deletions(-) create mode 100644 proto/zetachain/zetacore/authority/chain_info.proto create mode 100644 typescript/zetachain/zetacore/authority/chain_info_pb.d.ts create mode 100644 x/authority/keeper/chain_info.go create mode 100644 x/authority/keeper/chain_info_test.go create mode 100644 x/authority/types/chain_info.go create mode 100644 x/authority/types/chain_info.pb.go create mode 100644 x/authority/types/chain_info_test.go diff --git a/changelog.md b/changelog.md index 1414740d47..27b8257de4 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,7 @@ * [2113](https://github.com/zeta-chain/node/pull/2113) - add zetaclientd-supervisor process * [2154](https://github.com/zeta-chain/node/pull/2154) - add `ibccrosschain` module * [2258](https://github.com/zeta-chain/node/pull/2258) - add Optimism and Base in static chain information +* [2275](https://github.com/zeta-chain/node/pull/2275) - add ChainInfo singleton state variable in authority ### Refactor diff --git a/pkg/chains/chain.go b/pkg/chains/chain.go index 0b1c9edcc8..681e13a5ae 100644 --- a/pkg/chains/chain.go +++ b/pkg/chains/chain.go @@ -14,14 +14,47 @@ type SigninAlgo string // Chains represent a slice of Chain type Chains []Chain +// Validate checks whether the chain is valid +// The function check the chain ID is positive and all enum fields have a defined value +func (chain Chain) Validate() error { + if chain.ChainId <= 0 { + return fmt.Errorf("chain ID must be positive") + } + + if _, ok := ChainName_name[int32(chain.ChainName)]; !ok { + return fmt.Errorf("invalid chain name %d", int32(chain.ChainName)) + } + + if _, ok := Network_name[int32(chain.Network)]; !ok { + return fmt.Errorf("invalid network %d", int32(chain.Network)) + } + + if _, ok := NetworkType_name[int32(chain.NetworkType)]; !ok { + return fmt.Errorf("invalid network type %d", int32(chain.NetworkType)) + } + + if _, ok := Vm_name[int32(chain.Vm)]; !ok { + return fmt.Errorf("invalid vm %d", int32(chain.Vm)) + } + + if _, ok := Consensus_name[int32(chain.Consensus)]; !ok { + return fmt.Errorf("invalid consensus %d", int32(chain.Consensus)) + } + + return nil +} + // IsEqual compare two chain to see whether they represent the same chain func (chain Chain) IsEqual(c Chain) bool { return chain.ChainId == c.ChainId } +// IsZetaChain returns true if the chain is a ZetaChain chain func (chain Chain) IsZetaChain() bool { return chain.Network == Network_zeta } + +// IsExternalChain returns true if the chain is an ExternalChain chain, not ZetaChain func (chain Chain) IsExternalChain() bool { return chain.IsExternal } diff --git a/pkg/chains/chain_test.go b/pkg/chains/chain_test.go index 7bbb9de679..d14fd39a37 100644 --- a/pkg/chains/chain_test.go +++ b/pkg/chains/chain_test.go @@ -11,6 +11,133 @@ import ( "github.com/stretchr/testify/require" ) +func TestChain_Validate(t *testing.T) { + tests := []struct { + name string + chain Chain + errStr string + }{ + { + name: "should pass if chain is valid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_empty, + Network: Network_optimism, + NetworkType: NetworkType_testnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + }, + { + name: "should error if chain ID is zero", + chain: Chain{ + ChainId: 0, + ChainName: ChainName_empty, + Network: Network_optimism, + NetworkType: NetworkType_testnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "chain ID must be positive", + }, + { + name: "should error if chain ID is negative", + chain: Chain{ + ChainId: 0, + ChainName: ChainName_empty, + Network: Network_optimism, + NetworkType: NetworkType_testnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "chain ID must be positive", + }, + { + name: "should error if chain name invalid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_base_sepolia + 1, + Network: Network_optimism, + NetworkType: NetworkType_testnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "invalid chain name", + }, + { + name: "should error if network invalid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_empty, + Network: Network_base + 1, + NetworkType: NetworkType_testnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "invalid network", + }, + { + name: "should error if network type invalid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_empty, + Network: Network_base, + NetworkType: NetworkType_devnet + 1, + Vm: Vm_evm, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "invalid network type", + }, + { + name: "should error if vm invalid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_empty, + Network: Network_base, + NetworkType: NetworkType_devnet, + Vm: Vm_evm + 1, + Consensus: Consensus_op_stack, + IsExternal: true, + }, + errStr: "invalid vm", + }, + { + name: "should error if consensus invalid", + chain: Chain{ + ChainId: 42, + ChainName: ChainName_empty, + Network: Network_base, + NetworkType: NetworkType_devnet, + Vm: Vm_evm, + Consensus: Consensus_op_stack + 1, + IsExternal: true, + }, + errStr: "invalid consensus", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.errStr != "" { + require.ErrorContains(t, tt.chain.Validate(), tt.errStr) + } else { + require.NoError(t, tt.chain.Validate()) + } + }) + } + + t.Run("all default chains are valid", func(t *testing.T) { + for _, chain := range DefaultChainsList() { + require.NoError(t, chain.Validate()) + } + }) +} + func TestChain_EncodeAddress(t *testing.T) { tests := []struct { name string diff --git a/proto/zetachain/zetacore/authority/chain_info.proto b/proto/zetachain/zetacore/authority/chain_info.proto new file mode 100644 index 0000000000..f417184b06 --- /dev/null +++ b/proto/zetachain/zetacore/authority/chain_info.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package zetachain.zetacore.authority; + +import "zetachain/zetacore/pkg/chains/chains.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/x/authority/types"; + +// ChainInfo contains static information about the chains +// This structure is used to dynamically update these info on a live network +// before hardcoding the values in a upgrade +message ChainInfo { + repeated pkg.chains.Chain chains = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/zetachain/zetacore/authority/genesis.proto b/proto/zetachain/zetacore/authority/genesis.proto index 93eee1e9fc..a23416161f 100644 --- a/proto/zetachain/zetacore/authority/genesis.proto +++ b/proto/zetachain/zetacore/authority/genesis.proto @@ -2,9 +2,13 @@ syntax = "proto3"; package zetachain.zetacore.authority; import "zetachain/zetacore/authority/policies.proto"; +import "zetachain/zetacore/authority/chain_info.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/authority/types"; // GenesisState defines the authority module's genesis state. -message GenesisState { Policies policies = 1 [ (gogoproto.nullable) = false ]; } +message GenesisState { + Policies policies = 1 [ (gogoproto.nullable) = false ]; + ChainInfo chain_info = 2 [ (gogoproto.nullable) = false ]; +} diff --git a/testutil/sample/authority.go b/testutil/sample/authority.go index 9f2535d2b3..f24542c7fc 100644 --- a/testutil/sample/authority.go +++ b/testutil/sample/authority.go @@ -1,6 +1,9 @@ package sample -import authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" +import ( + "github.com/zeta-chain/zetacore/pkg/chains" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" +) func Policies() authoritytypes.Policies { return authoritytypes.Policies{ @@ -20,3 +23,17 @@ func Policies() authoritytypes.Policies { }, } } + +func ChainInfo(startChainID int64) authoritytypes.ChainInfo { + chain1 := Chain(startChainID) + chain2 := Chain(startChainID + 1) + chain3 := Chain(startChainID + 2) + + return authoritytypes.ChainInfo{ + Chains: []chains.Chain{ + *chain1, + *chain2, + *chain3, + }, + } +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 411c6dd7c9..431d93337d 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -121,9 +121,20 @@ func GenDoc(t *testing.T) *types.GenesisDoc { func Chain(chainID int64) *chains.Chain { r := newRandFromSeed(chainID) + chainNameLen := len(chains.ChainName_name) + networkLen := len(chains.Network_name) + networkTypeLen := len(chains.NetworkType_name) + vmLen := len(chains.Vm_name) + consensusLen := len(chains.Consensus_name) + return &chains.Chain{ - ChainName: chains.ChainName(r.Intn(4)), - ChainId: chainID, + ChainId: chainID, + ChainName: chains.ChainName(r.Intn(chainNameLen)), + Network: chains.Network(r.Intn(networkLen)), + NetworkType: chains.NetworkType(r.Intn(networkTypeLen)), + Vm: chains.Vm(r.Intn(vmLen)), + Consensus: chains.Consensus(r.Intn(consensusLen)), + IsExternal: true, } } diff --git a/typescript/zetachain/zetacore/authority/chain_info_pb.d.ts b/typescript/zetachain/zetacore/authority/chain_info_pb.d.ts new file mode 100644 index 0000000000..49437eb7e2 --- /dev/null +++ b/typescript/zetachain/zetacore/authority/chain_info_pb.d.ts @@ -0,0 +1,37 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file zetachain/zetacore/authority/chain_info.proto (package zetachain.zetacore.authority, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import type { Chain } from "../pkg/chains/chains_pb.js"; + +/** + * ChainInfo contains static information about the chains + * This structure is used to dynamically update these info on a live network + * before hardcoding the values in a upgrade + * + * @generated from message zetachain.zetacore.authority.ChainInfo + */ +export declare class ChainInfo extends Message { + /** + * @generated from field: repeated zetachain.zetacore.pkg.chains.Chain chains = 1; + */ + chains: Chain[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.authority.ChainInfo"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChainInfo; + + static fromJson(jsonValue: JsonValue, options?: Partial): ChainInfo; + + static fromJsonString(jsonString: string, options?: Partial): ChainInfo; + + static equals(a: ChainInfo | PlainMessage | undefined, b: ChainInfo | PlainMessage | undefined): boolean; +} + diff --git a/typescript/zetachain/zetacore/authority/genesis_pb.d.ts b/typescript/zetachain/zetacore/authority/genesis_pb.d.ts index a20371004b..381048e226 100644 --- a/typescript/zetachain/zetacore/authority/genesis_pb.d.ts +++ b/typescript/zetachain/zetacore/authority/genesis_pb.d.ts @@ -6,6 +6,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; import type { Policies } from "./policies_pb.js"; +import type { ChainInfo } from "./chain_info_pb.js"; /** * GenesisState defines the authority module's genesis state. @@ -18,6 +19,11 @@ export declare class GenesisState extends Message { */ policies?: Policies; + /** + * @generated from field: zetachain.zetacore.authority.ChainInfo chain_info = 2; + */ + chainInfo?: ChainInfo; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/zetachain/zetacore/authority/index.d.ts b/typescript/zetachain/zetacore/authority/index.d.ts index d363dc44f4..e27cc8abc4 100644 --- a/typescript/zetachain/zetacore/authority/index.d.ts +++ b/typescript/zetachain/zetacore/authority/index.d.ts @@ -1,3 +1,4 @@ +export * from "./chain_info_pb"; export * from "./genesis_pb"; export * from "./policies_pb"; export * from "./query_pb"; diff --git a/x/authority/genesis.go b/x/authority/genesis.go index 1391b5954d..56528a5935 100644 --- a/x/authority/genesis.go +++ b/x/authority/genesis.go @@ -10,6 +10,7 @@ import ( // InitGenesis initializes the authority module's state from a provided genesis state func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { k.SetPolicies(ctx, genState.Policies) + k.SetChainInfo(ctx, genState.ChainInfo) } // ExportGenesis returns the authority module's exported genesis. @@ -21,5 +22,10 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.Policies = policies } + chainInfo, found := k.GetChainInfo(ctx) + if found { + genesis.ChainInfo = chainInfo + } + return &genesis } diff --git a/x/authority/genesis_test.go b/x/authority/genesis_test.go index ac9c8d2e43..f14f4f37c6 100644 --- a/x/authority/genesis_test.go +++ b/x/authority/genesis_test.go @@ -14,7 +14,8 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ - Policies: sample.Policies(), + Policies: sample.Policies(), + ChainInfo: sample.ChainInfo(42), } // Init @@ -26,6 +27,11 @@ func TestGenesis(t *testing.T) { require.True(t, found) require.Equal(t, genesisState.Policies, policies) + // Check chain info is set + chainInfo, found := k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, genesisState.ChainInfo, chainInfo) + // Export got := authority.ExportGenesis(ctx, *k) require.NotNil(t, got) diff --git a/x/authority/keeper/chain_info.go b/x/authority/keeper/chain_info.go new file mode 100644 index 0000000000..5c9056fe0c --- /dev/null +++ b/x/authority/keeper/chain_info.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/zeta-chain/zetacore/x/authority/types" +) + +// SetChainInfo sets the chain info to the store +func (k Keeper) SetChainInfo(ctx sdk.Context, chainInfo types.ChainInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainInfoKey)) + b := k.cdc.MustMarshal(&chainInfo) + store.Set([]byte{0}, b) +} + +// GetChainInfo returns the policies from the store +func (k Keeper) GetChainInfo(ctx sdk.Context) (val types.ChainInfo, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainInfoKey)) + b := store.Get([]byte{0}) + if b == nil { + return val, false + } + k.cdc.MustUnmarshal(b, &val) + return val, true +} diff --git a/x/authority/keeper/chain_info_test.go b/x/authority/keeper/chain_info_test.go new file mode 100644 index 0000000000..87424cb4dd --- /dev/null +++ b/x/authority/keeper/chain_info_test.go @@ -0,0 +1,33 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestKeeper_SetChainInfo(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + chainInfo := sample.ChainInfo(42) + + _, found := k.GetChainInfo(ctx) + require.False(t, found) + + k.SetChainInfo(ctx, chainInfo) + + // Check policy is set + got, found := k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, chainInfo, got) + + // Can set policies again + newChainInfo := sample.ChainInfo(84) + require.NotEqual(t, chainInfo, newChainInfo) + k.SetChainInfo(ctx, newChainInfo) + got, found = k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, newChainInfo, got) +} diff --git a/x/authority/types/chain_info.go b/x/authority/types/chain_info.go new file mode 100644 index 0000000000..cff10235c4 --- /dev/null +++ b/x/authority/types/chain_info.go @@ -0,0 +1,30 @@ +package types + +import ( + "fmt" + + "github.com/zeta-chain/zetacore/pkg/chains" +) + +// DefaultChainInfo returns the structure with an empty list of chains +func DefaultChainInfo() ChainInfo { + return ChainInfo{ + Chains: []chains.Chain{}, + } +} + +// Validate performs basic validation of chain info +// It checks all chains are valid and they're all of external type +// The structure is used to store external chain information +func (ci ChainInfo) Validate() error { + for _, chain := range ci.Chains { + if err := chain.Validate(); err != nil { + return err + } + if !chain.IsExternal { + return fmt.Errorf("chain %d is not external", chain.ChainId) + } + } + + return nil +} diff --git a/x/authority/types/chain_info.pb.go b/x/authority/types/chain_info.pb.go new file mode 100644 index 0000000000..9dd945040e --- /dev/null +++ b/x/authority/types/chain_info.pb.go @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zetachain/zetacore/authority/chain_info.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + chains "github.com/zeta-chain/zetacore/pkg/chains" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// ChainInfo contains static information about the chains +// This structure is used to dynamically update these info on a live network +// before hardcoding the values in a upgrade +type ChainInfo struct { + Chains []chains.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains"` +} + +func (m *ChainInfo) Reset() { *m = ChainInfo{} } +func (m *ChainInfo) String() string { return proto.CompactTextString(m) } +func (*ChainInfo) ProtoMessage() {} +func (*ChainInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_88c7b2261e38c0a9, []int{0} +} +func (m *ChainInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChainInfo.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 *ChainInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainInfo.Merge(m, src) +} +func (m *ChainInfo) XXX_Size() int { + return m.Size() +} +func (m *ChainInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ChainInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ChainInfo proto.InternalMessageInfo + +func (m *ChainInfo) GetChains() []chains.Chain { + if m != nil { + return m.Chains + } + return nil +} + +func init() { + proto.RegisterType((*ChainInfo)(nil), "zetachain.zetacore.authority.ChainInfo") +} + +func init() { + proto.RegisterFile("zetachain/zetacore/authority/chain_info.proto", fileDescriptor_88c7b2261e38c0a9) +} + +var fileDescriptor_88c7b2261e38c0a9 = []byte{ + // 206 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xad, 0x4a, 0x2d, 0x49, + 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x13, 0x4b, 0x4b, 0x32, + 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0xf5, 0xc1, 0x12, 0xf1, 0x99, 0x79, 0x69, 0xf9, 0x7a, 0x05, 0x45, + 0xf9, 0x25, 0xf9, 0x42, 0x32, 0x70, 0xe5, 0x7a, 0x30, 0xe5, 0x7a, 0x70, 0xe5, 0x52, 0x5a, 0x58, + 0x0c, 0x2b, 0xc8, 0x4e, 0x87, 0x18, 0x53, 0x0c, 0xa5, 0x20, 0x26, 0x49, 0x89, 0xa4, 0xe7, 0xa7, + 0xe7, 0x83, 0x99, 0xfa, 0x20, 0x16, 0x44, 0x54, 0xc9, 0x9f, 0x8b, 0xd3, 0x19, 0xa4, 0xca, 0x33, + 0x2f, 0x2d, 0x5f, 0xc8, 0x89, 0x8b, 0x0d, 0xa2, 0x45, 0x82, 0x51, 0x81, 0x59, 0x83, 0xdb, 0x48, + 0x45, 0x0f, 0x8b, 0xed, 0x05, 0xd9, 0xe9, 0x7a, 0x50, 0x83, 0xc1, 0x3a, 0x9d, 0x58, 0x4e, 0xdc, + 0x93, 0x67, 0x08, 0x82, 0xea, 0x74, 0xf2, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, + 0x86, 0x28, 0x83, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xb0, 0x6b, 0x75, + 0xd1, 0x1c, 0x5e, 0x81, 0x14, 0x0e, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x37, 0x1a, + 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x16, 0x2c, 0xe3, 0x34, 0x01, 0x00, 0x00, +} + +func (m *ChainInfo) 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 *ChainInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Chains) > 0 { + for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintChainInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintChainInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovChainInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ChainInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Chains) > 0 { + for _, e := range m.Chains { + l = e.Size() + n += 1 + l + sovChainInfo(uint64(l)) + } + } + return n +} + +func sovChainInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozChainInfo(x uint64) (n int) { + return sovChainInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ChainInfo) 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 ErrIntOverflowChainInfo + } + 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: ChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChainInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthChainInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthChainInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Chains = append(m.Chains, chains.Chain{}) + if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChainInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChainInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipChainInfo(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChainInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChainInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChainInfo + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthChainInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupChainInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthChainInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthChainInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowChainInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupChainInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/authority/types/chain_info_test.go b/x/authority/types/chain_info_test.go new file mode 100644 index 0000000000..dd43b4064f --- /dev/null +++ b/x/authority/types/chain_info_test.go @@ -0,0 +1,79 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/authority/types" +) + +func TestDefaultChainInfo(t *testing.T) { + t.Run("default is empty", func(t *testing.T) { + chainInfo := types.DefaultChainInfo() + require.Empty(t, chainInfo.Chains) + }) +} + +func TestChainInfo_Validate(t *testing.T) { + tests := []struct { + name string + chainInfo types.ChainInfo + errContains string + }{ + { + name: "empty is valid", + chainInfo: types.ChainInfo{}, + }, + { + name: "valid chain info", + chainInfo: sample.ChainInfo(42), + }, + { + name: "invalid if chain is invalid", + chainInfo: types.ChainInfo{ + Chains: []chains.Chain{ + { + ChainId: 0, + ChainName: chains.ChainName_empty, + Network: chains.Network_optimism, + NetworkType: chains.NetworkType_testnet, + Vm: chains.Vm_evm, + Consensus: chains.Consensus_op_stack, + IsExternal: true, + }, + }, + }, + errContains: "chain ID must be positive", + }, + { + name: "invalid if chain is not external", + chainInfo: types.ChainInfo{ + Chains: []chains.Chain{ + { + ChainId: 42, + ChainName: chains.ChainName_empty, + Network: chains.Network_optimism, + NetworkType: chains.NetworkType_testnet, + Vm: chains.Vm_evm, + Consensus: chains.Consensus_op_stack, + IsExternal: false, + }, + }, + }, + errContains: "not external", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.chainInfo.Validate() + if tt.errContains != "" { + require.ErrorContains(t, err, tt.errContains) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/authority/types/genesis.go b/x/authority/types/genesis.go index bed0e04a41..13a01030bf 100644 --- a/x/authority/types/genesis.go +++ b/x/authority/types/genesis.go @@ -3,11 +3,16 @@ package types // DefaultGenesis returns the default authority genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - Policies: DefaultPolicies(), + Policies: DefaultPolicies(), + ChainInfo: DefaultChainInfo(), } } // Validate performs basic genesis state validation returning an error upon any failure func (gs GenesisState) Validate() error { - return gs.Policies.Validate() + if err := gs.Policies.Validate(); err != nil { + return err + } + + return gs.ChainInfo.Validate() } diff --git a/x/authority/types/genesis.pb.go b/x/authority/types/genesis.pb.go index 77857e5b67..aca80bfed4 100644 --- a/x/authority/types/genesis.pb.go +++ b/x/authority/types/genesis.pb.go @@ -25,7 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the authority module's genesis state. type GenesisState struct { - Policies Policies `protobuf:"bytes,1,opt,name=policies,proto3" json:"policies"` + Policies Policies `protobuf:"bytes,1,opt,name=policies,proto3" json:"policies"` + ChainInfo ChainInfo `protobuf:"bytes,2,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -68,6 +69,13 @@ func (m *GenesisState) GetPolicies() Policies { return Policies{} } +func (m *GenesisState) GetChainInfo() ChainInfo { + if m != nil { + return m.ChainInfo + } + return ChainInfo{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.authority.GenesisState") } @@ -77,20 +85,23 @@ func init() { } var fileDescriptor_633475075491b169 = []byte{ - // 202 bytes of a gzipped FileDescriptorProto + // 242 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xaa, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x13, 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0xf5, 0xd3, 0x53, 0xf3, 0x52, 0x8b, 0x33, 0x8b, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x64, 0xe0, 0x6a, 0xf5, 0x60, 0x6a, 0xf5, 0xe0, 0x6a, 0xa5, 0xb4, 0xf1, - 0x9a, 0x54, 0x90, 0x9f, 0x93, 0x99, 0x9c, 0x99, 0x0a, 0x35, 0x4a, 0x4a, 0x24, 0x3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x83, 0xdb, 0x48, 0x4d, 0x0f, + 0x9f, 0x9b, 0xf5, 0x02, 0xa0, 0xaa, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xeb, 0x16, + 0xf2, 0xe1, 0xe2, 0x42, 0x38, 0x42, 0x82, 0x09, 0x6c, 0x96, 0x3a, 0x7e, 0xb3, 0x9c, 0x41, 0x12, + 0x9e, 0x79, 0x69, 0xf9, 0x50, 0xc3, 0x38, 0x93, 0xe1, 0x02, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, + 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, + 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, + 0x0b, 0x0e, 0x08, 0x5d, 0xb4, 0x30, 0xa9, 0x40, 0x0a, 0x95, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, + 0x36, 0xb0, 0xdf, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x5f, 0x4d, 0x13, 0xb9, 0x01, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -113,6 +124,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 { size, err := m.Policies.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -145,6 +166,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Policies.Size() n += 1 + l + sovGenesis(uint64(l)) + l = m.ChainInfo.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -216,6 +239,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/authority/types/genesis_test.go b/x/authority/types/genesis_test.go index 46f4ad9bcb..90aee92509 100644 --- a/x/authority/types/genesis_test.go +++ b/x/authority/types/genesis_test.go @@ -5,6 +5,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/authority/types" ) @@ -25,7 +26,8 @@ func TestGenesisState_Validate(t *testing.T) { { name: "valid genesis", gs: &types.GenesisState{ - Policies: sample.Policies(), + Policies: sample.Policies(), + ChainInfo: sample.ChainInfo(42), }, errContains: "", }, @@ -40,9 +42,30 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, + ChainInfo: sample.ChainInfo(42), }, errContains: "invalid address", }, + { + name: "invalid if policies is invalid", + gs: &types.GenesisState{ + Policies: sample.Policies(), + ChainInfo: types.ChainInfo{ + Chains: []chains.Chain{ + { + ChainId: 0, + ChainName: chains.ChainName_empty, + Network: chains.Network_optimism, + NetworkType: chains.NetworkType_testnet, + Vm: chains.Vm_evm, + Consensus: chains.Consensus_op_stack, + IsExternal: true, + }, + }, + }, + }, + errContains: "chain ID must be positive", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/authority/types/keys.go b/x/authority/types/keys.go index 5b86ca9711..7593feed3a 100644 --- a/x/authority/types/keys.go +++ b/x/authority/types/keys.go @@ -25,4 +25,7 @@ func KeyPrefix(p string) []byte { const ( // PoliciesKey is the key for the policies store PoliciesKey = "Policies-value-" + + // ChainInfoKey is the key for the chain info store + ChainInfoKey = "ChainInfo-value-" ) From 180fcef0d9dab34bf4dac64378a7efbe63f7509b Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Wed, 29 May 2024 18:23:17 +0200 Subject: [PATCH 3/4] feat(`pkg/chains`): add a `CCTXGateway` field to chain static data (#2279) * proto gen * add field to chains * make generate * changelog * fix test * update comment * make format --- changelog.md | 1 + docs/openapi/openapi.swagger.yaml | 15 ++ pkg/chains/chains.go | 20 +++ pkg/chains/chains.pb.go | 155 +++++++++++++----- .../zetacore/pkg/chains/chains.proto | 16 ++ .../zetacore/pkg/chains/chains_pb.d.ts | 30 ++++ zetaclient/zetacore/tx_test.go | 3 +- 7 files changed, 196 insertions(+), 44 deletions(-) diff --git a/changelog.md b/changelog.md index 27b8257de4..a2fdd6c26c 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,7 @@ * [2113](https://github.com/zeta-chain/node/pull/2113) - add zetaclientd-supervisor process * [2154](https://github.com/zeta-chain/node/pull/2154) - add `ibccrosschain` module * [2258](https://github.com/zeta-chain/node/pull/2258) - add Optimism and Base in static chain information +* [2279](https://github.com/zeta-chain/node/pull/2279) - add a CCTXGateway field to chain static data * [2275](https://github.com/zeta-chain/node/pull/2275) - add ChainInfo singleton state variable in authority ### Refactor diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 9067eccc6d..9c0dbc1e10 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -56744,6 +56744,18 @@ definitions: description: |- QueryGetPoliciesResponse is the response type for the Query/Policies RPC method. + chainsCCTXGateway: + type: string + enum: + - zevm + - observers + default: zevm + description: |- + - zevm: zevm is the internal CCTX gateway to process outbound on the ZEVM and read + inbound events from the ZEVM only used for ZetaChain chains + - observers: observers is the CCTX gateway for chains relying on the observer set to + observe inbounds and TSS for outbounds + title: CCTXGateway describes for the chain the gateway used to handle CCTX outbounds chainsChain: type: object properties: @@ -56769,6 +56781,9 @@ definitions: is_external: type: boolean title: IsExternal describe if the chain is ZetaChain or external + cctx_gateway: + $ref: '#/definitions/chainsCCTXGateway' + title: CCTXGateway is the gateway used to handle CCTX outbounds title: |- Chain represents static data about a blockchain network it is identified by a unique chain ID diff --git a/pkg/chains/chains.go b/pkg/chains/chains.go index 21718f874d..61fffece76 100644 --- a/pkg/chains/chains.go +++ b/pkg/chains/chains.go @@ -16,6 +16,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // Ethereum is Ethereum mainnet @@ -27,6 +28,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BscMainnet is Binance Smart Chain mainnet @@ -38,6 +40,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BitcoinMainnet is Bitcoin mainnet @@ -49,6 +52,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Polygon is Polygon mainnet @@ -60,6 +64,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // OptimismMainnet is Optimism mainnet @@ -71,6 +76,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BaseMainnet is Base mainnet @@ -82,6 +88,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -97,6 +104,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // Sepolia is Ethereum sepolia testnet @@ -108,6 +116,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BscTestnet is Binance Smart Chain testnet @@ -119,6 +128,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BitcoinTestnet is Bitcoin testnet3 @@ -130,6 +140,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Amoy is Polygon amoy testnet @@ -141,6 +152,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // OptimismSepolia is Optimism sepolia testnet @@ -152,6 +164,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BaseSepolia is Base sepolia testnet @@ -163,6 +176,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -179,6 +193,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } /** @@ -194,6 +209,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // BitcoinRegtest is Bitcoin regtest (localnet) @@ -205,6 +221,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // GoerliLocalnet is Ethereum local goerli (localnet) @@ -216,6 +233,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -231,6 +249,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Mumbai is Polygon mumbai testnet (deprecated for amoy) @@ -242,6 +261,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } ) diff --git a/pkg/chains/chains.pb.go b/pkg/chains/chains.pb.go index 1153208c6d..848a7e1bc0 100644 --- a/pkg/chains/chains.pb.go +++ b/pkg/chains/chains.pb.go @@ -269,6 +269,36 @@ func (Consensus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_236b85e7bff6130d, []int{5} } +// CCTXGateway describes for the chain the gateway used to handle CCTX outbounds +type CCTXGateway int32 + +const ( + // zevm is the internal CCTX gateway to process outbound on the ZEVM and read + // inbound events from the ZEVM only used for ZetaChain chains + CCTXGateway_zevm CCTXGateway = 0 + // observers is the CCTX gateway for chains relying on the observer set to + // observe inbounds and TSS for outbounds + CCTXGateway_observers CCTXGateway = 1 +) + +var CCTXGateway_name = map[int32]string{ + 0: "zevm", + 1: "observers", +} + +var CCTXGateway_value = map[string]int32{ + "zevm": 0, + "observers": 1, +} + +func (x CCTXGateway) String() string { + return proto.EnumName(CCTXGateway_name, int32(x)) +} + +func (CCTXGateway) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_236b85e7bff6130d, []int{6} +} + // Chain represents static data about a blockchain network // it is identified by a unique chain ID type Chain struct { @@ -286,6 +316,8 @@ type Chain struct { Consensus Consensus `protobuf:"varint,6,opt,name=consensus,proto3,enum=zetachain.zetacore.pkg.chains.Consensus" json:"consensus,omitempty"` // IsExternal describe if the chain is ZetaChain or external IsExternal bool `protobuf:"varint,7,opt,name=is_external,json=isExternal,proto3" json:"is_external,omitempty"` + // CCTXGateway is the gateway used to handle CCTX outbounds + CctxGateway CCTXGateway `protobuf:"varint,8,opt,name=cctx_gateway,json=cctxGateway,proto3,enum=zetachain.zetacore.pkg.chains.CCTXGateway" json:"cctx_gateway,omitempty"` } func (m *Chain) Reset() { *m = Chain{} } @@ -370,6 +402,13 @@ func (m *Chain) GetIsExternal() bool { return false } +func (m *Chain) GetCctxGateway() CCTXGateway { + if m != nil { + return m.CctxGateway + } + return CCTXGateway_zevm +} + func init() { proto.RegisterEnum("zetachain.zetacore.pkg.chains.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.ChainName", ChainName_name, ChainName_value) @@ -377,6 +416,7 @@ func init() { proto.RegisterEnum("zetachain.zetacore.pkg.chains.NetworkType", NetworkType_name, NetworkType_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.Vm", Vm_name, Vm_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.Consensus", Consensus_name, Consensus_value) + proto.RegisterEnum("zetachain.zetacore.pkg.chains.CCTXGateway", CCTXGateway_name, CCTXGateway_value) proto.RegisterType((*Chain)(nil), "zetachain.zetacore.pkg.chains.Chain") } @@ -385,49 +425,51 @@ func init() { } var fileDescriptor_236b85e7bff6130d = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0x13, 0x3b, - 0x14, 0xc6, 0x33, 0x93, 0xff, 0x27, 0x69, 0xea, 0xeb, 0x76, 0x91, 0x5b, 0xe9, 0xce, 0xed, 0xbd, - 0x0b, 0x14, 0x22, 0x91, 0x08, 0x58, 0xb2, 0x41, 0x54, 0x14, 0x81, 0x44, 0x17, 0x03, 0xaa, 0x04, - 0x9b, 0x68, 0xe2, 0x1c, 0x26, 0x56, 0x62, 0x7b, 0x34, 0x76, 0x02, 0xe1, 0x29, 0x58, 0xf2, 0x00, - 0x2c, 0x78, 0x14, 0x96, 0x5d, 0xb2, 0x44, 0xed, 0x03, 0xf0, 0x0a, 0xc8, 0xce, 0x78, 0x02, 0x0b, - 0x68, 0x57, 0x73, 0xfc, 0x9b, 0xef, 0x7c, 0xe7,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0x53, 0xc2, 0x3d, 0x6a, 0x77, 0x7e, 0xfb, 0xbe, 0x4d, - 0x1b, 0xee, 0x91, 0xba, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0x15, 0x2a, 0x93, 0x8e, 0x07, 0x05, - 0x00, 0x00, + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x3d, 0x8f, 0x2b, 0x35, + 0x14, 0xcd, 0x4c, 0xbe, 0xef, 0x64, 0xb3, 0xc6, 0x6f, 0x8b, 0xe1, 0x49, 0x0c, 0x0b, 0x05, 0x0a, + 0x11, 0x24, 0x02, 0x4a, 0x1a, 0x44, 0xc4, 0x7b, 0x02, 0x89, 0x57, 0x0c, 0xab, 0x15, 0xd0, 0x8c, + 0x3c, 0xce, 0x65, 0x62, 0x25, 0x1e, 0x8f, 0xc6, 0x4e, 0x76, 0xc3, 0xaf, 0xe0, 0x47, 0x50, 0xf0, + 0x53, 0x28, 0xb7, 0xa4, 0x44, 0xbb, 0x05, 0x25, 0x7f, 0x01, 0xd9, 0xf3, 0x91, 0xa5, 0x80, 0xdd, + 0x2a, 0xd7, 0x67, 0xce, 0x39, 0xf7, 0xd8, 0xbe, 0x31, 0xcc, 0x7f, 0x46, 0xc3, 0xf8, 0x86, 0x89, + 0x7c, 0xe9, 0x2a, 0x55, 0xe2, 0xb2, 0xd8, 0x66, 0x4b, 0x07, 0xe9, 0xfa, 0x67, 0x51, 0x94, 0xca, + 0x28, 0xfa, 0x4e, 0xcb, 0x5d, 0x34, 0xdc, 0x45, 0xb1, 0xcd, 0x16, 0x15, 0xe9, 0xe5, 0x45, 0xa6, + 0x32, 0xe5, 0x98, 0x4b, 0x5b, 0x55, 0xa2, 0xf7, 0xff, 0xea, 0x42, 0x7f, 0x65, 0x09, 0xf4, 0x6d, + 0x18, 0x39, 0x66, 0x22, 0xd6, 0xa1, 0x7f, 0xe9, 0xc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0xa7, 0x7f, 0x40, 0x84, 0x05, 0x00, 0x00, } func (m *Chain) Marshal() (dAtA []byte, err error) { @@ -450,6 +492,11 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.CctxGateway != 0 { + i = encodeVarintChains(dAtA, i, uint64(m.CctxGateway)) + i-- + dAtA[i] = 0x40 + } if m.IsExternal { i-- if m.IsExternal { @@ -531,6 +578,9 @@ func (m *Chain) Size() (n int) { if m.IsExternal { n += 2 } + if m.CctxGateway != 0 { + n += 1 + sovChains(uint64(m.CctxGateway)) + } return n } @@ -703,6 +753,25 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } } m.IsExternal = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CctxGateway", wireType) + } + m.CctxGateway = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChains + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CctxGateway |= CCTXGateway(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipChains(dAtA[iNdEx:]) diff --git a/proto/zetachain/zetacore/pkg/chains/chains.proto b/proto/zetachain/zetacore/pkg/chains/chains.proto index 1f2279af35..8075822471 100644 --- a/proto/zetachain/zetacore/pkg/chains/chains.proto +++ b/proto/zetachain/zetacore/pkg/chains/chains.proto @@ -88,6 +88,19 @@ enum Consensus { op_stack = 3; } +// CCTXGateway describes for the chain the gateway used to handle CCTX outbounds +enum CCTXGateway { + option (gogoproto.goproto_enum_stringer) = true; + + // zevm is the internal CCTX gateway to process outbound on the ZEVM and read + // inbound events from the ZEVM only used for ZetaChain chains + zevm = 0; + + // observers is the CCTX gateway for chains relying on the observer set to + // observe inbounds and TSS for outbounds + observers = 1; +} + // Chain represents static data about a blockchain network // it is identified by a unique chain ID message Chain { @@ -111,4 +124,7 @@ message Chain { // IsExternal describe if the chain is ZetaChain or external bool is_external = 7; + + // CCTXGateway is the gateway used to handle CCTX outbounds + CCTXGateway cctx_gateway = 8; } diff --git a/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts b/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts index 6abe26cd04..782e669d43 100644 --- a/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts +++ b/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts @@ -253,6 +253,29 @@ export declare enum Consensus { op_stack = 3, } +/** + * CCTXGateway describes for the chain the gateway used to handle CCTX outbounds + * + * @generated from enum zetachain.zetacore.pkg.chains.CCTXGateway + */ +export declare enum CCTXGateway { + /** + * zevm is the internal CCTX gateway to process outbound on the ZEVM and read + * inbound events from the ZEVM only used for ZetaChain chains + * + * @generated from enum value: zevm = 0; + */ + zevm = 0, + + /** + * observers is the CCTX gateway for chains relying on the observer set to + * observe inbounds and TSS for outbounds + * + * @generated from enum value: observers = 1; + */ + observers = 1, +} + /** * Chain represents static data about a blockchain network * it is identified by a unique chain ID @@ -309,6 +332,13 @@ export declare class Chain extends Message { */ isExternal: boolean; + /** + * CCTXGateway is the gateway used to handle CCTX outbounds + * + * @generated from field: zetachain.zetacore.pkg.chains.CCTXGateway cctx_gateway = 8; + */ + cctxGateway: CCTXGateway; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/zetaclient/zetacore/tx_test.go b/zetaclient/zetacore/tx_test.go index f12fcc8b6a..919f9cc058 100644 --- a/zetaclient/zetacore/tx_test.go +++ b/zetaclient/zetacore/tx_test.go @@ -247,7 +247,6 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { WithPayload(observertypes.QuerySupportedChains{}). Return(observertypes.QuerySupportedChainsResponse{ Chains: []*chains.Chain{ - { chains.BitcoinMainnet.ChainId, chains.BitcoinMainnet.ChainName, @@ -256,6 +255,7 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { chains.BscMainnet.Vm, chains.BscMainnet.Consensus, chains.BscMainnet.IsExternal, + chains.BscMainnet.CctxGateway, }, { chains.Ethereum.ChainId, @@ -265,6 +265,7 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { chains.Ethereum.Vm, chains.Ethereum.Consensus, chains.Ethereum.IsExternal, + chains.Ethereum.CctxGateway, }, }, }) From 85861bea3c614c3acb6c85b3077b40f55545db3b Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 29 May 2024 13:20:01 -0400 Subject: [PATCH 4/4] refactor: MsgUpdateCrosschainFlags into MsgEnableCCTXFlags, MsgDisableCCTXFlags and MsgUpdateGasPriceIncreaseFlags (#2269) --- changelog.md | 2 + docs/cli/zetacored/zetacored_tx_observer.md | 4 +- ... => zetacored_tx_observer_disable-cctx.md} | 8 +- .../zetacored_tx_observer_enable-cctx.md | 53 + ...bserver_update-gas-price-increase-flags.md | 53 + docs/openapi/openapi.swagger.yaml | 6 +- docs/releases/v17_breaking_changes.md | 7 + docs/spec/observer/messages.md | 54 +- .../zetachain/zetacore/observer/events.proto | 15 +- proto/zetachain/zetacore/observer/tx.proto | 39 +- testutil/sample/observer.go | 9 + .../zetacore/observer/events_pb.d.ts | 77 +- .../zetachain/zetacore/observer/tx_pb.d.ts | 214 +- x/observer/client/cli/tx.go | 4 +- .../client/cli/tx_disable_cctx_flags.go | 44 + ...ssion_flags.go => tx_enable_cctx_flags.go} | 22 +- .../cli/tx_update_gas_price_increase_flags.go | 67 + .../keeper/msg_server_disable_cctx_flags.go | 55 + .../msg_server_disable_cctx_flags_test.go | 152 + .../keeper/msg_server_enable_cctx_flags.go | 55 + .../msg_server_enable_cctx_flags_test.go | 152 + .../msg_server_update_crosschain_flags.go | 55 - ...msg_server_update_crosschain_flags_test.go | 165 -- ..._server_update_gas_price_increase_flags.go | 54 + ...er_update_gas_price_increase_flags_test.go | 116 + x/observer/types/codec.go | 8 +- x/observer/types/events.pb.go | 576 +++- .../types/message_disable_cctx_flags.go | 55 + .../types/message_disable_cctx_flags_test.go | 104 + x/observer/types/message_enable_cctx_flags.go | 55 + .../types/message_enable_cctx_flags_test.go | 104 + .../types/message_update_crosschain_flags.go | 86 - .../message_update_crosschain_flags_test.go | 246 -- ...message_update_gas_price_increase_flags.go | 64 + ...ge_update_gas_price_increase_flags_test.go | 164 ++ x/observer/types/tx.pb.go | 2540 +++++++++++------ 36 files changed, 3804 insertions(+), 1680 deletions(-) rename docs/cli/zetacored/{zetacored_tx_observer_update-crosschain-flags.md => zetacored_tx_observer_disable-cctx.md} (93%) create mode 100644 docs/cli/zetacored/zetacored_tx_observer_enable-cctx.md create mode 100644 docs/cli/zetacored/zetacored_tx_observer_update-gas-price-increase-flags.md create mode 100644 x/observer/client/cli/tx_disable_cctx_flags.go rename x/observer/client/cli/{tx_permission_flags.go => tx_enable_cctx_flags.go} (60%) create mode 100644 x/observer/client/cli/tx_update_gas_price_increase_flags.go create mode 100644 x/observer/keeper/msg_server_disable_cctx_flags.go create mode 100644 x/observer/keeper/msg_server_disable_cctx_flags_test.go create mode 100644 x/observer/keeper/msg_server_enable_cctx_flags.go create mode 100644 x/observer/keeper/msg_server_enable_cctx_flags_test.go delete mode 100644 x/observer/keeper/msg_server_update_crosschain_flags.go delete mode 100644 x/observer/keeper/msg_server_update_crosschain_flags_test.go create mode 100644 x/observer/keeper/msg_server_update_gas_price_increase_flags.go create mode 100644 x/observer/keeper/msg_server_update_gas_price_increase_flags_test.go create mode 100644 x/observer/types/message_disable_cctx_flags.go create mode 100644 x/observer/types/message_disable_cctx_flags_test.go create mode 100644 x/observer/types/message_enable_cctx_flags.go create mode 100644 x/observer/types/message_enable_cctx_flags_test.go delete mode 100644 x/observer/types/message_update_crosschain_flags.go delete mode 100644 x/observer/types/message_update_crosschain_flags_test.go create mode 100644 x/observer/types/message_update_gas_price_increase_flags.go create mode 100644 x/observer/types/message_update_gas_price_increase_flags_test.go diff --git a/changelog.md b/changelog.md index a2fdd6c26c..584d3c2409 100644 --- a/changelog.md +++ b/changelog.md @@ -33,6 +33,8 @@ * [2205](https://github.com/zeta-chain/node/pull/2205) - remove deprecated variables pre-v17 * [2226](https://github.com/zeta-chain/node/pull/2226) - improve Go formatting with imports standardization and max line length to 120 * [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20 +* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags + ### Tests diff --git a/docs/cli/zetacored/zetacored_tx_observer.md b/docs/cli/zetacored/zetacored_tx_observer.md index 1e5d002136..25711bd3f6 100644 --- a/docs/cli/zetacored/zetacored_tx_observer.md +++ b/docs/cli/zetacored/zetacored_tx_observer.md @@ -28,11 +28,13 @@ zetacored tx observer [flags] * [zetacored tx](zetacored_tx.md) - Transactions subcommands * [zetacored tx observer add-blame-vote](zetacored_tx_observer_add-blame-vote.md) - Broadcast message add-blame-vote * [zetacored tx observer add-observer](zetacored_tx_observer_add-observer.md) - Broadcast message add-observer +* [zetacored tx observer disable-cctx](zetacored_tx_observer_disable-cctx.md) - Disable inbound and outbound for CCTX +* [zetacored tx observer enable-cctx](zetacored_tx_observer_enable-cctx.md) - Enable inbound and outbound for CCTX * [zetacored tx observer encode](zetacored_tx_observer_encode.md) - Encode a json string into hex * [zetacored tx observer remove-chain-params](zetacored_tx_observer_remove-chain-params.md) - Broadcast message to remove chain params * [zetacored tx observer reset-chain-nonces](zetacored_tx_observer_reset-chain-nonces.md) - Broadcast message to reset chain nonces * [zetacored tx observer update-chain-params](zetacored_tx_observer_update-chain-params.md) - Broadcast message updateChainParams -* [zetacored tx observer update-crosschain-flags](zetacored_tx_observer_update-crosschain-flags.md) - Update crosschain flags +* [zetacored tx observer update-gas-price-increase-flags](zetacored_tx_observer_update-gas-price-increase-flags.md) - Update the gas price increase flags * [zetacored tx observer update-keygen](zetacored_tx_observer_update-keygen.md) - command to update the keygen block via a group proposal * [zetacored tx observer update-observer](zetacored_tx_observer_update-observer.md) - Broadcast message add-observer * [zetacored tx observer vote-tss](zetacored_tx_observer_vote-tss.md) - Vote for a new TSS creation diff --git a/docs/cli/zetacored/zetacored_tx_observer_update-crosschain-flags.md b/docs/cli/zetacored/zetacored_tx_observer_disable-cctx.md similarity index 93% rename from docs/cli/zetacored/zetacored_tx_observer_update-crosschain-flags.md rename to docs/cli/zetacored/zetacored_tx_observer_disable-cctx.md index b3be9ad4b7..a423cee3b7 100644 --- a/docs/cli/zetacored/zetacored_tx_observer_update-crosschain-flags.md +++ b/docs/cli/zetacored/zetacored_tx_observer_disable-cctx.md @@ -1,9 +1,9 @@ -# tx observer update-crosschain-flags +# tx observer disable-cctx -Update crosschain flags +Disable inbound and outbound for CCTX ``` -zetacored tx observer update-crosschain-flags [is-inbound-enabled] [is-outbound-enabled] [flags] +zetacored tx observer disable-cctx [disable-inbound] [disable-outbound] [flags] ``` ### Options @@ -22,7 +22,7 @@ zetacored tx observer update-crosschain-flags [is-inbound-enabled] [is-outbound- --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) - -h, --help help for update-crosschain-flags + -h, --help help for disable-cctx --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device diff --git a/docs/cli/zetacored/zetacored_tx_observer_enable-cctx.md b/docs/cli/zetacored/zetacored_tx_observer_enable-cctx.md new file mode 100644 index 0000000000..59a37e5b95 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_observer_enable-cctx.md @@ -0,0 +1,53 @@ +# tx observer enable-cctx + +Enable inbound and outbound for CCTX + +``` +zetacored tx observer enable-cctx [enable-inbound] [enable-outbound] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async) + --chain-id string The network chain ID + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for enable-cctx + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx observer](zetacored_tx_observer.md) - observer transactions subcommands + diff --git a/docs/cli/zetacored/zetacored_tx_observer_update-gas-price-increase-flags.md b/docs/cli/zetacored/zetacored_tx_observer_update-gas-price-increase-flags.md new file mode 100644 index 0000000000..8268638c44 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_observer_update-gas-price-increase-flags.md @@ -0,0 +1,53 @@ +# tx observer update-gas-price-increase-flags + +Update the gas price increase flags + +``` +zetacored tx observer update-gas-price-increase-flags [epochLength] [retryInterval] [gasPriceIncreasePercent] [gasPriceIncreaseMax] [maxPendingCctxs] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async) + --chain-id string The network chain ID + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-gas-price-increase-flags + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx observer](zetacored_tx_observer.md) - observer transactions subcommands + diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 9c0dbc1e10..112be45c71 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -57750,13 +57750,17 @@ definitions: type: object observerMsgAddObserverResponse: type: object + observerMsgDisableCCTXResponse: + type: object + observerMsgEnableCCTXResponse: + type: object observerMsgRemoveChainParamsResponse: type: object observerMsgResetChainNoncesResponse: type: object observerMsgUpdateChainParamsResponse: type: object - observerMsgUpdateCrosschainFlagsResponse: + observerMsgUpdateGasPriceIncreaseFlagsResponse: type: object observerMsgUpdateKeygenResponse: type: object diff --git a/docs/releases/v17_breaking_changes.md b/docs/releases/v17_breaking_changes.md index 13dc5df873..61d5c23921 100644 --- a/docs/releases/v17_breaking_changes.md +++ b/docs/releases/v17_breaking_changes.md @@ -7,6 +7,13 @@ * `MsgEnableHeaderVerification` message enables block header verification for a list of chains and can be triggered via `PolicyType_groupOperational` * `MsgDisableHeaderVerification` message disables block header verification for a list of chains and can be triggered via `PolicyType_emergency` +### Crosschain Flags update + +* `MsgUpdateCrosschainFlags` has been removed,and replaced with `MsgEnableCCTX`, `MsgDisableCCTX` and `MsgUpdateGasPriceIncreaseFlags` messages. + * `MsgEnableCCTX` message enables either the IsInboundEnabled flag,or the IsOutboundEnabled flag or both `PolicyType_groupOperational` + * `MsgDisableCCTX` message disables either the IsInboundEnabled flag,or the IsOutboundEnabled flag or both `PolicyType_emergency` + * `MsgUpdateGasPriceIncreaseFlags` message updates the gas price increase flags and can be triggered via `PolicyType_groupOperational` + ### `BallotMaturityBlocks` moved to `emissions` module * Observer param `ballot_maturity_blocks` is part of `emissions` module now. Observer `params` are deprecated and removed from `observer` module. diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index 2f7b25d91e..48e0b76de0 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -63,22 +63,6 @@ message MsgAddBlameVote { } ``` -## MsgUpdateCrosschainFlags - -UpdateCrosschainFlags updates the crosschain related flags. - -Aurthorized: admin policy group 1 (except enabling/disabled -inbounds/outbounds and gas price increase), admin policy group 2 (all). - -```proto -message MsgUpdateCrosschainFlags { - string creator = 1; - bool isInboundEnabled = 3; - bool isOutboundEnabled = 4; - GasPriceIncreaseFlags gasPriceIncreaseFlags = 5; -} -``` - ## MsgUpdateKeygen UpdateKeygen updates the block height of the keygen and sets the status to @@ -142,3 +126,41 @@ message MsgVoteTSS { } ``` +## MsgEnableCCTX + +EnableCCTX enables the IsInboundEnabled and IsOutboundEnabled flags.These flags control the creation of inbounds and outbounds. +The flags are enabled by the policy account with the groupOperational policy type. + +```proto +message MsgEnableCCTX { + string creator = 1; + bool enableInbound = 2; + bool enableOutbound = 3; +} +``` + +## MsgDisableCCTX + +DisableCCTX disables the IsInboundEnabled and IsOutboundEnabled flags. These flags control the creation of inbounds and outbounds. +The flags are disabled by the policy account with the groupEmergency policy type. + +```proto +message MsgDisableCCTX { + string creator = 1; + bool disableInbound = 2; + bool disableOutbound = 3; +} +``` + +## MsgUpdateGasPriceIncreaseFlags + +UpdateGasPriceIncreaseFlags updates the GasPriceIncreaseFlags. These flags control the increase of gas prices. +The flags are updated by the policy account with the groupOperational policy type. + +```proto +message MsgUpdateGasPriceIncreaseFlags { + string creator = 1; + GasPriceIncreaseFlags gasPriceIncreaseFlags = 2; +} +``` + diff --git a/proto/zetachain/zetacore/observer/events.proto b/proto/zetachain/zetacore/observer/events.proto index 4d752a4ce5..a939daafa1 100644 --- a/proto/zetachain/zetacore/observer/events.proto +++ b/proto/zetachain/zetacore/observer/events.proto @@ -29,10 +29,19 @@ message EventNewObserverAdded { uint64 observer_last_block_count = 5; } -message EventCrosschainFlagsUpdated { +message EventCCTXDisabled { string msg_type_url = 1; bool isInboundEnabled = 2; bool isOutboundEnabled = 3; - GasPriceIncreaseFlags gasPriceIncreaseFlags = 4; - string signer = 5; } + +message EventCCTXEnabled { + string msg_type_url = 1; + bool isInboundEnabled = 2; + bool isOutboundEnabled = 3; +} + +message EventGasPriceIncreaseFlagsUpdated { + string msg_type_url = 1; + GasPriceIncreaseFlags gasPriceIncreaseFlags = 2; +} \ No newline at end of file diff --git a/proto/zetachain/zetacore/observer/tx.proto b/proto/zetachain/zetacore/observer/tx.proto index 7316317fd4..a3a70c6c65 100644 --- a/proto/zetachain/zetacore/observer/tx.proto +++ b/proto/zetachain/zetacore/observer/tx.proto @@ -22,13 +22,15 @@ service Msg { rpc RemoveChainParams(MsgRemoveChainParams) returns (MsgRemoveChainParamsResponse); rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse); - rpc UpdateCrosschainFlags(MsgUpdateCrosschainFlags) - returns (MsgUpdateCrosschainFlagsResponse); rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse); rpc VoteBlockHeader(MsgVoteBlockHeader) returns (MsgVoteBlockHeaderResponse); rpc ResetChainNonces(MsgResetChainNonces) returns (MsgResetChainNoncesResponse); rpc VoteTSS(MsgVoteTSS) returns (MsgVoteTSSResponse); + rpc EnableCCTX(MsgEnableCCTX) returns (MsgEnableCCTXResponse); + rpc DisableCCTX(MsgDisableCCTX) returns (MsgDisableCCTXResponse); + rpc UpdateGasPriceIncreaseFlags(MsgUpdateGasPriceIncreaseFlags) + returns (MsgUpdateGasPriceIncreaseFlagsResponse); } message MsgUpdateObserver { @@ -83,15 +85,6 @@ message MsgAddBlameVote { message MsgAddBlameVoteResponse {} -message MsgUpdateCrosschainFlags { - string creator = 1; - bool isInboundEnabled = 3; - bool isOutboundEnabled = 4; - GasPriceIncreaseFlags gasPriceIncreaseFlags = 5; -} - -message MsgUpdateCrosschainFlagsResponse {} - message MsgUpdateKeygen { string creator = 1; int64 block = 2; @@ -120,3 +113,27 @@ message MsgVoteTSSResponse { bool vote_finalized = 2; bool keygen_success = 3; } + +message MsgEnableCCTX { + string creator = 1; + bool enableInbound = 2; + bool enableOutbound = 3; +} + +message MsgEnableCCTXResponse {} + +message MsgDisableCCTX { + string creator = 1; + bool disableInbound = 2; + bool disableOutbound = 3; +} + +message MsgDisableCCTXResponse {} + +message MsgUpdateGasPriceIncreaseFlags { + string creator = 1; + GasPriceIncreaseFlags gasPriceIncreaseFlags = 2 + [ (gogoproto.nullable) = false ]; +} + +message MsgUpdateGasPriceIncreaseFlagsResponse {} \ No newline at end of file diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index 4e3096fc8b..a67636642e 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -255,3 +255,12 @@ func NonceToCCTX(t *testing.T, seed string) types.NonceToCctx { Tss: Tss().TssPubkey, } } + +func GasPriceIncreaseFlags() types.GasPriceIncreaseFlags { + return types.GasPriceIncreaseFlags{ + EpochLength: 1, + RetryInterval: 1, + GasPriceIncreasePercent: 1, + MaxPendingCctxs: 100, + } +} diff --git a/typescript/zetachain/zetacore/observer/events_pb.d.ts b/typescript/zetachain/zetacore/observer/events_pb.d.ts index 122ff3672e..5139b88e2e 100644 --- a/typescript/zetachain/zetacore/observer/events_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/events_pb.d.ts @@ -130,9 +130,9 @@ export declare class EventNewObserverAdded extends Message { +export declare class EventCCTXDisabled extends Message { /** * @generated from field: string msg_type_url = 1; */ @@ -148,28 +148,81 @@ export declare class EventCrosschainFlagsUpdated extends Message); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.EventCCTXDisabled"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): EventCCTXDisabled; + + static fromJson(jsonValue: JsonValue, options?: Partial): EventCCTXDisabled; + + static fromJsonString(jsonString: string, options?: Partial): EventCCTXDisabled; + + static equals(a: EventCCTXDisabled | PlainMessage | undefined, b: EventCCTXDisabled | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.EventCCTXEnabled + */ +export declare class EventCCTXEnabled extends Message { /** - * @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 4; + * @generated from field: string msg_type_url = 1; */ - gasPriceIncreaseFlags?: GasPriceIncreaseFlags; + msgTypeUrl: string; + + /** + * @generated from field: bool isInboundEnabled = 2; + */ + isInboundEnabled: boolean; /** - * @generated from field: string signer = 5; + * @generated from field: bool isOutboundEnabled = 3; */ - signer: string; + isOutboundEnabled: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.EventCCTXEnabled"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): EventCCTXEnabled; + + static fromJson(jsonValue: JsonValue, options?: Partial): EventCCTXEnabled; + + static fromJsonString(jsonString: string, options?: Partial): EventCCTXEnabled; + + static equals(a: EventCCTXEnabled | PlainMessage | undefined, b: EventCCTXEnabled | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.EventGasPriceIncreaseFlagsUpdated + */ +export declare class EventGasPriceIncreaseFlagsUpdated extends Message { + /** + * @generated from field: string msg_type_url = 1; + */ + msgTypeUrl: string; + + /** + * @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 2; + */ + gasPriceIncreaseFlags?: GasPriceIncreaseFlags; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.EventCrosschainFlagsUpdated"; + static readonly typeName = "zetachain.zetacore.observer.EventGasPriceIncreaseFlagsUpdated"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): EventCrosschainFlagsUpdated; + static fromBinary(bytes: Uint8Array, options?: Partial): EventGasPriceIncreaseFlagsUpdated; - static fromJson(jsonValue: JsonValue, options?: Partial): EventCrosschainFlagsUpdated; + static fromJson(jsonValue: JsonValue, options?: Partial): EventGasPriceIncreaseFlagsUpdated; - static fromJsonString(jsonString: string, options?: Partial): EventCrosschainFlagsUpdated; + static fromJsonString(jsonString: string, options?: Partial): EventGasPriceIncreaseFlagsUpdated; - static equals(a: EventCrosschainFlagsUpdated | PlainMessage | undefined, b: EventCrosschainFlagsUpdated | PlainMessage | undefined): boolean; + static equals(a: EventGasPriceIncreaseFlagsUpdated | PlainMessage | undefined, b: EventGasPriceIncreaseFlagsUpdated | PlainMessage | undefined): boolean; } diff --git a/typescript/zetachain/zetacore/observer/tx_pb.d.ts b/typescript/zetachain/zetacore/observer/tx_pb.d.ts index 1482e2fd44..4b270f371d 100644 --- a/typescript/zetachain/zetacore/observer/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/tx_pb.d.ts @@ -9,8 +9,8 @@ import type { ObserverUpdateReason } from "./observer_pb.js"; import type { HeaderData } from "../pkg/proofs/proofs_pb.js"; import type { ChainParams } from "./params_pb.js"; import type { Blame } from "./blame_pb.js"; -import type { GasPriceIncreaseFlags } from "./crosschain_flags_pb.js"; import type { ReceiveStatus } from "../pkg/chains/chains_pb.js"; +import type { GasPriceIncreaseFlags } from "./crosschain_flags_pb.js"; /** * @generated from message zetachain.zetacore.observer.MsgUpdateObserver @@ -350,64 +350,6 @@ export declare class MsgAddBlameVoteResponse extends Message | undefined, b: MsgAddBlameVoteResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.observer.MsgUpdateCrosschainFlags - */ -export declare class MsgUpdateCrosschainFlags extends Message { - /** - * @generated from field: string creator = 1; - */ - creator: string; - - /** - * @generated from field: bool isInboundEnabled = 3; - */ - isInboundEnabled: boolean; - - /** - * @generated from field: bool isOutboundEnabled = 4; - */ - isOutboundEnabled: boolean; - - /** - * @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 5; - */ - gasPriceIncreaseFlags?: GasPriceIncreaseFlags; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.MsgUpdateCrosschainFlags"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateCrosschainFlags; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateCrosschainFlags; - - static fromJsonString(jsonString: string, options?: Partial): MsgUpdateCrosschainFlags; - - static equals(a: MsgUpdateCrosschainFlags | PlainMessage | undefined, b: MsgUpdateCrosschainFlags | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.observer.MsgUpdateCrosschainFlagsResponse - */ -export declare class MsgUpdateCrosschainFlagsResponse extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.MsgUpdateCrosschainFlagsResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateCrosschainFlagsResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateCrosschainFlagsResponse; - - static fromJsonString(jsonString: string, options?: Partial): MsgUpdateCrosschainFlagsResponse; - - static equals(a: MsgUpdateCrosschainFlagsResponse | PlainMessage | undefined, b: MsgUpdateCrosschainFlagsResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.observer.MsgUpdateKeygen */ @@ -587,3 +529,157 @@ export declare class MsgVoteTSSResponse extends Message { static equals(a: MsgVoteTSSResponse | PlainMessage | undefined, b: MsgVoteTSSResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.observer.MsgEnableCCTX + */ +export declare class MsgEnableCCTX extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: bool enableInbound = 2; + */ + enableInbound: boolean; + + /** + * @generated from field: bool enableOutbound = 3; + */ + enableOutbound: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgEnableCCTX"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgEnableCCTX; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgEnableCCTX; + + static fromJsonString(jsonString: string, options?: Partial): MsgEnableCCTX; + + static equals(a: MsgEnableCCTX | PlainMessage | undefined, b: MsgEnableCCTX | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.MsgEnableCCTXResponse + */ +export declare class MsgEnableCCTXResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgEnableCCTXResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgEnableCCTXResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgEnableCCTXResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgEnableCCTXResponse; + + static equals(a: MsgEnableCCTXResponse | PlainMessage | undefined, b: MsgEnableCCTXResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.MsgDisableCCTX + */ +export declare class MsgDisableCCTX extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: bool disableInbound = 2; + */ + disableInbound: boolean; + + /** + * @generated from field: bool disableOutbound = 3; + */ + disableOutbound: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgDisableCCTX"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgDisableCCTX; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgDisableCCTX; + + static fromJsonString(jsonString: string, options?: Partial): MsgDisableCCTX; + + static equals(a: MsgDisableCCTX | PlainMessage | undefined, b: MsgDisableCCTX | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.MsgDisableCCTXResponse + */ +export declare class MsgDisableCCTXResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgDisableCCTXResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgDisableCCTXResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgDisableCCTXResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgDisableCCTXResponse; + + static equals(a: MsgDisableCCTXResponse | PlainMessage | undefined, b: MsgDisableCCTXResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlags + */ +export declare class MsgUpdateGasPriceIncreaseFlags extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 2; + */ + gasPriceIncreaseFlags?: GasPriceIncreaseFlags; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlags"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateGasPriceIncreaseFlags; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateGasPriceIncreaseFlags; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateGasPriceIncreaseFlags; + + static equals(a: MsgUpdateGasPriceIncreaseFlags | PlainMessage | undefined, b: MsgUpdateGasPriceIncreaseFlags | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlagsResponse + */ +export declare class MsgUpdateGasPriceIncreaseFlagsResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlagsResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateGasPriceIncreaseFlagsResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateGasPriceIncreaseFlagsResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateGasPriceIncreaseFlagsResponse; + + static equals(a: MsgUpdateGasPriceIncreaseFlagsResponse | PlainMessage | undefined, b: MsgUpdateGasPriceIncreaseFlagsResponse | PlainMessage | undefined): boolean; +} + diff --git a/x/observer/client/cli/tx.go b/x/observer/client/cli/tx.go index b66dd7a058..78569fb753 100644 --- a/x/observer/client/cli/tx.go +++ b/x/observer/client/cli/tx.go @@ -23,13 +23,15 @@ func GetTxCmd() *cobra.Command { CmdAddObserver(), CmdUpdateChainParams(), CmdRemoveChainParams(), - CmdUpdateCrosschainFlags(), CmdUpdateKeygen(), CmdAddBlameVote(), CmdUpdateObserver(), CmdEncode(), CmdResetChainNonces(), CmdVoteTSS(), + CmdEnableCCTX(), + CmdDisableCCTX(), + CmdUpdateGasPriceIncreaseFlags(), ) return cmd diff --git a/x/observer/client/cli/tx_disable_cctx_flags.go b/x/observer/client/cli/tx_disable_cctx_flags.go new file mode 100644 index 0000000000..53cdf923bf --- /dev/null +++ b/x/observer/client/cli/tx_disable_cctx_flags.go @@ -0,0 +1,44 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdDisableCCTX() *cobra.Command { + cmd := &cobra.Command{ + Use: "disable-cctx [disable-inbound] [disable-outbound]", + Short: "Disable inbound and outbound for CCTX", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + disableInbound, err := strconv.ParseBool(args[0]) + if err != nil { + return err + } + disableOutbound, err := strconv.ParseBool(args[1]) + if err != nil { + return err + } + msg := types.NewMsgDisableCCTX(clientCtx.GetFromAddress().String(), disableInbound, disableOutbound) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/observer/client/cli/tx_permission_flags.go b/x/observer/client/cli/tx_enable_cctx_flags.go similarity index 60% rename from x/observer/client/cli/tx_permission_flags.go rename to x/observer/client/cli/tx_enable_cctx_flags.go index 1aa219ac98..c21016e258 100644 --- a/x/observer/client/cli/tx_permission_flags.go +++ b/x/observer/client/cli/tx_enable_cctx_flags.go @@ -11,10 +11,10 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -func CmdUpdateCrosschainFlags() *cobra.Command { +func CmdEnableCCTX() *cobra.Command { cmd := &cobra.Command{ - Use: "update-crosschain-flags [is-inbound-enabled] [is-outbound-enabled]", - Short: "Update crosschain flags", + Use: "enable-cctx [enable-inbound] [enable-outbound]", + Short: "Enable inbound and outbound for CCTX", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -22,25 +22,23 @@ func CmdUpdateCrosschainFlags() *cobra.Command { if err != nil { return err } - argIsInboundEnabled, err := strconv.ParseBool(args[0]) + enableInbound, err := strconv.ParseBool(args[0]) if err != nil { return err } - arsIsOutboundEnabled, err := strconv.ParseBool(args[1]) + enableOutbound, err := strconv.ParseBool(args[1]) + if err != nil { + return err + } + msg := types.NewMsgEnableCCTX(clientCtx.GetFromAddress().String(), enableInbound, enableOutbound) + err = msg.ValidateBasic() if err != nil { return err } - msg := types.NewMsgUpdateCrosschainFlags( - clientCtx.GetFromAddress().String(), - argIsInboundEnabled, - arsIsOutboundEnabled, - ) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } - flags.AddTxFlagsToCmd(cmd) - return cmd } diff --git a/x/observer/client/cli/tx_update_gas_price_increase_flags.go b/x/observer/client/cli/tx_update_gas_price_increase_flags.go new file mode 100644 index 0000000000..e2cc0a5685 --- /dev/null +++ b/x/observer/client/cli/tx_update_gas_price_increase_flags.go @@ -0,0 +1,67 @@ +package cli + +import ( + "strconv" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdUpdateGasPriceIncreaseFlags() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-gas-price-increase-flags [epochLength] [retryInterval] [gasPriceIncreasePercent] [gasPriceIncreaseMax] [maxPendingCctxs]", + Short: "Update the gas price increase flags", + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + epochLength, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return err + } + retryInterval, err := strconv.ParseInt(args[1], 10, 64) + if err != nil { + return err + } + + gasPriceIncreasePercent, err := strconv.ParseUint(args[2], 10, 32) + if err != nil { + return err + } + gasPriceIncreaseMax, err := strconv.ParseUint(args[3], 10, 32) + if err != nil { + return err + } + maxPendingCctxs, err := strconv.ParseUint(args[4], 10, 32) + if err != nil { + return err + } + gasPriceIncreaseFlags := types.GasPriceIncreaseFlags{ + EpochLength: epochLength, + RetryInterval: time.Duration(retryInterval), + // #nosec G701 bitsize set to 32 + GasPriceIncreasePercent: uint32(gasPriceIncreasePercent), + // #nosec G701 bitsize set to 32 + GasPriceIncreaseMax: uint32(gasPriceIncreaseMax), + // #nosec G701 bitsize set to 32 + MaxPendingCctxs: uint32(maxPendingCctxs)} + msg := types.NewMsgUpdateGasPriceIncreaseFlags(clientCtx.GetFromAddress().String(), gasPriceIncreaseFlags) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/observer/keeper/msg_server_disable_cctx_flags.go b/x/observer/keeper/msg_server_disable_cctx_flags.go new file mode 100644 index 0000000000..0645db2cc9 --- /dev/null +++ b/x/observer/keeper/msg_server_disable_cctx_flags.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// DisableCCTX disables the IsInboundEnabled and IsOutboundEnabled flags. These flags control the creation of inbounds and outbounds. +// The flags are disabled by the policy account with the groupEmergency policy type. +func (k msgServer) DisableCCTX( + goCtx context.Context, + msg *types.MsgDisableCCTX, +) (*types.MsgDisableCCTXResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check permission + if !k.GetAuthorityKeeper().IsAuthorized(ctx, msg.Creator, authoritytypes.PolicyType_groupEmergency) { + return &types.MsgDisableCCTXResponse{}, authoritytypes.ErrUnauthorized.Wrap( + "DisableCCTX can only be executed by the correct policy account", + ) + } + + // check if the value exists, + // if not, set the default value for the Inbound and Outbound flags only + flags, isFound := k.GetCrosschainFlags(ctx) + if !isFound { + flags = *types.DefaultCrosschainFlags() + flags.GasPriceIncreaseFlags = nil + } + + if msg.DisableInbound { + flags.IsInboundEnabled = false + } + if msg.DisableOutbound { + flags.IsOutboundEnabled = false + } + + k.SetCrosschainFlags(ctx, flags) + + err := ctx.EventManager().EmitTypedEvents(&types.EventCCTXDisabled{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgDisableCCTX{}), + IsInboundEnabled: flags.IsInboundEnabled, + IsOutboundEnabled: flags.IsOutboundEnabled, + }) + + if err != nil { + ctx.Logger().Error("Error emitting event EventCCTXDisabled :", err) + } + + return &types.MsgDisableCCTXResponse{}, nil +} diff --git a/x/observer/keeper/msg_server_disable_cctx_flags_test.go b/x/observer/keeper/msg_server_disable_cctx_flags_test.go new file mode 100644 index 0000000000..2dcab71f51 --- /dev/null +++ b/x/observer/keeper/msg_server_disable_cctx_flags_test.go @@ -0,0 +1,152 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/keeper" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgServer_MsgDisableCCTX(t *testing.T) { + t.Run("can disable cctx flags if flags dont exist", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgDisableCCTX{ + Creator: admin, + DisableOutbound: true, + DisableInbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) + + _, err := srv.DisableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.False(t, flags.IsInboundEnabled) + require.False(t, flags.IsOutboundEnabled) + require.Nil(t, flags.GasPriceIncreaseFlags) + }) + + t.Run("can disable cctx flags if flags set to true", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: true, + IsOutboundEnabled: true, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgDisableCCTX{ + Creator: admin, + DisableOutbound: true, + DisableInbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) + + _, err := srv.DisableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.False(t, flags.IsInboundEnabled) + require.False(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("can disable only outbound flag", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: true, + IsOutboundEnabled: true, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgDisableCCTX{ + Creator: admin, + DisableOutbound: true, + DisableInbound: false, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) + + _, err := srv.DisableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsInboundEnabled) + require.False(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("can disable only inbound flag", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: true, + IsOutboundEnabled: true, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgDisableCCTX{ + Creator: admin, + DisableOutbound: false, + DisableInbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) + + _, err := srv.DisableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.False(t, flags.IsInboundEnabled) + require.True(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("cannot disable cctx flags if not correct address", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgDisableCCTX{ + Creator: admin, + DisableOutbound: true, + DisableInbound: false, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) + + _, err := srv.DisableCCTX(sdk.WrapSDKContext(ctx), msg) + require.ErrorIs(t, authoritytypes.ErrUnauthorized, err) + + _, found := k.GetCrosschainFlags(ctx) + require.False(t, found) + }) +} diff --git a/x/observer/keeper/msg_server_enable_cctx_flags.go b/x/observer/keeper/msg_server_enable_cctx_flags.go new file mode 100644 index 0000000000..a361af6708 --- /dev/null +++ b/x/observer/keeper/msg_server_enable_cctx_flags.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// EnableCCTX enables the IsInboundEnabled and IsOutboundEnabled flags.These flags control the creation of inbounds and outbounds. +// The flags are enabled by the policy account with the groupOperational policy type. +func (k msgServer) EnableCCTX( + goCtx context.Context, + msg *types.MsgEnableCCTX, +) (*types.MsgEnableCCTXResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check permission + if !k.GetAuthorityKeeper().IsAuthorized(ctx, msg.Creator, authoritytypes.PolicyType_groupOperational) { + return &types.MsgEnableCCTXResponse{}, authoritytypes.ErrUnauthorized.Wrap( + "EnableCCTX can only be executed by the correct policy account", + ) + } + + // check if the value exists, + // if not, set the default value for the Inbound and Outbound flags only + flags, isFound := k.GetCrosschainFlags(ctx) + if !isFound { + flags = *types.DefaultCrosschainFlags() + flags.GasPriceIncreaseFlags = nil + } + + if msg.EnableInbound { + flags.IsInboundEnabled = true + } + if msg.EnableOutbound { + flags.IsOutboundEnabled = true + } + + k.SetCrosschainFlags(ctx, flags) + + err := ctx.EventManager().EmitTypedEvents(&types.EventCCTXEnabled{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgEnableCCTX{}), + IsInboundEnabled: flags.IsInboundEnabled, + IsOutboundEnabled: flags.IsOutboundEnabled, + }) + + if err != nil { + ctx.Logger().Error("Error emitting EventCCTXEnabled :", err) + } + + return &types.MsgEnableCCTXResponse{}, nil +} diff --git a/x/observer/keeper/msg_server_enable_cctx_flags_test.go b/x/observer/keeper/msg_server_enable_cctx_flags_test.go new file mode 100644 index 0000000000..8bb3346f91 --- /dev/null +++ b/x/observer/keeper/msg_server_enable_cctx_flags_test.go @@ -0,0 +1,152 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/keeper" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgServer_EnableCCTX(t *testing.T) { + t.Run("can enable cctx flags if flags dont exist", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgEnableCCTX{ + Creator: admin, + EnableInbound: true, + EnableOutbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.EnableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsInboundEnabled) + require.True(t, flags.IsOutboundEnabled) + require.Nil(t, flags.GasPriceIncreaseFlags) + }) + + t.Run("can enable cctx flags if flags set to false", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: false, + IsOutboundEnabled: false, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgEnableCCTX{ + Creator: admin, + EnableInbound: true, + EnableOutbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.EnableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsInboundEnabled) + require.True(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("can enable cctx flags only inbound flag", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: false, + IsOutboundEnabled: false, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgEnableCCTX{ + Creator: admin, + EnableInbound: true, + EnableOutbound: false, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.EnableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsInboundEnabled) + require.False(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("can enable cctx flags only outbound flag", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + gasPriceIncreaseFlags := sample.GasPriceIncreaseFlags() + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: false, + IsOutboundEnabled: false, + GasPriceIncreaseFlags: &gasPriceIncreaseFlags, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgEnableCCTX{ + Creator: admin, + EnableInbound: false, + EnableOutbound: true, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.EnableCCTX(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.False(t, flags.IsInboundEnabled) + require.True(t, flags.IsOutboundEnabled) + require.Equal(t, gasPriceIncreaseFlags, *flags.GasPriceIncreaseFlags) + }) + + t.Run("cannot enable cctx flags if not correct address", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgEnableCCTX{ + Creator: admin, + EnableInbound: true, + EnableOutbound: false, + } + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, false) + + _, err := srv.EnableCCTX(sdk.WrapSDKContext(ctx), msg) + require.ErrorIs(t, authoritytypes.ErrUnauthorized, err) + + _, found := k.GetCrosschainFlags(ctx) + require.False(t, found) + }) +} diff --git a/x/observer/keeper/msg_server_update_crosschain_flags.go b/x/observer/keeper/msg_server_update_crosschain_flags.go deleted file mode 100644 index 045b21dd7d..0000000000 --- a/x/observer/keeper/msg_server_update_crosschain_flags.go +++ /dev/null @@ -1,55 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// UpdateCrosschainFlags updates the crosschain related flags. -// -// Aurthorized: admin policy group 1 (except enabling/disabled -// inbounds/outbounds and gas price increase), admin policy group 2 (all). -func (k msgServer) UpdateCrosschainFlags( - goCtx context.Context, - msg *types.MsgUpdateCrosschainFlags, -) (*types.MsgUpdateCrosschainFlagsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // check permission - if !k.GetAuthorityKeeper().IsAuthorized(ctx, msg.Creator, msg.GetRequiredPolicyType()) { - return &types.MsgUpdateCrosschainFlagsResponse{}, authoritytypes.ErrUnauthorized - } - - // check if the value exists - flags, isFound := k.GetCrosschainFlags(ctx) - if !isFound { - flags = *types.DefaultCrosschainFlags() - } - - // update values - flags.IsInboundEnabled = msg.IsInboundEnabled - flags.IsOutboundEnabled = msg.IsOutboundEnabled - - if msg.GasPriceIncreaseFlags != nil { - flags.GasPriceIncreaseFlags = msg.GasPriceIncreaseFlags - } - - k.SetCrosschainFlags(ctx, flags) - - err := ctx.EventManager().EmitTypedEvents(&types.EventCrosschainFlagsUpdated{ - MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateCrosschainFlags{}), - IsInboundEnabled: msg.IsInboundEnabled, - IsOutboundEnabled: msg.IsOutboundEnabled, - GasPriceIncreaseFlags: msg.GasPriceIncreaseFlags, - Signer: msg.Creator, - }) - if err != nil { - ctx.Logger().Error("Error emitting EventCrosschainFlagsUpdated :", err) - } - - return &types.MsgUpdateCrosschainFlagsResponse{}, nil -} diff --git a/x/observer/keeper/msg_server_update_crosschain_flags_test.go b/x/observer/keeper/msg_server_update_crosschain_flags_test.go deleted file mode 100644 index b4a5f1f516..0000000000 --- a/x/observer/keeper/msg_server_update_crosschain_flags_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/testutil/sample" - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - "github.com/zeta-chain/zetacore/x/observer/keeper" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMsgServer_UpdateCrosschainFlags(t *testing.T) { - t.Run("can update crosschain flags", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ - UseAuthorityMock: true, - }) - srv := keeper.NewMsgServerImpl(*k) - admin := sample.AccAddress() - - // mock the authority keeper for authorization - authorityMock := keepertest.GetObserverAuthorityMock(t, k) - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) - - _, err := srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: false, - GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{ - EpochLength: 42, - RetryInterval: time.Minute * 42, - GasPriceIncreasePercent: 42, - }, - }) - require.NoError(t, err) - - flags, found := k.GetCrosschainFlags(ctx) - require.True(t, found) - require.False(t, flags.IsInboundEnabled) - require.False(t, flags.IsOutboundEnabled) - require.Equal(t, int64(42), flags.GasPriceIncreaseFlags.EpochLength) - require.Equal(t, time.Minute*42, flags.GasPriceIncreaseFlags.RetryInterval) - require.Equal(t, uint32(42), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent) - - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) - - // can update flags again - _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: true, - IsOutboundEnabled: true, - GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{ - EpochLength: 43, - RetryInterval: time.Minute * 43, - GasPriceIncreasePercent: 43, - }, - }) - require.NoError(t, err) - - flags, found = k.GetCrosschainFlags(ctx) - require.True(t, found) - require.True(t, flags.IsInboundEnabled) - require.True(t, flags.IsOutboundEnabled) - require.Equal(t, int64(43), flags.GasPriceIncreaseFlags.EpochLength) - require.Equal(t, time.Minute*43, flags.GasPriceIncreaseFlags.RetryInterval) - require.Equal(t, uint32(43), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent) - - // group 1 should be able to disable inbound and outbound - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - - // if gas price increase flags is nil, it should not be updated - _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: false, - }) - require.NoError(t, err) - - flags, found = k.GetCrosschainFlags(ctx) - require.True(t, found) - require.False(t, flags.IsInboundEnabled) - require.False(t, flags.IsOutboundEnabled) - require.Equal(t, int64(43), flags.GasPriceIncreaseFlags.EpochLength) - require.Equal(t, time.Minute*43, flags.GasPriceIncreaseFlags.RetryInterval) - require.Equal(t, uint32(43), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent) - - // group 1 should be able to disable header verification - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) - - // if gas price increase flags is nil, it should not be updated - _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: false, - }) - require.NoError(t, err) - - flags, found = k.GetCrosschainFlags(ctx) - require.True(t, found) - require.False(t, flags.IsInboundEnabled) - require.False(t, flags.IsOutboundEnabled) - require.Equal(t, int64(43), flags.GasPriceIncreaseFlags.EpochLength) - require.Equal(t, time.Minute*43, flags.GasPriceIncreaseFlags.RetryInterval) - require.Equal(t, uint32(43), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent) - - // if flags are not defined, default should be used - k.RemoveCrosschainFlags(ctx) - _, found = k.GetCrosschainFlags(ctx) - require.False(t, found) - - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) - - _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: true, - }) - require.NoError(t, err) - - flags, found = k.GetCrosschainFlags(ctx) - require.True(t, found) - require.False(t, flags.IsInboundEnabled) - require.True(t, flags.IsOutboundEnabled) - require.Equal(t, types.DefaultGasPriceIncreaseFlags.EpochLength, flags.GasPriceIncreaseFlags.EpochLength) - require.Equal(t, types.DefaultGasPriceIncreaseFlags.RetryInterval, flags.GasPriceIncreaseFlags.RetryInterval) - require.Equal( - t, - types.DefaultGasPriceIncreaseFlags.GasPriceIncreasePercent, - flags.GasPriceIncreaseFlags.GasPriceIncreasePercent, - ) - }) - - t.Run("cannot update crosschain flags if not authorized", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ - UseAuthorityMock: true, - }) - srv := keeper.NewMsgServerImpl(*k) - - admin := sample.AccAddress() - authorityMock := keepertest.GetObserverAuthorityMock(t, k) - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, false) - - _, err := srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: false, - }) - require.Error(t, err) - require.Equal(t, authoritytypes.ErrUnauthorized, err) - - keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, false) - - _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{ - Creator: admin, - IsInboundEnabled: false, - IsOutboundEnabled: true, - }) - require.Error(t, err) - require.Equal(t, authoritytypes.ErrUnauthorized, err) - }) -} diff --git a/x/observer/keeper/msg_server_update_gas_price_increase_flags.go b/x/observer/keeper/msg_server_update_gas_price_increase_flags.go new file mode 100644 index 0000000000..7402ab0cc7 --- /dev/null +++ b/x/observer/keeper/msg_server_update_gas_price_increase_flags.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// UpdateGasPriceIncreaseFlags updates the GasPriceIncreaseFlags. These flags control the increase of gas prices. +// The flags are updated by the policy account with the groupOperational policy type. +func (k msgServer) UpdateGasPriceIncreaseFlags( + goCtx context.Context, + msg *types.MsgUpdateGasPriceIncreaseFlags, +) (*types.MsgUpdateGasPriceIncreaseFlagsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check permission + if !k.GetAuthorityKeeper().IsAuthorized(ctx, msg.Creator, authoritytypes.PolicyType_groupOperational) { + return &types.MsgUpdateGasPriceIncreaseFlagsResponse{}, authoritytypes.ErrUnauthorized.Wrap( + "UpdateGasPriceIncreaseFlags can only be executed by the correct policy account", + ) + } + // check if the value exists, + // if not, set the default value for the GasPriceIncreaseFlags only + // Set Inbound and Outbound flags to false + flags, isFound := k.GetCrosschainFlags(ctx) + if !isFound { + flags = *types.DefaultCrosschainFlags() + flags.IsInboundEnabled = false + flags.IsOutboundEnabled = false + } + + err := msg.GasPriceIncreaseFlags.Validate() + if err != nil { + return &types.MsgUpdateGasPriceIncreaseFlagsResponse{}, err + } + + flags.GasPriceIncreaseFlags = &msg.GasPriceIncreaseFlags + k.SetCrosschainFlags(ctx, flags) + + err = ctx.EventManager().EmitTypedEvents(&types.EventGasPriceIncreaseFlagsUpdated{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateGasPriceIncreaseFlags{}), + GasPriceIncreaseFlags: flags.GasPriceIncreaseFlags, + }) + + if err != nil { + ctx.Logger().Error("Error emitting EventGasPriceIncreaseFlagsUpdated :", err) + } + + return &types.MsgUpdateGasPriceIncreaseFlagsResponse{}, nil +} diff --git a/x/observer/keeper/msg_server_update_gas_price_increase_flags_test.go b/x/observer/keeper/msg_server_update_gas_price_increase_flags_test.go new file mode 100644 index 0000000000..63fcec7acf --- /dev/null +++ b/x/observer/keeper/msg_server_update_gas_price_increase_flags_test.go @@ -0,0 +1,116 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + "github.com/zeta-chain/zetacore/x/observer/keeper" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestKeeper_UpdateGasPriceIncreaseFlags(t *testing.T) { + t.Run("can update gas price increase flags if crosschain flags dont exist", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + updatedFlags := sample.GasPriceIncreaseFlags() + msg := &types.MsgUpdateGasPriceIncreaseFlags{ + Creator: admin, + GasPriceIncreaseFlags: updatedFlags, + } + + // mock the authority keeper for authorization + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.UpdateGasPriceIncreaseFlags(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.Equal(t, updatedFlags, *flags.GasPriceIncreaseFlags) + require.False(t, flags.IsInboundEnabled) + require.False(t, flags.IsOutboundEnabled) + }) + + t.Run("can update gas price increase flags if crosschain flags exist", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + defaultCrosschainFlags := types.DefaultCrosschainFlags() + k.SetCrosschainFlags(ctx, *defaultCrosschainFlags) + updatedFlags := sample.GasPriceIncreaseFlags() + msg := &types.MsgUpdateGasPriceIncreaseFlags{ + Creator: admin, + GasPriceIncreaseFlags: updatedFlags, + } + + // mock the authority keeper for authorization + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.UpdateGasPriceIncreaseFlags(sdk.WrapSDKContext(ctx), msg) + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.Equal(t, updatedFlags, *flags.GasPriceIncreaseFlags) + require.Equal(t, defaultCrosschainFlags.IsInboundEnabled, flags.IsInboundEnabled) + require.Equal(t, defaultCrosschainFlags.IsOutboundEnabled, flags.IsOutboundEnabled) + }) + + t.Run("cannot update invalid gas price increase flags", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgUpdateGasPriceIncreaseFlags{ + Creator: admin, + GasPriceIncreaseFlags: types.GasPriceIncreaseFlags{ + EpochLength: -1, + RetryInterval: 1, + GasPriceIncreasePercent: 1, + }, + } + + // mock the authority keeper for authorization + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, true) + + _, err := srv.UpdateGasPriceIncreaseFlags(sdk.WrapSDKContext(ctx), msg) + require.ErrorContains(t, err, "epoch length must be positive") + + _, found := k.GetCrosschainFlags(ctx) + require.False(t, found) + + }) + + t.Run("cannot update gas price increase flags if not authorized", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + msg := &types.MsgUpdateGasPriceIncreaseFlags{ + Creator: admin, + GasPriceIncreaseFlags: sample.GasPriceIncreaseFlags(), + } + + // mock the authority keeper for authorization + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupOperational, false) + + _, err := srv.UpdateGasPriceIncreaseFlags(sdk.WrapSDKContext(ctx), msg) + require.ErrorContains(t, err, "sender not authorized") + }) +} diff --git a/x/observer/types/codec.go b/x/observer/types/codec.go index 91cc9725db..9db4078a11 100644 --- a/x/observer/types/codec.go +++ b/x/observer/types/codec.go @@ -13,11 +13,13 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRemoveChainParams{}, "observer/RemoveChainParams", nil) cdc.RegisterConcrete(&MsgVoteBlockHeader{}, "observer/VoteBlockHeader", nil) cdc.RegisterConcrete(&MsgAddBlameVote{}, "observer/AddBlameVote", nil) - cdc.RegisterConcrete(&MsgUpdateCrosschainFlags{}, "observer/UpdateCrosschainFlags", nil) cdc.RegisterConcrete(&MsgUpdateKeygen{}, "observer/UpdateKeygen", nil) cdc.RegisterConcrete(&MsgUpdateObserver{}, "observer/UpdateObserver", nil) cdc.RegisterConcrete(&MsgResetChainNonces{}, "observer/ResetChainNonces", nil) cdc.RegisterConcrete(&MsgVoteTSS{}, "observer/VoteTSS", nil) + cdc.RegisterConcrete(&MsgEnableCCTX{}, "observer/EnableCCTX", nil) + cdc.RegisterConcrete(&MsgDisableCCTX{}, "observer/DisableCCTX", nil) + cdc.RegisterConcrete(&MsgUpdateGasPriceIncreaseFlags{}, "observer/UpdateGasPriceIncreaseFlags", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -26,12 +28,14 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUpdateChainParams{}, &MsgRemoveChainParams{}, &MsgAddBlameVote{}, - &MsgUpdateCrosschainFlags{}, &MsgUpdateKeygen{}, &MsgVoteBlockHeader{}, &MsgUpdateObserver{}, &MsgResetChainNonces{}, &MsgVoteTSS{}, + &MsgEnableCCTX{}, + &MsgDisableCCTX{}, + &MsgUpdateGasPriceIncreaseFlags{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/observer/types/events.pb.go b/x/observer/types/events.pb.go index ed991d3821..e1dde9feb0 100644 --- a/x/observer/types/events.pb.go +++ b/x/observer/types/events.pb.go @@ -235,26 +235,24 @@ func (m *EventNewObserverAdded) GetObserverLastBlockCount() uint64 { return 0 } -type EventCrosschainFlagsUpdated struct { - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - IsInboundEnabled bool `protobuf:"varint,2,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` - IsOutboundEnabled bool `protobuf:"varint,3,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` - GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,4,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"` - Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +type EventCCTXDisabled struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + IsInboundEnabled bool `protobuf:"varint,2,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` + IsOutboundEnabled bool `protobuf:"varint,3,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` } -func (m *EventCrosschainFlagsUpdated) Reset() { *m = EventCrosschainFlagsUpdated{} } -func (m *EventCrosschainFlagsUpdated) String() string { return proto.CompactTextString(m) } -func (*EventCrosschainFlagsUpdated) ProtoMessage() {} -func (*EventCrosschainFlagsUpdated) Descriptor() ([]byte, []int) { +func (m *EventCCTXDisabled) Reset() { *m = EventCCTXDisabled{} } +func (m *EventCCTXDisabled) String() string { return proto.CompactTextString(m) } +func (*EventCCTXDisabled) ProtoMessage() {} +func (*EventCCTXDisabled) Descriptor() ([]byte, []int) { return fileDescriptor_067e682d8234d605, []int{3} } -func (m *EventCrosschainFlagsUpdated) XXX_Unmarshal(b []byte) error { +func (m *EventCCTXDisabled) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventCrosschainFlagsUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventCCTXDisabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventCrosschainFlagsUpdated.Marshal(b, m, deterministic) + return xxx_messageInfo_EventCCTXDisabled.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -264,58 +262,158 @@ func (m *EventCrosschainFlagsUpdated) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *EventCrosschainFlagsUpdated) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCrosschainFlagsUpdated.Merge(m, src) +func (m *EventCCTXDisabled) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCCTXDisabled.Merge(m, src) } -func (m *EventCrosschainFlagsUpdated) XXX_Size() int { +func (m *EventCCTXDisabled) XXX_Size() int { return m.Size() } -func (m *EventCrosschainFlagsUpdated) XXX_DiscardUnknown() { - xxx_messageInfo_EventCrosschainFlagsUpdated.DiscardUnknown(m) +func (m *EventCCTXDisabled) XXX_DiscardUnknown() { + xxx_messageInfo_EventCCTXDisabled.DiscardUnknown(m) } -var xxx_messageInfo_EventCrosschainFlagsUpdated proto.InternalMessageInfo +var xxx_messageInfo_EventCCTXDisabled proto.InternalMessageInfo -func (m *EventCrosschainFlagsUpdated) GetMsgTypeUrl() string { +func (m *EventCCTXDisabled) GetMsgTypeUrl() string { if m != nil { return m.MsgTypeUrl } return "" } -func (m *EventCrosschainFlagsUpdated) GetIsInboundEnabled() bool { +func (m *EventCCTXDisabled) GetIsInboundEnabled() bool { if m != nil { return m.IsInboundEnabled } return false } -func (m *EventCrosschainFlagsUpdated) GetIsOutboundEnabled() bool { +func (m *EventCCTXDisabled) GetIsOutboundEnabled() bool { if m != nil { return m.IsOutboundEnabled } return false } -func (m *EventCrosschainFlagsUpdated) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags { +type EventCCTXEnabled struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + IsInboundEnabled bool `protobuf:"varint,2,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` + IsOutboundEnabled bool `protobuf:"varint,3,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` +} + +func (m *EventCCTXEnabled) Reset() { *m = EventCCTXEnabled{} } +func (m *EventCCTXEnabled) String() string { return proto.CompactTextString(m) } +func (*EventCCTXEnabled) ProtoMessage() {} +func (*EventCCTXEnabled) Descriptor() ([]byte, []int) { + return fileDescriptor_067e682d8234d605, []int{4} +} +func (m *EventCCTXEnabled) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCCTXEnabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCCTXEnabled.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 *EventCCTXEnabled) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCCTXEnabled.Merge(m, src) +} +func (m *EventCCTXEnabled) XXX_Size() int { + return m.Size() +} +func (m *EventCCTXEnabled) XXX_DiscardUnknown() { + xxx_messageInfo_EventCCTXEnabled.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCCTXEnabled proto.InternalMessageInfo + +func (m *EventCCTXEnabled) GetMsgTypeUrl() string { if m != nil { - return m.GasPriceIncreaseFlags + return m.MsgTypeUrl } - return nil + return "" +} + +func (m *EventCCTXEnabled) GetIsInboundEnabled() bool { + if m != nil { + return m.IsInboundEnabled + } + return false } -func (m *EventCrosschainFlagsUpdated) GetSigner() string { +func (m *EventCCTXEnabled) GetIsOutboundEnabled() bool { if m != nil { - return m.Signer + return m.IsOutboundEnabled + } + return false +} + +type EventGasPriceIncreaseFlagsUpdated struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,2,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"` +} + +func (m *EventGasPriceIncreaseFlagsUpdated) Reset() { *m = EventGasPriceIncreaseFlagsUpdated{} } +func (m *EventGasPriceIncreaseFlagsUpdated) String() string { return proto.CompactTextString(m) } +func (*EventGasPriceIncreaseFlagsUpdated) ProtoMessage() {} +func (*EventGasPriceIncreaseFlagsUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_067e682d8234d605, []int{5} +} +func (m *EventGasPriceIncreaseFlagsUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventGasPriceIncreaseFlagsUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventGasPriceIncreaseFlagsUpdated.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 *EventGasPriceIncreaseFlagsUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventGasPriceIncreaseFlagsUpdated.Merge(m, src) +} +func (m *EventGasPriceIncreaseFlagsUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventGasPriceIncreaseFlagsUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventGasPriceIncreaseFlagsUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventGasPriceIncreaseFlagsUpdated proto.InternalMessageInfo + +func (m *EventGasPriceIncreaseFlagsUpdated) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl } return "" } +func (m *EventGasPriceIncreaseFlagsUpdated) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags { + if m != nil { + return m.GasPriceIncreaseFlags + } + return nil +} + func init() { proto.RegisterType((*EventBallotCreated)(nil), "zetachain.zetacore.observer.EventBallotCreated") proto.RegisterType((*EventKeygenBlockUpdated)(nil), "zetachain.zetacore.observer.EventKeygenBlockUpdated") proto.RegisterType((*EventNewObserverAdded)(nil), "zetachain.zetacore.observer.EventNewObserverAdded") - proto.RegisterType((*EventCrosschainFlagsUpdated)(nil), "zetachain.zetacore.observer.EventCrosschainFlagsUpdated") + proto.RegisterType((*EventCCTXDisabled)(nil), "zetachain.zetacore.observer.EventCCTXDisabled") + proto.RegisterType((*EventCCTXEnabled)(nil), "zetachain.zetacore.observer.EventCCTXEnabled") + proto.RegisterType((*EventGasPriceIncreaseFlagsUpdated)(nil), "zetachain.zetacore.observer.EventGasPriceIncreaseFlagsUpdated") } func init() { @@ -323,43 +421,44 @@ func init() { } var fileDescriptor_067e682d8234d605 = []byte{ - // 566 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0xd3, 0x52, 0xc1, 0xa5, 0xd0, 0xf4, 0x44, 0x5b, 0x37, 0x95, 0x4c, 0x89, 0x84, 0x54, - 0x0a, 0x38, 0x52, 0x98, 0x40, 0x2c, 0x24, 0x2a, 0x25, 0x02, 0xd1, 0x2a, 0xa2, 0x0b, 0x8b, 0x75, - 0xb6, 0x5f, 0x6d, 0x2b, 0xce, 0x5d, 0x74, 0x77, 0x2e, 0x84, 0x9d, 0x9d, 0x15, 0xf1, 0x0f, 0x31, - 0x76, 0x64, 0x60, 0x40, 0xc9, 0x3f, 0x82, 0xee, 0xce, 0x71, 0x42, 0x13, 0x45, 0xd9, 0xce, 0xdf, - 0xfb, 0xbe, 0xe7, 0xef, 0xfd, 0x42, 0x47, 0x5f, 0x41, 0x92, 0x20, 0x26, 0x09, 0x6d, 0xe8, 0x17, - 0xe3, 0xd0, 0x60, 0xbe, 0x00, 0x7e, 0x05, 0xbc, 0x01, 0x57, 0x40, 0xa5, 0x70, 0x07, 0x9c, 0x49, - 0x86, 0x0f, 0x0a, 0xa6, 0x3b, 0x61, 0xba, 0x13, 0x66, 0xed, 0x7e, 0xc4, 0x22, 0xa6, 0x79, 0x0d, - 0xf5, 0x32, 0x92, 0x5a, 0x73, 0x59, 0xf2, 0x80, 0x33, 0x21, 0x74, 0xd0, 0xbb, 0x4c, 0x49, 0x94, - 0xff, 0xa6, 0x76, 0xbc, 0x4c, 0x33, 0x79, 0x18, 0x6e, 0xfd, 0x8f, 0x85, 0xf0, 0x89, 0xf2, 0xd8, - 0x22, 0x69, 0xca, 0x64, 0x9b, 0x03, 0x91, 0x10, 0xe2, 0x43,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 0xfa, 0xfa, 0xce, 0x9f, 0xdd, 0x38, 0xf9, 0x2f, 0xd3, 0xa3, - 0x57, 0xbd, 0x13, 0xfe, 0x86, 0x3e, 0xf9, 0xe7, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xe4, - 0xf6, 0x72, 0xb1, 0x04, 0x00, 0x00, + // 582 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0x6e, 0xb6, 0x81, 0xc0, 0x1d, 0xac, 0x8d, 0x18, 0xcb, 0x8a, 0x14, 0xb6, 0x4a, 0x48, 0x63, + 0x40, 0x2a, 0x95, 0x13, 0x88, 0x0b, 0x2d, 0x63, 0x54, 0x20, 0x36, 0x55, 0x9b, 0x84, 0xb8, 0x44, + 0x4e, 0xf2, 0x96, 0x44, 0x4d, 0xed, 0xca, 0x76, 0x06, 0xe5, 0xce, 0x15, 0xb8, 0xf2, 0x2b, 0xf8, + 0x1b, 0x1c, 0x77, 0xe4, 0xc0, 0x01, 0xb5, 0x7f, 0x04, 0xd9, 0x4e, 0xd2, 0x42, 0xab, 0xaa, 0xb7, + 0xdd, 0xac, 0xf7, 0xbe, 0xef, 0xf3, 0xf7, 0x3d, 0x27, 0x0f, 0xed, 0x7d, 0x02, 0x81, 0xfd, 0x08, + 0xc7, 0xa4, 0xa1, 0x4e, 0x94, 0x41, 0x83, 0x7a, 0x1c, 0xd8, 0x39, 0xb0, 0x06, 0x9c, 0x03, 0x11, + 0xdc, 0x19, 0x30, 0x2a, 0xa8, 0x79, 0xa7, 0x40, 0x3a, 0x39, 0xd2, 0xc9, 0x91, 0xb5, 0x5b, 0x21, + 0x0d, 0xa9, 0xc2, 0x35, 0xe4, 0x49, 0x53, 0x6a, 0xcd, 0x45, 0xe2, 0x3e, 0xa3, 0x9c, 0xab, 0xa6, + 0x7b, 0x96, 0xe0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0x39, 0x73, 0xef, 0xee, 0xce, 0x17, 0x6c, 0x75, 0x7e, 0x8e, 0x6c, 0xe3, 0x62, 0x64, 0x1b, 0x7f, + 0x46, 0xb6, 0xf1, 0x6d, 0x6c, 0x97, 0x2e, 0xc6, 0x76, 0xe9, 0xd7, 0xd8, 0x2e, 0xbd, 0x6f, 0x84, + 0xb1, 0x88, 0x52, 0xcf, 0xf1, 0x69, 0x5f, 0xad, 0xa7, 0x47, 0xff, 0x6d, 0xaa, 0x8f, 0x93, 0x5d, + 0x25, 0x93, 0x70, 0xef, 0xaa, 0xda, 0x54, 0x8f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x12, 0xe0, + 0x05, 0x6e, 0x68, 0x05, 0x00, 0x00, } func (m *EventBallotCreated) Marshal() (dAtA []byte, err error) { @@ -520,7 +619,7 @@ func (m *EventNewObserverAdded) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventCrosschainFlagsUpdated) Marshal() (dAtA []byte, err error) { +func (m *EventCCTXDisabled) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -530,35 +629,66 @@ func (m *EventCrosschainFlagsUpdated) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventCrosschainFlagsUpdated) MarshalTo(dAtA []byte) (int, error) { +func (m *EventCCTXDisabled) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCrosschainFlagsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventCCTXDisabled) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer))) + if m.IsOutboundEnabled { i-- - dAtA[i] = 0x2a + if m.IsOutboundEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 } - if m.GasPriceIncreaseFlags != nil { - { - size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) + if m.IsInboundEnabled { + i-- + if m.IsInboundEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x10 + } + if len(m.MsgTypeUrl) > 0 { + i -= len(m.MsgTypeUrl) + copy(dAtA[i:], m.MsgTypeUrl) + i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventCCTXEnabled) 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 *EventCCTXEnabled) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCCTXEnabled) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if m.IsOutboundEnabled { i-- if m.IsOutboundEnabled { @@ -589,6 +719,48 @@ func (m *EventCrosschainFlagsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *EventGasPriceIncreaseFlagsUpdated) 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 *EventGasPriceIncreaseFlagsUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventGasPriceIncreaseFlagsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasPriceIncreaseFlags != nil { + { + size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.MsgTypeUrl) > 0 { + i -= len(m.MsgTypeUrl) + copy(dAtA[i:], m.MsgTypeUrl) + i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -678,7 +850,7 @@ func (m *EventNewObserverAdded) Size() (n int) { return n } -func (m *EventCrosschainFlagsUpdated) Size() (n int) { +func (m *EventCCTXDisabled) Size() (n int) { if m == nil { return 0 } @@ -694,14 +866,42 @@ func (m *EventCrosschainFlagsUpdated) Size() (n int) { if m.IsOutboundEnabled { n += 2 } - if m.GasPriceIncreaseFlags != nil { - l = m.GasPriceIncreaseFlags.Size() + return n +} + +func (m *EventCCTXEnabled) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MsgTypeUrl) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Signer) + if m.IsInboundEnabled { + n += 2 + } + if m.IsOutboundEnabled { + n += 2 + } + return n +} + +func (m *EventGasPriceIncreaseFlagsUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MsgTypeUrl) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.GasPriceIncreaseFlags != nil { + l = m.GasPriceIncreaseFlags.Size() + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -1264,7 +1464,7 @@ func (m *EventNewObserverAdded) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error { +func (m *EventCCTXDisabled) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1287,10 +1487,10 @@ func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventCrosschainFlagsUpdated: wiretype end group for non-group") + return fmt.Errorf("proto: EventCCTXDisabled: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventCrosschainFlagsUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventCCTXDisabled: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1365,11 +1565,61 @@ func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error { } } m.IsOutboundEnabled = bool(v != 0) - case 4: + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventCCTXEnabled) 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 ErrIntOverflowEvents + } + 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: EventCCTXEnabled: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCCTXEnabled: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -1379,31 +1629,117 @@ func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - if m.GasPriceIncreaseFlags == nil { - m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{} + m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType) } - if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsInboundEnabled = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsOutboundEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 5: + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventGasPriceIncreaseFlagsUpdated) 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 ErrIntOverflowEvents + } + 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: EventGasPriceIncreaseFlagsUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventGasPriceIncreaseFlagsUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1431,7 +1767,43 @@ func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GasPriceIncreaseFlags == nil { + m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{} + } + if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/observer/types/message_disable_cctx_flags.go b/x/observer/types/message_disable_cctx_flags.go new file mode 100644 index 0000000000..dd5eb1bedb --- /dev/null +++ b/x/observer/types/message_disable_cctx_flags.go @@ -0,0 +1,55 @@ +package types + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + TypeMsgDisableCCTX = "disable_crosschain" +) + +var _ sdk.Msg = &MsgDisableCCTX{} + +func NewMsgDisableCCTX(creator string, disableOutbound, disableInbound bool) *MsgDisableCCTX { + return &MsgDisableCCTX{ + Creator: creator, + DisableInbound: disableInbound, + DisableOutbound: disableOutbound, + } +} + +func (msg *MsgDisableCCTX) Route() string { + return RouterKey +} + +func (msg *MsgDisableCCTX) Type() string { + return TypeMsgDisableCCTX +} + +func (msg *MsgDisableCCTX) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgDisableCCTX) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgDisableCCTX) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if !msg.DisableInbound && !msg.DisableOutbound { + return cosmoserrors.Wrap( + sdkerrors.ErrInvalidRequest, + "at least one of DisableInbound or DisableOutbound must be true", + ) + } + return nil +} diff --git a/x/observer/types/message_disable_cctx_flags_test.go b/x/observer/types/message_disable_cctx_flags_test.go new file mode 100644 index 0000000000..40a4d023d2 --- /dev/null +++ b/x/observer/types/message_disable_cctx_flags_test.go @@ -0,0 +1,104 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgDisableCCTX_ValidateBasic(t *testing.T) { + tt := []struct { + name string + msg *types.MsgDisableCCTX + err require.ErrorAssertionFunc + }{ + { + name: "invalid creator address", + msg: types.NewMsgDisableCCTX("invalid", true, true), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "invalid creator address") + }, + }, + { + name: "invalid flags", + msg: types.NewMsgDisableCCTX(sample.AccAddress(), false, false), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "at least one of DisableInbound or DisableOutbound must be true") + }, + }, + { + name: "valid", + msg: types.NewMsgDisableCCTX(sample.AccAddress(), true, true), + err: require.NoError, + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + tc.err(t, tc.msg.ValidateBasic()) + }) + } +} + +func TestMsgDisableCCTX_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgDisableCCTX + panics bool + }{ + { + name: "valid signer", + msg: types.MsgDisableCCTX{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgDisableCCTX{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgDisableCCTX_Type(t *testing.T) { + msg := types.MsgDisableCCTX{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgDisableCCTX, msg.Type()) +} + +func TestMsgDisableCCTX_Route(t *testing.T) { + msg := types.MsgDisableCCTX{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgDisableCCTX_GetSignBytes(t *testing.T) { + msg := types.MsgDisableCCTX{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_enable_cctx_flags.go b/x/observer/types/message_enable_cctx_flags.go new file mode 100644 index 0000000000..d85117fb34 --- /dev/null +++ b/x/observer/types/message_enable_cctx_flags.go @@ -0,0 +1,55 @@ +package types + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + TypeMsgEnableCCTX = "enable_crosschain" +) + +var _ sdk.Msg = &MsgEnableCCTX{} + +func NewMsgEnableCCTX(creator string, enableInbound, enableOutbound bool) *MsgEnableCCTX { + return &MsgEnableCCTX{ + Creator: creator, + EnableInbound: enableInbound, + EnableOutbound: enableOutbound, + } +} + +func (msg *MsgEnableCCTX) Route() string { + return RouterKey +} + +func (msg *MsgEnableCCTX) Type() string { + return TypeMsgEnableCCTX +} + +func (msg *MsgEnableCCTX) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgEnableCCTX) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgEnableCCTX) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if !msg.EnableInbound && !msg.EnableOutbound { + return cosmoserrors.Wrap( + sdkerrors.ErrInvalidRequest, + "at least one of EnableInbound or EnableOutbound must be true", + ) + } + return nil +} diff --git a/x/observer/types/message_enable_cctx_flags_test.go b/x/observer/types/message_enable_cctx_flags_test.go new file mode 100644 index 0000000000..2033837e7d --- /dev/null +++ b/x/observer/types/message_enable_cctx_flags_test.go @@ -0,0 +1,104 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgEnableCCTX_ValidateBasic(t *testing.T) { + tt := []struct { + name string + msg *types.MsgEnableCCTX + err require.ErrorAssertionFunc + }{ + { + name: "invalid creator address", + msg: types.NewMsgEnableCCTX("invalid", true, true), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "invalid creator address") + }, + }, + { + name: "invalid flags", + msg: types.NewMsgEnableCCTX(sample.AccAddress(), false, false), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "at least one of EnableInbound or EnableOutbound must be true") + }, + }, + { + name: "valid", + msg: types.NewMsgEnableCCTX(sample.AccAddress(), true, true), + err: require.NoError, + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + tc.err(t, tc.msg.ValidateBasic()) + }) + } +} + +func TestMsgEnableCCTX_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgEnableCCTX + panics bool + }{ + { + name: "valid signer", + msg: types.MsgEnableCCTX{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgEnableCCTX{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgEnableCCTX_Type(t *testing.T) { + msg := types.MsgEnableCCTX{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgEnableCCTX, msg.Type()) +} + +func TestMsgEnableCCTX_Route(t *testing.T) { + msg := types.MsgEnableCCTX{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgEnableCCTX_GetSignBytes(t *testing.T) { + msg := types.MsgEnableCCTX{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_update_crosschain_flags.go b/x/observer/types/message_update_crosschain_flags.go deleted file mode 100644 index 472d9ffdf6..0000000000 --- a/x/observer/types/message_update_crosschain_flags.go +++ /dev/null @@ -1,86 +0,0 @@ -package types - -import ( - "errors" - - cosmoserrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" -) - -const ( - TypeMsgUpdateCrosschainFlags = "update_crosschain_flags" -) - -var _ sdk.Msg = &MsgUpdateCrosschainFlags{} - -func NewMsgUpdateCrosschainFlags(creator string, isInboundEnabled, isOutboundEnabled bool) *MsgUpdateCrosschainFlags { - return &MsgUpdateCrosschainFlags{ - Creator: creator, - IsInboundEnabled: isInboundEnabled, - IsOutboundEnabled: isOutboundEnabled, - } -} - -func (msg *MsgUpdateCrosschainFlags) Route() string { - return RouterKey -} - -func (msg *MsgUpdateCrosschainFlags) Type() string { - return TypeMsgUpdateCrosschainFlags -} - -func (msg *MsgUpdateCrosschainFlags) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgUpdateCrosschainFlags) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUpdateCrosschainFlags) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) - } - - if msg.GasPriceIncreaseFlags != nil { - if err := msg.GasPriceIncreaseFlags.Validate(); err != nil { - return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) - } - } - - return nil -} - -func (gpf GasPriceIncreaseFlags) Validate() error { - if gpf.EpochLength <= 0 { - return errors.New("epoch length must be positive") - } - if gpf.RetryInterval <= 0 { - return errors.New("retry interval must be positive") - } - return nil -} - -// GetRequiredPolicyType returns the required policy type for the message to execute the message -// Group emergency should only be able to stop or disable functionalities in case of emergency -// this concerns disabling inbound and outbound txs or block header verification -// every other action requires group admin -// TODO: add separate message for each group -// https://github.com/zeta-chain/node/issues/1562 -func (msg *MsgUpdateCrosschainFlags) GetRequiredPolicyType() authoritytypes.PolicyType { - if msg.IsInboundEnabled || msg.IsOutboundEnabled { - return authoritytypes.PolicyType_groupOperational - } - if msg.GasPriceIncreaseFlags != nil { - return authoritytypes.PolicyType_groupOperational - } - return authoritytypes.PolicyType_groupEmergency -} diff --git a/x/observer/types/message_update_crosschain_flags_test.go b/x/observer/types/message_update_crosschain_flags_test.go deleted file mode 100644 index ae529d7d02..0000000000 --- a/x/observer/types/message_update_crosschain_flags_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - - "github.com/zeta-chain/zetacore/testutil/sample" - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMsgUpdateCrosschainFlags_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg types.MsgUpdateCrosschainFlags - err error - }{ - { - name: "invalid address", - msg: types.MsgUpdateCrosschainFlags{ - Creator: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, - }, - { - name: "invalid gas price increase flags", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{ - EpochLength: -1, - RetryInterval: 1, - GasPriceIncreasePercent: 1, - }, - }, - err: sdkerrors.ErrInvalidRequest, - }, - { - name: "valid address", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{ - EpochLength: 1, - RetryInterval: 1, - GasPriceIncreasePercent: 1, - }, - }, - }, - { - name: "gas price increase flags can be nil", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - }, - }, - } - 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) - }) - } -} - -func TestGasPriceIncreaseFlags_Validate(t *testing.T) { - tests := []struct { - name string - gpf types.GasPriceIncreaseFlags - errContains string - }{ - { - name: "invalid epoch length", - gpf: types.GasPriceIncreaseFlags{ - EpochLength: -1, - RetryInterval: 1, - GasPriceIncreasePercent: 1, - }, - errContains: "epoch length must be positive", - }, - { - name: "invalid retry interval", - gpf: types.GasPriceIncreaseFlags{ - EpochLength: 1, - RetryInterval: -1, - GasPriceIncreasePercent: 1, - }, - errContains: "retry interval must be positive", - }, - { - name: "valid", - gpf: types.GasPriceIncreaseFlags{ - EpochLength: 1, - RetryInterval: 1, - GasPriceIncreasePercent: 1, - }, - }, - { - name: "percent can be 0", - gpf: types.GasPriceIncreaseFlags{ - EpochLength: 1, - RetryInterval: 1, - GasPriceIncreasePercent: 0, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.gpf.Validate() - if tt.errContains != "" { - require.ErrorContains(t, err, tt.errContains) - return - } - require.NoError(t, err) - }) - } -} - -func TestMsgUpdateCrosschainFlags_GetRequiredPolicyType(t *testing.T) { - tests := []struct { - name string - msg types.MsgUpdateCrosschainFlags - want authoritytypes.PolicyType - }{ - { - name: "disabling outbound and inbound allows group 1", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - IsInboundEnabled: false, - IsOutboundEnabled: false, - GasPriceIncreaseFlags: nil, - }, - want: authoritytypes.PolicyType_groupEmergency, - }, - - { - name: "updating gas price increase flags asserts group 2", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - IsInboundEnabled: false, - IsOutboundEnabled: false, - GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{ - EpochLength: 1, - RetryInterval: 1, - GasPriceIncreasePercent: 1, - MaxPendingCctxs: 100, - }, - }, - want: authoritytypes.PolicyType_groupOperational, - }, - { - name: "enabling inbound asserts group 2", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - IsInboundEnabled: true, - IsOutboundEnabled: false, - GasPriceIncreaseFlags: nil, - }, - want: authoritytypes.PolicyType_groupOperational, - }, - { - name: "enabling outbound asserts group 2", - msg: types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - IsInboundEnabled: false, - IsOutboundEnabled: true, - GasPriceIncreaseFlags: nil, - }, - want: authoritytypes.PolicyType_groupOperational, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.EqualValues(t, tt.want, tt.msg.GetRequiredPolicyType()) - }) - } -} - -func TestMsgUpdateCrosschainFlags_GetSigners(t *testing.T) { - signer := sample.AccAddress() - tests := []struct { - name string - msg *types.MsgUpdateCrosschainFlags - panics bool - }{ - { - name: "valid signer", - msg: types.NewMsgUpdateCrosschainFlags( - signer, - true, - true, - ), - panics: false, - }, - { - name: "invalid signer", - msg: types.NewMsgUpdateCrosschainFlags( - "invalid", - true, - true, - ), - panics: true, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if !tt.panics { - signers := tt.msg.GetSigners() - require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) - } else { - require.Panics(t, func() { - tt.msg.GetSigners() - }) - } - }) - } -} - -func TestMsgUpdateCrosschainFlags_Type(t *testing.T) { - msg := types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - } - require.Equal(t, types.TypeMsgUpdateCrosschainFlags, msg.Type()) -} - -func TestMsgUpdateCrosschainFlags_Route(t *testing.T) { - msg := types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - } - require.Equal(t, types.RouterKey, msg.Route()) -} - -func TestMsgUpdateCrosschainFlags_GetSignBytes(t *testing.T) { - msg := types.MsgUpdateCrosschainFlags{ - Creator: sample.AccAddress(), - } - require.NotPanics(t, func() { - msg.GetSignBytes() - }) -} diff --git a/x/observer/types/message_update_gas_price_increase_flags.go b/x/observer/types/message_update_gas_price_increase_flags.go new file mode 100644 index 0000000000..57d3bdf38d --- /dev/null +++ b/x/observer/types/message_update_gas_price_increase_flags.go @@ -0,0 +1,64 @@ +package types + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/pkg/errors" +) + +const ( + TypeMsgUpdateGasPriceIncreaseFlags = "update_gas_price_increase_flags" +) + +var _ sdk.Msg = &MsgUpdateGasPriceIncreaseFlags{} + +func NewMsgUpdateGasPriceIncreaseFlags(creator string, flags GasPriceIncreaseFlags) *MsgUpdateGasPriceIncreaseFlags { + return &MsgUpdateGasPriceIncreaseFlags{ + Creator: creator, + GasPriceIncreaseFlags: flags, + } +} + +func (msg *MsgUpdateGasPriceIncreaseFlags) Route() string { + return RouterKey +} + +func (msg *MsgUpdateGasPriceIncreaseFlags) Type() string { + return TypeMsgUpdateGasPriceIncreaseFlags +} + +func (msg *MsgUpdateGasPriceIncreaseFlags) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateGasPriceIncreaseFlags) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateGasPriceIncreaseFlags) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + + err := msg.GasPriceIncreaseFlags.Validate() + if err != nil { + return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + } + return nil +} + +func (gpf GasPriceIncreaseFlags) Validate() error { + if gpf.EpochLength <= 0 { + return errors.New("epoch length must be positive") + } + if gpf.RetryInterval <= 0 { + return errors.New("retry interval must be positive") + } + return nil +} diff --git a/x/observer/types/message_update_gas_price_increase_flags_test.go b/x/observer/types/message_update_gas_price_increase_flags_test.go new file mode 100644 index 0000000000..d432835b62 --- /dev/null +++ b/x/observer/types/message_update_gas_price_increase_flags_test.go @@ -0,0 +1,164 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgUpdateGasPriceIncreaseFlags_ValidateBasic(t *testing.T) { + tt := []struct { + name string + msg *types.MsgUpdateGasPriceIncreaseFlags + err require.ErrorAssertionFunc + }{ + { + name: "invalid creator address", + msg: types.NewMsgUpdateGasPriceIncreaseFlags("invalid", types.DefaultGasPriceIncreaseFlags), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "invalid creator address") + }, + }, + { + name: "invalid gas price increase flags", + msg: types.NewMsgUpdateGasPriceIncreaseFlags( + sample.AccAddress(), + types.GasPriceIncreaseFlags{ + EpochLength: -1, + RetryInterval: 1, + GasPriceIncreasePercent: 1, + }, + ), + err: func(t require.TestingT, err error, i ...interface{}) { + require.Contains(t, err.Error(), "invalid request") + }, + }, + { + name: "valid", + msg: types.NewMsgUpdateGasPriceIncreaseFlags(sample.AccAddress(), sample.GasPriceIncreaseFlags()), + err: require.NoError, + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + tc.err(t, tc.msg.ValidateBasic()) + }) + } +} + +func TestMsgUpdateGasPriceIncreaseFlags_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateGasPriceIncreaseFlags + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateGasPriceIncreaseFlags{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateGasPriceIncreaseFlags{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateGasPriceIncreaseFlags_Type(t *testing.T) { + msg := types.MsgUpdateGasPriceIncreaseFlags{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateGasPriceIncreaseFlags, msg.Type()) +} + +func TestMsgUpdateGasPriceIncreaseFlags_Route(t *testing.T) { + msg := types.MsgUpdateGasPriceIncreaseFlags{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateGasPriceIncreaseFlags_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateGasPriceIncreaseFlags{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} + +func TestGasPriceIncreaseFlags_Validate(t *testing.T) { + tests := []struct { + name string + gpf types.GasPriceIncreaseFlags + errContains string + }{ + { + name: "invalid epoch length", + gpf: types.GasPriceIncreaseFlags{ + EpochLength: -1, + RetryInterval: 1, + GasPriceIncreasePercent: 1, + }, + errContains: "epoch length must be positive", + }, + { + name: "invalid retry interval", + gpf: types.GasPriceIncreaseFlags{ + EpochLength: 1, + RetryInterval: -1, + GasPriceIncreasePercent: 1, + }, + errContains: "retry interval must be positive", + }, + { + name: "valid", + gpf: types.GasPriceIncreaseFlags{ + EpochLength: 1, + RetryInterval: 1, + GasPriceIncreasePercent: 1, + }, + }, + { + name: "percent can be 0", + gpf: types.GasPriceIncreaseFlags{ + EpochLength: 1, + RetryInterval: 1, + GasPriceIncreasePercent: 0, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.gpf.Validate() + if tt.errContains != "" { + require.ErrorContains(t, err, tt.errContains) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index cb1d69eac1..cc79b9c3c2 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -638,110 +638,6 @@ func (m *MsgAddBlameVoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddBlameVoteResponse proto.InternalMessageInfo -type MsgUpdateCrosschainFlags struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - IsInboundEnabled bool `protobuf:"varint,3,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` - IsOutboundEnabled bool `protobuf:"varint,4,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` - GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,5,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"` -} - -func (m *MsgUpdateCrosschainFlags) Reset() { *m = MsgUpdateCrosschainFlags{} } -func (m *MsgUpdateCrosschainFlags) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateCrosschainFlags) ProtoMessage() {} -func (*MsgUpdateCrosschainFlags) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{12} -} -func (m *MsgUpdateCrosschainFlags) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateCrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateCrosschainFlags.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 *MsgUpdateCrosschainFlags) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateCrosschainFlags.Merge(m, src) -} -func (m *MsgUpdateCrosschainFlags) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateCrosschainFlags) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateCrosschainFlags.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateCrosschainFlags proto.InternalMessageInfo - -func (m *MsgUpdateCrosschainFlags) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgUpdateCrosschainFlags) GetIsInboundEnabled() bool { - if m != nil { - return m.IsInboundEnabled - } - return false -} - -func (m *MsgUpdateCrosschainFlags) GetIsOutboundEnabled() bool { - if m != nil { - return m.IsOutboundEnabled - } - return false -} - -func (m *MsgUpdateCrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags { - if m != nil { - return m.GasPriceIncreaseFlags - } - return nil -} - -type MsgUpdateCrosschainFlagsResponse struct { -} - -func (m *MsgUpdateCrosschainFlagsResponse) Reset() { *m = MsgUpdateCrosschainFlagsResponse{} } -func (m *MsgUpdateCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateCrosschainFlagsResponse) ProtoMessage() {} -func (*MsgUpdateCrosschainFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{13} -} -func (m *MsgUpdateCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.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 *MsgUpdateCrosschainFlagsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.Merge(m, src) -} -func (m *MsgUpdateCrosschainFlagsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateCrosschainFlagsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateCrosschainFlagsResponse proto.InternalMessageInfo - type MsgUpdateKeygen struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Block int64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` @@ -751,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_eda6e3b1d16a4021, []int{14} + return fileDescriptor_eda6e3b1d16a4021, []int{12} } func (m *MsgUpdateKeygen) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -801,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_eda6e3b1d16a4021, []int{15} + return fileDescriptor_eda6e3b1d16a4021, []int{13} } func (m *MsgUpdateKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -841,7 +737,7 @@ func (m *MsgResetChainNonces) Reset() { *m = MsgResetChainNonces{} } func (m *MsgResetChainNonces) String() string { return proto.CompactTextString(m) } func (*MsgResetChainNonces) ProtoMessage() {} func (*MsgResetChainNonces) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{16} + return fileDescriptor_eda6e3b1d16a4021, []int{14} } func (m *MsgResetChainNonces) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -905,7 +801,7 @@ func (m *MsgResetChainNoncesResponse) Reset() { *m = MsgResetChainNonces func (m *MsgResetChainNoncesResponse) String() string { return proto.CompactTextString(m) } func (*MsgResetChainNoncesResponse) ProtoMessage() {} func (*MsgResetChainNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{17} + return fileDescriptor_eda6e3b1d16a4021, []int{15} } func (m *MsgResetChainNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -945,7 +841,7 @@ func (m *MsgVoteTSS) Reset() { *m = MsgVoteTSS{} } func (m *MsgVoteTSS) String() string { return proto.CompactTextString(m) } func (*MsgVoteTSS) ProtoMessage() {} func (*MsgVoteTSS) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{18} + return fileDescriptor_eda6e3b1d16a4021, []int{16} } func (m *MsgVoteTSS) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1012,7 +908,7 @@ func (m *MsgVoteTSSResponse) Reset() { *m = MsgVoteTSSResponse{} } func (m *MsgVoteTSSResponse) String() string { return proto.CompactTextString(m) } func (*MsgVoteTSSResponse) ProtoMessage() {} func (*MsgVoteTSSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda6e3b1d16a4021, []int{19} + return fileDescriptor_eda6e3b1d16a4021, []int{17} } func (m *MsgVoteTSSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1062,6 +958,288 @@ func (m *MsgVoteTSSResponse) GetKeygenSuccess() bool { return false } +type MsgEnableCCTX struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + EnableInbound bool `protobuf:"varint,2,opt,name=enableInbound,proto3" json:"enableInbound,omitempty"` + EnableOutbound bool `protobuf:"varint,3,opt,name=enableOutbound,proto3" json:"enableOutbound,omitempty"` +} + +func (m *MsgEnableCCTX) Reset() { *m = MsgEnableCCTX{} } +func (m *MsgEnableCCTX) String() string { return proto.CompactTextString(m) } +func (*MsgEnableCCTX) ProtoMessage() {} +func (*MsgEnableCCTX) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{18} +} +func (m *MsgEnableCCTX) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableCCTX) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableCCTX.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 *MsgEnableCCTX) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableCCTX.Merge(m, src) +} +func (m *MsgEnableCCTX) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableCCTX) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableCCTX.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableCCTX proto.InternalMessageInfo + +func (m *MsgEnableCCTX) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgEnableCCTX) GetEnableInbound() bool { + if m != nil { + return m.EnableInbound + } + return false +} + +func (m *MsgEnableCCTX) GetEnableOutbound() bool { + if m != nil { + return m.EnableOutbound + } + return false +} + +type MsgEnableCCTXResponse struct { +} + +func (m *MsgEnableCCTXResponse) Reset() { *m = MsgEnableCCTXResponse{} } +func (m *MsgEnableCCTXResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEnableCCTXResponse) ProtoMessage() {} +func (*MsgEnableCCTXResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{19} +} +func (m *MsgEnableCCTXResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableCCTXResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableCCTXResponse.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 *MsgEnableCCTXResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableCCTXResponse.Merge(m, src) +} +func (m *MsgEnableCCTXResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableCCTXResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableCCTXResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableCCTXResponse proto.InternalMessageInfo + +type MsgDisableCCTX struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + DisableInbound bool `protobuf:"varint,2,opt,name=disableInbound,proto3" json:"disableInbound,omitempty"` + DisableOutbound bool `protobuf:"varint,3,opt,name=disableOutbound,proto3" json:"disableOutbound,omitempty"` +} + +func (m *MsgDisableCCTX) Reset() { *m = MsgDisableCCTX{} } +func (m *MsgDisableCCTX) String() string { return proto.CompactTextString(m) } +func (*MsgDisableCCTX) ProtoMessage() {} +func (*MsgDisableCCTX) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{20} +} +func (m *MsgDisableCCTX) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableCCTX) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableCCTX.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 *MsgDisableCCTX) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableCCTX.Merge(m, src) +} +func (m *MsgDisableCCTX) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableCCTX) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableCCTX.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableCCTX proto.InternalMessageInfo + +func (m *MsgDisableCCTX) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgDisableCCTX) GetDisableInbound() bool { + if m != nil { + return m.DisableInbound + } + return false +} + +func (m *MsgDisableCCTX) GetDisableOutbound() bool { + if m != nil { + return m.DisableOutbound + } + return false +} + +type MsgDisableCCTXResponse struct { +} + +func (m *MsgDisableCCTXResponse) Reset() { *m = MsgDisableCCTXResponse{} } +func (m *MsgDisableCCTXResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDisableCCTXResponse) ProtoMessage() {} +func (*MsgDisableCCTXResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{21} +} +func (m *MsgDisableCCTXResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableCCTXResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableCCTXResponse.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 *MsgDisableCCTXResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableCCTXResponse.Merge(m, src) +} +func (m *MsgDisableCCTXResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableCCTXResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableCCTXResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableCCTXResponse proto.InternalMessageInfo + +type MsgUpdateGasPriceIncreaseFlags struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + GasPriceIncreaseFlags GasPriceIncreaseFlags `protobuf:"bytes,2,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags"` +} + +func (m *MsgUpdateGasPriceIncreaseFlags) Reset() { *m = MsgUpdateGasPriceIncreaseFlags{} } +func (m *MsgUpdateGasPriceIncreaseFlags) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGasPriceIncreaseFlags) ProtoMessage() {} +func (*MsgUpdateGasPriceIncreaseFlags) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{22} +} +func (m *MsgUpdateGasPriceIncreaseFlags) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGasPriceIncreaseFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGasPriceIncreaseFlags.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 *MsgUpdateGasPriceIncreaseFlags) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGasPriceIncreaseFlags.Merge(m, src) +} +func (m *MsgUpdateGasPriceIncreaseFlags) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGasPriceIncreaseFlags) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGasPriceIncreaseFlags.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGasPriceIncreaseFlags proto.InternalMessageInfo + +func (m *MsgUpdateGasPriceIncreaseFlags) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateGasPriceIncreaseFlags) GetGasPriceIncreaseFlags() GasPriceIncreaseFlags { + if m != nil { + return m.GasPriceIncreaseFlags + } + return GasPriceIncreaseFlags{} +} + +type MsgUpdateGasPriceIncreaseFlagsResponse struct { +} + +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) Reset() { + *m = MsgUpdateGasPriceIncreaseFlagsResponse{} +} +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGasPriceIncreaseFlagsResponse) ProtoMessage() {} +func (*MsgUpdateGasPriceIncreaseFlagsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{23} +} +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGasPriceIncreaseFlagsResponse.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 *MsgUpdateGasPriceIncreaseFlagsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGasPriceIncreaseFlagsResponse.Merge(m, src) +} +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGasPriceIncreaseFlagsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGasPriceIncreaseFlagsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateObserver)(nil), "zetachain.zetacore.observer.MsgUpdateObserver") proto.RegisterType((*MsgUpdateObserverResponse)(nil), "zetachain.zetacore.observer.MsgUpdateObserverResponse") @@ -1075,14 +1253,18 @@ func init() { proto.RegisterType((*MsgAddObserverResponse)(nil), "zetachain.zetacore.observer.MsgAddObserverResponse") proto.RegisterType((*MsgAddBlameVote)(nil), "zetachain.zetacore.observer.MsgAddBlameVote") proto.RegisterType((*MsgAddBlameVoteResponse)(nil), "zetachain.zetacore.observer.MsgAddBlameVoteResponse") - proto.RegisterType((*MsgUpdateCrosschainFlags)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlags") - proto.RegisterType((*MsgUpdateCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlagsResponse") proto.RegisterType((*MsgUpdateKeygen)(nil), "zetachain.zetacore.observer.MsgUpdateKeygen") proto.RegisterType((*MsgUpdateKeygenResponse)(nil), "zetachain.zetacore.observer.MsgUpdateKeygenResponse") proto.RegisterType((*MsgResetChainNonces)(nil), "zetachain.zetacore.observer.MsgResetChainNonces") proto.RegisterType((*MsgResetChainNoncesResponse)(nil), "zetachain.zetacore.observer.MsgResetChainNoncesResponse") proto.RegisterType((*MsgVoteTSS)(nil), "zetachain.zetacore.observer.MsgVoteTSS") proto.RegisterType((*MsgVoteTSSResponse)(nil), "zetachain.zetacore.observer.MsgVoteTSSResponse") + proto.RegisterType((*MsgEnableCCTX)(nil), "zetachain.zetacore.observer.MsgEnableCCTX") + proto.RegisterType((*MsgEnableCCTXResponse)(nil), "zetachain.zetacore.observer.MsgEnableCCTXResponse") + proto.RegisterType((*MsgDisableCCTX)(nil), "zetachain.zetacore.observer.MsgDisableCCTX") + proto.RegisterType((*MsgDisableCCTXResponse)(nil), "zetachain.zetacore.observer.MsgDisableCCTXResponse") + proto.RegisterType((*MsgUpdateGasPriceIncreaseFlags)(nil), "zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlags") + proto.RegisterType((*MsgUpdateGasPriceIncreaseFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlagsResponse") } func init() { @@ -1090,81 +1272,86 @@ func init() { } var fileDescriptor_eda6e3b1d16a4021 = []byte{ - // 1176 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcb, 0x73, 0xdb, 0x44, - 0x18, 0x8f, 0x48, 0x9b, 0x38, 0x5f, 0xde, 0x22, 0x69, 0x1d, 0x85, 0x98, 0x8c, 0x86, 0x52, 0xb7, - 0x04, 0x3b, 0x71, 0x79, 0xcf, 0x70, 0x48, 0x5a, 0x9a, 0x84, 0x92, 0x26, 0x23, 0x87, 0x1e, 0x7a, - 0xd1, 0xac, 0xa5, 0x8d, 0x24, 0xa2, 0xec, 0x7a, 0xb4, 0xeb, 0x3c, 0x0a, 0xc3,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b, 0xec, 0xb4, 0xe9, - 0xc3, 0xee, 0xac, 0x8e, 0x59, 0x6d, 0x44, 0x7c, 0x83, 0x3d, 0xf8, 0x3f, 0x00, 0x00, 0xff, 0xff, - 0x57, 0xa3, 0x79, 0xf2, 0x42, 0x0f, 0x00, 0x00, + // 1257 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0x46, + 0x10, 0x36, 0xeb, 0xc4, 0x8f, 0x91, 0x25, 0x3b, 0xac, 0x1d, 0xcb, 0x74, 0xad, 0x1a, 0x44, 0xe2, + 0x28, 0xa9, 0x2b, 0xd9, 0x4a, 0xd1, 0xe7, 0xc9, 0x8f, 0xc6, 0x76, 0x53, 0xc7, 0x06, 0xe5, 0x06, + 0x45, 0x2e, 0xc4, 0x8a, 0x5c, 0x53, 0xac, 0xe9, 0x5d, 0x81, 0x4b, 0xf9, 0x91, 0x06, 0x05, 0x7a, + 0xec, 0xa9, 0xfd, 0x01, 0x05, 0x7a, 0xef, 0x3f, 0xe8, 0xb9, 0x3d, 0xa4, 0xb7, 0x1c, 0x7b, 0x2a, + 0x0a, 0xfb, 0xd4, 0x7f, 0x51, 0x70, 0x77, 0x49, 0x53, 0x0f, 0x53, 0x52, 0x8a, 0x9c, 0x24, 0xce, + 0x7e, 0xdf, 0xcc, 0x37, 0xbb, 0xb3, 0x33, 0x24, 0xdc, 0x79, 0x8e, 0x03, 0x64, 0xd5, 0x91, 0x4b, + 0xca, 0xfc, 0x1f, 0xf5, 0x71, 0x99, 0xd6, 0x18, 0xf6, 0x4f, 0xb0, 0x5f, 0x0e, 0xce, 0x4a, 0x0d, + 0x9f, 0x06, 0x54, 0x9d, 0x8f, 0x51, 0xa5, 0x08, 0x55, 0x8a, 0x50, 0xda, 0xb4, 0x43, 0x1d, 0xca, + 0x71, 0xe5, 0xf0, 0x9f, 0xa0, 0x68, 0xf7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8b, 0x39, + 0x6e, 0x87, 0xd4, 0x68, 0x93, 0xc4, 0x71, 0x5b, 0x8c, 0xea, 0x12, 0xe4, 0x84, 0x61, 0xaf, 0x19, + 0x08, 0x98, 0x88, 0xdb, 0x66, 0xd5, 0x67, 0x61, 0xa6, 0x25, 0x70, 0x7c, 0xb2, 0x2f, 0x78, 0x0b, + 0xda, 0x74, 0x59, 0x1f, 0x92, 0x96, 0x20, 0x67, 0x0b, 0x60, 0xab, 0xa6, 0x36, 0xab, 0x5a, 0x84, + 0x49, 0x69, 0x69, 0x53, 0xd5, 0x6e, 0x96, 0xad, 0x23, 0x11, 0x3d, 0xd6, 0xf5, 0xab, 0x02, 0x85, + 0xf8, 0x2e, 0x6d, 0x21, 0xb6, 0xef, 0xbb, 0x16, 0xde, 0x21, 0xa1, 0x14, 0x86, 0x1f, 0x85, 0xef, + 0x65, 0x29, 0x42, 0x09, 0xcc, 0x38, 0xdd, 0x28, 0x72, 0x76, 0x54, 0x52, 0x3b, 0x47, 0xd7, 0x60, + 0xb2, 0x93, 0x74, 0x77, 0xab, 0x17, 0x61, 0x29, 0x5d, 0x6b, 0x94, 0x56, 0xe5, 0xf7, 0x0c, 0x0c, + 0xef, 0x32, 0x47, 0xa5, 0x90, 0x49, 0xb6, 0xfd, 0xf7, 0x52, 0x15, 0xb5, 0x76, 0x57, 0xed, 0xe1, + 0x00, 0xe0, 0xb8, 0xdc, 0xcf, 0x20, 0xd7, 0xf6, 0xce, 0x56, 0xea, 0xe5, 0xa6, 0x15, 0xaf, 0x7d, + 0x38, 0x18, 0x3e, 0x8e, 0xfc, 0xbd, 0x02, 0xb7, 0x3a, 0xc7, 0xfd, 0x6a, 0x7f, 0xde, 0x12, 0x14, + 0xed, 0x93, 0x81, 0x29, 0x2d, 0x1a, 0x3a, 0x87, 0x7a, 0x4f, 0x0d, 0x1d, 0x94, 0xde, 0x1a, 0xae, + 0x9d, 0xf6, 0xaa, 0x0f, 0x13, 0x2d, 0x83, 0x70, 0xb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 0xff, + 0xff, 0xd6, 0x91, 0x58, 0xd4, 0x15, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1184,11 +1371,13 @@ type MsgClient interface { UpdateChainParams(ctx context.Context, in *MsgUpdateChainParams, opts ...grpc.CallOption) (*MsgUpdateChainParamsResponse, error) RemoveChainParams(ctx context.Context, in *MsgRemoveChainParams, opts ...grpc.CallOption) (*MsgRemoveChainParamsResponse, error) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) - UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) VoteBlockHeader(ctx context.Context, in *MsgVoteBlockHeader, opts ...grpc.CallOption) (*MsgVoteBlockHeaderResponse, error) ResetChainNonces(ctx context.Context, in *MsgResetChainNonces, opts ...grpc.CallOption) (*MsgResetChainNoncesResponse, error) VoteTSS(ctx context.Context, in *MsgVoteTSS, opts ...grpc.CallOption) (*MsgVoteTSSResponse, error) + EnableCCTX(ctx context.Context, in *MsgEnableCCTX, opts ...grpc.CallOption) (*MsgEnableCCTXResponse, error) + DisableCCTX(ctx context.Context, in *MsgDisableCCTX, opts ...grpc.CallOption) (*MsgDisableCCTXResponse, error) + UpdateGasPriceIncreaseFlags(ctx context.Context, in *MsgUpdateGasPriceIncreaseFlags, opts ...grpc.CallOption) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) } type msgClient struct { @@ -1244,18 +1433,9 @@ func (c *msgClient) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts return out, nil } -func (c *msgClient) UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error) { - out := new(MsgUpdateCrosschainFlagsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) { - out := new(MsgUpdateKeygenResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateKeygen", in, out, opts...) +func (c *msgClient) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) { + out := new(MsgUpdateKeygenResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateKeygen", in, out, opts...) if err != nil { return nil, err } @@ -1289,6 +1469,33 @@ func (c *msgClient) VoteTSS(ctx context.Context, in *MsgVoteTSS, opts ...grpc.Ca return out, nil } +func (c *msgClient) EnableCCTX(ctx context.Context, in *MsgEnableCCTX, opts ...grpc.CallOption) (*MsgEnableCCTXResponse, error) { + out := new(MsgEnableCCTXResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/EnableCCTX", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DisableCCTX(ctx context.Context, in *MsgDisableCCTX, opts ...grpc.CallOption) (*MsgDisableCCTXResponse, error) { + out := new(MsgDisableCCTXResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/DisableCCTX", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateGasPriceIncreaseFlags(ctx context.Context, in *MsgUpdateGasPriceIncreaseFlags, opts ...grpc.CallOption) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) { + out := new(MsgUpdateGasPriceIncreaseFlagsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateGasPriceIncreaseFlags", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error) @@ -1296,11 +1503,13 @@ type MsgServer interface { UpdateChainParams(context.Context, *MsgUpdateChainParams) (*MsgUpdateChainParamsResponse, error) RemoveChainParams(context.Context, *MsgRemoveChainParams) (*MsgRemoveChainParamsResponse, error) AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) - UpdateCrosschainFlags(context.Context, *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error) UpdateKeygen(context.Context, *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) VoteBlockHeader(context.Context, *MsgVoteBlockHeader) (*MsgVoteBlockHeaderResponse, error) ResetChainNonces(context.Context, *MsgResetChainNonces) (*MsgResetChainNoncesResponse, error) VoteTSS(context.Context, *MsgVoteTSS) (*MsgVoteTSSResponse, error) + EnableCCTX(context.Context, *MsgEnableCCTX) (*MsgEnableCCTXResponse, error) + DisableCCTX(context.Context, *MsgDisableCCTX) (*MsgDisableCCTXResponse, error) + UpdateGasPriceIncreaseFlags(context.Context, *MsgUpdateGasPriceIncreaseFlags) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1322,9 +1531,6 @@ func (*UnimplementedMsgServer) RemoveChainParams(ctx context.Context, req *MsgRe func (*UnimplementedMsgServer) AddBlameVote(ctx context.Context, req *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddBlameVote not implemented") } -func (*UnimplementedMsgServer) UpdateCrosschainFlags(ctx context.Context, req *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateCrosschainFlags not implemented") -} func (*UnimplementedMsgServer) UpdateKeygen(ctx context.Context, req *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateKeygen not implemented") } @@ -1337,6 +1543,15 @@ func (*UnimplementedMsgServer) ResetChainNonces(ctx context.Context, req *MsgRes func (*UnimplementedMsgServer) VoteTSS(ctx context.Context, req *MsgVoteTSS) (*MsgVoteTSSResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VoteTSS not implemented") } +func (*UnimplementedMsgServer) EnableCCTX(ctx context.Context, req *MsgEnableCCTX) (*MsgEnableCCTXResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EnableCCTX not implemented") +} +func (*UnimplementedMsgServer) DisableCCTX(ctx context.Context, req *MsgDisableCCTX) (*MsgDisableCCTXResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableCCTX not implemented") +} +func (*UnimplementedMsgServer) UpdateGasPriceIncreaseFlags(ctx context.Context, req *MsgUpdateGasPriceIncreaseFlags) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateGasPriceIncreaseFlags not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1432,24 +1647,6 @@ func _Msg_AddBlameVote_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _Msg_UpdateCrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateCrosschainFlags) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateCrosschainFlags(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateCrosschainFlags(ctx, req.(*MsgUpdateCrosschainFlags)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_UpdateKeygen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateKeygen) if err := dec(in); err != nil { @@ -1522,6 +1719,60 @@ func _Msg_VoteTSS_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } +func _Msg_EnableCCTX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEnableCCTX) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EnableCCTX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/EnableCCTX", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EnableCCTX(ctx, req.(*MsgEnableCCTX)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DisableCCTX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDisableCCTX) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DisableCCTX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/DisableCCTX", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DisableCCTX(ctx, req.(*MsgDisableCCTX)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateGasPriceIncreaseFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateGasPriceIncreaseFlags) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateGasPriceIncreaseFlags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/UpdateGasPriceIncreaseFlags", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateGasPriceIncreaseFlags(ctx, req.(*MsgUpdateGasPriceIncreaseFlags)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Msg", HandlerType: (*MsgServer)(nil), @@ -1546,10 +1797,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "AddBlameVote", Handler: _Msg_AddBlameVote_Handler, }, - { - MethodName: "UpdateCrosschainFlags", - Handler: _Msg_UpdateCrosschainFlags_Handler, - }, { MethodName: "UpdateKeygen", Handler: _Msg_UpdateKeygen_Handler, @@ -1566,6 +1813,18 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "VoteTSS", Handler: _Msg_VoteTSS_Handler, }, + { + MethodName: "EnableCCTX", + Handler: _Msg_EnableCCTX_Handler, + }, + { + MethodName: "DisableCCTX", + Handler: _Msg_DisableCCTX_Handler, + }, + { + MethodName: "UpdateGasPriceIncreaseFlags", + Handler: _Msg_UpdateGasPriceIncreaseFlags_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zetachain/zetacore/observer/tx.proto", @@ -2011,91 +2270,6 @@ func (m *MsgAddBlameVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgUpdateCrosschainFlags) 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 *MsgUpdateCrosschainFlags) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateCrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasPriceIncreaseFlags != nil { - { - size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.IsOutboundEnabled { - i-- - if m.IsOutboundEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.IsInboundEnabled { - i-- - if m.IsInboundEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - 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 *MsgUpdateCrosschainFlagsResponse) 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 *MsgUpdateCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgUpdateKeygen) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2322,62 +2496,271 @@ func (m *MsgVoteTSSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgEnableCCTX) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgUpdateObserver) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgEnableCCTX) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableCCTX) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i 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)) + if m.EnableOutbound { + i-- + if m.EnableOutbound { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 } - l = len(m.NewObserverAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.EnableInbound { + i-- + if m.EnableInbound { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 } - if m.UpdateReason != 0 { - n += 1 + sovTx(uint64(m.UpdateReason)) + 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 n + return len(dAtA) - i, nil } -func (m *MsgUpdateObserverResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgEnableCCTXResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgVoteBlockHeader) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgEnableCCTXResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableCCTXResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *MsgDisableCCTX) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - if m.ChainId != 0 { - n += 1 + sovTx(uint64(m.ChainId)) + return dAtA[:n], nil +} + +func (m *MsgDisableCCTX) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableCCTX) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DisableOutbound { + i-- + if m.DisableOutbound { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.DisableInbound { + i-- + if m.DisableInbound { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + 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 *MsgDisableCCTXResponse) 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 *MsgDisableCCTXResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableCCTXResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateGasPriceIncreaseFlags) 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 *MsgUpdateGasPriceIncreaseFlags) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGasPriceIncreaseFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + 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 *MsgUpdateGasPriceIncreaseFlagsResponse) 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 *MsgUpdateGasPriceIncreaseFlagsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + 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 *MsgVoteBlockHeader) 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)) + } + if m.ChainId != 0 { + n += 1 + sovTx(uint64(m.ChainId)) } l = len(m.BlockHash) if l > 0 { @@ -2517,38 +2900,6 @@ func (m *MsgAddBlameVoteResponse) Size() (n int) { return n } -func (m *MsgUpdateCrosschainFlags) 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)) - } - if m.IsInboundEnabled { - n += 2 - } - if m.IsOutboundEnabled { - n += 2 - } - if m.GasPriceIncreaseFlags != nil { - l = m.GasPriceIncreaseFlags.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUpdateCrosschainFlagsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgUpdateKeygen) Size() (n int) { if m == nil { return 0 @@ -2646,49 +2997,344 @@ func (m *MsgVoteTSSResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *MsgEnableCCTX) 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)) + } + if m.EnableInbound { + n += 2 + } + if m.EnableOutbound { + n += 2 + } + return n } -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *MsgEnableCCTXResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -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 + +func (m *MsgDisableCCTX) 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)) + } + if m.DisableInbound { + n += 2 + } + if m.DisableOutbound { + n += 2 + } + return n +} + +func (m *MsgDisableCCTXResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateGasPriceIncreaseFlags) 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 = m.GasPriceIncreaseFlags.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +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 *MsgVoteBlockHeader) 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: MsgVoteBlockHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteBlockHeader: 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 @@ -2714,8 +3360,253 @@ func (m *MsgUpdateObserver) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.BlockHash == nil { + m.BlockHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 *MsgVoteBlockHeaderResponse) 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: MsgVoteBlockHeaderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotCreated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BallotCreated = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteFinalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.VoteFinalized = bool(v != 0) + 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 *MsgUpdateChainParams) 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: MsgUpdateChainParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateChainParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OldObserverAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2743,13 +3634,13 @@ func (m *MsgUpdateObserver) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OldObserverAddress = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewObserverAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainParams", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2759,43 +3650,28 @@ func (m *MsgUpdateObserver) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen 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) + if m.ChainParams == nil { + m.ChainParams = &ChainParams{} } - 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 - } + if err := m.ChainParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2817,7 +3693,7 @@ func (m *MsgUpdateObserver) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateObserverResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateChainParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2840,10 +3716,10 @@ func (m *MsgUpdateObserverResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateObserverResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateChainParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateObserverResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateChainParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2867,7 +3743,7 @@ func (m *MsgUpdateObserverResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteBlockHeader) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveChainParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2890,10 +3766,10 @@ func (m *MsgVoteBlockHeader) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteBlockHeader: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveChainParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteBlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveChainParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2947,92 +3823,6 @@ func (m *MsgVoteBlockHeader) Unmarshal(dAtA []byte) error { break } } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3054,7 +3844,7 @@ func (m *MsgVoteBlockHeader) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteBlockHeaderResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveChainParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3077,52 +3867,12 @@ func (m *MsgVoteBlockHeaderResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteBlockHeaderResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveChainParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveChainParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotCreated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BallotCreated = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteFinalized", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.VoteFinalized = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3144,7 +3894,7 @@ func (m *MsgVoteBlockHeaderResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateChainParams) Unmarshal(dAtA []byte) error { +func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3167,10 +3917,10 @@ func (m *MsgUpdateChainParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateChainParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddObserver: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateChainParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddObserver: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3207,9 +3957,9 @@ func (m *MsgUpdateChainParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObserverAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3219,28 +3969,76 @@ func (m *MsgUpdateChainParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ChainParams == nil { - m.ChainParams = &ChainParams{} + m.ObserverAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ZetaclientGranteePubkey", wireType) } - if err := m.ChainParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + 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.ZetaclientGranteePubkey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AddNodeAccountOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex + m.AddNodeAccountOnly = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3262,7 +4060,7 @@ func (m *MsgUpdateChainParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateChainParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3285,10 +4083,10 @@ func (m *MsgUpdateChainParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateChainParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddObserverResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateChainParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddObserverResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3312,7 +4110,7 @@ func (m *MsgUpdateChainParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveChainParams) Unmarshal(dAtA []byte) error { +func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3335,10 +4133,10 @@ func (m *MsgRemoveChainParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveChainParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddBlameVote: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveChainParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddBlameVote: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3392,6 +4190,39 @@ func (m *MsgRemoveChainParams) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3413,7 +4244,7 @@ func (m *MsgRemoveChainParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveChainParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3436,10 +4267,10 @@ func (m *MsgRemoveChainParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveChainParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddBlameVoteResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveChainParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddBlameVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3463,7 +4294,7 @@ func (m *MsgRemoveChainParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3486,10 +4317,10 @@ func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddObserver: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateKeygen: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddObserver: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateKeygen: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3525,74 +4356,10 @@ func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObserverAddress", 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.ObserverAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZetaclientGranteePubkey", 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.ZetaclientGranteePubkey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AddNodeAccountOnly", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) } - var v int + m.Block = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3602,12 +4369,11 @@ func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Block |= int64(b&0x7F) << shift if b < 0x80 { break } } - m.AddNodeAccountOnly = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3629,7 +4395,7 @@ func (m *MsgAddObserver) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateKeygenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3652,10 +4418,10 @@ func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddObserverResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateKeygenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddObserverResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3679,7 +4445,7 @@ func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { +func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3702,10 +4468,10 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddBlameVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgResetChainNonces: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddBlameVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgResetChainNonces: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3760,10 +4526,10 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainNonceLow", wireType) } - var msglen int + m.ChainNonceLow = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3773,25 +4539,30 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ChainNonceLow |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainNonceHigh", wireType) } - if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.ChainNonceHigh = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainNonceHigh |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3813,7 +4584,7 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgResetChainNoncesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3836,10 +4607,10 @@ func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddBlameVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgResetChainNoncesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddBlameVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgResetChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3863,7 +4634,7 @@ func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { +func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3886,10 +4657,10 @@ func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateCrosschainFlags: wiretype end group for non-group") + return fmt.Errorf("proto: MsgVoteTSS: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateCrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgVoteTSS: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3924,11 +4695,11 @@ func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { } m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType) } - var v int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3938,17 +4709,29 @@ func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.IsInboundEnabled = bool(v != 0) - case 4: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TssPubkey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field KeygenZetaHeight", wireType) } - var v int + m.KeygenZetaHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3958,48 +4741,30 @@ func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.KeygenZetaHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - m.IsOutboundEnabled = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var msglen int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GasPriceIncreaseFlags == nil { - m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{} - } - if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= chains.ReceiveStatus(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4021,7 +4786,7 @@ func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateCrosschainFlagsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgVoteTSSResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4044,12 +4809,72 @@ func (m *MsgUpdateCrosschainFlagsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgVoteTSSResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgVoteTSSResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotCreated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BallotCreated = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteFinalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.VoteFinalized = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeygenSuccess", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.KeygenSuccess = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4071,7 +4896,7 @@ func (m *MsgUpdateCrosschainFlagsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { +func (m *MsgEnableCCTX) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4094,10 +4919,10 @@ func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateKeygen: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEnableCCTX: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateKeygen: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEnableCCTX: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4134,9 +4959,9 @@ func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EnableInbound", wireType) } - m.Block = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4146,11 +4971,32 @@ func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Block |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableInbound = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableOutbound", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.EnableOutbound = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4172,7 +5018,7 @@ func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateKeygenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgEnableCCTXResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4195,10 +5041,10 @@ func (m *MsgUpdateKeygenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateKeygenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEnableCCTXResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEnableCCTXResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4222,7 +5068,7 @@ func (m *MsgUpdateKeygenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { +func (m *MsgDisableCCTX) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4245,10 +5091,10 @@ func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgResetChainNonces: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDisableCCTX: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgResetChainNonces: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDisableCCTX: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4285,9 +5131,9 @@ func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DisableInbound", wireType) } - m.ChainId = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4297,35 +5143,17 @@ func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.DisableInbound = bool(v != 0) case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainNonceLow", wireType) - } - m.ChainNonceLow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainNonceLow |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainNonceHigh", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DisableOutbound", wireType) } - m.ChainNonceHigh = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4335,11 +5163,12 @@ func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainNonceHigh |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.DisableOutbound = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4361,7 +5190,7 @@ func (m *MsgResetChainNonces) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgResetChainNoncesResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDisableCCTXResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4384,10 +5213,10 @@ func (m *MsgResetChainNoncesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgResetChainNoncesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDisableCCTXResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgResetChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDisableCCTXResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4411,7 +5240,7 @@ func (m *MsgResetChainNoncesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGasPriceIncreaseFlags) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4434,10 +5263,10 @@ func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteTSS: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGasPriceIncreaseFlags: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteTSS: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGasPriceIncreaseFlags: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4474,9 +5303,9 @@ func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4486,62 +5315,25 @@ func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.TssPubkey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeygenZetaHeight", wireType) - } - m.KeygenZetaHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.KeygenZetaHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= chains.ReceiveStatus(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4563,7 +5355,7 @@ func (m *MsgVoteTSS) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteTSSResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGasPriceIncreaseFlagsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4586,72 +5378,12 @@ func (m *MsgVoteTSSResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteTSSResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGasPriceIncreaseFlagsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteTSSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGasPriceIncreaseFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotCreated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BallotCreated = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteFinalized", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.VoteFinalized = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeygenSuccess", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.KeygenSuccess = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])