From 4e4a45be701e45c0792cb76111d45f2302b366d3 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:23:14 +0000 Subject: [PATCH 01/41] feat(dogfood): scaffold module --- proto/exocore/dogfood/v1/genesis.proto | 13 + proto/exocore/dogfood/v1/params.proto | 13 + proto/exocore/dogfood/v1/query.proto | 27 ++ proto/exocore/dogfood/v1/tx.proto | 8 + x/dogfood/client/cli/query.go | 33 ++ x/dogfood/client/cli/query_params.go | 36 ++ x/dogfood/client/cli/tx.go | 39 ++ x/dogfood/genesis.go | 20 + x/dogfood/keeper/keeper.go | 46 +++ x/dogfood/keeper/msg_server.go | 17 + x/dogfood/keeper/params.go | 16 + x/dogfood/keeper/query.go | 7 + x/dogfood/keeper/query_params.go | 19 + x/dogfood/module.go | 172 ++++++++ x/dogfood/types/codec.go | 19 + x/dogfood/types/errors.go | 12 + x/dogfood/types/expected_keepers.go | 18 + x/dogfood/types/genesis.go | 14 + x/dogfood/types/genesis.pb.go | 321 +++++++++++++++ x/dogfood/types/keys.go | 19 + x/dogfood/types/params.go | 39 ++ x/dogfood/types/params.pb.go | 264 ++++++++++++ x/dogfood/types/query.pb.go | 538 +++++++++++++++++++++++++ x/dogfood/types/query.pb.gw.go | 153 +++++++ x/dogfood/types/tx.pb.go | 81 ++++ x/dogfood/types/types.go | 1 + 26 files changed, 1945 insertions(+) create mode 100644 proto/exocore/dogfood/v1/genesis.proto create mode 100644 proto/exocore/dogfood/v1/params.proto create mode 100644 proto/exocore/dogfood/v1/query.proto create mode 100644 proto/exocore/dogfood/v1/tx.proto create mode 100644 x/dogfood/client/cli/query.go create mode 100644 x/dogfood/client/cli/query_params.go create mode 100644 x/dogfood/client/cli/tx.go create mode 100644 x/dogfood/genesis.go create mode 100644 x/dogfood/keeper/keeper.go create mode 100644 x/dogfood/keeper/msg_server.go create mode 100644 x/dogfood/keeper/params.go create mode 100644 x/dogfood/keeper/query.go create mode 100644 x/dogfood/keeper/query_params.go create mode 100644 x/dogfood/module.go create mode 100644 x/dogfood/types/codec.go create mode 100644 x/dogfood/types/errors.go create mode 100644 x/dogfood/types/expected_keepers.go create mode 100644 x/dogfood/types/genesis.go create mode 100644 x/dogfood/types/genesis.pb.go create mode 100644 x/dogfood/types/keys.go create mode 100644 x/dogfood/types/params.go create mode 100644 x/dogfood/types/params.pb.go create mode 100644 x/dogfood/types/query.pb.go create mode 100644 x/dogfood/types/query.pb.gw.go create mode 100644 x/dogfood/types/tx.pb.go create mode 100644 x/dogfood/types/types.go diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto new file mode 100644 index 000000000..4cb6bca2f --- /dev/null +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package exocore.dogfood.v1; + +import "gogoproto/gogo.proto"; +import "exocore/dogfood/v1/params.proto"; + +option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; + +// GenesisState defines the dogfood module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/exocore/dogfood/v1/params.proto b/proto/exocore/dogfood/v1/params.proto new file mode 100644 index 000000000..3305239a6 --- /dev/null +++ b/proto/exocore/dogfood/v1/params.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package exocore.dogfood.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + +} diff --git a/proto/exocore/dogfood/v1/query.proto b/proto/exocore/dogfood/v1/query.proto new file mode 100644 index 000000000..9f1a73ae7 --- /dev/null +++ b/proto/exocore/dogfood/v1/query.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package exocore.dogfood.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "exocore/dogfood/v1/params.proto"; + +option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/exocore/dogfood/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/tx.proto b/proto/exocore/dogfood/v1/tx.proto new file mode 100644 index 000000000..77c3fbde4 --- /dev/null +++ b/proto/exocore/dogfood/v1/tx.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package exocore.dogfood.v1; + +option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; + +// Msg defines the Msg service. +service Msg {} \ No newline at end of file diff --git a/x/dogfood/client/cli/query.go b/x/dogfood/client/cli/query.go new file mode 100644 index 000000000..41b496df3 --- /dev/null +++ b/x/dogfood/client/cli/query.go @@ -0,0 +1,33 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group dogfood queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf( + "Querying commands for the %s module", + types.ModuleName, + ), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + + return cmd +} diff --git a/x/dogfood/client/cli/query_params.go b/x/dogfood/client/cli/query_params.go new file mode 100644 index 000000000..f5f252819 --- /dev/null +++ b/x/dogfood/client/cli/query_params.go @@ -0,0 +1,36 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dogfood/client/cli/tx.go b/x/dogfood/client/cli/tx.go new file mode 100644 index 000000000..ed092de4d --- /dev/null +++ b/x/dogfood/client/cli/tx.go @@ -0,0 +1,39 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64( + (time.Duration(10) * time.Minute).Nanoseconds(), + ) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf( + "%s transactions subcommands", + types.ModuleName, + ), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/x/dogfood/genesis.go b/x/dogfood/genesis.go new file mode 100644 index 000000000..0c4077eb6 --- /dev/null +++ b/x/dogfood/genesis.go @@ -0,0 +1,20 @@ +package dogfood + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/keeper" + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + return genesis +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go new file mode 100644 index 000000000..b1b480e39 --- /dev/null +++ b/x/dogfood/keeper/keeper.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + paramstore paramtypes.Subspace + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + ps paramtypes.Subspace, + +) *Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/dogfood/keeper/msg_server.go b/x/dogfood/keeper/msg_server.go new file mode 100644 index 000000000..403b51343 --- /dev/null +++ b/x/dogfood/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/dogfood/keeper/params.go b/x/dogfood/keeper/params.go new file mode 100644 index 000000000..95553df50 --- /dev/null +++ b/x/dogfood/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams() +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/dogfood/keeper/query.go b/x/dogfood/keeper/query.go new file mode 100644 index 000000000..dfee6251a --- /dev/null +++ b/x/dogfood/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/dogfood/keeper/query_params.go b/x/dogfood/keeper/query_params.go new file mode 100644 index 000000000..2f0e76b04 --- /dev/null +++ b/x/dogfood/keeper/query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/dogfood/module.go b/x/dogfood/module.go new file mode 100644 index 000000000..90d11aad2 --- /dev/null +++ b/x/dogfood/module.go @@ -0,0 +1,172 @@ +package dogfood + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/ExocoreNetwork/exocore/x/dogfood/client/cli" + "github.com/ExocoreNetwork/exocore/x/dogfood/keeper" + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a +// Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal +// and unmarshal structs to/from []byte in order to persist them in the module's KVStore +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as +// proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for +// testing +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +func (AppModuleBasic) ValidateGenesis( + cdc codec.JSONCodec, + config client.TxEncodingConfig, + bz json.RawMessage, +) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +func (AppModuleBasic) RegisterGRPCGatewayRoutes( + clientCtx client.Context, + mux *runtime.ServeMux, +) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + +// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are +// used by end-users to generate new transactions containing messages defined in the module +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root +// command are used by end-users to generate new queries to the subset of the state defined by +// the module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that +// modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC +// queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its +// predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will +// be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis( + ctx sdk.Context, + cdc codec.JSONCodec, + gs json.RawMessage, +) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be +// incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty +// versions, the initial version should be set to 1 +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock contains the logic that is automatically triggered at the end of each block +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/dogfood/types/codec.go b/x/dogfood/types/codec.go new file mode 100644 index 000000000..b70e2a444 --- /dev/null +++ b/x/dogfood/types/codec.go @@ -0,0 +1,19 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/dogfood/types/errors.go b/x/dogfood/types/errors.go new file mode 100644 index 000000000..f279c2d27 --- /dev/null +++ b/x/dogfood/types/errors.go @@ -0,0 +1,12 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// x/dogfood module sentinel errors +var ( + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") +) diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go new file mode 100644 index 000000000..6aa6e9778 --- /dev/null +++ b/x/dogfood/types/expected_keepers.go @@ -0,0 +1,18 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go new file mode 100644 index 000000000..9d633ecd7 --- /dev/null +++ b/x/dogfood/types/genesis.go @@ -0,0 +1,14 @@ +package types + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go new file mode 100644 index 000000000..a70ecb578 --- /dev/null +++ b/x/dogfood/types/genesis.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/dogfood/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// GenesisState defines the dogfood module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "exocore.dogfood.v1.GenesisState") +} + +func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } + +var fileDescriptor_1a9d908a27866b1b = []byte{ + // 202 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x4f, + 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, + 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, + 0x58, 0x10, 0x95, 0x52, 0xf2, 0x58, 0xcc, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0xa5, 0xe4, + 0xc1, 0xc5, 0xe3, 0x0e, 0x31, 0x3b, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x82, 0x8b, 0x0d, 0x22, + 0x2f, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa5, 0x87, 0x69, 0x97, 0x5e, 0x00, 0x58, 0x85, + 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xf5, 0x4e, 0xde, 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, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, + 0xab, 0xef, 0x0a, 0x31, 0xcd, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0xe6, 0xbc, 0x0a, + 0xb8, 0x03, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x33, 0x06, 0x04, 0x00, 0x00, + 0xff, 0xff, 0xda, 0xc5, 0xe8, 0xc9, 0x0c, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go new file mode 100644 index 000000000..2a58dafee --- /dev/null +++ b/x/dogfood/types/keys.go @@ -0,0 +1,19 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "dogfood" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the module's message routing key + RouterKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_dogfood" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/dogfood/types/params.go b/x/dogfood/types/params.go new file mode 100644 index 000000000..357196ad6 --- /dev/null +++ b/x/dogfood/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/dogfood/types/params.pb.go b/x/dogfood/types/params.pb.go new file mode 100644 index 000000000..60a1da67d --- /dev/null +++ b/x/dogfood/types/params.pb.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/dogfood/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_e8747fb70c97d97f, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "exocore.dogfood.v1.Params") +} + +func init() { proto.RegisterFile("exocore/dogfood/v1/params.proto", fileDescriptor_e8747fb70c97d97f) } + +var fileDescriptor_e8747fb70c97d97f = []byte{ + // 160 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, + 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x2a, 0xd0, + 0x83, 0x2a, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, 0x58, + 0x10, 0x95, 0x4a, 0x7c, 0x5c, 0x6c, 0x01, 0x60, 0x9d, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, + 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, + 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x2b, 0xc4, 0x78, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, + 0xa2, 0x6c, 0x7d, 0x98, 0x73, 0x2a, 0xe0, 0x0e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, + 0xdb, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x0e, 0x0c, 0x9a, 0xb0, 0x00, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dogfood/types/query.pb.go b/x/dogfood/types/query.pb.go new file mode 100644 index 000000000..ec851da1b --- /dev/null +++ b/x/dogfood/types/query.pb.go @@ -0,0 +1,538 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/dogfood/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "exocore.dogfood.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "exocore.dogfood.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("exocore/dogfood/v1/query.proto", fileDescriptor_e23d51a3dceb1c68) } + +var fileDescriptor_e23d51a3dceb1c68 = []byte{ + // 309 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x3f, 0x4b, 0x03, 0x31, + 0x18, 0xc6, 0x2f, 0xa2, 0x1d, 0xe2, 0x16, 0x0b, 0xea, 0x21, 0xa9, 0x74, 0x50, 0x71, 0x48, 0xb8, + 0xba, 0x38, 0x17, 0x9c, 0x04, 0xff, 0x74, 0x74, 0xcb, 0xb5, 0x31, 0x1e, 0xda, 0x7b, 0xd3, 0x4b, + 0xee, 0x6c, 0x1d, 0xf5, 0x0b, 0x08, 0x7e, 0xa9, 0x8e, 0x05, 0x17, 0x27, 0x91, 0x3b, 0x3f, 0x88, + 0xf4, 0x12, 0x0a, 0xda, 0x82, 0x5b, 0x78, 0x9f, 0xdf, 0xf3, 0xe4, 0x79, 0x5f, 0x4c, 0xe5, 0x18, + 0xfa, 0x90, 0x49, 0x3e,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x22, 0x95, 0xd8, 0xbb, 0x3c, 0x66, + 0x7d, 0x18, 0xf2, 0x33, 0x67, 0xbe, 0x90, 0xf6, 0x11, 0xb2, 0xfb, 0x45, 0xd6, 0x78, 0x91, 0x66, + 0x27, 0x5a, 0x9a, 0xb8, 0x51, 0x1f, 0xf0, 0xe4, 0x27, 0x00, 0x00, 0xff, 0xff, 0x19, 0xa2, 0xb5, + 0x7c, 0xf7, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "exocore.dogfood.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "exocore/dogfood/v1/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dogfood/types/query.pb.gw.go b/x/dogfood/types/query.pb.gw.go new file mode 100644 index 000000000..f078ad093 --- /dev/null +++ b/x/dogfood/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: exocore/dogfood/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "dogfood", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/dogfood/types/tx.pb.go b/x/dogfood/types/tx.pb.go new file mode 100644 index 000000000..0f65f29c2 --- /dev/null +++ b/x/dogfood/types/tx.pb.go @@ -0,0 +1,81 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/dogfood/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// 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 + +func init() { proto.RegisterFile("exocore/dogfood/v1/tx.proto", fileDescriptor_015649094fe3d8cd) } + +var fileDescriptor_015649094fe3d8cd = []byte{ + // 137 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, + 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4a, 0xea, 0x41, 0x25, 0xf5, 0xca, + 0x0c, 0x8d, 0x58, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, + 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, + 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, + 0xdf, 0x15, 0xa2, 0xdf, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0x66, 0x57, 0x05, 0xdc, + 0xb6, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x75, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xe3, 0x2e, 0x08, 0x39, 0x8d, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "exocore.dogfood.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "exocore/dogfood/v1/tx.proto", +} diff --git a/x/dogfood/types/types.go b/x/dogfood/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/dogfood/types/types.go @@ -0,0 +1 @@ +package types From 503728c81b6a75b3c46aa5a46ccfac9cb161ef01 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:28:55 +0000 Subject: [PATCH 02/41] fix(dogfood): remove mem store --- x/dogfood/keeper/keeper.go | 6 +----- x/dogfood/types/keys.go | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index b1b480e39..5abed0dd1 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -16,17 +16,14 @@ type ( Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey - memKey storetypes.StoreKey paramstore paramtypes.Subspace } ) func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, + storeKey storetypes.StoreKey, ps paramtypes.Subspace, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -36,7 +33,6 @@ func NewKeeper( return &Keeper{ cdc: cdc, storeKey: storeKey, - memKey: memKey, paramstore: ps, } } diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 2a58dafee..1a9e60990 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -9,9 +9,6 @@ const ( // RouterKey defines the module's message routing key RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_dogfood" ) func KeyPrefix(p string) []byte { From 36a2961c28ee094d3572d71ba7816655f6f2fbcc Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:04:42 +0000 Subject: [PATCH 03/41] fix(dogfood): remove not required keepers --- x/dogfood/module.go | 8 +------- x/dogfood/types/expected_keepers.go | 17 ----------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 90d11aad2..e8ea80431 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -106,22 +106,16 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, } } diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 6aa6e9778..ab1254f4c 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -1,18 +1 @@ package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} From 47861d7a817b1aa03df27d8ac79d448bd6da1e38 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:08:08 +0000 Subject: [PATCH 04/41] refactor(dogfood): remove not required items --- x/dogfood/client/cli/query.go | 28 ++++++++++++++++++++++ x/dogfood/client/cli/query_params.go | 36 ---------------------------- x/dogfood/client/cli/tx.go | 12 ---------- x/dogfood/types/keys.go | 7 ------ 4 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 x/dogfood/client/cli/query_params.go diff --git a/x/dogfood/client/cli/query.go b/x/dogfood/client/cli/query.go index 41b496df3..a4dfc065d 100644 --- a/x/dogfood/client/cli/query.go +++ b/x/dogfood/client/cli/query.go @@ -7,6 +7,7 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" @@ -31,3 +32,30 @@ func GetQueryCmd(queryRoute string) *cobra.Command { return cmd } + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dogfood/client/cli/query_params.go b/x/dogfood/client/cli/query_params.go deleted file mode 100644 index f5f252819..000000000 --- a/x/dogfood/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/ExocoreNetwork/exocore/x/dogfood/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/dogfood/client/cli/tx.go b/x/dogfood/client/cli/tx.go index ed092de4d..06c36befa 100644 --- a/x/dogfood/client/cli/tx.go +++ b/x/dogfood/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "time" "github.com/spf13/cobra" @@ -11,17 +10,6 @@ import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64( - (time.Duration(10) * time.Minute).Nanoseconds(), - ) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 1a9e60990..1256e87e4 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -6,11 +6,4 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName ) - -func KeyPrefix(p string) []byte { - return []byte(p) -} From 15e8e8af96496b6621703bd49a2cdadd7c000dc8 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:10:45 +0000 Subject: [PATCH 05/41] refactor(dogfood): remove errors --- x/dogfood/types/errors.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/x/dogfood/types/errors.go b/x/dogfood/types/errors.go index f279c2d27..5c3965cb5 100644 --- a/x/dogfood/types/errors.go +++ b/x/dogfood/types/errors.go @@ -1,12 +1,3 @@ package types // DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/dogfood module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") -) From 92be5654213c26e3530d84733127052ad8883816 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:14:59 +0000 Subject: [PATCH 06/41] refactor(dogfood): merge `query_params.go` --- x/dogfood/keeper/query.go | 18 ++++++++++++++++++ x/dogfood/keeper/query_params.go | 19 ------------------- 2 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 x/dogfood/keeper/query_params.go diff --git a/x/dogfood/keeper/query.go b/x/dogfood/keeper/query.go index dfee6251a..34ed99320 100644 --- a/x/dogfood/keeper/query.go +++ b/x/dogfood/keeper/query.go @@ -1,7 +1,25 @@ package keeper import ( + "context" + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ types.QueryServer = Keeper{} + +func (k Keeper) Params( + goCtx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/dogfood/keeper/query_params.go b/x/dogfood/keeper/query_params.go deleted file mode 100644 index 2f0e76b04..000000000 --- a/x/dogfood/keeper/query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/ExocoreNetwork/exocore/x/dogfood/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} From 6d44166b0f5719377ac3e664f9499ddaf5884cd9 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:17:27 +0000 Subject: [PATCH 07/41] feat(dogfood): add parameters The dogfooding module, as previously described, is used as the staking module for the Exocore chain. It allows operators and delegators to deposit and delegate their assets on a client chain for staking. The staked assets are then used to secure the Exocore chain. The parameters used by this module are the following: - EpochsUntilUnbonded, which represents the number of epochs after which an unbonding is effective. - EpochIdentifier, which is the identifier of the epoch duration. It should be valid according to the epoch keeper of `app.go`, and is thus constrained to the options week/day/hour. - MaxValidators, which is the maximum number of validators that will be forwarded to ABCI. - HistoricalEntries, which is the number of historical entries to persist in state. These are used by IBC. --- proto/exocore/dogfood/v1/params.proto | 12 +- x/dogfood/genesis.go | 2 +- x/dogfood/keeper/params.go | 48 ++++++- x/dogfood/keeper/query.go | 2 +- x/dogfood/types/params.go | 109 +++++++++++++-- x/dogfood/types/params.pb.go | 194 ++++++++++++++++++++++++-- 6 files changed, 339 insertions(+), 28 deletions(-) diff --git a/proto/exocore/dogfood/v1/params.proto b/proto/exocore/dogfood/v1/params.proto index 3305239a6..4d3f94a8d 100644 --- a/proto/exocore/dogfood/v1/params.proto +++ b/proto/exocore/dogfood/v1/params.proto @@ -9,5 +9,15 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - + // EpochsUntilUnbonded is the number of epochs after which an unbonding + // is released. Note that it starts from the beginning of the next epoch + // in which the unbonding request was received. At that point, the vote + // power is reduced by the amount of the unbonding operation. + uint32 epochs_until_unbonded = 1; + // EpochIdentifier is the identifier of the epoch (week, hour, day). + string epoch_identifier = 2; + // MaxValidators is the maximum number of validators. + uint32 max_validators = 3; + // HistoricalEntries is the number of historical entries to persist. + uint32 historical_entries = 4; } diff --git a/x/dogfood/genesis.go b/x/dogfood/genesis.go index 0c4077eb6..15eef3d3e 100644 --- a/x/dogfood/genesis.go +++ b/x/dogfood/genesis.go @@ -14,7 +14,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the module's exported genesis func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) + genesis.Params = k.GetDogfoodParams(ctx) return genesis } diff --git a/x/dogfood/keeper/params.go b/x/dogfood/keeper/params.go index 95553df50..f2bb7af60 100644 --- a/x/dogfood/keeper/params.go +++ b/x/dogfood/keeper/params.go @@ -5,12 +5,52 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +// GetEpochsUntilUnbonded returns the number of epochs after which an unbonding that is made +// during the current epoch will be released. It is a parameter of the dogfood module. +func (k Keeper) GetEpochsUntilUnbonded(ctx sdk.Context) uint32 { + var epochsUntilUnbonded uint32 + k.paramstore.Get(ctx, types.KeyEpochsUntilUnbonded, &epochsUntilUnbonded) + return epochsUntilUnbonded } -// SetParams set the params +// GetEpochIdentifier returns the epoch identifier used to measure an epoch. It is a parameter +// of the dogfood module. +func (k Keeper) GetEpochIdentifier(ctx sdk.Context) string { + var epochIdentifier string + k.paramstore.Get(ctx, types.KeyEpochIdentifier, &epochIdentifier) + return epochIdentifier +} + +// GetMaxValidators returns the maximum number of validators that can be asked to validate for +// the chain. It is a parameter of the dogfood module. +func (k Keeper) GetMaxValidators(ctx sdk.Context) uint32 { + var maxValidators uint32 + k.paramstore.Get(ctx, types.KeyMaxValidators, &maxValidators) + return maxValidators +} + +// GetHistorialEntries is the number of historical info entries to persist in the store. These +// entries are used by the IBC module. The return value is a parameter of the dogfood module. +func (k Keeper) GetHistoricalEntries(ctx sdk.Context) uint32 { + var historicalEntries uint32 + k.paramstore.Get(ctx, types.KeyHistoricalEntries, &historicalEntries) + return historicalEntries +} + +// SetParams sets the params for the dogfood module. func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.SetParamSet(ctx, ¶ms) } + +// GetDogfoodParams returns the parameters for the dogfood module. Note that this function is +// intentionally called GetDogfoodParams and not GetParams, since the GetParams function is used +// to implement the slashingtypes.StakingKeeper interface `GetParams(sdk.Context) +// stakingtypes.Params`. +func (k Keeper) GetDogfoodParams(ctx sdk.Context) (params types.Params) { + return types.NewParams( + k.GetEpochsUntilUnbonded(ctx), + k.GetEpochIdentifier(ctx), + k.GetMaxValidators(ctx), + k.GetHistoricalEntries(ctx), + ) +} diff --git a/x/dogfood/keeper/query.go b/x/dogfood/keeper/query.go index 34ed99320..60c010b19 100644 --- a/x/dogfood/keeper/query.go +++ b/x/dogfood/keeper/query.go @@ -21,5 +21,5 @@ func (k Keeper) Params( } ctx := sdk.UnwrapSDKContext(goCtx) - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + return &types.QueryParamsResponse{Params: k.GetDogfoodParams(ctx)}, nil } diff --git a/x/dogfood/types/params.go b/x/dogfood/types/params.go index 357196ad6..97fb4f583 100644 --- a/x/dogfood/types/params.go +++ b/x/dogfood/types/params.go @@ -1,38 +1,127 @@ package types import ( + "fmt" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "gopkg.in/yaml.v2" + + epochTypes "github.com/evmos/evmos/v14/x/epochs/types" ) var _ paramtypes.ParamSet = (*Params)(nil) -// ParamKeyTable the param key table for launch module +const ( + // DefaultEpochsUntilUnbonded is the default number of epochs after which an unbonding entry + // is released. For example, if an unbonding is requested during epoch 8, it is made + // effective at the beginning of epoch 9. The unbonding amount is released at the beginning + // of epoch 16 (9 + DefaultEpochsUntilUnbonded). + DefaultEpochsUntilUnbonded = 7 + // DefaultEpochIdentifier is the epoch identifier which is used, by default, to identify the + // epoch. Note that the options include week, day or hour. + DefaultEpochIdentifier = epochTypes.HourEpochID + // DefaultMaxValidators is the default maximum number of bonded validators. + DefaultMaxValidators = stakingtypes.DefaultMaxValidators + // DefaultHistorical entries is the number of entries of historical staking data to persist. + // Apps that don't use IBC can ignore this value by not adding the staking module to the + // application module manager's SetOrderBeginBlockers. + DefaultHistoricalEntries = stakingtypes.DefaultHistoricalEntries +) + +// Reflection based keys for params subspace. +var ( + KeyEpochsUntilUnbonded = []byte("EpochsUntilUnbonded") + KeyEpochIdentifier = []byte("EpochIdentifier") + KeyMaxValidators = []byte("MaxValidators") + KeyHistoricalEntries = []byte("HistoricalEntries") +) + +// ParamKeyTable returns a key table with the necessary registered params. func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} +// NewParams creates a new Params instance. +func NewParams( + epochsUntilUnbonded uint32, + epochIdentifier string, + maxValidators uint32, + historicalEntries uint32, +) Params { + return Params{ + EpochsUntilUnbonded: epochsUntilUnbonded, + EpochIdentifier: epochIdentifier, + MaxValidators: maxValidators, + HistoricalEntries: historicalEntries, + } } -// DefaultParams returns a default set of parameters +// DefaultParams returns a default set of parameters. func DefaultParams() Params { - return NewParams() + return NewParams( + DefaultEpochsUntilUnbonded, + DefaultEpochIdentifier, + DefaultMaxValidators, + DefaultHistoricalEntries, + ) } -// ParamSetPairs get the params.ParamSet +// ParamSetPairs implements params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair( + KeyEpochsUntilUnbonded, + &p.EpochsUntilUnbonded, + ValidatePositiveUint32, + ), + paramtypes.NewParamSetPair( + KeyEpochIdentifier, + &p.EpochIdentifier, + epochTypes.ValidateEpochIdentifierInterface, + ), + paramtypes.NewParamSetPair( + KeyMaxValidators, + &p.MaxValidators, + ValidatePositiveUint32, + ), + paramtypes.NewParamSetPair( + KeyHistoricalEntries, + &p.HistoricalEntries, + ValidatePositiveUint32, + ), + } } -// Validate validates the set of params +// Validate validates the set of params. func (p Params) Validate() error { + if err := ValidatePositiveUint32(p.EpochsUntilUnbonded); err != nil { + return fmt.Errorf("epochs until unbonded: %w", err) + } + if err := epochTypes.ValidateEpochIdentifierInterface(p.EpochIdentifier); err != nil { + return fmt.Errorf("epoch identifier: %w", err) + } + if err := ValidatePositiveUint32(p.MaxValidators); err != nil { + return fmt.Errorf("max validators: %w", err) + } + if err := ValidatePositiveUint32(p.HistoricalEntries); err != nil { + return fmt.Errorf("historical entries: %w", err) + } + return nil +} + +// ValidatePositiveUint32 checks whether the supplied value is a positive uint32. +func ValidatePositiveUint32(i interface{}) error { + if val, ok := i.(uint32); !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } else if val == 0 { + return fmt.Errorf("invalid parameter value: %d", val) + } return nil } -// String implements the Stringer interface. +// String implements the Stringer interface. Ths interface is required as part of the +// proto.Message interface, which is used in the query server. func (p Params) String() string { out, _ := yaml.Marshal(p) return string(out) diff --git a/x/dogfood/types/params.pb.go b/x/dogfood/types/params.pb.go index 60a1da67d..1b35e818a 100644 --- a/x/dogfood/types/params.pb.go +++ b/x/dogfood/types/params.pb.go @@ -25,6 +25,17 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // EpochsUntilUnbonded is the number of epochs after which an unbonding + // is released. Note that it starts from the beginning of the next epoch + // in which the unbonding request was received. At that point, the vote + // power is reduced by the amount of the unbonding operation. + EpochsUntilUnbonded uint32 `protobuf:"varint,1,opt,name=epochs_until_unbonded,json=epochsUntilUnbonded,proto3" json:"epochs_until_unbonded,omitempty"` + // EpochIdentifier is the identifier of the epoch (week, hour, day). + EpochIdentifier string `protobuf:"bytes,2,opt,name=epoch_identifier,json=epochIdentifier,proto3" json:"epoch_identifier,omitempty"` + // MaxValidators is the maximum number of validators. + MaxValidators uint32 `protobuf:"varint,3,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty"` + // HistoricalEntries is the number of historical entries to persist. + HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -59,6 +70,34 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetEpochsUntilUnbonded() uint32 { + if m != nil { + return m.EpochsUntilUnbonded + } + return 0 +} + +func (m *Params) GetEpochIdentifier() string { + if m != nil { + return m.EpochIdentifier + } + return "" +} + +func (m *Params) GetMaxValidators() uint32 { + if m != nil { + return m.MaxValidators + } + return 0 +} + +func (m *Params) GetHistoricalEntries() uint32 { + if m != nil { + return m.HistoricalEntries + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "exocore.dogfood.v1.Params") } @@ -66,17 +105,26 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/params.proto", fileDescriptor_e8747fb70c97d97f) } var fileDescriptor_e8747fb70c97d97f = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, - 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x2a, 0xd0, - 0x83, 0x2a, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, 0x58, - 0x10, 0x95, 0x4a, 0x7c, 0x5c, 0x6c, 0x01, 0x60, 0x9d, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, - 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, - 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, - 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x2b, 0xc4, 0x78, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, - 0xa2, 0x6c, 0x7d, 0x98, 0x73, 0x2a, 0xe0, 0x0e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, - 0xdb, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x0e, 0x0c, 0x9a, 0xb0, 0x00, 0x00, 0x00, + // 290 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0x3f, 0x4b, 0xc3, 0x40, + 0x18, 0x87, 0x73, 0x5a, 0x0a, 0x1e, 0xd4, 0x3f, 0xa7, 0x42, 0x70, 0xb8, 0x16, 0x41, 0xa8, 0x83, + 0x39, 0xaa, 0x9b, 0xa3, 0xd0, 0x41, 0x04, 0x91, 0x42, 0x1d, 0x5c, 0xc2, 0x35, 0x77, 0x4d, 0x0f, + 0x9b, 0xbc, 0xe1, 0xee, 0x1a, 0xe3, 0xb7, 0x70, 0x74, 0xf4, 0xbb, 0xb8, 0x38, 0x76, 0x74, 0x94, + 0xe4, 0x8b, 0x48, 0x2f, 0x31, 0x6e, 0xc7, 0xef, 0x79, 0xee, 0x1d, 0x1e, 0xdc, 0x97, 0x05, 0x44, + 0xa0, 0x25, 0x13, 0x10, 0xcf, 0x01, 0x04, 0xcb, 0x47, 0x2c, 0xe3, 0x9a, 0x27, 0x26, 0xc8, 0x34, + 0x58, 0x20, 0xa4, 0x11, 0x82, 0x46, 0x08, 0xf2, 0xd1, 0xc9, 0x51, 0x0c, 0x31, 0x38, 0xcc, 0x36, + 0xaf, 0xda, 0x3c, 0xfd, 0x44, 0xb8, 0xfb, 0xe0, 0xbe, 0x92, 0x4b, 0x7c, 0x2c, 0x33, 0x88, 0x16, + 0x26, 0x5c, 0xa5, 0x56, 0x2d, 0xc3, 0x55, 0x3a, 0x83, 0x54, 0x48, 0xe1, 0xa3, 0x01, 0x1a, 0xf6, + 0x26, 0x87, 0x35, 0x9c, 0x6e, 0xd8, 0xb4, 0x41, 0xe4, 0x1c, 0xef, 0xbb, 0x39, 0x54, 0x42, 0xa6, + 0x56, 0xcd, 0x95, 0xd4, 0xfe, 0xd6, 0x00, 0x0d, 0x77, 0x26, 0x7b, 0x6e, 0xbf, 0x6d, 0x67, 0x72, + 0x86, 0x77, 0x13, 0x5e, 0x84, 0x39, 0x5f, 0x2a, 0xc1, 0x2d, 0x68, 0xe3, 0x6f, 0xbb, 0xbb, 0xbd, + 0x84, 0x17, 0x8f, 0xed, 0x48, 0x2e, 0x30, 0x59, 0x28, 0x63, 0x41, 0xab, 0x88, 0x2f, 0x43, 0x99, + 0x5a, 0xad, 0xa4, 0xf1, 0x3b, 0x4e, 0x3d, 0xf8, 0x27, 0xe3, 0x1a, 0x5c, 0x77, 0xde, 0x3f, 0xfa, + 0xde, 0xcd, 0xdd, 0x57, 0x49, 0xd1, 0xba, 0xa4, 0xe8, 0xa7, 0xa4, 0xe8, 0xad, 0xa2, 0xde, 0xba, + 0xa2, 0xde, 0x77, 0x45, 0xbd, 0xa7, 0x51, 0xac, 0xec, 0x62, 0x35, 0x0b, 0x22, 0x48, 0xd8, 0xb8, + 0x8e, 0x72, 0x2f, 0xed, 0x0b, 0xe8, 0x67, 0xf6, 0x17, 0xb1, 0x68, 0x33, 0xda, 0xd7, 0x4c, 0x9a, + 0x59, 0xd7, 0x95, 0xb9, 0xfa, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x52, 0x3e, 0xbb, 0xe0, 0x66, 0x01, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -99,6 +147,28 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.HistoricalEntries != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.HistoricalEntries)) + i-- + dAtA[i] = 0x20 + } + if m.MaxValidators != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxValidators)) + i-- + dAtA[i] = 0x18 + } + if len(m.EpochIdentifier) > 0 { + i -= len(m.EpochIdentifier) + copy(dAtA[i:], m.EpochIdentifier) + i = encodeVarintParams(dAtA, i, uint64(len(m.EpochIdentifier))) + i-- + dAtA[i] = 0x12 + } + if m.EpochsUntilUnbonded != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EpochsUntilUnbonded)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -119,6 +189,19 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.EpochsUntilUnbonded != 0 { + n += 1 + sovParams(uint64(m.EpochsUntilUnbonded)) + } + l = len(m.EpochIdentifier) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if m.MaxValidators != 0 { + n += 1 + sovParams(uint64(m.MaxValidators)) + } + if m.HistoricalEntries != 0 { + n += 1 + sovParams(uint64(m.HistoricalEntries)) + } return n } @@ -157,6 +240,95 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochsUntilUnbonded", wireType) + } + m.EpochsUntilUnbonded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochsUntilUnbonded |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxValidators", wireType) + } + m.MaxValidators = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxValidators |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From cb08e29ba2fac1e19cea2377405a9da531525752 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:45:24 +0000 Subject: [PATCH 08/41] feat(dogfood): load genesis state for bootstrap The bootstrapping smart contract is responsible for accepting user deposits, operator registration, and delegations. These operations may flow freely until 24 hours (say) before the spawn time of Exocore, at which the contract will be locked. During this time, the genesis state of Exocore will be amended to record the initial deposits, delegations, operator registrations and public keys. The last of these will feed into the dogfooding module which will mark these operators as part of the initial validator set and allow block production. This PR includes the capability to load that state, and save the newly created operator information to disk. In addition, the staking hooks have been set up (partially) in this PR, which allow the SDK's slashing keeper to record validator signing rates for downtime slashing. --- proto/buf.lock | 10 +- proto/buf.yaml | 2 +- proto/exocore/dogfood/v1/dogfood.proto | 24 ++ proto/exocore/dogfood/v1/genesis.proto | 8 + x/dogfood/genesis.go | 8 +- x/dogfood/keeper/hooks.go | 34 ++ x/dogfood/keeper/keeper.go | 32 +- x/dogfood/keeper/validators.go | 261 +++++++++++++++ x/dogfood/module.go | 4 +- x/dogfood/types/dogfood.pb.go | 429 +++++++++++++++++++++++++ x/dogfood/types/expected_keepers.go | 19 ++ x/dogfood/types/genesis.pb.go | 98 +++++- x/dogfood/types/keys.go | 23 ++ x/dogfood/types/validator.go | 45 +++ 14 files changed, 972 insertions(+), 25 deletions(-) create mode 100644 proto/exocore/dogfood/v1/dogfood.proto create mode 100644 x/dogfood/keeper/hooks.go create mode 100644 x/dogfood/keeper/validators.go create mode 100644 x/dogfood/types/dogfood.pb.go create mode 100644 x/dogfood/types/validator.go diff --git a/proto/buf.lock b/proto/buf.lock index face468fb..d025fc2f3 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -5,15 +5,19 @@ deps: owner: cosmos repository: cosmos-proto commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 - remote: buf.build owner: cosmos repository: cosmos-sdk - commit: 508e19f5f37549e3a471a2a59b903c00 + commit: 954f7b05f38440fc8250134b15adec47 + digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54 - remote: buf.build owner: cosmos repository: gogo-proto - commit: 34d970b699f84aa382f3c29773a60836 + commit: 88ef6483f90f478fb938c37dde52ece3 + digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba - remote: buf.build owner: googleapis repository: googleapis - commit: 783e4b5374fa488ab068d08af9658438 + commit: e874a0be2bf140a5a4c7d4122c635823 + digest: shake256:4fe3036b4d706f6ee2b13c730bd04777f021dfd02ed27e6e40480acfe664a7548238312ee0727fd77648a38d227e296d43f4a38a34cdd46068156211016d9657 diff --git a/proto/buf.yaml b/proto/buf.yaml index d7876a9fc..00eff3659 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,7 +1,7 @@ version: v1 name: buf.build/evmos/evmos deps: - - buf.build/cosmos/cosmos-sdk + - buf.build/cosmos/cosmos-sdk:v0.47.0 - buf.build/cosmos/cosmos-proto - buf.build/cosmos/gogo-proto - buf.build/googleapis/googleapis diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto new file mode 100644 index 000000000..e51f4a408 --- /dev/null +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package exocore.dogfood.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; + +// ExocoreValidator is a validator that is part of the Exocore network. It is +// used to validate and sign blocks and transactions. +message ExocoreValidator { + // The address, as derived from the consensus key. It has no relation + // with the operator's account address. + bytes address = 1; + // Last known power + int64 power = 2; + // pubkey is the consensus public key of the validator, as a Protobuf Any. + google.protobuf.Any pubkey = 3 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" + ]; +} \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index 4cb6bca2f..02b53d840 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -3,11 +3,19 @@ syntax = "proto3"; package exocore.dogfood.v1; import "gogoproto/gogo.proto"; + +import "tendermint/abci/types.proto"; + import "exocore/dogfood/v1/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; // GenesisState defines the dogfood module's genesis state. message GenesisState { + // Parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; + + // Validator set, stored by ExocoreValidatorKey. + repeated .tendermint.abci.ValidatorUpdate val_set = 2 + [ (gogoproto.nullable) = false ]; } diff --git a/x/dogfood/genesis.go b/x/dogfood/genesis.go index 15eef3d3e..de40ed814 100644 --- a/x/dogfood/genesis.go +++ b/x/dogfood/genesis.go @@ -3,12 +3,18 @@ package dogfood import ( "github.com/ExocoreNetwork/exocore/x/dogfood/keeper" "github.com/ExocoreNetwork/exocore/x/dogfood/types" + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis( + ctx sdk.Context, + k keeper.Keeper, + genState types.GenesisState, +) []abci.ValidatorUpdate { k.SetParams(ctx, genState.Params) + return k.ApplyValidatorChanges(ctx, genState.ValSet) } // ExportGenesis returns the module's exported genesis diff --git a/x/dogfood/keeper/hooks.go b/x/dogfood/keeper/hooks.go new file mode 100644 index 000000000..cfbd66959 --- /dev/null +++ b/x/dogfood/keeper/hooks.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// interface guard +var _ types.DogfoodHooks = &MultiDogfoodHooks{} + +// MultiDogfoodHooks is a collection of DogfoodHooks. It calls the hook for each element in the +// collection one-by-one. The hook is called in the order in which the collection is created. +type MultiDogfoodHooks []types.DogfoodHooks + +// NewMultiDogfoodHooks is used to create a collective object of dogfood hooks from a list of +// the hooks. It follows the "accept interface, return concrete types" philosophy. Other modules +// may set the hooks by calling k := (*k).SetHooks(NewMultiDogfoodHooks(hookI)) +func NewMultiDogfoodHooks(hooks ...types.DogfoodHooks) MultiDogfoodHooks { + return hooks +} + +// AfterValidatorBonded is the implementation of types.DogfoodHooks for MultiDogfoodHooks. +func (hooks MultiDogfoodHooks) AfterValidatorBonded( + ctx sdk.Context, + consAddr sdk.ConsAddress, + operator sdk.ValAddress, +) error { + for _, hook := range hooks { + if err := hook.AfterValidatorBonded(ctx, consAddr, operator); err != nil { + return err + } + } + return nil +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index 5abed0dd1..b90ec9095 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -17,13 +17,19 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey paramstore paramtypes.Subspace + + dogfoodHooks types.DogfoodHooks + + epochsKeeper types.EpochsKeeper } ) +// NewKeeper creates a new dogfood keeper. func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ps paramtypes.Subspace, + epochsKeeper types.EpochsKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -31,12 +37,32 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + paramstore: ps, + epochsKeeper: epochsKeeper, } } +// Logger returns a logger object for use within the module. func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// SetHooks sets the hooks on the keeper. It intentionally has a pointer receiver so that +// changes can be saved to the object. +func (k *Keeper) SetHooks(sh types.DogfoodHooks) *Keeper { + if k.dogfoodHooks != nil { + panic("cannot set dogfood hooks twice") + } + if sh == nil { + panic("cannot set nil dogfood hooks") + } + k.dogfoodHooks = sh + return k +} + +// Hooks returns the hooks registered to the module. +func (k Keeper) Hooks() types.DogfoodHooks { + return k.dogfoodHooks +} diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go new file mode 100644 index 000000000..d1b5e3e37 --- /dev/null +++ b/x/dogfood/keeper/validators.go @@ -0,0 +1,261 @@ +// This file is a duplicate of the subscriber module's validators file with minor changes. +// The function ApplyValidatorChanges can likely be carved out into a shared package. + +package keeper + +import ( + "time" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + abci "github.com/cometbft/cometbft/abci/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// UnbondingTime returns the time duration of the unbonding period. It is part of the +// implementation of the staking keeper expected by IBC. +// It is calculated as the number of epochs until unbonded multiplied by the duration of an +// epoch. This function is used by IBC's client keeper to validate the self client, and +// nowhere else. As long as it reports a consistent value, it's fine. +func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration { + count := k.GetEpochsUntilUnbonded(ctx) + identifier := k.GetEpochIdentifier(ctx) + epoch, found := k.epochsKeeper.GetEpochInfo(ctx, identifier) + if !found { + panic("epoch info not found") + } + durationPerEpoch := epoch.Duration + return time.Duration(count) * durationPerEpoch +} + +// ApplyValidatorChanges returns the validator set as is. However, it also +// stores the validators that are added or those that are removed, and updates +// the power for the existing validators. It also allows any hooks registered +// on the keeper to be executed. +func (k Keeper) ApplyValidatorChanges( + ctx sdk.Context, + changes []abci.ValidatorUpdate, +) []abci.ValidatorUpdate { + ret := []abci.ValidatorUpdate{} + for _, change := range changes { + // convert TM pubkey to SDK pubkey + pubkey, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()) + if err != nil { + // An error here would indicate that the validator updates + // received from other modules are invalid. + panic(err) + } + addr := pubkey.Address() + val, found := k.GetValidator(ctx, addr) + + if found { + // update or delete an existing validator + if change.Power < 1 { + k.DeleteValidator(ctx, addr) + } else { + val.Power = change.Power + k.SetValidator(ctx, val) + } + } else if change.Power > 0 { + // create a new validator - the address is just derived from the public key and has + // no correlation with the operator address on Exocore + ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) + if err != nil { + // An error here would indicate that the validator updates + // received are invalid. + panic(err) + } + + k.SetValidator(ctx, ocVal) + err = k.Hooks().AfterValidatorBonded(ctx, sdk.ConsAddress(addr), nil) + if err != nil { + // AfterValidatorBonded is hooked by the Slashing module and should not return + // an error. If any other module were to hook it, they should also not. + panic(err) + } + } else { + // edge case: we received an update for 0 power + // but the validator is already deleted. Do not forward + // to tendermint. + continue + } + + ret = append(ret, change) + } + return ret +} + +// SetValidator stores a validator based on the pub key derived address. This +// is accessible in the genesis state via `val_set`. +func (k Keeper) SetValidator(ctx sdk.Context, validator types.ExocoreValidator) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&validator) + + store.Set(types.ExocoreValidatorKey(validator.Address), bz) +} + +// GetValidator gets a validator based on the pub key derived address. +func (k Keeper) GetValidator( + ctx sdk.Context, addr []byte, +) (validator types.ExocoreValidator, found bool) { + store := ctx.KVStore(k.storeKey) + v := store.Get(types.ExocoreValidatorKey(addr)) + if v == nil { + return + } + k.cdc.MustUnmarshal(v, &validator) + found = true + + return +} + +// DeleteValidator deletes a validator based on the pub key derived address. +func (k Keeper) DeleteValidator(ctx sdk.Context, addr []byte) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ExocoreValidatorKey(addr)) +} + +// GetAllExocoreValidators returns all validators in the store. +func (k Keeper) GetAllExocoreValidators( + ctx sdk.Context, +) (validators []types.ExocoreValidator) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.ExocoreValidatorBytePrefix}) + + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + val := types.ExocoreValidator{} + k.cdc.MustUnmarshal(iterator.Value(), &val) + validators = append(validators, val) + } + + return validators +} + +// GetHistoricalInfo gets the historical info at a given height. It is part of the +// implementation of the staking keeper expected by IBC. +func (k Keeper) GetHistoricalInfo( + ctx sdk.Context, height int64, +) (stakingtypes.HistoricalInfo, bool) { + store := ctx.KVStore(k.storeKey) + key := types.HistoricalInfoKey(height) + + value := store.Get(key) + if value == nil { + return stakingtypes.HistoricalInfo{}, false + } + + return stakingtypes.MustUnmarshalHistoricalInfo(k.cdc, value), true +} + +// SetHistoricalInfo sets the historical info at a given height. This is +// (intentionally) not exported in the genesis state. +func (k Keeper) SetHistoricalInfo( + ctx sdk.Context, height int64, hi *stakingtypes.HistoricalInfo, +) { + store := ctx.KVStore(k.storeKey) + key := types.HistoricalInfoKey(height) + value := k.cdc.MustMarshal(hi) + + store.Set(key, value) +} + +// DeleteHistoricalInfo deletes the historical info at a given height. +func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64) { + store := ctx.KVStore(k.storeKey) + key := types.HistoricalInfoKey(height) + + store.Delete(key) +} + +// TrackHistoricalInfo saves the latest historical-info and deletes the oldest +// heights that are below pruning height. +func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { + numHistoricalEntries := k.GetHistoricalEntries(ctx) + + // Prune store to ensure we only have parameter-defined historical entries. + // In most cases, this will involve removing a single historical entry. + // In the rare scenario when the historical entries gets reduced to a lower value k' + // from the original value k. k - k' entries must be deleted from the store. + // Since the entries to be deleted are always in a continuous range, we can iterate + // over the historical entries starting from the most recent version to be pruned + // and then return at the first empty entry. + for i := ctx.BlockHeight() - int64(numHistoricalEntries); i >= 0; i-- { + _, found := k.GetHistoricalInfo(ctx, i) + if found { + k.DeleteHistoricalInfo(ctx, i) + } else { + break + } + } + + // if there is no need to persist historicalInfo, return. + if numHistoricalEntries == 0 { + return + } + + // Create HistoricalInfo struct + lastVals := []stakingtypes.Validator{} + for _, v := range k.GetAllExocoreValidators(ctx) { + pk, err := v.ConsPubKey() + if err != nil { + // This should never happen as the pubkey is assumed + // to be stored correctly earlier. + panic(err) + } + val, err := stakingtypes.NewValidator(nil, pk, stakingtypes.Description{}) + if err != nil { + // This should never happen as the pubkey is assumed + // to be stored correctly earlier. + panic(err) + } + + // Set validator to bonded status. + val.Status = stakingtypes.Bonded + // Compute tokens from voting power. + val.Tokens = sdk.TokensFromConsensusPower( + v.Power, + // TODO(mm) + // note that this is not super relevant for the historical info + // since IBC does not seem to use the tokens field. + sdk.NewInt(1), + ) + lastVals = append(lastVals, val) + } + + // Create historical info entry which sorts the validator set by voting power. + historicalEntry := stakingtypes.NewHistoricalInfo( + ctx.BlockHeader(), lastVals, + // TODO(mm) + // this should match the power reduction number above + // and is also thus not relevant. + sdk.NewInt(1), + ) + + // Set latest HistoricalInfo at current height. + k.SetHistoricalInfo(ctx, ctx.BlockHeight(), &historicalEntry) +} + +// MustGetCurrentValidatorsAsABCIUpdates gets all validators converted +// to the ABCI validator update type. It panics in case of failure. +func (k Keeper) MustGetCurrentValidatorsAsABCIUpdates(ctx sdk.Context) []abci.ValidatorUpdate { + vals := k.GetAllExocoreValidators(ctx) + valUpdates := make([]abci.ValidatorUpdate, 0, len(vals)) + for _, v := range vals { + pk, err := v.ConsPubKey() + if err != nil { + // This should never happen as the pubkey is assumed + // to be stored correctly earlier. + panic(err) + } + tmPK, err := cryptocodec.ToTmProtoPublicKey(pk) + if err != nil { + // This should never happen as the pubkey is assumed + // to be stored correctly earlier. + panic(err) + } + valUpdates = append(valUpdates, abci.ValidatorUpdate{PubKey: tmPK, Power: v.Power}) + } + return valUpdates +} diff --git a/x/dogfood/module.go b/x/dogfood/module.go index e8ea80431..2ac7087e3 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -141,9 +141,7 @@ func (am AppModule) InitGenesis( // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} + return InitGenesis(ctx, am.keeper, genState) } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go new file mode 100644 index 000000000..64cadbb85 --- /dev/null +++ b/x/dogfood/types/dogfood.pb.go @@ -0,0 +1,429 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/dogfood/v1/dogfood.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// ExocoreValidator is a validator that is part of the Exocore network. It is +// used to validate and sign blocks and transactions. +type ExocoreValidator struct { + // The address, as derived from the consensus key. It has no relation + // with the operator's account address. + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Last known power + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + // pubkey is the consensus public key of the validator, as a Protobuf Any. + Pubkey *types.Any `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty" yaml:"consensus_pubkey"` +} + +func (m *ExocoreValidator) Reset() { *m = ExocoreValidator{} } +func (m *ExocoreValidator) String() string { return proto.CompactTextString(m) } +func (*ExocoreValidator) ProtoMessage() {} +func (*ExocoreValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{0} +} +func (m *ExocoreValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExocoreValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExocoreValidator.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 *ExocoreValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExocoreValidator.Merge(m, src) +} +func (m *ExocoreValidator) XXX_Size() int { + return m.Size() +} +func (m *ExocoreValidator) XXX_DiscardUnknown() { + xxx_messageInfo_ExocoreValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_ExocoreValidator proto.InternalMessageInfo + +func (m *ExocoreValidator) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +func (m *ExocoreValidator) GetPower() int64 { + if m != nil { + return m.Power + } + return 0 +} + +func (m *ExocoreValidator) GetPubkey() *types.Any { + if m != nil { + return m.Pubkey + } + return nil +} + +func init() { + proto.RegisterType((*ExocoreValidator)(nil), "exocore.dogfood.v1.ExocoreValidator") +} + +func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } + +var fileDescriptor_071b9989c501c3f2 = []byte{ + // 302 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0x31, 0x4e, 0xf3, 0x30, + 0x14, 0xc7, 0xeb, 0xaf, 0xfa, 0x8a, 0x14, 0x18, 0x50, 0x14, 0x89, 0xd0, 0xc1, 0x44, 0x9d, 0xba, + 0x60, 0xab, 0x74, 0x63, 0xa3, 0x12, 0x53, 0x25, 0x84, 0x3a, 0x30, 0xb0, 0x54, 0x4e, 0xe2, 0x9a, + 0xaa, 0x49, 0x5e, 0x64, 0x3b, 0x6d, 0x7d, 0x0b, 0x2e, 0xc1, 0x0d, 0x38, 0x04, 0x62, 0xea, 0xc8, + 0x84, 0x50, 0x72, 0x03, 0x4e, 0x80, 0x88, 0x63, 0xb6, 0xf7, 0xf3, 0xff, 0x3d, 0xfb, 0xe7, 0xe7, + 0x45, 0x7c, 0x0f, 0x09, 0x48, 0x4e, 0x53, 0x10, 0x2b, 0x80, 0x94, 0x6e, 0x27, 0xae, 0x24, 0xa5, + 0x04, 0x0d, 0xbe, 0xdf, 0x75, 0x10, 0x77, 0xbc, 0x9d, 0x0c, 0x03, 0x01, 0x02, 0xda, 0x98, 0xfe, + 0x56, 0xb6, 0x73, 0x78, 0x2e, 0x00, 0x44, 0xc6, 0x69, 0x4b, 0x71, 0xb5, 0xa2, 0xac, 0x30, 0x2e, + 0x4a, 0x40, 0xe5, 0xa0, 0x96, 0x76, 0xc6, 0x82, 0x8d, 0x46, 0x2f, 0xc8, 0x3b, 0xbd, 0xb5, 0x4f, + 0x3c, 0xb0, 0x6c, 0x9d, 0x32, 0x0d, 0xd2, 0x0f, 0xbd, 0x23, 0x96, 0xa6, 0x92, 0x2b, 0x15, 0xa2, + 0x08, 0x8d, 0x4f, 0x16, 0x0e, 0xfd, 0xc0, 0xfb, 0x5f, 0xc2, 0x8e, 0xcb, 0xf0, 0x5f, 0x84, 0xc6, + 0xfd, 0x85, 0x05, 0x9f, 0x79, 0x83, 0xb2, 0x8a, 0x37, 0xdc, 0x84, 0xfd, 0x08, 0x8d, 0x8f, 0xaf, + 0x02, 0x62, 0x5d, 0x88, 0x73, 0x21, 0x37, 0x85, 0x99, 0x4d, 0xbf, 0x3f, 0x2f, 0xce, 0x0c, 0xcb, + 0xb3, 0xeb, 0x51, 0x02, 0x85, 0xe2, 0x85, 0xaa, 0xd4, 0xd2, 0xce, 0x8d, 0xde, 0x5f, 0x2f, 0x83, + 0xce, 0x2b, 0x91, 0xa6, 0xd4, 0x40, 0xee, 0xab, 0x78, 0xce, 0xcd, 0xa2, 0xbb, 0x78, 0x36, 0x7f, + 0xab, 0x31, 0x3a, 0xd4, 0x18, 0x7d, 0xd5, 0x18, 0x3d, 0x37, 0xb8, 0x77, 0x68, 0x70, 0xef, 0xa3, + 0xc1, 0xbd, 0xc7, 0x89, 0x58, 0xeb, 0xa7, 0x2a, 0x26, 0x09, 0xe4, 0xb4, 0xfb, 0xc9, 0x1d, 0xd7, + 0x3b, 0x90, 0x1b, 0xea, 0xb6, 0xbb, 0xff, 0xdb, 0xaf, 0x36, 0x25, 0x57, 0xf1, 0xa0, 0xf5, 0x9a, + 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x39, 0xda, 0x59, 0x49, 0x7f, 0x01, 0x00, 0x00, +} + +func (m *ExocoreValidator) 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 *ExocoreValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExocoreValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pubkey != nil { + { + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDogfood(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Power != 0 { + i = encodeVarintDogfood(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDogfood(dAtA []byte, offset int, v uint64) int { + offset -= sovDogfood(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ExocoreValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovDogfood(uint64(l)) + } + if m.Power != 0 { + n += 1 + sovDogfood(uint64(m.Power)) + } + if m.Pubkey != nil { + l = m.Pubkey.Size() + n += 1 + l + sovDogfood(uint64(l)) + } + return n +} + +func sovDogfood(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDogfood(x uint64) (n int) { + return sovDogfood(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExocoreValidator) 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 ErrIntOverflowDogfood + } + 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: ExocoreValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExocoreValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pubkey == nil { + m.Pubkey = &types.Any{} + } + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDogfood(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, ErrIntOverflowDogfood + } + 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, ErrIntOverflowDogfood + } + 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, ErrIntOverflowDogfood + } + 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, ErrInvalidLengthDogfood + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDogfood + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDogfood + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDogfood = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDogfood = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDogfood = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index ab1254f4c..b498ad09b 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -1 +1,20 @@ package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + epochsTypes "github.com/evmos/evmos/v14/x/epochs/types" +) + +// EpochsKeeper represents the expected keeper interface for the epochs module. +type EpochsKeeper interface { + GetEpochInfo(sdk.Context, string) (epochsTypes.EpochInfo, bool) +} + +// DogfoodHooks represent the event hooks for dogfood module. Ideally, these should +// match those of the staking module but for now it is only a subset of them. The side effects +// of calling the other hooks are not relevant to running the chain, so they can be skipped. +type DogfoodHooks interface { + AfterValidatorBonded( + sdk.Context, sdk.ConsAddress, sdk.ValAddress, + ) error +} diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index a70ecb578..b3744468b 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cometbft/cometbft/abci/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -25,7 +26,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the dogfood module's genesis state. type GenesisState struct { + // Parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // Validator set, stored by ExocoreValidatorKey. + ValSet []types.ValidatorUpdate `protobuf:"bytes,2,rep,name=val_set,json=valSet,proto3" json:"val_set"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -68,6 +72,13 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetValSet() []types.ValidatorUpdate { + if m != nil { + return m.ValSet + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "exocore.dogfood.v1.GenesisState") } @@ -75,20 +86,25 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 202 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x4f, - 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, - 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, - 0x58, 0x10, 0x95, 0x52, 0xf2, 0x58, 0xcc, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0xa5, 0xe4, - 0xc1, 0xc5, 0xe3, 0x0e, 0x31, 0x3b, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x82, 0x8b, 0x0d, 0x22, - 0x2f, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa5, 0x87, 0x69, 0x97, 0x5e, 0x00, 0x58, 0x85, - 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xf5, 0x4e, 0xde, 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, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, - 0xab, 0xef, 0x0a, 0x31, 0xcd, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0xe6, 0xbc, 0x0a, - 0xb8, 0x03, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x33, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0xda, 0xc5, 0xe8, 0xc9, 0x0c, 0x01, 0x00, 0x00, + // 273 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x8f, 0x31, 0x4b, 0xc3, 0x40, + 0x14, 0xc7, 0x73, 0x2a, 0x15, 0x52, 0xa7, 0xe0, 0x50, 0x22, 0x5c, 0x83, 0x53, 0xa7, 0x3b, 0x52, + 0x17, 0x37, 0xa1, 0x20, 0x0e, 0x82, 0x88, 0x45, 0x07, 0x17, 0xb9, 0x24, 0xcf, 0x78, 0x98, 0xe4, + 0x85, 0xcb, 0x33, 0xd6, 0x8f, 0xe0, 0xe6, 0xc7, 0xea, 0xd8, 0xd1, 0x49, 0x24, 0xf9, 0x22, 0xd2, + 0xe4, 0xaa, 0x83, 0xdd, 0x0e, 0xee, 0xc7, 0xfb, 0xff, 0x7e, 0x6e, 0x00, 0x0b, 0x8c, 0xd1, 0x80, + 0x4c, 0x30, 0x7d, 0x44, 0x4c, 0x64, 0x1d, 0xca, 0x14, 0x0a, 0xa8, 0x74, 0x25, 0x4a, 0x83, 0x84, + 0x9e, 0x67, 0x09, 0x61, 0x09, 0x51, 0x87, 0xfe, 0x61, 0x8a, 0x29, 0x76, 0xdf, 0x72, 0xfd, 0xea, + 0x49, 0xff, 0x88, 0xa0, 0x48, 0xc0, 0xe4, 0xba, 0x20, 0xa9, 0xa2, 0x58, 0x4b, 0x7a, 0x2b, 0xc1, + 0x9e, 0xf1, 0xc7, 0x5b, 0x86, 0x4a, 0x65, 0x54, 0x6e, 0x81, 0xe3, 0x77, 0xe6, 0x1e, 0x5c, 0xf4, + 0xcb, 0x73, 0x52, 0x04, 0xde, 0xa9, 0x3b, 0xe8, 0x81, 0x11, 0x0b, 0xd8, 0x64, 0x38, 0xf5, 0xc5, + 0x7f, 0x13, 0x71, 0xdd, 0x11, 0xb3, 0xbd, 0xe5, 0xd7, 0xd8, 0xb9, 0xb1, 0xbc, 0x77, 0xe6, 0xee, + 0xd7, 0x2a, 0x7b, 0xa8, 0x80, 0x46, 0x3b, 0xc1, 0xee, 0x64, 0x38, 0x0d, 0xc4, 0x9f, 0x9a, 0x58, + 0xab, 0x89, 0x3b, 0x95, 0xe9, 0x44, 0x11, 0x9a, 0xdb, 0x32, 0x51, 0x04, 0x9b, 0x03, 0xb5, 0xca, + 0xe6, 0x40, 0xb3, 0xcb, 0x65, 0xc3, 0xd9, 0xaa, 0xe1, 0xec, 0xbb, 0xe1, 0xec, 0xa3, 0xe5, 0xce, + 0xaa, 0xe5, 0xce, 0x67, 0xcb, 0x9d, 0xfb, 0x30, 0xd5, 0xf4, 0xf4, 0x12, 0x89, 0x18, 0x73, 0x79, + 0xde, 0xeb, 0x5c, 0x01, 0xbd, 0xa2, 0x79, 0x96, 0x9b, 0xc0, 0xc5, 0x6f, 0x62, 0xd7, 0x1f, 0x0d, + 0xba, 0xbe, 0x93, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x26, 0x56, 0x05, 0x51, 0x6b, 0x01, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -111,6 +127,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ValSet) > 0 { + for iNdEx := len(m.ValSet) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -143,6 +173,12 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.ValSet) > 0 { + for _, e := range m.ValSet { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -214,6 +250,40 @@ 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 ValSet", 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 + } + m.ValSet = append(m.ValSet, types.ValidatorUpdate{}) + if err := m.ValSet[len(m.ValSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 1256e87e4..f7efde563 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -1,5 +1,9 @@ package types +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + const ( // ModuleName defines the module name ModuleName = "dogfood" @@ -7,3 +11,22 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName ) + +const ( + // ExocoreValidatorBytePrefix is the prefix for the validator store. + ExocoreValidatorBytePrefix byte = iota + 1 + + // HistoricalInfoBytePrefix is the prefix for the historical info store. + HistoricalInfoBytePrefix +) + +// ExocoreValidatorKey returns the key for the validator store. +func ExocoreValidatorKey(address sdk.AccAddress) []byte { + return append([]byte{ExocoreValidatorBytePrefix}, address.Bytes()...) +} + +// HistoricalInfoKey returns the key for the historical info store. +func HistoricalInfoKey(height int64) []byte { + bz := sdk.Uint64ToBigEndian(uint64(height)) + return append([]byte{HistoricalInfoBytePrefix}, bz...) +} diff --git a/x/dogfood/types/validator.go b/x/dogfood/types/validator.go new file mode 100644 index 000000000..dafb75065 --- /dev/null +++ b/x/dogfood/types/validator.go @@ -0,0 +1,45 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// NewExocoreValidator creates an ExocoreValidator with the specified (consensus) address, vote +// power and consensus public key. If the public key is malformed, it returns an error. +func NewExocoreValidator( + address []byte, power int64, pubKey cryptotypes.PubKey, +) (ExocoreValidator, error) { + pkAny, err := codectypes.NewAnyWithValue(pubKey) + if err != nil { + return ExocoreValidator{}, errorsmod.Wrap(err, "failed to pack public key") + } + return ExocoreValidator{ + Address: address, + Power: power, + Pubkey: pkAny, + }, nil +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces. +// It is required to ensure that ConsPubKey below works. +func (ecv ExocoreValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(ecv.Pubkey, &pk) +} + +// ConsPubKey returns the validator PubKey as a cryptotypes.PubKey. +func (ecv ExocoreValidator) ConsPubKey() (cryptotypes.PubKey, error) { + pk, ok := ecv.Pubkey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + return nil, errorsmod.Wrapf( + sdkerrors.ErrInvalidType, + "expecting cryptotypes.PubKey, got %T", + pk, + ) + } + + return pk, nil +} From b4f4df5606d22d30ef4916019ac8e205c78375f4 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 7 Feb 2024 19:01:50 +0000 Subject: [PATCH 09/41] feat(dogfood): implement operator hooks --- proto/exocore/dogfood/v1/dogfood.proto | 58 ++ x/dogfood/keeper/impl_operator_hooks.go | 107 +++ x/dogfood/keeper/keeper.go | 35 + x/dogfood/keeper/opt_out.go | 162 ++++ x/dogfood/keeper/queue.go | 45 ++ x/dogfood/keeper/unbonding.go | 58 ++ x/dogfood/types/dogfood.pb.go | 955 +++++++++++++++++++++++- x/dogfood/types/expected_keepers.go | 14 +- x/dogfood/types/keys.go | 40 + x/dogfood/types/utils.go | 31 + 10 files changed, 1477 insertions(+), 28 deletions(-) create mode 100644 x/dogfood/keeper/impl_operator_hooks.go create mode 100644 x/dogfood/keeper/opt_out.go create mode 100644 x/dogfood/keeper/queue.go create mode 100644 x/dogfood/keeper/unbonding.go create mode 100644 x/dogfood/types/utils.go diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index e51f4a408..1259ac803 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -5,6 +5,7 @@ package exocore.dogfood.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; +import "tendermint/crypto/keys.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; @@ -21,4 +22,61 @@ message ExocoreValidator { (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" ]; +} + +// OperationType is used to indicate the type of operation that is being +// cached by the module to create the updated validator set. +enum OperationType { + option (gogoproto.goproto_enum_prefix) = false; + // KeyOpUnspecified is used to indicate that the operation type is not specified. + // This should never be used. + OPERATION_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "KeyOpUnspecified" ]; + // KeyAddition is used to indicate that the operation is a key addition. + OPERATION_TYPE_ADDITION_OR_UPDATE = 1 [ (gogoproto.enumvalue_customname) = "KeyAdditionOrUpdate" ]; + // KeyRemoval is used to indicate that the operation is a key removal. Typically + // this is done due to key replacement mechanism and not directly. + OPERATION_TYPE_REMOVAL = 2 [ (gogoproto.enumvalue_customname) = "KeyRemoval" ]; +} + +// QueueResultType is used to indicate the result of the queue operation. +enum QueueResultType { + option (gogoproto.goproto_enum_prefix) = false; + // QueueResultUnspecified is used to indicate that the queue result type is not specified. + QUEUE_RESULT_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "QueueResultUnspecified" ]; + // QueueResultSuccess is used to indicate that the queue operation was successful. + QUEUE_RESULT_TYPE_SUCCESS = 1 [ (gogoproto.enumvalue_customname) = "QueueResultSuccess" ]; + // QueueResultExists is used to indicate that the queue operation failed because the + // operation already exists in the queue. + QUEUE_RESULT_TYPE_EXISTS = 2 [ (gogoproto.enumvalue_customname) = "QueueResultExists" ]; + // QueueResultRemoved is used to indicate that the queue operation resulted in an existing + // operation being removed from the queue. + QUEUE_RESULT_TYPE_REMOVED = 3 [ (gogoproto.enumvalue_customname) = "QueueResultRemoved" ]; +} + +// Operation is used to indicate the operation that is being cached by the module +// to create the updated validator set. +message Operation { + // OperationType is the type of the operation (addition / removal). + OperationType operation_type = 1; + // OperatorAddress is the sdk.AccAddress of the operator. + bytes operator_address = 2; + // PubKey is the public key for which the operation is being applied. + tendermint.crypto.PublicKey pub_key = 3 [(gogoproto.nullable) = false]; +} + +// Operations is a collection of Operation. +message Operations { + repeated Operation list = 1 [(gogoproto.nullable) = false]; +} + +// AccountAddresses represents a list of account addresses. It is used to store the list of +// operator addresses whose operations are maturing at an epoch. +message AccountAddresses { + repeated bytes list = 1; +} + +// ConsensusAddresses represents a list of account addresses. It is used to store the list of +// addresses (which correspond to operator public keys) to delete at the end of an epoch. +message ConsensusAddresses { + repeated bytes list = 1; } \ No newline at end of file diff --git a/x/dogfood/keeper/impl_operator_hooks.go b/x/dogfood/keeper/impl_operator_hooks.go new file mode 100644 index 000000000..e5a42d615 --- /dev/null +++ b/x/dogfood/keeper/impl_operator_hooks.go @@ -0,0 +1,107 @@ +package keeper + +import ( + "strings" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// OperatorHooksWrapper is the wrapper structure that implements the operator hooks for the +// dogfood keeper. +type OperatorHooksWrapper struct { + keeper *Keeper +} + +// Interface guards +var _ types.OperatorHooks = OperatorHooksWrapper{} + +func (k *Keeper) OperatorHooks() OperatorHooksWrapper { + return OperatorHooksWrapper{k} +} + +// Hooks assumptions: Assuming I is opt-in, O is opt-out and R is key replacement, these are all +// possible within the same epoch, for a fresh operator. +// I O +// I R +// I R O +// This is not possible for a fresh operator to do: +// I O R +// R I O +// R I +// For an operator that is already opted in, the list looks like follows: +// R O +// O I +// O I R +// R O I +// The impossible list looks like: +// O R +// O R I +// TODO: list out operation results for each of these, and make sure everything is covered below + +// AfterOperatorOptIn is the implementation of the operator hooks. +func (h OperatorHooksWrapper) AfterOperatorOptIn( + ctx sdk.Context, addr sdk.AccAddress, + chainID string, pubKey tmprotocrypto.PublicKey, +) { + if strings.Compare(ctx.ChainID(), chainID) == 0 { + // res == Removed, it means operator has opted back in + // res == Success, there is no additional information to store + // res == Exists, there is nothing to do + if res := h.keeper.QueueOperation( + ctx, addr, pubKey, types.KeyAdditionOrUpdate, + ); res == types.QueueResultRemoved { + // the old operation was key removal, which is now removed from the queue. + // so all of the changes that were associated with it need to be undone. + h.keeper.ClearUnbondingInformation(ctx, addr, pubKey) + } + } +} + +// AfterOperatorKeyReplacement is the implementation of the operator hooks. +func (h OperatorHooksWrapper) AfterOperatorKeyReplacement( + ctx sdk.Context, addr sdk.AccAddress, + newKey tmprotocrypto.PublicKey, oldKey tmprotocrypto.PublicKey, + chainID string, +) { + if strings.Compare(chainID, ctx.ChainID()) == 0 { + // res == Removed, it means operator has added their original key again + // res == Success, there is no additional information to store + // res == Exists, there is no nothing to do + if res := h.keeper.QueueOperation( + ctx, addr, newKey, types.KeyAdditionOrUpdate, + ); res == types.QueueResultRemoved { + // see AfterOperatorOptIn for explanation + h.keeper.ClearUnbondingInformation(ctx, addr, newKey) + } + // res == Removed, it means operator had added this key and is now removing it. + // no additional information to clear. + // res == Success, the old key should be pruned from the operator module. + // res == Exists, there is nothing to do. + if res := h.keeper.QueueOperation( + ctx, addr, oldKey, types.KeyRemoval, + ); res == types.QueueResultSuccess { + // the old key can be marked for pruning + h.keeper.SetUnbondingInformation(ctx, addr, oldKey, false) + } + } +} + +// AfterOperatorOptOutInitiated is the implementation of the operator hooks. +func (h OperatorHooksWrapper) AfterOperatorOptOutInitiated( + ctx sdk.Context, addr sdk.AccAddress, + chainID string, pubKey tmprotocrypto.PublicKey, +) { + if strings.Compare(chainID, ctx.ChainID()) == 0 { + // res == Removed means operator had opted in and is now opting out. nothing to do if + // it is within the same epoch. + // res == Success, set up pruning deadline and opt out completion deadline + // res == Exists, there is nothing to do (should never happen) + if res := h.keeper.QueueOperation( + ctx, addr, pubKey, types.KeyRemoval, + ); res == types.QueueResultSuccess { + h.keeper.SetUnbondingInformation(ctx, addr, pubKey, true) + } + } +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index b90ec9095..47e766553 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -66,3 +66,38 @@ func (k *Keeper) SetHooks(sh types.DogfoodHooks) *Keeper { func (k Keeper) Hooks() types.DogfoodHooks { return k.dogfoodHooks } + +// GetQueuedKeyOperations returns the list of operations that are queued for execution at the +// end of the current epoch. +func (k Keeper) GetQueuedOperations( + ctx sdk.Context, +) []types.Operation { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.QueuedOperationsKey()) + if bz == nil { + return []types.Operation{} + } + var operations types.Operations + if err := operations.Unmarshal(bz); err != nil { + // TODO(mm): any failure to unmarshal is treated as no operations or panic? + return []types.Operation{} + } + return operations.GetList() +} + +// ClearQueuedOperations clears the operations to be executed at the end of the epoch. +func (k Keeper) ClearQueuedOperations(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.QueuedOperationsKey()) +} + +// setQueuedOperations is a private, internal function used to update the current queue of +// operations to be executed at the end of the epoch with the supplied value. +func (k Keeper) setQueuedOperations(ctx sdk.Context, operations types.Operations) { + store := ctx.KVStore(k.storeKey) + bz, err := operations.Marshal() + if err != nil { + panic(err) + } + store.Set(types.QueuedOperationsKey(), bz) +} diff --git a/x/dogfood/keeper/opt_out.go b/x/dogfood/keeper/opt_out.go new file mode 100644 index 000000000..939d747e3 --- /dev/null +++ b/x/dogfood/keeper/opt_out.go @@ -0,0 +1,162 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AppendOptOutToFinish appends an operator address to the list of operator addresses that have +// opted out and will be finished at the end of the provided epoch. +func (k Keeper) AppendOptOutToFinish( + ctx sdk.Context, epoch int64, operatorAddr sdk.AccAddress, +) { + prev := k.GetOptOutsToFinish(ctx, epoch) + next := types.AccountAddresses{List: append(prev, operatorAddr)} + k.setOptOutsToFinish(ctx, epoch, next) +} + +// GetOptOutsToFinish returns the list of operator addresses that have opted out and will be +// finished at the end of the provided epoch. +func (k Keeper) GetOptOutsToFinish( + ctx sdk.Context, epoch int64, +) [][]byte { + store := ctx.KVStore(k.storeKey) + key := types.OptOutsToFinishKey(epoch) + bz := store.Get(key) + if bz == nil { + return [][]byte{} + } + var res types.AccountAddresses + if err := res.Unmarshal(bz); err != nil { + panic(err) + } + return res.GetList() +} + +// setOptOutsToFinish sets the list of operator addresses that have opted out and will be +// finished at the end of the provided epoch. +func (k Keeper) setOptOutsToFinish( + ctx sdk.Context, epoch int64, addrs types.AccountAddresses, +) { + store := ctx.KVStore(k.storeKey) + key := types.OptOutsToFinishKey(epoch) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(key, bz) +} + +// RemoveOptOutToFinish removes an operator address from the list of operator addresses that +// have opted out and will be finished at the end of the provided epoch. +func (k Keeper) RemoveOptOutToFinish(ctx sdk.Context, epoch int64, addr sdk.AccAddress) { + prev := k.GetOptOutsToFinish(ctx, epoch) + next := types.AccountAddresses{ + List: types.RemoveFromBytesList(prev, addr), + } + k.setOptOutsToFinish(ctx, epoch, next) +} + +// ClearOptOutsToFinish clears the list of operator addresses that have opted out and will be +// finished at the end of the provided epoch. +func (k Keeper) ClearOptOutsToFinish(ctx sdk.Context, epoch int64) { + store := ctx.KVStore(k.storeKey) + key := types.OptOutsToFinishKey(epoch) + store.Delete(key) +} + +// SetOperatorOptOutFinishEpoch sets the epoch at which an operator's opt out will be finished. +func (k Keeper) SetOperatorOptOutFinishEpoch( + ctx sdk.Context, operatorAddr sdk.AccAddress, epoch int64, +) { + store := ctx.KVStore(k.storeKey) + key := types.OperatorOptOutFinishEpochKey(operatorAddr) + bz := sdk.Uint64ToBigEndian(uint64(epoch)) + store.Set(key, bz) +} + +// GetOperatorOptOutFinishEpoch returns the epoch at which an operator's opt out will be +// finished. +func (k Keeper) GetOperatorOptOutFinishEpoch( + ctx sdk.Context, operatorAddr sdk.AccAddress, +) int64 { + store := ctx.KVStore(k.storeKey) + key := types.OperatorOptOutFinishEpochKey(operatorAddr) + bz := store.Get(key) + if bz == nil { + return -1 + } + return int64(sdk.BigEndianToUint64(bz)) +} + +// DeleteOperatorOptOutFinishEpoch deletes the epoch at which an operator's opt out will be +// finished. +func (k Keeper) DeleteOperatorOptOutFinishEpoch( + ctx sdk.Context, operatorAddr sdk.AccAddress, +) { + store := ctx.KVStore(k.storeKey) + key := types.OperatorOptOutFinishEpochKey(operatorAddr) + store.Delete(key) +} + +// AppendConsensusAddrToPrune appends a consensus address to the list of consensus addresses to +// prune at the end of the epoch. +func (k Keeper) AppendConsensusAddrToPrune( + ctx sdk.Context, epoch int64, operatorAddr sdk.ConsAddress, +) { + prev := k.GetConsensusAddrsToPrune(ctx, epoch) + next := types.ConsensusAddresses{List: append(prev, operatorAddr)} + k.setConsensusAddrsToPrune(ctx, epoch, next) +} + +// GetConsensusAddrsToPrune returns the list of consensus addresses to prune at the end of the +// epoch. +func (k Keeper) GetConsensusAddrsToPrune( + ctx sdk.Context, epoch int64, +) [][]byte { + store := ctx.KVStore(k.storeKey) + key := types.ConsensusAddrsToPruneKey(epoch) + bz := store.Get(key) + if bz == nil { + return [][]byte{} + } + var res types.ConsensusAddresses + if err := res.Unmarshal(bz); err != nil { + panic(err) + } + return res.GetList() +} + +// DeleteConsensusAddrToPrune deletes a consensus address from the list of consensus addresses +// to prune at the end of the provided epoch. +func (k Keeper) DeleteConsensusAddrToPrune( + ctx sdk.Context, epoch int64, addr sdk.ConsAddress, +) { + prev := k.GetConsensusAddrsToPrune(ctx, epoch) + next := types.ConsensusAddresses{ + List: types.RemoveFromBytesList(prev, addr.Bytes()), + } + k.setConsensusAddrsToPrune(ctx, epoch, next) +} + +// ClearConsensusAddrsToPrune clears the list of consensus addresses to prune at the end of the +// epoch. +func (k Keeper) ClearConsensusAddrsToPrune(ctx sdk.Context, epoch int64) { + store := ctx.KVStore(k.storeKey) + key := types.ConsensusAddrsToPruneKey(epoch) + store.Delete(key) +} + +// setConsensusAddrsToPrune sets the list of consensus addresses to prune at the end of the +// epoch. +func (k Keeper) setConsensusAddrsToPrune( + ctx sdk.Context, epoch int64, addrs types.ConsensusAddresses, +) { + store := ctx.KVStore(k.storeKey) + key := types.ConsensusAddrsToPruneKey(epoch) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(key, bz) +} diff --git a/x/dogfood/keeper/queue.go b/x/dogfood/keeper/queue.go new file mode 100644 index 000000000..591962d5f --- /dev/null +++ b/x/dogfood/keeper/queue.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// QueueOperation adds an operation to the consensus public key queue. If a similar operation +// already exists, the queue is not modified and QueueResultExists is returned. If a reverse +// operation already exists (removal + addition, or addition + removal), the old operation is +// dropped from the queue and QueueResultRemoved is returned. In the case that the operation is +// added to the queue, QueueResultSuccess is returned. +func (k Keeper) QueueOperation( + ctx sdk.Context, addr sdk.AccAddress, + key tmprotocrypto.PublicKey, operationType types.OperationType, +) types.QueueResultType { + if operationType == types.KeyOpUnspecified { + // should never happen + panic("invalid operation type") + } + currentQueue := k.GetQueuedOperations(ctx) + indexToDelete := len(currentQueue) + for i, operation := range currentQueue { + if operation.PubKey.Equal(key) { + if operation.OperationType == operationType { + return types.QueueResultExists + } else { + indexToDelete = i + break + } + } + } + ret := types.QueueResultSuccess + if indexToDelete > len(currentQueue) { + currentQueue = append(currentQueue[:indexToDelete], currentQueue[indexToDelete+1:]...) + ret = types.QueueResultRemoved + } else { + operation := types.Operation{OperationType: operationType, OperatorAddress: addr, PubKey: key} + currentQueue = append(currentQueue, operation) + } + operations := types.Operations{List: currentQueue} + k.setQueuedOperations(ctx, operations) + return ret +} diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go new file mode 100644 index 000000000..4987e523a --- /dev/null +++ b/x/dogfood/keeper/unbonding.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ClearUnbondingInformation clears all information related to an operator's opt out +// or key replacement. This is done because the operator has opted back in or has +// replaced their key (again) with the original one. +func (k Keeper) ClearUnbondingInformation( + ctx sdk.Context, addr sdk.AccAddress, pubKey tmprotocrypto.PublicKey, +) { + optOutEpoch := k.GetOperatorOptOutFinishEpoch(ctx, addr) + k.DeleteOperatorOptOutFinishEpoch(ctx, addr) + k.RemoveOptOutToFinish(ctx, optOutEpoch, addr) + consAddress, err := types.TMCryptoPublicKeyToConsAddr(pubKey) + if err != nil { + panic(err) + } + k.DeleteConsensusAddrToPrune(ctx, optOutEpoch, consAddress) +} + +// SetUnbondingInformation sets information related to an operator's opt out or key replacement. +func (k Keeper) SetUnbondingInformation( + ctx sdk.Context, addr sdk.AccAddress, pubKey tmprotocrypto.PublicKey, isOptingOut bool, +) { + unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) + k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) + if isOptingOut { + k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) + } + consAddress, err := types.TMCryptoPublicKeyToConsAddr(pubKey) + if err != nil { + panic(err) + } + k.AppendConsensusAddrToPrune(ctx, unbondingCompletionEpoch, consAddress) +} + +// GetUnbondingCompletionEpoch returns the epoch at the end of which +// an unbonding triggered in this epoch will be completed. +func (k Keeper) GetUnbondingCompletionEpoch( + ctx sdk.Context, +) int64 { + unbondingEpochs := k.GetEpochsUntilUnbonded(ctx) + epochInfo, found := k.epochsKeeper.GetEpochInfo( + ctx, k.GetEpochIdentifier(ctx), + ) + if !found { + panic("current epoch not found") + } + // if i execute the transaction at epoch 5, the vote power change + // goes into effect at the beginning of epoch 6. the information + // should be held for 7 epochs, so it should be deleted at the + // beginning of epoch 13 or the end of epoch 12. + return epochInfo.CurrentEpoch + int64(unbondingEpochs) +} diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 64cadbb85..3a64b1dea 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -25,6 +26,79 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// OperationType is used to indicate the type of operation that is being +// cached by the module to create the updated validator set. +type OperationType int32 + +const ( + // KeyOpUnspecified is used to indicate that the operation type is not specified. + // This should never be used. + KeyOpUnspecified OperationType = 0 + // KeyAddition is used to indicate that the operation is a key addition. + KeyAdditionOrUpdate OperationType = 1 + // KeyRemoval is used to indicate that the operation is a key removal. Typically + // this is done due to key replacement mechanism and not directly. + KeyRemoval OperationType = 2 +) + +var OperationType_name = map[int32]string{ + 0: "OPERATION_TYPE_UNSPECIFIED", + 1: "OPERATION_TYPE_ADDITION_OR_UPDATE", + 2: "OPERATION_TYPE_REMOVAL", +} + +var OperationType_value = map[string]int32{ + "OPERATION_TYPE_UNSPECIFIED": 0, + "OPERATION_TYPE_ADDITION_OR_UPDATE": 1, + "OPERATION_TYPE_REMOVAL": 2, +} + +func (x OperationType) String() string { + return proto.EnumName(OperationType_name, int32(x)) +} + +func (OperationType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{0} +} + +// QueueResultType is used to indicate the result of the queue operation. +type QueueResultType int32 + +const ( + // QueueResultUnspecified is used to indicate that the queue result type is not specified. + QueueResultUnspecified QueueResultType = 0 + // QueueResultSuccess is used to indicate that the queue operation was successful. + QueueResultSuccess QueueResultType = 1 + // QueueResultExists is used to indicate that the queue operation failed because the + // operation already exists in the queue. + QueueResultExists QueueResultType = 2 + // QueueResultRemoved is used to indicate that the queue operation resulted in an existing + // operation being removed from the queue. + QueueResultRemoved QueueResultType = 3 +) + +var QueueResultType_name = map[int32]string{ + 0: "QUEUE_RESULT_TYPE_UNSPECIFIED", + 1: "QUEUE_RESULT_TYPE_SUCCESS", + 2: "QUEUE_RESULT_TYPE_EXISTS", + 3: "QUEUE_RESULT_TYPE_REMOVED", +} + +var QueueResultType_value = map[string]int32{ + "QUEUE_RESULT_TYPE_UNSPECIFIED": 0, + "QUEUE_RESULT_TYPE_SUCCESS": 1, + "QUEUE_RESULT_TYPE_EXISTS": 2, + "QUEUE_RESULT_TYPE_REMOVED": 3, +} + +func (x QueueResultType) String() string { + return proto.EnumName(QueueResultType_name, int32(x)) +} + +func (QueueResultType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{1} +} + // ExocoreValidator is a validator that is part of the Exocore network. It is // used to validate and sign blocks and transactions. type ExocoreValidator struct { @@ -91,33 +165,267 @@ func (m *ExocoreValidator) GetPubkey() *types.Any { return nil } +// Operation is used to indicate the operation that is being cached by the module +// to create the updated validator set. +type Operation struct { + // OperationType is the type of the operation (addition / removal). + OperationType OperationType `protobuf:"varint,1,opt,name=operation_type,json=operationType,proto3,enum=exocore.dogfood.v1.OperationType" json:"operation_type,omitempty"` + // OperatorAddress is the sdk.AccAddress of the operator. + OperatorAddress []byte `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + // PubKey is the public key for which the operation is being applied. + PubKey crypto.PublicKey `protobuf:"bytes,3,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` +} + +func (m *Operation) Reset() { *m = Operation{} } +func (m *Operation) String() string { return proto.CompactTextString(m) } +func (*Operation) ProtoMessage() {} +func (*Operation) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{1} +} +func (m *Operation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Operation.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 *Operation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Operation.Merge(m, src) +} +func (m *Operation) XXX_Size() int { + return m.Size() +} +func (m *Operation) XXX_DiscardUnknown() { + xxx_messageInfo_Operation.DiscardUnknown(m) +} + +var xxx_messageInfo_Operation proto.InternalMessageInfo + +func (m *Operation) GetOperationType() OperationType { + if m != nil { + return m.OperationType + } + return KeyOpUnspecified +} + +func (m *Operation) GetOperatorAddress() []byte { + if m != nil { + return m.OperatorAddress + } + return nil +} + +func (m *Operation) GetPubKey() crypto.PublicKey { + if m != nil { + return m.PubKey + } + return crypto.PublicKey{} +} + +// Operations is a collection of Operation. +type Operations struct { + List []Operation `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` +} + +func (m *Operations) Reset() { *m = Operations{} } +func (m *Operations) String() string { return proto.CompactTextString(m) } +func (*Operations) ProtoMessage() {} +func (*Operations) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{2} +} +func (m *Operations) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Operations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Operations.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 *Operations) XXX_Merge(src proto.Message) { + xxx_messageInfo_Operations.Merge(m, src) +} +func (m *Operations) XXX_Size() int { + return m.Size() +} +func (m *Operations) XXX_DiscardUnknown() { + xxx_messageInfo_Operations.DiscardUnknown(m) +} + +var xxx_messageInfo_Operations proto.InternalMessageInfo + +func (m *Operations) GetList() []Operation { + if m != nil { + return m.List + } + return nil +} + +// AccountAddresses represents a list of account addresses. It is used to store the list of +// operator addresses whose operations are maturing at an epoch. +type AccountAddresses struct { + List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (m *AccountAddresses) Reset() { *m = AccountAddresses{} } +func (m *AccountAddresses) String() string { return proto.CompactTextString(m) } +func (*AccountAddresses) ProtoMessage() {} +func (*AccountAddresses) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{3} +} +func (m *AccountAddresses) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountAddresses.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 *AccountAddresses) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountAddresses.Merge(m, src) +} +func (m *AccountAddresses) XXX_Size() int { + return m.Size() +} +func (m *AccountAddresses) XXX_DiscardUnknown() { + xxx_messageInfo_AccountAddresses.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountAddresses proto.InternalMessageInfo + +func (m *AccountAddresses) GetList() [][]byte { + if m != nil { + return m.List + } + return nil +} + +// ConsensusAddresses represents a list of account addresses. It is used to store the list of +// addresses (which correspond to operator public keys) to delete at the end of an epoch. +type ConsensusAddresses struct { + List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (m *ConsensusAddresses) Reset() { *m = ConsensusAddresses{} } +func (m *ConsensusAddresses) String() string { return proto.CompactTextString(m) } +func (*ConsensusAddresses) ProtoMessage() {} +func (*ConsensusAddresses) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{4} +} +func (m *ConsensusAddresses) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsensusAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsensusAddresses.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 *ConsensusAddresses) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusAddresses.Merge(m, src) +} +func (m *ConsensusAddresses) XXX_Size() int { + return m.Size() +} +func (m *ConsensusAddresses) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusAddresses.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusAddresses proto.InternalMessageInfo + +func (m *ConsensusAddresses) GetList() [][]byte { + if m != nil { + return m.List + } + return nil +} + func init() { + proto.RegisterEnum("exocore.dogfood.v1.OperationType", OperationType_name, OperationType_value) + proto.RegisterEnum("exocore.dogfood.v1.QueueResultType", QueueResultType_name, QueueResultType_value) proto.RegisterType((*ExocoreValidator)(nil), "exocore.dogfood.v1.ExocoreValidator") + proto.RegisterType((*Operation)(nil), "exocore.dogfood.v1.Operation") + proto.RegisterType((*Operations)(nil), "exocore.dogfood.v1.Operations") + proto.RegisterType((*AccountAddresses)(nil), "exocore.dogfood.v1.AccountAddresses") + proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") } func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0x31, 0x4e, 0xf3, 0x30, - 0x14, 0xc7, 0xeb, 0xaf, 0xfa, 0x8a, 0x14, 0x18, 0x50, 0x14, 0x89, 0xd0, 0xc1, 0x44, 0x9d, 0xba, - 0x60, 0xab, 0x74, 0x63, 0xa3, 0x12, 0x53, 0x25, 0x84, 0x3a, 0x30, 0xb0, 0x54, 0x4e, 0xe2, 0x9a, - 0xaa, 0x49, 0x5e, 0x64, 0x3b, 0x6d, 0x7d, 0x0b, 0x2e, 0xc1, 0x0d, 0x38, 0x04, 0x62, 0xea, 0xc8, - 0x84, 0x50, 0x72, 0x03, 0x4e, 0x80, 0x88, 0x63, 0xb6, 0xf7, 0xf3, 0xff, 0x3d, 0xfb, 0xe7, 0xe7, - 0x45, 0x7c, 0x0f, 0x09, 0x48, 0x4e, 0x53, 0x10, 0x2b, 0x80, 0x94, 0x6e, 0x27, 0xae, 0x24, 0xa5, - 0x04, 0x0d, 0xbe, 0xdf, 0x75, 0x10, 0x77, 0xbc, 0x9d, 0x0c, 0x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0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x39, 0xda, 0x59, 0x49, 0x7f, 0x01, 0x00, 0x00, + // 705 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xcf, 0x4e, 0xdb, 0x4a, + 0x14, 0xc6, 0xe3, 0x84, 0x0b, 0xba, 0xc3, 0x3f, 0xdf, 0xb9, 0x29, 0x04, 0x0b, 0x82, 0xc9, 0xa2, + 0x4a, 0x91, 0x6a, 0x0b, 0x68, 0x55, 0xa9, 0x55, 0x2b, 0x99, 0xc4, 0x55, 0xa3, 0x50, 0x12, 0xec, + 0x18, 0xb5, 0xdd, 0x58, 0x8e, 0x7d, 0x48, 0x2d, 0x12, 0x8f, 0xe5, 0xb1, 0x01, 0xbf, 0x41, 0x95, + 0x55, 0x5f, 0x20, 0xab, 0xaa, 0x6f, 0x50, 0xa9, 0xab, 0xee, 0x51, 0x57, 0x2c, 0xbb, 0x42, 0x15, + 0xbc, 0x41, 0x77, 0xdd, 0x55, 0xf1, 0x1f, 0x48, 0x09, 0x62, 0xe7, 0x6f, 0xce, 0xf9, 0x66, 0x7e, + 0xdf, 0x91, 0x67, 0x10, 0x0f, 0x27, 0xc4, 0x24, 0x1e, 0x88, 0x16, 0xe9, 0x1c, 0x10, 0x62, 0x89, + 0x47, 0x1b, 0xe9, 0xa7, 0xe0, 0x7a, 0xc4, 0x27, 0x18, 0x27, 0x1d, 0x42, 0xba, 0x7c, 0xb4, 0xc1, + 0xe5, 0x3b, 0xa4, 0x43, 0xa2, 0xb2, 0x38, 0xfc, 0x8a, 0x3b, 0xb9, 0xa5, 0x0e, 0x21, 0x9d, 0x2e, + 0x88, 0x91, 0x6a, 0x07, 0x07, 0xa2, 0xe1, 0x84, 0x69, 0xc9, 0x24, 0xb4, 0x47, 0xa8, 0x1e, 0x7b, + 0x62, 0x91, 0x94, 0x96, 0x7d, 0x70, 0x2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, 0xe2, 0xc3, 0xa7, 0x62, 0x66, 0xfd, 0x37, 0x83, 0xe6, 0xf7, 0x02, 0x08, 0x40, 0x01, + 0x1a, 0x74, 0xfd, 0x88, 0xfd, 0x39, 0x5a, 0xd9, 0xd3, 0x64, 0x6d, 0x68, 0x56, 0xb5, 0x9d, 0xd6, + 0x6d, 0xf8, 0x5c, 0x7f, 0xc0, 0x2f, 0x8c, 0xf8, 0x46, 0x43, 0x3c, 0x46, 0x4b, 0xe3, 0x76, 0x55, + 0xab, 0x54, 0x64, 0x55, 0x65, 0x19, 0x6e, 0xa1, 0x3f, 0xe0, 0xf1, 0x88, 0x55, 0x0d, 0x4c, 0x73, + 0xf8, 0x67, 0x6c, 0xa1, 0xc2, 0xb8, 0x4d, 0x7e, 0x53, 0x53, 0x5b, 0x2a, 0x9b, 0xe5, 0xee, 0xf5, + 0x07, 0xfc, 0x7f, 0x23, 0x2e, 0xf9, 0xc4, 0xa6, 0x3e, 0xbd, 0xfd, 0xac, 0x28, 0xb3, 0x5c, 0x65, + 0x73, 0x63, 0x67, 0x45, 0xd9, 0xc1, 0x8a, 0xb3, 0x6f, 0xd7, 0x4f, 0x2f, 0x8a, 0xcc, 0xd9, 0x45, + 0x91, 0xf9, 0x79, 0x51, 0x64, 0x3e, 0x5e, 0x16, 0x33, 0x67, 0x97, 0xc5, 0xcc, 0x8f, 0xcb, 0x62, + 0xe6, 0xdd, 0x46, 0xc7, 0xf6, 0xdf, 0x07, 0x6d, 0xc1, 0x24, 0x3d, 0x31, 0xb9, 0xd8, 0xbb, 0xe0, + 0x1f, 0x13, 0xef, 0x50, 0x4c, 0x9f, 0xa2, 0x93, 0xab, 0xc7, 0x68, 0x78, 0x75, 0x68, 0x7b, 0x32, + 0xba, 0xa6, 0x5b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xf3, 0x23, 0x11, 0xac, 0x04, 0x00, + 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -167,6 +475,152 @@ func (m *ExocoreValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Operation) 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 *Operation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Operation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDogfood(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if m.OperationType != 0 { + i = encodeVarintDogfood(dAtA, i, uint64(m.OperationType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Operations) 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 *Operations) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Operations) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDogfood(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *AccountAddresses) 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 *AccountAddresses) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.List[iNdEx]) + copy(dAtA[i:], m.List[iNdEx]) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.List[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ConsensusAddresses) 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 *ConsensusAddresses) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.List[iNdEx]) + copy(dAtA[i:], m.List[iNdEx]) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.List[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintDogfood(dAtA []byte, offset int, v uint64) int { offset -= sovDogfood(v) base := offset @@ -198,15 +652,78 @@ func (m *ExocoreValidator) Size() (n int) { return n } -func sovDogfood(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *Operation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OperationType != 0 { + n += 1 + sovDogfood(uint64(m.OperationType)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovDogfood(uint64(l)) + } + l = m.PubKey.Size() + n += 1 + l + sovDogfood(uint64(l)) + return n } -func sozDogfood(x uint64) (n int) { - return sovDogfood(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *Operations) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovDogfood(uint64(l)) + } + } + return n } -func (m *ExocoreValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 + +func (m *AccountAddresses) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, b := range m.List { + l = len(b) + n += 1 + l + sovDogfood(uint64(l)) + } + } + return n +} + +func (m *ConsensusAddresses) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, b := range m.List { + l = len(b) + n += 1 + l + sovDogfood(uint64(l)) + } + } + return n +} + +func sovDogfood(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDogfood(x uint64) (n int) { + return sovDogfood(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExocoreValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 @@ -343,6 +860,390 @@ func (m *ExocoreValidator) Unmarshal(dAtA []byte) error { } return nil } +func (m *Operation) 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 ErrIntOverflowDogfood + } + 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: Operation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Operation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperationType", wireType) + } + m.OperationType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperationType |= OperationType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = append(m.OperatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.OperatorAddress == nil { + m.OperatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Operations) 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 ErrIntOverflowDogfood + } + 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: Operations: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Operations: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, Operation{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccountAddresses) 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 ErrIntOverflowDogfood + } + 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: AccountAddresses: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsensusAddresses) 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 ErrIntOverflowDogfood + } + 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: ConsensusAddresses: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsensusAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDogfood(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index b498ad09b..1880294b6 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -1,6 +1,7 @@ package types import ( + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" epochsTypes "github.com/evmos/evmos/v14/x/epochs/types" ) @@ -10,7 +11,7 @@ type EpochsKeeper interface { GetEpochInfo(sdk.Context, string) (epochsTypes.EpochInfo, bool) } -// DogfoodHooks represent the event hooks for dogfood module. Ideally, these should +// DogfoodHooks represents the event hooks for dogfood module. Ideally, these should // match those of the staking module but for now it is only a subset of them. The side effects // of calling the other hooks are not relevant to running the chain, so they can be skipped. type DogfoodHooks interface { @@ -18,3 +19,14 @@ type DogfoodHooks interface { sdk.Context, sdk.ConsAddress, sdk.ValAddress, ) error } + +// OperatorHooks is the interface for the operator module's hooks. The functions are called +// whenever an operator opts in to a Cosmos chain, opts out of a Cosmos chain, or replaces their +// public key with another one. +type OperatorHooks interface { + AfterOperatorOptIn(sdk.Context, sdk.AccAddress, string, tmprotocrypto.PublicKey) + AfterOperatorKeyReplacement( + sdk.Context, sdk.AccAddress, tmprotocrypto.PublicKey, tmprotocrypto.PublicKey, string, + ) + AfterOperatorOptOutInitiated(sdk.Context, sdk.AccAddress, string, tmprotocrypto.PublicKey) +} diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index f7efde563..b0b823c05 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -18,6 +18,21 @@ const ( // HistoricalInfoBytePrefix is the prefix for the historical info store. HistoricalInfoBytePrefix + + // QueuedOperationsByte is the byte used to store the queue of operations. + QueuedOperationsByte + + // OptOutsToFinishBytePrefix is the byte used to store the list of operator addresses whose + // opt outs are maturing at the provided epoch. + OptOutsToFinishBytePrefix + + // OperatorOptOutFinishEpochBytePrefix is the byte prefix to store the epoch at which an + // operator's opt out will mature. + OperatorOptOutFinishEpochBytePrefix + + // ConsensusAddrsToPruneBytePrefix is the byte prefix to store the list of consensus + // addresses that can be pruned from the operator module at the provided epoch. + ConsensusAddrsToPruneBytePrefix ) // ExocoreValidatorKey returns the key for the validator store. @@ -30,3 +45,28 @@ func HistoricalInfoKey(height int64) []byte { bz := sdk.Uint64ToBigEndian(uint64(height)) return append([]byte{HistoricalInfoBytePrefix}, bz...) } + +// QueuedOperationsKey returns the key for the queued operations store. +func QueuedOperationsKey() []byte { + return []byte{QueuedOperationsByte} +} + +// OptOutsToFinishKey returns the key for the operator opt out maturity store (epoch -> list of +// addresses). +func OptOutsToFinishKey(epoch int64) []byte { + return append([]byte{OptOutsToFinishBytePrefix}, sdk.Uint64ToBigEndian(uint64(epoch))...) +} + +// OperatorOptOutFinishEpochKey is the key for the operator opt out maturity store +// (sdk.AccAddress -> epoch) +func OperatorOptOutFinishEpochKey(address sdk.AccAddress) []byte { + return append([]byte{OperatorOptOutFinishEpochBytePrefix}, address.Bytes()...) +} + +// ConsensusAddrsToPruneKey is the key to lookup the list of operator consensus addresses that +// can be pruned from the operator module at the provided epoch. +func ConsensusAddrsToPruneKey(epoch int64) []byte { + return append( + []byte{ConsensusAddrsToPruneBytePrefix}, + sdk.Uint64ToBigEndian(uint64(epoch))...) +} diff --git a/x/dogfood/types/utils.go b/x/dogfood/types/utils.go new file mode 100644 index 000000000..079a21dec --- /dev/null +++ b/x/dogfood/types/utils.go @@ -0,0 +1,31 @@ +package types + +import ( + "bytes" + + sdk "github.com/cosmos/cosmos-sdk/types" + + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" +) + +// TMCryptoPublicKeyToConsAddr converts a TM public key to an SDK public key +// and returns the associated consensus address. +func TMCryptoPublicKeyToConsAddr(k tmprotocrypto.PublicKey) (sdk.ConsAddress, error) { + sdkK, err := cryptocodec.FromTmProtoPublicKey(k) + if err != nil { + return nil, err + } + return sdk.GetConsAddress(sdkK), nil +} + +// RemoveFromBytesList removes an address from a list of addresses +// or a byte slice from a list of byte slices. +func RemoveFromBytesList(list [][]byte, addr []byte) [][]byte { + for i, a := range list { + if bytes.Equal(a, addr) { + return append(list[:i], list[i+1:]...) + } + } + panic("address not found in list") +} From fdf9b9a367acd3388478faaf244bebe469af0095 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 8 Feb 2024 15:33:33 +0000 Subject: [PATCH 10/41] docs(dogfood): explain the operator queue logic The operator module should restrict an operator from doing things that are logically not possible. For example, an operator that is already opted in should not be able to opt in again. Similarly, an operator who has opted out of a chain should not be able to replace the key for that chain without opting back in. Based on these assumptions, the comment maps out the list of possible operations that can happen within an epoch and is used to ensure that all of the cases result in the unbonding period being enforced accurately. --- x/dogfood/keeper/impl_operator_hooks.go | 42 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/x/dogfood/keeper/impl_operator_hooks.go b/x/dogfood/keeper/impl_operator_hooks.go index e5a42d615..9e0c22af2 100644 --- a/x/dogfood/keeper/impl_operator_hooks.go +++ b/x/dogfood/keeper/impl_operator_hooks.go @@ -32,13 +32,51 @@ func (k *Keeper) OperatorHooks() OperatorHooksWrapper { // R I // For an operator that is already opted in, the list looks like follows: // R O -// O I +// O I (reversing the decision to opt out) // O I R // R O I // The impossible list looks like: // O R // O R I -// TODO: list out operation results for each of these, and make sure everything is covered below +// Replacing the key with the same key is not possible, so it is not covered. +// The assumption is that these are enforced (allowed/denied) by the operator module. + +// Cases for a fresh operator: +// I + O => KeyAdditionOrUpdate + KeyRemoval => Success + Removed => covered. +// I + R => KeyAdditionOrUpdate (old) + KeyAdditionOrUpdate (new) + KeyRemoval (old) => +// Success + Success + Removed + => not considered unbonding of the old key since it +// was not yet effective => covered. +// I + R + O => KeyAdditionOrUpdate (old) + KeyAdditionOrUpdate (new) + KeyRemoval (old) + +// KeyRemoval (new) => +// Success (old) + Success (new) + Removed (old) + Removed (new) => covered + +// Cases for an operator that has already opted in: +// R + O => KeyAdditionOrUpdate (new) + KeyRemoval (old) + KeyRemoval (new) => +// Success (new) + Success (old) + Removed (new) => +// unbonding data made (old) => covered. +// O + I +// O + I case 1 => KeyRemoval (old) + KeyAdditionOrUpdate (new) => Success (old) + Success (new) +// => unbonding data made (old) => covered. +// O + I case 2 => KeyRemoval (old) + KeyAdditionOrUpdate (old) => Success (old) + Removed (old) +// => unbonding data made (old) and then cleared => covered. +// O + I + R +// O + I + R case 1 => KeyRemoval (old) + KeyAdditionOrUpdate (old) + KeyRemoval (old) + +// KeyAdditionOrUpdate (new) => Success (old) + Removed (old) + Success (old) + +// Success (new) => unbonding data old made + cleared + made => covered. +// O + I + R case 2 => +// AfterOperatorOptOut(old) => Success => unbonding data made for old +// AfterOperatorOptIn(new) => Success => no data changed +// AfterOperatorKeyReplacement(new, new2) => +// new2 operation KeyAdditionOrUpdate => Success => no data changed +// new operation KeyRemoval => Removed => no data changed +// => covered +// R + O + I => KeyAdditionOrUpdate (new) + KeyRemoval (old) + KeyRemoval (new) + +// KeyAdditionOrUpdate (X) +// Success + Success (=> unbonding data for old) + Removed (=> no data) + +// case 1 => X == new => Success => no change => covered +// case 2 => X == old => Removed => unbonding data for old removed => covered. +// case 3 => X == abc => Success => no change and unbonding data for old is not removed => +// covered. // AfterOperatorOptIn is the implementation of the operator hooks. func (h OperatorHooksWrapper) AfterOperatorOptIn( From 50d098daa4d994055905149d63c4d85e7787a5c3 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:14:29 +0000 Subject: [PATCH 11/41] feat(dogfood): implement delegation hooks Whenever a delegation or undelegation event happens in the delegation module, the hooks are called. For both of these events, as long as the operator is not in the process of opting out from the chain, consensus key operations are queued to be applied at the end of the current epoch. For undelegation, specifically, the `recordKey` identifier of the undelegation is used to mark within the delegation module that the undelegation should be held until released at some point in the future (as opposed to releasing it after a fixed number of blocks, which is the default behaviour). This point in the future is calculated as the earlier of the unbonding period end, or the operator's opt out period end (if the operator is opting out). --- proto/exocore/dogfood/v1/dogfood.proto | 7 + x/dogfood/keeper/impl_delegation_hooks.go | 126 +++++++++++++ x/dogfood/keeper/keeper.go | 18 +- x/dogfood/keeper/unbonding.go | 55 ++++++ x/dogfood/types/dogfood.pb.go | 219 +++++++++++++++++++--- x/dogfood/types/expected_keepers.go | 23 +++ x/dogfood/types/keys.go | 12 ++ 7 files changed, 434 insertions(+), 26 deletions(-) create mode 100644 x/dogfood/keeper/impl_delegation_hooks.go diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index 1259ac803..a27fc45e6 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -79,4 +79,11 @@ message AccountAddresses { // addresses (which correspond to operator public keys) to delete at the end of an epoch. message ConsensusAddresses { repeated bytes list = 1; +} + +// RecordKeys is a collection of record keys. This is used to store a list of +// undelegation records to mature in the delegation module at the end of the +// epoch. +message RecordKeys { + repeated bytes list = 1; } \ No newline at end of file diff --git a/x/dogfood/keeper/impl_delegation_hooks.go b/x/dogfood/keeper/impl_delegation_hooks.go new file mode 100644 index 000000000..21a8da737 --- /dev/null +++ b/x/dogfood/keeper/impl_delegation_hooks.go @@ -0,0 +1,126 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DelegationHooksWrapper is the wrapper structure that implements the delegation hooks for the +// dogfood keeper. +type DelegationHooksWrapper struct { + keeper *Keeper +} + +// Interface guard +var _ types.DelegationHooks = DelegationHooksWrapper{} + +// DelegationHooks returns the delegation hooks wrapper. It follows the "accept interfaces, +// return concretes" pattern. +func (k *Keeper) DelegationHooks() DelegationHooksWrapper { + return DelegationHooksWrapper{k} +} + +// AfterDelegation is called after a delegation is made. +func (wrapper DelegationHooksWrapper) AfterDelegation( + ctx sdk.Context, operator sdk.AccAddress, +) { + found, pubKey, err := wrapper.keeper.operatorKeeper.GetOperatorConsKeyForChainId( + ctx, operator, ctx.ChainID(), + ) + if err != nil { + // the operator keeper can offer two errors: not an operator and not a chain. + // both of these should not happen here because the dogfooding genesis will + // register the chain, and the operator must be known to the delegation module + // when it calls this hook. + panic(err) + } + if found { + if !wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( + ctx, operator, ctx.ChainID(), + ) { + // only queue the operation if operator is still opted into the chain. + res := wrapper.keeper.QueueOperation( + ctx, operator, pubKey, types.KeyAdditionOrUpdate, + ) + switch res { + case types.QueueResultExists: + // nothing to do because the operation is in the queue already. + case types.QueueResultRemoved: + // a KeyRemoval was in the queue which has now been cleared from the queue. + // the KeyRemoval can only be in the queue if the operator is opting out from + // the chain, or has replaced their key. if it is the former, it means that + // there is some inconsistency. if it is the latter, it means that the operator + // module just reported the old key in `GetOperatorConsKeyForChainId`, which + // should not happen. + panic("unexpected removal of operation from queue") + case types.QueueResultSuccess: + // best case, nothing to do. + case types.QueueResultUnspecified: + panic("unspecified queue result") + } + } + } +} + +// AfterUndelegationStarted is called after an undelegation is started. +func (wrapper DelegationHooksWrapper) AfterUndelegationStarted( + ctx sdk.Context, operator sdk.AccAddress, recordKey []byte, +) { + found, pubKey, err := wrapper.keeper.operatorKeeper.GetOperatorConsKeyForChainId( + ctx, operator, ctx.ChainID(), + ) + if err != nil { + panic(err) + } + if found { + // note that this is still key addition or update because undelegation does not remove + // the operator from the list. it only decreases their vote power. + if !wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( + ctx, operator, ctx.ChainID(), + ) { + // only queue the operation if operator is still opted into the chain. + res := wrapper.keeper.QueueOperation( + ctx, operator, pubKey, types.KeyAdditionOrUpdate, + ) + switch res { + case types.QueueResultExists: + // nothing to do + case types.QueueResultRemoved: + // KeyRemoval + KeyAdditionOrUpdate => Removed + // KeyRemoval can happen + // 1. if the operator is opting out from the chain,which is inconsistent. + // 2. if the operator is replacing their old key, which should not be returned + // by `GetOperatorConsKeyForChainId`. + panic("unexpected removal of operation from queue") + case types.QueueResultSuccess: + // best case, nothing to do. + case types.QueueResultUnspecified: + panic("unspecified queue result") + } + } + // now handle the unbonding timeline. + wrapper.keeper.delegationKeeper.IncrementUndelegationHoldCount(ctx, recordKey) + // mark for unbonding release. + // note that we aren't supporting redelegation yet, so this undelegated amount will be + // held until the end of the unbonding period or the operator opt out period, whichever + // is first. + var unbondingCompletionEpoch int64 + if wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( + ctx, operator, ctx.ChainID(), + ) { + unbondingCompletionEpoch = wrapper.keeper.GetOperatorOptOutFinishEpoch( + ctx, operator, + ) + } else { + unbondingCompletionEpoch = wrapper.keeper.GetUnbondingCompletionEpoch(ctx) + } + wrapper.keeper.AppendUndelegationToMature(ctx, unbondingCompletionEpoch, recordKey) + } +} + +// AfterUndelegationCompleted is called after an undelegation is completed. +func (DelegationHooksWrapper) AfterUndelegationCompleted( + sdk.Context, sdk.AccAddress, +) { + // no-op +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index 47e766553..8061edd8b 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -18,9 +18,13 @@ type ( storeKey storetypes.StoreKey paramstore paramtypes.Subspace + // internal hooks to allow other modules to subscriber to our events dogfoodHooks types.DogfoodHooks - epochsKeeper types.EpochsKeeper + // external keepers as interfaces + epochsKeeper types.EpochsKeeper + operatorKeeper types.OperatorKeeper + delegationKeeper types.DelegationKeeper } ) @@ -30,6 +34,8 @@ func NewKeeper( storeKey storetypes.StoreKey, ps paramtypes.Subspace, epochsKeeper types.EpochsKeeper, + operatorKeeper types.OperatorKeeper, + delegationKeeper types.DelegationKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -37,10 +43,12 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: ps, - epochsKeeper: epochsKeeper, + cdc: cdc, + storeKey: storeKey, + paramstore: ps, + epochsKeeper: epochsKeeper, + operatorKeeper: operatorKeeper, + delegationKeeper: delegationKeeper, } } diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index 4987e523a..a973754c5 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -56,3 +56,58 @@ func (k Keeper) GetUnbondingCompletionEpoch( // beginning of epoch 13 or the end of epoch 12. return epochInfo.CurrentEpoch + int64(unbondingEpochs) } + +// AppendUndelegationsToMature stores that the undelegation with recordKey should be +// released at the end of the provided epoch. +func (k Keeper) AppendUndelegationToMature( + ctx sdk.Context, epoch int64, recordKey []byte, +) { + prev := k.GetUndelegationsToMature(ctx, epoch) + next := types.RecordKeys{ + List: append(prev, recordKey), + } + k.setUndelegationsToMature(ctx, epoch, next) +} + +// GetUndelegationsToMature returns all undelegation entries that should be released +// at the end of the provided epoch. +func (k Keeper) GetUndelegationsToMature( + ctx sdk.Context, epoch int64, +) [][]byte { + store := ctx.KVStore(k.storeKey) + key := types.UnbondingReleaseMaturityKey(epoch) + bz := store.Get(key) + if bz == nil { + return [][]byte{} + } + var res types.RecordKeys + if err := res.Unmarshal(bz); err != nil { + // should never happen + panic(err) + } + return res.GetList() +} + +// ClearUndelegationsToMature is a pruning method which is called after we mature +// the undelegation entries. +func (k Keeper) ClearUndelegationsToMature( + ctx sdk.Context, epoch int64, +) { + store := ctx.KVStore(k.storeKey) + key := types.UnbondingReleaseMaturityKey(epoch) + store.Delete(key) +} + +// setUndelegationsToMature sets all undelegation entries that should be released +// at the end of the provided epoch. +func (k Keeper) setUndelegationsToMature( + ctx sdk.Context, epoch int64, recordKeys types.RecordKeys, +) { + store := ctx.KVStore(k.storeKey) + key := types.UnbondingReleaseMaturityKey(epoch) + val, err := recordKeys.Marshal() + if err != nil { + panic(err) + } + store.Set(key, val) +} diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 3a64b1dea..fa4d626f1 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -367,6 +367,53 @@ func (m *ConsensusAddresses) GetList() [][]byte { return nil } +// RecordKeys is a collection of record keys. This is used to store a list of +// undelegation records to mature in the delegation module at the end of the +// epoch. +type RecordKeys struct { + List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (m *RecordKeys) Reset() { *m = RecordKeys{} } +func (m *RecordKeys) String() string { return proto.CompactTextString(m) } +func (*RecordKeys) ProtoMessage() {} +func (*RecordKeys) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{5} +} +func (m *RecordKeys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RecordKeys.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 *RecordKeys) XXX_Merge(src proto.Message) { + xxx_messageInfo_RecordKeys.Merge(m, src) +} +func (m *RecordKeys) XXX_Size() int { + return m.Size() +} +func (m *RecordKeys) XXX_DiscardUnknown() { + xxx_messageInfo_RecordKeys.DiscardUnknown(m) +} + +var xxx_messageInfo_RecordKeys proto.InternalMessageInfo + +func (m *RecordKeys) GetList() [][]byte { + if m != nil { + return m.List + } + return nil +} + func init() { proto.RegisterEnum("exocore.dogfood.v1.OperationType", OperationType_name, OperationType_value) proto.RegisterEnum("exocore.dogfood.v1.QueueResultType", QueueResultType_name, QueueResultType_value) @@ -375,12 +422,13 @@ func init() { proto.RegisterType((*Operations)(nil), "exocore.dogfood.v1.Operations") proto.RegisterType((*AccountAddresses)(nil), "exocore.dogfood.v1.AccountAddresses") proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") + proto.RegisterType((*RecordKeys)(nil), "exocore.dogfood.v1.RecordKeys") } func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 705 bytes of a gzipped FileDescriptorProto + // 715 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xcf, 0x4e, 0xdb, 0x4a, 0x14, 0xc6, 0xe3, 0x84, 0x0b, 0xba, 0xc3, 0x3f, 0xdf, 0xb9, 0x29, 0x04, 0x0b, 0x82, 0xc9, 0xa2, 0x4a, 0x91, 0x6a, 0x0b, 0x68, 0x55, 0xa9, 0x55, 0x2b, 0x99, 0xc4, 0x55, 0xa3, 0x50, 0x12, 0xec, @@ -406,26 +454,26 @@ var fileDescriptor_071b9989c501c3f2 = []byte{ 0xda, 0x66, 0x1d, 0xc2, 0xed, 0x89, 0xd3, 0xf3, 0xd5, 0x4c, 0xc4, 0x5f, 0x87, 0xb0, 0x24, 0x23, 0x74, 0xc5, 0x41, 0xf1, 0x13, 0x34, 0xd1, 0xb5, 0xa9, 0x5f, 0x60, 0xf8, 0x5c, 0x79, 0x7a, 0x73, 0xe5, 0x4e, 0xea, 0x64, 0xa3, 0xc8, 0x50, 0xba, 0x8f, 0x58, 0xc9, 0x34, 0x49, 0xe0, 0xf8, 0x09, - 0x15, 0x50, 0x8c, 0x47, 0x36, 0x9b, 0x49, 0xfa, 0xca, 0x08, 0x57, 0xd2, 0x19, 0xdf, 0xd9, 0xb9, - 0xfe, 0x95, 0x41, 0xb3, 0x7f, 0x4d, 0x08, 0x3f, 0x42, 0x5c, 0xa3, 0x29, 0x2b, 0x52, 0xab, 0xd6, - 0xd8, 0xd5, 0x5b, 0x6f, 0x9b, 0xb2, 0xae, 0xed, 0xaa, 0x4d, 0xb9, 0x52, 0x7b, 0x59, 0x93, 0xab, - 0x6c, 0x86, 0xcb, 0xf7, 0x07, 0x3c, 0x5b, 0x87, 0xb0, 0xe1, 0x6a, 0x0e, 0x75, 0xc1, 0xb4, 0x0f, - 0x6c, 0xb0, 0xf0, 0x0b, 0xb4, 0x76, 0xc3, 0x25, 0x55, 0xab, 0xb5, 0x48, 0x35, 0x14, 0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0xc8, 0x91, 0xd1, 0xe5, 0x26, 0x3e, 0x7c, 0x2a, + 0x66, 0xd6, 0x7f, 0x33, 0x68, 0x7e, 0x2f, 0x80, 0x00, 0x14, 0xa0, 0x41, 0xd7, 0x8f, 0xd8, 0x9f, + 0xa3, 0x95, 0x3d, 0x4d, 0xd6, 0x86, 0x66, 0x55, 0xdb, 0x69, 0xdd, 0x86, 0xcf, 0xf5, 0x07, 0xfc, + 0xc2, 0x88, 0x6f, 0x34, 0xc4, 0x63, 0xb4, 0x34, 0x6e, 0x57, 0xb5, 0x4a, 0x45, 0x56, 0x55, 0x96, + 0xe1, 0x16, 0xfa, 0x03, 0x1e, 0x8f, 0x58, 0xd5, 0xc0, 0x34, 0x87, 0xff, 0xce, 0x16, 0x2a, 0x8c, + 0xdb, 0xe4, 0x37, 0x35, 0xb5, 0xa5, 0xb2, 0x59, 0xee, 0x5e, 0x7f, 0xc0, 0xff, 0x37, 0xe2, 0x92, + 0x4f, 0x6c, 0xea, 0xd3, 0xdb, 0xcf, 0x8a, 0x32, 0xcb, 0x55, 0x36, 0x37, 0x76, 0x56, 0x94, 0x1d, + 0xac, 0x38, 0xfb, 0x76, 0xfd, 0xf4, 0xa2, 0xc8, 0x9c, 0x5d, 0x14, 0x99, 0x9f, 0x17, 0x45, 0xe6, + 0xe3, 0x65, 0x31, 0x73, 0x76, 0x59, 0xcc, 0xfc, 0xb8, 0x2c, 0x66, 0xde, 0x6d, 0x74, 0x6c, 0xff, + 0x7d, 0xd0, 0x16, 0x4c, 0xd2, 0x13, 0x93, 0xab, 0xbf, 0x0b, 0xfe, 0x31, 0xf1, 0x0e, 0xc5, 0xf4, + 0xb1, 0x3a, 0xb9, 0x7a, 0xae, 0x86, 0x97, 0x8b, 0xb6, 0x27, 0xa3, 0x8b, 0xbc, 0xf5, 0x27, 0x00, + 0x00, 0xff, 0xff, 0xbd, 0x64, 0x30, 0xab, 0xce, 0x04, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -621,6 +669,38 @@ func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RecordKeys) 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 *RecordKeys) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.List[iNdEx]) + copy(dAtA[i:], m.List[iNdEx]) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.List[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintDogfood(dAtA []byte, offset int, v uint64) int { offset -= sovDogfood(v) base := offset @@ -715,6 +795,21 @@ func (m *ConsensusAddresses) Size() (n int) { return n } +func (m *RecordKeys) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, b := range m.List { + l = len(b) + n += 1 + l + sovDogfood(uint64(l)) + } + } + return n +} + func sovDogfood(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1244,6 +1339,88 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { } return nil } +func (m *RecordKeys) 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 ErrIntOverflowDogfood + } + 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: RecordKeys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDogfood(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 1880294b6..585c28b38 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -30,3 +30,26 @@ type OperatorHooks interface { ) AfterOperatorOptOutInitiated(sdk.Context, sdk.AccAddress, string, tmprotocrypto.PublicKey) } + +// DelegationHooks represent the event hooks for delegation module. +type DelegationHooks interface { + AfterDelegation(sdk.Context, sdk.AccAddress) + AfterUndelegationStarted(sdk.Context, sdk.AccAddress, []byte) + AfterUndelegationCompleted(sdk.Context, sdk.AccAddress) +} + +// OperatorKeeper represents the expected keeper interface for the operator module. +type OperatorKeeper interface { + GetOperatorConsKeyForChainId( + sdk.Context, sdk.AccAddress, string, + ) (bool, tmprotocrypto.PublicKey, error) + IsOperatorOptingOutFromChainId( + sdk.Context, sdk.AccAddress, string, + ) bool +} + +// DelegationKeeper represents the expected keeper interface for the delegation module. +type DelegationKeeper interface { + IncrementUndelegationHoldCount(sdk.Context, []byte) + DecrementUndelegationHoldCount(sdk.Context, []byte) +} diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index b0b823c05..e7e0e4aab 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -33,6 +33,10 @@ const ( // ConsensusAddrsToPruneBytePrefix is the byte prefix to store the list of consensus // addresses that can be pruned from the operator module at the provided epoch. ConsensusAddrsToPruneBytePrefix + + // UnbondingReleaseMaturityBytePrefix is the byte prefix to store the list of undelegations + // that will mature at the provided epoch. + UnbondingReleaseMaturityBytePrefix ) // ExocoreValidatorKey returns the key for the validator store. @@ -70,3 +74,11 @@ func ConsensusAddrsToPruneKey(epoch int64) []byte { []byte{ConsensusAddrsToPruneBytePrefix}, sdk.Uint64ToBigEndian(uint64(epoch))...) } + +// UnbondingReleaseMaturityKey is the key to lookup the list of undelegations that will mature +// at the provided epoch. +func UnbondingReleaseMaturityKey(epoch int64) []byte { + return append( + []byte{UnbondingReleaseMaturityBytePrefix}, + sdk.Uint64ToBigEndian(uint64(epoch))...) +} From ebc853022aec2b2c83ce09b94f89a9a50d78784c Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:18:50 +0000 Subject: [PATCH 12/41] fix(dogfood): upd delegation hook interface --- x/dogfood/keeper/impl_delegation_hooks.go | 2 +- x/dogfood/types/expected_keepers.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dogfood/keeper/impl_delegation_hooks.go b/x/dogfood/keeper/impl_delegation_hooks.go index 21a8da737..e32442853 100644 --- a/x/dogfood/keeper/impl_delegation_hooks.go +++ b/x/dogfood/keeper/impl_delegation_hooks.go @@ -120,7 +120,7 @@ func (wrapper DelegationHooksWrapper) AfterUndelegationStarted( // AfterUndelegationCompleted is called after an undelegation is completed. func (DelegationHooksWrapper) AfterUndelegationCompleted( - sdk.Context, sdk.AccAddress, + sdk.Context, sdk.AccAddress, []byte, ) { // no-op } diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 585c28b38..f6d85f8c6 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -35,7 +35,7 @@ type OperatorHooks interface { type DelegationHooks interface { AfterDelegation(sdk.Context, sdk.AccAddress) AfterUndelegationStarted(sdk.Context, sdk.AccAddress, []byte) - AfterUndelegationCompleted(sdk.Context, sdk.AccAddress) + AfterUndelegationCompleted(sdk.Context, sdk.AccAddress, []byte) } // OperatorKeeper represents the expected keeper interface for the operator module. From 5d0a0cd4ebd94b92e3b9bb1f5f65ac8852116aac Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:50:24 +0000 Subject: [PATCH 13/41] feat(dogfood): implement epochs hooks + end block The epochs hooks are used by the dogfood module to subscribe to the start and end times of epochs. After an epoch ends, the operations that are currently in the queue are upgraded to "pending", which are applied at the end of the block. The upgrades are also made to undelegation maturity, operator opt out, and operator key replacement data. Once the pending actions are applied, they are cleared from the queue. This branch is merged into dogfood-part5, which forms the basis of #121. --- x/dogfood/keeper/abci.go | 182 ++++++++++++++++++++++++++ x/dogfood/keeper/impl_epochs_hooks.go | 61 +++++++++ x/dogfood/keeper/keeper.go | 3 + x/dogfood/types/expected_keepers.go | 13 ++ x/dogfood/types/keys.go | 37 ++++++ 5 files changed, 296 insertions(+) create mode 100644 x/dogfood/keeper/abci.go create mode 100644 x/dogfood/keeper/impl_epochs_hooks.go diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go new file mode 100644 index 000000000..043045680 --- /dev/null +++ b/x/dogfood/keeper/abci.go @@ -0,0 +1,182 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { + // start with undelegations + undelegations := k.GetPendingUndelegations(ctx) + for _, undelegation := range undelegations.GetList() { + k.delegationKeeper.DecrementUndelegationHoldCount(ctx, undelegation) + } + k.ClearPendingUndelegations(ctx) + // then opt outs (consensus addresses should be done after opt out) + optOuts := k.GetPendingOptOuts(ctx) + for _, addr := range optOuts.GetList() { + k.operatorKeeper.CompleteOperatorOptOutFromChainId(ctx, addr, ctx.ChainID()) + } + k.ClearPendingOptOuts(ctx) + // then consensus addresses + consensusAddrs := k.GetPendingConsensusAddrs(ctx) + for _, consensusAddr := range consensusAddrs.GetList() { + k.operatorKeeper.DeleteOperatorAddressForChainIdAndConsAddr( + ctx, ctx.ChainID(), consensusAddr, + ) + } + k.ClearPendingConsensusAddrs(ctx) + // finally, operations + operations := k.GetPendingOperations(ctx) + res := make([]abci.ValidatorUpdate, 0, len(operations.GetList())) + for _, operation := range operations.GetList() { + switch operation.OperationType { + case types.KeyAdditionOrUpdate: + power, err := k.restakingKeeper.GetOperatorAssetValue( + ctx, operation.OperatorAddress, + ) + if err != nil { + panic(err) + } + res = append(res, abci.ValidatorUpdate{ + PubKey: operation.PubKey, + Power: power, + }) + case types.KeyRemoval: + res = append(res, abci.ValidatorUpdate{ + PubKey: operation.PubKey, + Power: 0, + }) + case types.KeyOpUnspecified: + panic("unspecified operation type") + } + } + return res +} + +// SetPendingOperations sets the pending operations to be applied at the end of the block. +func (k Keeper) SetPendingOperations(ctx sdk.Context, operations types.Operations) { + store := ctx.KVStore(k.storeKey) + bz, err := operations.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingOperationsKey(), bz) +} + +// GetPendingOperations returns the pending operations to be applied at the end of the block. +func (k Keeper) GetPendingOperations(ctx sdk.Context) types.Operations { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingOperationsKey()) + if bz == nil { + return types.Operations{} + } + var operations types.Operations + if err := operations.Unmarshal(bz); err != nil { + panic(err) + } + return operations +} + +// ClearPendingOperations clears the pending operations to be applied at the end of the block. +func (k Keeper) ClearPendingOperations(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingOperationsKey()) +} + +// SetPendingOptOuts sets the pending opt-outs to be applied at the end of the block. +func (k Keeper) SetPendingOptOuts(ctx sdk.Context, addrs types.AccountAddresses) { + store := ctx.KVStore(k.storeKey) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingOptOutsKey(), bz) +} + +// GetPendingOptOuts returns the pending opt-outs to be applied at the end of the block. +func (k Keeper) GetPendingOptOuts(ctx sdk.Context) types.AccountAddresses { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingOptOutsKey()) + if bz == nil { + return types.AccountAddresses{} + } + var addrs types.AccountAddresses + if err := addrs.Unmarshal(bz); err != nil { + panic(err) + } + return addrs +} + +// ClearPendingOptOuts clears the pending opt-outs to be applied at the end of the block. +func (k Keeper) ClearPendingOptOuts(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingOptOutsKey()) +} + +// SetPendingConsensusAddrs sets the pending consensus addresses to be pruned at the end of the +// block. +func (k Keeper) SetPendingConsensusAddrs(ctx sdk.Context, addrs types.ConsensusAddresses) { + store := ctx.KVStore(k.storeKey) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingConsensusAddrsKey(), bz) +} + +// GetPendingConsensusAddrs returns the pending consensus addresses to be pruned at the end of +// the block. +func (k Keeper) GetPendingConsensusAddrs(ctx sdk.Context) types.ConsensusAddresses { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingConsensusAddrsKey()) + if bz == nil { + return types.ConsensusAddresses{} + } + var addrs types.ConsensusAddresses + if err := addrs.Unmarshal(bz); err != nil { + panic(err) + } + return addrs +} + +// ClearPendingConsensusAddrs clears the pending consensus addresses to be pruned at the end of +// the block. +func (k Keeper) ClearPendingConsensusAddrs(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingConsensusAddrsKey()) +} + +// SetPendingUndelegations sets the pending undelegations to be released at the end of the +// block. +func (k Keeper) SetPendingUndelegations(ctx sdk.Context, undelegations types.RecordKeys) { + store := ctx.KVStore(k.storeKey) + bz, err := undelegations.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingUndelegationsKey(), bz) +} + +// GetPendingUndelegations returns the pending undelegations to be released at the end of the +// block. +func (k Keeper) GetPendingUndelegations(ctx sdk.Context) types.RecordKeys { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingUndelegationsKey()) + if bz == nil { + return types.RecordKeys{} + } + var undelegations types.RecordKeys + if err := undelegations.Unmarshal(bz); err != nil { + panic(err) + } + return undelegations +} + +// ClearPendingUndelegations clears the pending undelegations to be released at the end of the +// block. +func (k Keeper) ClearPendingUndelegations(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingUndelegationsKey()) +} diff --git a/x/dogfood/keeper/impl_epochs_hooks.go b/x/dogfood/keeper/impl_epochs_hooks.go new file mode 100644 index 000000000..c68604316 --- /dev/null +++ b/x/dogfood/keeper/impl_epochs_hooks.go @@ -0,0 +1,61 @@ +package keeper + +import ( + "strings" + + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + _ = sdk.NewCoin("stake", sdk.NewInt(1)) +) + +// EpochsHooksWrapper is the wrapper structure that implements the epochs hooks for the dogfood +// keeper. +type EpochsHooksWrapper struct { + keeper *Keeper +} + +// Interface guard +var _ types.EpochsHooks = EpochsHooksWrapper{} + +// EpochsHooks returns the epochs hooks wrapper. It follows the "accept interfaces, return +// concretes" pattern. +func (k *Keeper) EpochsHooks() EpochsHooksWrapper { + return EpochsHooksWrapper{k} +} + +// AfterEpochEnd is called after an epoch ends. +func (wrapper EpochsHooksWrapper) AfterEpochEnd( + ctx sdk.Context, identifier string, epoch int64, +) { + if strings.Compare(identifier, wrapper.keeper.GetEpochIdentifier(ctx)) == 0 { + // we will upgrade all of the queued information to "pending", which will be applied at + // the end of the block. + // note that this hook is called during BeginBlock, and the "pending" operations will be + // applied within this block. however, for clarity, it is highlighted that unbonding + // takes N epochs + 1 block to complete. + operations := wrapper.keeper.GetQueuedOperations(ctx) + wrapper.keeper.SetPendingOperations(ctx, types.Operations{List: operations}) + wrapper.keeper.ClearQueuedOperations(ctx) + optOuts := wrapper.keeper.GetOptOutsToFinish(ctx, epoch) + wrapper.keeper.SetPendingOptOuts(ctx, types.AccountAddresses{List: optOuts}) + wrapper.keeper.ClearOptOutsToFinish(ctx, epoch) + consAddresses := wrapper.keeper.GetConsensusAddrsToPrune(ctx, epoch) + wrapper.keeper.SetPendingConsensusAddrs( + ctx, types.ConsensusAddresses{List: consAddresses}, + ) + wrapper.keeper.ClearConsensusAddrsToPrune(ctx, epoch) + undelegations := wrapper.keeper.GetUndelegationsToMature(ctx, epoch) + wrapper.keeper.SetPendingUndelegations(ctx, types.RecordKeys{List: undelegations}) + wrapper.keeper.ClearUndelegationsToMature(ctx, epoch) + } +} + +// BeforeEpochStart is called before an epoch starts. +func (wrapper EpochsHooksWrapper) BeforeEpochStart( + ctx sdk.Context, identifier string, epoch int64, +) { + // nothing to do +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index 8061edd8b..103d60c97 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -25,6 +25,7 @@ type ( epochsKeeper types.EpochsKeeper operatorKeeper types.OperatorKeeper delegationKeeper types.DelegationKeeper + restakingKeeper types.RestakingKeeper } ) @@ -36,6 +37,7 @@ func NewKeeper( epochsKeeper types.EpochsKeeper, operatorKeeper types.OperatorKeeper, delegationKeeper types.DelegationKeeper, + restakingKeeper types.RestakingKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -49,6 +51,7 @@ func NewKeeper( epochsKeeper: epochsKeeper, operatorKeeper: operatorKeeper, delegationKeeper: delegationKeeper, + restakingKeeper: restakingKeeper, } } diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index f6d85f8c6..9dfd255ea 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -46,6 +46,8 @@ type OperatorKeeper interface { IsOperatorOptingOutFromChainId( sdk.Context, sdk.AccAddress, string, ) bool + CompleteOperatorOptOutFromChainId(sdk.Context, sdk.AccAddress, string) + DeleteOperatorAddressForChainIdAndConsAddr(sdk.Context, string, sdk.ConsAddress) } // DelegationKeeper represents the expected keeper interface for the delegation module. @@ -53,3 +55,14 @@ type DelegationKeeper interface { IncrementUndelegationHoldCount(sdk.Context, []byte) DecrementUndelegationHoldCount(sdk.Context, []byte) } + +// EpochsHooks represents the event hooks for the epochs module. +type EpochsHooks interface { + AfterEpochEnd(sdk.Context, string, int64) + BeforeEpochStart(sdk.Context, string, int64) +} + +// RestakingKeeper represents the expected keeper interface for the restaking module. +type RestakingKeeper interface { + GetOperatorAssetValue(sdk.Context, sdk.AccAddress) (int64, error) +} diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index e7e0e4aab..40aa58676 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -37,6 +37,22 @@ const ( // UnbondingReleaseMaturityBytePrefix is the byte prefix to store the list of undelegations // that will mature at the provided epoch. UnbondingReleaseMaturityBytePrefix + + // PendingOperationsByte is the byte used to store the list of operations to be applied at + // the end of the current block. + PendingOperationsByte + + // PendingOptOutsByte is the byte used to store the list of operator addresses whose opt + // outs will be made effective at the end of the current block. + PendingOptOutsByte + + // PendingConsensusAddrsByte is the byte used to store the list of consensus addresses to be + // pruned at the end of the block. + PendingConsensusAddrsByte + + // PendingUndelegationsByte is the byte used to store the list of undelegations that will + // mature at the end of the current block. + PendingUndelegationsByte ) // ExocoreValidatorKey returns the key for the validator store. @@ -82,3 +98,24 @@ func UnbondingReleaseMaturityKey(epoch int64) []byte { []byte{UnbondingReleaseMaturityBytePrefix}, sdk.Uint64ToBigEndian(uint64(epoch))...) } + +// PendingOperationsKey returns the key for the pending operations store. +func PendingOperationsKey() []byte { + return []byte{PendingOperationsByte} +} + +// PendingOptOutsKey returns the key for the pending opt-outs store. +func PendingOptOutsKey() []byte { + return []byte{PendingOptOutsByte} +} + +// PendingConsensusAddrsByte is the byte used to store the list of consensus addresses to be +// pruned at the end of the block. +func PendingConsensusAddrsKey() []byte { + return []byte{PendingConsensusAddrsByte} +} + +// PendingUndelegationsKey returns the key for the pending undelegations store. +func PendingUndelegationsKey() []byte { + return []byte{PendingUndelegationsByte} +} From a2aa2e106c43e60d908526a928b8fa035ba7391f Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:54:31 +0000 Subject: [PATCH 14/41] fix(dogfood): call `EndBlock` from module --- x/dogfood/module.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 2ac7087e3..bfd476b9a 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -159,6 +159,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return am.keeper.EndBlock(ctx) } From cc56595c94ff9b3043b84d9ee5732d48d52529d7 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:24:17 +0000 Subject: [PATCH 15/41] feat(dogfood): retrieve val set from id The validator set is not bound to change at each block. It can only change at the end of an epoch, or following a slashing event. Therefore, storing the historical information for each block is redundant. Instead, we create a validator set id corresponding to each validator set, and map each height to a validator set id. The mapping and the validator set id are pruned once the historical info for a height is not required. TODO: actually store the validator set against each id, within the `EndBlock` function at the end of the epoch. --- proto/exocore/dogfood/v1/dogfood.proto | 20 + x/dogfood/genesis.go | 26 -- x/dogfood/keeper/genesis.go | 34 ++ x/dogfood/keeper/validators.go | 210 ++++++---- x/dogfood/module.go | 6 +- x/dogfood/types/dogfood.pb.go | 519 ++++++++++++++++++++++++- x/dogfood/types/keys.go | 28 +- 7 files changed, 719 insertions(+), 124 deletions(-) delete mode 100644 x/dogfood/genesis.go create mode 100644 x/dogfood/keeper/genesis.go diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index e51f4a408..429f893b2 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -4,7 +4,10 @@ package exocore.dogfood.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + import "cosmos_proto/cosmos.proto"; +import "cosmos/staking/v1beta1/staking.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; @@ -21,4 +24,21 @@ message ExocoreValidator { (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" ]; +} + +// Validators is a list of validators stored according to the staking module. +message Validators { + repeated cosmos.staking.v1beta1.Validator list = 1 [(gogoproto.nullable) = false]; +} + +// HeaderSubset is a subset of the block header that is relevant to the IBC codebase. It is +// stored for each height and then converted to the `tm.Header` object after queried. It is +// pruned when the information is no longer needed according to the `HistoricalEntries` param. +message HeaderSubset { + // timestamp of the block + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // validators for the next block + bytes next_validators_hash = 2; + // state after txs from the previous block + bytes app_hash = 3; } \ No newline at end of file diff --git a/x/dogfood/genesis.go b/x/dogfood/genesis.go deleted file mode 100644 index de40ed814..000000000 --- a/x/dogfood/genesis.go +++ /dev/null @@ -1,26 +0,0 @@ -package dogfood - -import ( - "github.com/ExocoreNetwork/exocore/x/dogfood/keeper" - "github.com/ExocoreNetwork/exocore/x/dogfood/types" - abci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis( - ctx sdk.Context, - k keeper.Keeper, - genState types.GenesisState, -) []abci.ValidatorUpdate { - k.SetParams(ctx, genState.Params) - return k.ApplyValidatorChanges(ctx, genState.ValSet) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetDogfoodParams(ctx) - - return genesis -} diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go new file mode 100644 index 000000000..16f51892b --- /dev/null +++ b/x/dogfood/keeper/genesis.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func (k Keeper) InitGenesis( + ctx sdk.Context, + genState types.GenesisState, +) []abci.ValidatorUpdate { + k.SetParams(ctx, genState.Params) + // the `params` validator is not super useful to validate state level information + // so, it must be done here. by extension, the `InitGenesis` of the epochs module + // should be called before that of this module. + _, found := k.epochsKeeper.GetEpochInfo(ctx, genState.Params.EpochIdentifier) + if !found { + // the panic is suitable here because it is being done at genesis, when the node + // is not running. it means that the genesis file is malformed. + panic("epoch info not found") + + } + return k.ApplyValidatorChanges(ctx, genState.ValSet) +} + +// ExportGenesis returns the module's exported genesis +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetDogfoodParams(ctx) + + return genesis +} diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index d1b5e3e37..15c5d229b 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -8,6 +8,7 @@ import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" abci "github.com/cometbft/cometbft/abci/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -21,10 +22,8 @@ import ( func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration { count := k.GetEpochsUntilUnbonded(ctx) identifier := k.GetEpochIdentifier(ctx) - epoch, found := k.epochsKeeper.GetEpochInfo(ctx, identifier) - if !found { - panic("epoch info not found") - } + // no need to check for found, as the epoch info is validated at genesis. + epoch, _ := k.epochsKeeper.GetEpochInfo(ctx, identifier) durationPerEpoch := epoch.Duration return time.Duration(count) * durationPerEpoch } @@ -138,103 +137,111 @@ func (k Keeper) GetAllExocoreValidators( func (k Keeper) GetHistoricalInfo( ctx sdk.Context, height int64, ) (stakingtypes.HistoricalInfo, bool) { - store := ctx.KVStore(k.storeKey) - key := types.HistoricalInfoKey(height) - - value := store.Get(key) - if value == nil { + headerSubset, found := k.GetBlockHeader(ctx, height) + if !found { + // only panic in the case of an unmarshal error return stakingtypes.HistoricalInfo{}, false } - - return stakingtypes.MustUnmarshalHistoricalInfo(k.cdc, value), true + valSetID, found := k.GetValidatorSetID(ctx, height) + if !found { + // only panic in the case of an unmarshal error + return stakingtypes.HistoricalInfo{}, false + } + valSet, found := k.GetValidatorSet(ctx, valSetID) + if !found { + // only panic in the case of an unmarshal error + return stakingtypes.HistoricalInfo{}, false + } + header := tmproto.Header{ + Time: headerSubset.Time, + NextValidatorsHash: headerSubset.NextValidatorsHash, + AppHash: headerSubset.AppHash, + } + return stakingtypes.NewHistoricalInfo( + header, stakingtypes.Validators(valSet.GetList()), sdk.DefaultPowerReduction, + ), true } -// SetHistoricalInfo sets the historical info at a given height. This is +// SetValidatorSet sets the validator set at a given id. This is // (intentionally) not exported in the genesis state. -func (k Keeper) SetHistoricalInfo( - ctx sdk.Context, height int64, hi *stakingtypes.HistoricalInfo, +func (k Keeper) SetValidatorSet( + ctx sdk.Context, id uint64, vs *types.Validators, ) { store := ctx.KVStore(k.storeKey) - key := types.HistoricalInfoKey(height) - value := k.cdc.MustMarshal(hi) - + key := types.ValidatorSetKey(id) + value := k.cdc.MustMarshal(vs) store.Set(key, value) } -// DeleteHistoricalInfo deletes the historical info at a given height. -func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64) { +// GetValidatorSet gets the validator set at a given id. +func (k Keeper) GetValidatorSet( + ctx sdk.Context, id uint64, +) (*types.Validators, bool) { store := ctx.KVStore(k.storeKey) - key := types.HistoricalInfoKey(height) + key := types.ValidatorSetKey(id) + if !store.Has(key) { + return nil, false + } + value := store.Get(key) + var hi types.Validators + k.cdc.MustUnmarshal(value, &hi) + return &hi, true +} +// DeleteValidatorSet deletes the validator set at a given id. +func (k Keeper) DeleteValidatorSet(ctx sdk.Context, id uint64) { + store := ctx.KVStore(k.storeKey) + key := types.ValidatorSetKey(id) store.Delete(key) } -// TrackHistoricalInfo saves the latest historical-info and deletes the oldest -// heights that are below pruning height. +// TrackHistoricalInfo saves the latest historical info and deletes the ones eligible to be +// pruned. The historical info is stored in two parts: one is the header and the other is the +// validator set. Within an epoch, the validator set will only change if there is a slashing +// event. Otherwise, it is constant. The header, however, will change at every block. Since +// the Cosmos SDK does not allow for the retrieval of a past block header, we store the header +// ourselves in this function. The validator set is stored when it changes at the end of an +// epoch or at a slashing event in the corresponding functions. func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { + // Get the number of historical entries to persist, as the number of block heights. numHistoricalEntries := k.GetHistoricalEntries(ctx) - // Prune store to ensure we only have parameter-defined historical entries. - // In most cases, this will involve removing a single historical entry. - // In the rare scenario when the historical entries gets reduced to a lower value k' - // from the original value k. k - k' entries must be deleted from the store. - // Since the entries to be deleted are always in a continuous range, we can iterate - // over the historical entries starting from the most recent version to be pruned - // and then return at the first empty entry. + // we are deleting headers, say, from, 0 to 999 at block 1999 + // for these headers, we must find the corresponding validator set ids to delete. + // they must be only deleted if no other block is using them. + lastDeletedID := uint64(0) // contract: starts from 1. for i := ctx.BlockHeight() - int64(numHistoricalEntries); i >= 0; i-- { - _, found := k.GetHistoricalInfo(ctx, i) + _, found := k.GetBlockHeader(ctx, i) if found { - k.DeleteHistoricalInfo(ctx, i) + // because they are deleted together, and saved one after the other, + // since the block header exists, so must the validator set id. + lastDeletedID, _ = k.GetValidatorSetID(ctx, i+1) + // clear both the header and the mapping + k.DeleteBlockHeader(ctx, i) + k.DeleteValidatorSetID(ctx, i) } else { break } } + // contract: TrackHistoricalInfo must be called after storing the validator set + // for the current block. + currentID, _ := k.GetValidatorSetID(ctx, ctx.BlockHeight()) + for i := lastDeletedID; i < currentID; i++ { + k.DeleteValidatorSet(ctx, i) + } // if there is no need to persist historicalInfo, return. if numHistoricalEntries == 0 { return } - // Create HistoricalInfo struct - lastVals := []stakingtypes.Validator{} - for _, v := range k.GetAllExocoreValidators(ctx) { - pk, err := v.ConsPubKey() - if err != nil { - // This should never happen as the pubkey is assumed - // to be stored correctly earlier. - panic(err) - } - val, err := stakingtypes.NewValidator(nil, pk, stakingtypes.Description{}) - if err != nil { - // This should never happen as the pubkey is assumed - // to be stored correctly earlier. - panic(err) - } + // store the header + k.StoreBlockHeader(ctx) - // Set validator to bonded status. - val.Status = stakingtypes.Bonded - // Compute tokens from voting power. - val.Tokens = sdk.TokensFromConsensusPower( - v.Power, - // TODO(mm) - // note that this is not super relevant for the historical info - // since IBC does not seem to use the tokens field. - sdk.NewInt(1), - ) - lastVals = append(lastVals, val) - } - - // Create historical info entry which sorts the validator set by voting power. - historicalEntry := stakingtypes.NewHistoricalInfo( - ctx.BlockHeader(), lastVals, - // TODO(mm) - // this should match the power reduction number above - // and is also thus not relevant. - sdk.NewInt(1), - ) - - // Set latest HistoricalInfo at current height. - k.SetHistoricalInfo(ctx, ctx.BlockHeight(), &historicalEntry) + // we have stored: + // before TrackHistoricalInfo: ValidatorSetID for height, and the validator set. + // within TrackHistoricalInfo: the header. + // this is enough information to answer the GetHistoricalInfo query. } // MustGetCurrentValidatorsAsABCIUpdates gets all validators converted @@ -259,3 +266,66 @@ func (k Keeper) MustGetCurrentValidatorsAsABCIUpdates(ctx sdk.Context) []abci.Va } return valUpdates } + +// GetValidatorSetID returns the identifier of the validator set at a given height. +// It is used to "share" the validator set entries across multiple heights within an epoch. +// Typically, the validator set should change only at the end of an epoch. However, in the +// case of a slashing occurrence, the validator set may change within an epoch. +func (k Keeper) GetValidatorSetID(ctx sdk.Context, height int64) (uint64, bool) { + store := ctx.KVStore(k.storeKey) + key := types.ValidatorSetIDKey(height) + value := store.Get(key) + if value == nil { + return 0, false + } + return sdk.BigEndianToUint64(value), true +} + +// SetValidatorSetID sets the identifier of the validator set at a given height. +func (k Keeper) SetValidatorSetID(ctx sdk.Context, height int64, id uint64) { + store := ctx.KVStore(k.storeKey) + key := types.ValidatorSetIDKey(height) + value := sdk.Uint64ToBigEndian(id) + store.Set(key, value) +} + +// DeleteValidatorSetID deletes the identifier of the validator set at a given height. +func (k Keeper) DeleteValidatorSetID(ctx sdk.Context, height int64) { + store := ctx.KVStore(k.storeKey) + key := types.ValidatorSetIDKey(height) + store.Delete(key) +} + +// GetBlockHeader returns the block header at a given height. +func (k Keeper) GetBlockHeader(ctx sdk.Context, height int64) (types.HeaderSubset, bool) { + store := ctx.KVStore(k.storeKey) + key := types.HeaderKey(height) + var header types.HeaderSubset + value := store.Get(key) + if value == nil { + return header, false + } + k.cdc.MustUnmarshal(value, &header) + return header, true +} + +// SetBlockHeader sets the block header at a given height. +func (k Keeper) DeleteBlockHeader(ctx sdk.Context, height int64) { + store := ctx.KVStore(k.storeKey) + key := types.HeaderKey(height) + store.Delete(key) +} + +// StoreBlockHeader stores the block header subset as of the current height. +func (k Keeper) StoreBlockHeader(ctx sdk.Context) { + key := types.HeaderKey(ctx.BlockHeight()) + sdkHeader := ctx.BlockHeader() + header := types.HeaderSubset{ + Time: sdkHeader.Time, + NextValidatorsHash: sdkHeader.NextValidatorsHash, + AppHash: sdkHeader.GetAppHash(), + } + store := ctx.KVStore(k.storeKey) + value := k.cdc.MustMarshal(&header) + store.Set(key, value) +} diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 2ac7087e3..4be32e0a3 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -141,12 +141,12 @@ func (am AppModule) InitGenesis( // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - return InitGenesis(ctx, am.keeper, genState) + return am.keeper.InitGenesis(ctx, genState) } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) + genState := am.keeper.ExportGenesis(ctx) return cdc.MustMarshalJSON(genState) } @@ -159,6 +159,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 64cadbb85..1e5f859ed 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -7,17 +7,22 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -91,33 +96,156 @@ func (m *ExocoreValidator) GetPubkey() *types.Any { return nil } +// Validators is a list of validators stored according to the staking module. +type Validators struct { + List []types1.Validator `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` +} + +func (m *Validators) Reset() { *m = Validators{} } +func (m *Validators) String() string { return proto.CompactTextString(m) } +func (*Validators) ProtoMessage() {} +func (*Validators) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{1} +} +func (m *Validators) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Validators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Validators.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 *Validators) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validators.Merge(m, src) +} +func (m *Validators) XXX_Size() int { + return m.Size() +} +func (m *Validators) XXX_DiscardUnknown() { + xxx_messageInfo_Validators.DiscardUnknown(m) +} + +var xxx_messageInfo_Validators proto.InternalMessageInfo + +func (m *Validators) GetList() []types1.Validator { + if m != nil { + return m.List + } + return nil +} + +// HeaderSubset is a subset of the block header that is relevant to the IBC codebase. It is +// stored for each height and then converted to the `tm.Header` object after queried. It is +// pruned when the information is no longer needed according to the `HistoricalEntries` param. +type HeaderSubset struct { + // timestamp of the block + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` + // validators for the next block + NextValidatorsHash []byte `protobuf:"bytes,2,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` + // state after txs from the previous block + AppHash []byte `protobuf:"bytes,3,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` +} + +func (m *HeaderSubset) Reset() { *m = HeaderSubset{} } +func (m *HeaderSubset) String() string { return proto.CompactTextString(m) } +func (*HeaderSubset) ProtoMessage() {} +func (*HeaderSubset) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{2} +} +func (m *HeaderSubset) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderSubset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderSubset.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 *HeaderSubset) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderSubset.Merge(m, src) +} +func (m *HeaderSubset) XXX_Size() int { + return m.Size() +} +func (m *HeaderSubset) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderSubset.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderSubset proto.InternalMessageInfo + +func (m *HeaderSubset) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func (m *HeaderSubset) GetNextValidatorsHash() []byte { + if m != nil { + return m.NextValidatorsHash + } + return nil +} + +func (m *HeaderSubset) GetAppHash() []byte { + if m != nil { + return m.AppHash + } + return nil +} + func init() { proto.RegisterType((*ExocoreValidator)(nil), "exocore.dogfood.v1.ExocoreValidator") + proto.RegisterType((*Validators)(nil), "exocore.dogfood.v1.Validators") + proto.RegisterType((*HeaderSubset)(nil), "exocore.dogfood.v1.HeaderSubset") } func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0x31, 0x4e, 0xf3, 0x30, - 0x14, 0xc7, 0xeb, 0xaf, 0xfa, 0x8a, 0x14, 0x18, 0x50, 0x14, 0x89, 0xd0, 0xc1, 0x44, 0x9d, 0xba, - 0x60, 0xab, 0x74, 0x63, 0xa3, 0x12, 0x53, 0x25, 0x84, 0x3a, 0x30, 0xb0, 0x54, 0x4e, 0xe2, 0x9a, - 0xaa, 0x49, 0x5e, 0x64, 0x3b, 0x6d, 0x7d, 0x0b, 0x2e, 0xc1, 0x0d, 0x38, 0x04, 0x62, 0xea, 0xc8, - 0x84, 0x50, 0x72, 0x03, 0x4e, 0x80, 0x88, 0x63, 0xb6, 0xf7, 0xf3, 0xff, 0x3d, 0xfb, 0xe7, 0xe7, - 0x45, 0x7c, 0x0f, 0x09, 0x48, 0x4e, 0x53, 0x10, 0x2b, 0x80, 0x94, 0x6e, 0x27, 0xae, 0x24, 0xa5, - 0x04, 0x0d, 0xbe, 0xdf, 0x75, 0x10, 0x77, 0xbc, 0x9d, 0x0c, 0x03, 0x01, 0x02, 0xda, 0x98, 0xfe, - 0x56, 0xb6, 0x73, 0x78, 0x2e, 0x00, 0x44, 0xc6, 0x69, 0x4b, 0x71, 0xb5, 0xa2, 0xac, 0x30, 0x2e, - 0x4a, 0x40, 0xe5, 0xa0, 0x96, 0x76, 0xc6, 0x82, 0x8d, 0x46, 0x2f, 0xc8, 0x3b, 0xbd, 0xb5, 0x4f, - 0x3c, 0xb0, 0x6c, 0x9d, 0x32, 0x0d, 0xd2, 0x0f, 0xbd, 0x23, 0x96, 0xa6, 0x92, 0x2b, 0x15, 0xa2, - 0x08, 0x8d, 0x4f, 0x16, 0x0e, 0xfd, 0xc0, 0xfb, 0x5f, 0xc2, 0x8e, 0xcb, 0xf0, 0x5f, 0x84, 0xc6, - 0xfd, 0x85, 0x05, 0x9f, 0x79, 0x83, 0xb2, 0x8a, 0x37, 0xdc, 0x84, 0xfd, 0x08, 0x8d, 0x8f, 0xaf, - 0x02, 0x62, 0x5d, 0x88, 0x73, 0x21, 0x37, 0x85, 0x99, 0x4d, 0xbf, 0x3f, 0x2f, 0xce, 0x0c, 0xcb, - 0xb3, 0xeb, 0x51, 0x02, 0x85, 0xe2, 0x85, 0xaa, 0xd4, 0xd2, 0xce, 0x8d, 0xde, 0x5f, 0x2f, 0x83, - 0xce, 0x2b, 0x91, 0xa6, 0xd4, 0x40, 0xee, 0xab, 0x78, 0xce, 0xcd, 0xa2, 0xbb, 0x78, 0x36, 0x7f, - 0xab, 0x31, 0x3a, 0xd4, 0x18, 0x7d, 0xd5, 0x18, 0x3d, 0x37, 0xb8, 0x77, 0x68, 0x70, 0xef, 0xa3, - 0xc1, 0xbd, 0xc7, 0x89, 0x58, 0xeb, 0xa7, 0x2a, 0x26, 0x09, 0xe4, 0xb4, 0xfb, 0xc9, 0x1d, 0xd7, - 0x3b, 0x90, 0x1b, 0xea, 0xb6, 0xbb, 0xff, 0xdb, 0xaf, 0x36, 0x25, 0x57, 0xf1, 0xa0, 0xf5, 0x9a, - 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x39, 0xda, 0x59, 0x49, 0x7f, 0x01, 0x00, 0x00, + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0x31, 0x8e, 0xd3, 0x40, + 0x14, 0x86, 0x33, 0x24, 0x2c, 0xab, 0x49, 0x0a, 0x34, 0xb2, 0x84, 0x37, 0x85, 0x63, 0x2c, 0x8a, + 0x34, 0xd8, 0x38, 0xdb, 0x20, 0xa8, 0x88, 0x84, 0xb4, 0x68, 0x25, 0x84, 0x0c, 0xa2, 0xa0, 0x89, + 0xc6, 0xf6, 0xac, 0x63, 0x25, 0xf6, 0x1b, 0x79, 0xc6, 0xd9, 0xf8, 0x16, 0xdb, 0x70, 0x04, 0x6e, + 0xc0, 0x21, 0x56, 0x54, 0x5b, 0x52, 0x05, 0x94, 0xdc, 0x80, 0x13, 0x20, 0x7b, 0x66, 0x82, 0xc4, + 0x76, 0xf3, 0xfb, 0x7f, 0xff, 0xd3, 0xf7, 0x9e, 0x1f, 0x76, 0xd9, 0x16, 0x12, 0xa8, 0x58, 0x90, + 0x42, 0x76, 0x05, 0x90, 0x06, 0x9b, 0xd0, 0x3c, 0x7d, 0x5e, 0x81, 0x04, 0x42, 0x74, 0x85, 0x6f, + 0x3e, 0x6f, 0xc2, 0xb1, 0x95, 0x41, 0x06, 0x9d, 0x1d, 0xb4, 0x2f, 0x55, 0x39, 0x3e, 0xcb, 0x00, + 0xb2, 0x35, 0x0b, 0x3a, 0x15, 0xd7, 0x57, 0x01, 0x2d, 0x1b, 0x6d, 0x4d, 0xfe, 0xb7, 0x64, 0x5e, + 0x30, 0x21, 0x69, 0xc1, 0x4d, 0x36, 0x01, 0x51, 0x80, 0x58, 0xa8, 0xa6, 0x4a, 0x68, 0xeb, 0x99, + 0x52, 0x81, 0x90, 0x74, 0x95, 0x97, 0x59, 0xb0, 0x09, 0x63, 0x26, 0x69, 0x68, 0xb4, 0xaa, 0xf2, + 0xbe, 0x21, 0xfc, 0xf8, 0xad, 0x22, 0xfd, 0x4c, 0xd7, 0x79, 0x4a, 0x25, 0x54, 0xc4, 0xc6, 0x8f, + 0x68, 0x9a, 0x56, 0x4c, 0x08, 0x1b, 0xb9, 0x68, 0x3a, 0x8a, 0x8c, 0x24, 0x16, 0x7e, 0xc8, 0xe1, + 0x9a, 0x55, 0xf6, 0x03, 0x17, 0x4d, 0xfb, 0x91, 0x12, 0x84, 0xe2, 0x13, 0x5e, 0xc7, 0x2b, 0xd6, + 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0x3f, 0x0f, 0x4e, 0xef, 0x4b, 0x98, 0xe5, 0x72, 0x59, 0xc7, 0x7e, + 0x02, 0x45, 0xa0, 0x7f, 0xd6, 0x7b, 0x26, 0xaf, 0xa1, 0x5a, 0x05, 0xe6, 0x0e, 0xb7, 0xc7, 0x4b, + 0x94, 0x0d, 0x67, 0x22, 0x3e, 0xe9, 0xe8, 0xcf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x07, 0xfc, + 0xed, 0x55, 0xa9, 0x02, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -167,6 +295,88 @@ func (m *ExocoreValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Validators) 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 *Validators) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validators) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDogfood(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *HeaderSubset) 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 *HeaderSubset) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderSubset) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.NextValidatorsHash) > 0 { + i -= len(m.NextValidatorsHash) + copy(dAtA[i:], m.NextValidatorsHash) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.NextValidatorsHash))) + i-- + dAtA[i] = 0x12 + } + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintDogfood(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintDogfood(dAtA []byte, offset int, v uint64) int { offset -= sovDogfood(v) base := offset @@ -198,6 +408,40 @@ func (m *ExocoreValidator) Size() (n int) { return n } +func (m *Validators) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovDogfood(uint64(l)) + } + } + return n +} + +func (m *HeaderSubset) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) + n += 1 + l + sovDogfood(uint64(l)) + l = len(m.NextValidatorsHash) + if l > 0 { + n += 1 + l + sovDogfood(uint64(l)) + } + l = len(m.AppHash) + if l > 0 { + n += 1 + l + sovDogfood(uint64(l)) + } + return n +} + func sovDogfood(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -343,6 +587,241 @@ func (m *ExocoreValidator) Unmarshal(dAtA []byte) error { } return nil } +func (m *Validators) 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 ErrIntOverflowDogfood + } + 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: Validators: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validators: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, types1.Validator{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeaderSubset) 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 ErrIntOverflowDogfood + } + 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: HeaderSubset: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderSubset: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...) + if m.NextValidatorsHash == nil { + m.NextValidatorsHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDogfood + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDogfood(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index f7efde563..e3875dc57 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -16,8 +16,14 @@ const ( // ExocoreValidatorBytePrefix is the prefix for the validator store. ExocoreValidatorBytePrefix byte = iota + 1 - // HistoricalInfoBytePrefix is the prefix for the historical info store. - HistoricalInfoBytePrefix + // ValidatorSetBytePrefix is the prefix for the historical validator set store. + ValidatorSetBytePrefix + + // ValidatorSetIDBytePrefix is the prefix for the validator set id store. + ValidatorSetIDBytePrefix + + // HeaderBytePrefix is the prefix for the header store. + HeaderBytePrefix ) // ExocoreValidatorKey returns the key for the validator store. @@ -25,8 +31,20 @@ func ExocoreValidatorKey(address sdk.AccAddress) []byte { return append([]byte{ExocoreValidatorBytePrefix}, address.Bytes()...) } -// HistoricalInfoKey returns the key for the historical info store. -func HistoricalInfoKey(height int64) []byte { +// ValidatorSetKey returns the key for the historical validator set store. +func ValidatorSetKey(id uint64) []byte { + bz := sdk.Uint64ToBigEndian(id) + return append([]byte{ValidatorSetBytePrefix}, bz...) +} + +// ValidatorSetIDKey returns the key for the validator set id store. +func ValidatorSetIDKey(height int64) []byte { + bz := sdk.Uint64ToBigEndian(uint64(height)) + return append([]byte{ValidatorSetIDBytePrefix}, bz...) +} + +// HeaderKey returns the key for the header store. +func HeaderKey(height int64) []byte { bz := sdk.Uint64ToBigEndian(uint64(height)) - return append([]byte{HistoricalInfoBytePrefix}, bz...) + return append([]byte{HeaderBytePrefix}, bz...) } From 3447309b9f3c1342bf4e2d1e3fa26dcace13ddbe Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:35:44 +0000 Subject: [PATCH 16/41] fix(dogfood): remove old key then add new --- x/dogfood/keeper/impl_operator_hooks.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/x/dogfood/keeper/impl_operator_hooks.go b/x/dogfood/keeper/impl_operator_hooks.go index 9e0c22af2..3599d6565 100644 --- a/x/dogfood/keeper/impl_operator_hooks.go +++ b/x/dogfood/keeper/impl_operator_hooks.go @@ -104,15 +104,7 @@ func (h OperatorHooksWrapper) AfterOperatorKeyReplacement( chainID string, ) { if strings.Compare(chainID, ctx.ChainID()) == 0 { - // res == Removed, it means operator has added their original key again - // res == Success, there is no additional information to store - // res == Exists, there is no nothing to do - if res := h.keeper.QueueOperation( - ctx, addr, newKey, types.KeyAdditionOrUpdate, - ); res == types.QueueResultRemoved { - // see AfterOperatorOptIn for explanation - h.keeper.ClearUnbondingInformation(ctx, addr, newKey) - } + // remove the old key // res == Removed, it means operator had added this key and is now removing it. // no additional information to clear. // res == Success, the old key should be pruned from the operator module. @@ -123,6 +115,16 @@ func (h OperatorHooksWrapper) AfterOperatorKeyReplacement( // the old key can be marked for pruning h.keeper.SetUnbondingInformation(ctx, addr, oldKey, false) } + // add the new key + // res == Removed, it means operator has added their original key again + // res == Success, there is no additional information to store + // res == Exists, there is no nothing to do + if res := h.keeper.QueueOperation( + ctx, addr, newKey, types.KeyAdditionOrUpdate, + ); res == types.QueueResultRemoved { + // see AfterOperatorOptIn for explanation + h.keeper.ClearUnbondingInformation(ctx, addr, newKey) + } } } From fe987cef101286d3c8e205b821700c188aee3394 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:41:30 +0000 Subject: [PATCH 17/41] fix(dogfood): RecordKeys > UndelegationRecordKeys The delegation module calls the records as undelegation records, and within itself stores the identifier for the record as the record key. The dogfood module should follow the same naming convention and call them undelegation record keys for clarity. --- proto/exocore/dogfood/v1/dogfood.proto | 7 +- x/dogfood/keeper/unbonding.go | 8 +- x/dogfood/types/dogfood.pb.go | 157 ++++++++++++------------- 3 files changed, 85 insertions(+), 87 deletions(-) diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index 587e5522f..21c5b350b 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -84,10 +84,9 @@ message ConsensusAddresses { repeated bytes list = 1; } -// RecordKeys is a collection of record keys. This is used to store a list of -// undelegation records to mature in the delegation module at the end of the -// epoch. -message RecordKeys { +// UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a +// list of undelegation records to mature in the delegation module at the end of the epoch. +message UndelegationRecordKeys { repeated bytes list = 1; } diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index a973754c5..9e588e63a 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -63,7 +63,7 @@ func (k Keeper) AppendUndelegationToMature( ctx sdk.Context, epoch int64, recordKey []byte, ) { prev := k.GetUndelegationsToMature(ctx, epoch) - next := types.RecordKeys{ + next := types.UndelegationRecordKeys{ List: append(prev, recordKey), } k.setUndelegationsToMature(ctx, epoch, next) @@ -80,7 +80,7 @@ func (k Keeper) GetUndelegationsToMature( if bz == nil { return [][]byte{} } - var res types.RecordKeys + var res types.UndelegationRecordKeys if err := res.Unmarshal(bz); err != nil { // should never happen panic(err) @@ -101,11 +101,11 @@ func (k Keeper) ClearUndelegationsToMature( // setUndelegationsToMature sets all undelegation entries that should be released // at the end of the provided epoch. func (k Keeper) setUndelegationsToMature( - ctx sdk.Context, epoch int64, recordKeys types.RecordKeys, + ctx sdk.Context, epoch int64, undelegationRecords types.UndelegationRecordKeys, ) { store := ctx.KVStore(k.storeKey) key := types.UnbondingReleaseMaturityKey(epoch) - val, err := recordKeys.Marshal() + val, err := undelegationRecords.Marshal() if err != nil { panic(err) } diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 0b5879f77..fc3868a19 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -372,25 +372,24 @@ func (m *ConsensusAddresses) GetList() [][]byte { return nil } -// RecordKeys is a collection of record keys. This is used to store a list of -// undelegation records to mature in the delegation module at the end of the -// epoch. -type RecordKeys struct { +// UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a +// list of undelegation records to mature in the delegation module at the end of the epoch. +type UndelegationRecordKeys struct { List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } -func (m *RecordKeys) Reset() { *m = RecordKeys{} } -func (m *RecordKeys) String() string { return proto.CompactTextString(m) } -func (*RecordKeys) ProtoMessage() {} -func (*RecordKeys) Descriptor() ([]byte, []int) { +func (m *UndelegationRecordKeys) Reset() { *m = UndelegationRecordKeys{} } +func (m *UndelegationRecordKeys) String() string { return proto.CompactTextString(m) } +func (*UndelegationRecordKeys) ProtoMessage() {} +func (*UndelegationRecordKeys) Descriptor() ([]byte, []int) { return fileDescriptor_071b9989c501c3f2, []int{5} } -func (m *RecordKeys) XXX_Unmarshal(b []byte) error { +func (m *UndelegationRecordKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *UndelegationRecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RecordKeys.Marshal(b, m, deterministic) + return xxx_messageInfo_UndelegationRecordKeys.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -400,19 +399,19 @@ func (m *RecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *RecordKeys) XXX_Merge(src proto.Message) { - xxx_messageInfo_RecordKeys.Merge(m, src) +func (m *UndelegationRecordKeys) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationRecordKeys.Merge(m, src) } -func (m *RecordKeys) XXX_Size() int { +func (m *UndelegationRecordKeys) XXX_Size() int { return m.Size() } -func (m *RecordKeys) XXX_DiscardUnknown() { - xxx_messageInfo_RecordKeys.DiscardUnknown(m) +func (m *UndelegationRecordKeys) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationRecordKeys.DiscardUnknown(m) } -var xxx_messageInfo_RecordKeys proto.InternalMessageInfo +var xxx_messageInfo_UndelegationRecordKeys proto.InternalMessageInfo -func (m *RecordKeys) GetList() [][]byte { +func (m *UndelegationRecordKeys) GetList() [][]byte { if m != nil { return m.List } @@ -538,7 +537,7 @@ func init() { proto.RegisterType((*Operations)(nil), "exocore.dogfood.v1.Operations") proto.RegisterType((*AccountAddresses)(nil), "exocore.dogfood.v1.AccountAddresses") proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") - proto.RegisterType((*RecordKeys)(nil), "exocore.dogfood.v1.RecordKeys") + proto.RegisterType((*UndelegationRecordKeys)(nil), "exocore.dogfood.v1.UndelegationRecordKeys") proto.RegisterType((*Validators)(nil), "exocore.dogfood.v1.Validators") proto.RegisterType((*HeaderSubset)(nil), "exocore.dogfood.v1.HeaderSubset") } @@ -546,61 +545,61 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 849 bytes of a gzipped FileDescriptorProto + // 857 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcf, 0x6f, 0xe3, 0x44, 0x14, 0x8e, 0x9b, 0xb2, 0xbb, 0x4c, 0xbb, 0x5d, 0x33, 0x84, 0x6e, 0x6a, 0xed, 0xa6, 0x6e, 0x84, - 0x50, 0xa8, 0x84, 0x4d, 0x5a, 0x10, 0x08, 0x04, 0x52, 0xda, 0x18, 0x35, 0xca, 0xd2, 0x64, 0xed, - 0x64, 0x05, 0x5c, 0xac, 0x89, 0xfd, 0x9a, 0x5a, 0x4d, 0x3c, 0x23, 0xcf, 0x38, 0x5b, 0xff, 0x07, - 0x28, 0xa7, 0xbd, 0x70, 0xcc, 0x09, 0xf1, 0x1f, 0x20, 0x71, 0xe2, 0xbe, 0xe2, 0xb4, 0x47, 0x4e, - 0x0b, 0x6a, 0xff, 0x03, 0x6e, 0xdc, 0x56, 0xfe, 0x95, 0x66, 0x9b, 0xaa, 0x37, 0xbf, 0x79, 0xef, - 0x7b, 0xf3, 0x7d, 0x7e, 0xdf, 0x3c, 0xa4, 0xc2, 0x39, 0x75, 0x68, 0x00, 0xba, 0x4b, 0x87, 0x27, - 0x94, 0xba, 0xfa, 0xa4, 0x9e, 0x7f, 0x6a, 0x2c, 0xa0, 0x82, 0x62, 0x9c, 0x55, 0x68, 0xf9, 0xf1, - 0xa4, 0xae, 0x94, 0x86, 0x74, 0x48, 0x93, 0xb4, 0x1e, 0x7f, 0xa5, 0x95, 0xca, 0xd6, 0x90, 0xd2, - 0xe1, 0x08, 0xf4, 0x24, 0x1a, 0x84, 0x27, 0x3a, 0xf1, 0xa3, 0x2c, 0xb5, 0x7d, 0x3d, 0x25, 0xbc, - 0x31, 0x70, 0x41, 0xc6, 0x2c, 0xc7, 0x3a, 0x94, 0x8f, 0x29, 0xb7, 0xd3, 0xa6, 0x69, 0x90, 0xa5, - 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 0x37, 0xe4, 0x5f, 0xa9, 0xb7, 0xa9, 0x7a, 0xf3, 0x9b, 0xf7, 0xbe, + 0x37, 0xdf, 0xe7, 0xf7, 0xcd, 0x43, 0x32, 0x9c, 0x13, 0x87, 0x04, 0xa0, 0xba, 0x64, 0x74, 0x42, + 0x88, 0xab, 0x4e, 0x9b, 0xf9, 0xa7, 0x42, 0x03, 0xc2, 0x09, 0xc6, 0x59, 0x85, 0x92, 0x1f, 0x4f, + 0x9b, 0x52, 0x65, 0x44, 0x46, 0x24, 0x49, 0xab, 0xf1, 0x57, 0x5a, 0x29, 0x6d, 0x8d, 0x08, 0x19, + 0x8d, 0x41, 0x4d, 0xa2, 0x61, 0x78, 0xa2, 0xda, 0x7e, 0x94, 0xa5, 0xb6, 0xaf, 0xa7, 0xb8, 0x37, + 0x01, 0xc6, 0xed, 0x09, 0xcd, 0xb1, 0x0e, 0x61, 0x13, 0xc2, 0xac, 0xb4, 0x69, 0x1a, 0x64, 0xa9, + 0x47, 0x1c, 0x7c, 0x17, 0x82, 0x89, 0xe7, 0x73, 0xd5, 0x09, 0x22, 0xca, 0x89, 0x7a, 0x06, 0x51, + 0x9e, 0x7d, 0x3f, 0xad, 0x55, 0x19, 0xb7, 0xcf, 0x3c, 0x7f, 0xa4, 0x4e, 0x9b, 0x43, 0xe0, 0x76, + 0x33, 0x8f, 0xd3, 0xaa, 0xfa, 0xaf, 0x02, 0x12, 0xb5, 0x54, 0xc7, 0x33, 0x7b, 0xec, 0xb9, 0x36, + 0x27, 0x01, 0xae, 0xa2, 0xbb, 0xb6, 0xeb, 0x06, 0xc0, 0x58, 0x55, 0x90, 0x85, 0xc6, 0xba, 0x9e, + 0x87, 0xb8, 0x82, 0xde, 0xa2, 0xe4, 0x39, 0x04, 0xd5, 0x15, 0x59, 0x68, 0x94, 0xf5, 0x34, 0xc0, + 0x36, 0xba, 0x43, 0xc3, 0xe1, 0x19, 0x44, 0xd5, 0xb2, 0x2c, 0x34, 0xd6, 0xf6, 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f8, 0x69, 0x38, + 0x54, 0x1c, 0x32, 0x51, 0xb3, 0x4d, 0x77, 0x0c, 0xfc, 0x39, 0x09, 0xce, 0xd4, 0x7c, 0xc5, 0x9f, + 0x2f, 0x96, 0x7c, 0xbc, 0x4b, 0xd8, 0xf0, 0x4e, 0xe2, 0xb9, 0xfd, 0xff, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x41, 0xe1, 0x03, 0x2c, 0x04, 0x06, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -796,7 +795,7 @@ func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RecordKeys) Marshal() (dAtA []byte, err error) { +func (m *UndelegationRecordKeys) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -806,12 +805,12 @@ func (m *RecordKeys) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RecordKeys) MarshalTo(dAtA []byte) (int, error) { +func (m *UndelegationRecordKeys) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *UndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1004,7 +1003,7 @@ func (m *ConsensusAddresses) Size() (n int) { return n } -func (m *RecordKeys) Size() (n int) { +func (m *UndelegationRecordKeys) Size() (n int) { if m == nil { return 0 } @@ -1582,7 +1581,7 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { } return nil } -func (m *RecordKeys) Unmarshal(dAtA []byte) error { +func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1605,10 +1604,10 @@ func (m *RecordKeys) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RecordKeys: wiretype end group for non-group") + return fmt.Errorf("proto: UndelegationRecordKeys: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: From 061ec1365075f6ec5064d242c60826f96a1a8c8b Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:55:05 +0000 Subject: [PATCH 18/41] doc(dogfood): update comments in EndBlock ...and refactor getters / setters to `pending.go`. --- x/dogfood/keeper/abci.go | 136 ++---------------------------------- x/dogfood/keeper/pending.go | 132 ++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 130 deletions(-) create mode 100644 x/dogfood/keeper/pending.go diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go index 4b6fcb36c..01750e969 100644 --- a/x/dogfood/keeper/abci.go +++ b/x/dogfood/keeper/abci.go @@ -7,19 +7,21 @@ import ( ) func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { - // start with undelegations + // start with clearing the hold on the undelegations. undelegations := k.GetPendingUndelegations(ctx) for _, undelegation := range undelegations.GetList() { k.delegationKeeper.DecrementUndelegationHoldCount(ctx, undelegation) } k.ClearPendingUndelegations(ctx) - // then opt outs (consensus addresses should be done after opt out) + // then, let the operator module know that the opt out has finished. optOuts := k.GetPendingOptOuts(ctx) for _, addr := range optOuts.GetList() { k.operatorKeeper.CompleteOperatorOptOutFromChainId(ctx, addr, ctx.ChainID()) } k.ClearPendingOptOuts(ctx) - // then consensus addresses + // for slashing, the operator module is required to store a mapping of chain id + cons addr + // to operator address. this information can now be pruned, since the opt out is considered + // complete. consensusAddrs := k.GetPendingConsensusAddrs(ctx) for _, consensusAddr := range consensusAddrs.GetList() { k.operatorKeeper.DeleteOperatorAddressForChainIdAndConsAddr( @@ -27,7 +29,7 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { ) } k.ClearPendingConsensusAddrs(ctx) - // finally, operations + // finally, perform the actual operations of vote power changes. operations := k.GetPendingOperations(ctx) res := make([]abci.ValidatorUpdate, 0, len(operations.GetList())) for _, operation := range operations.GetList() { @@ -54,129 +56,3 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { } return res } - -// SetPendingOperations sets the pending operations to be applied at the end of the block. -func (k Keeper) SetPendingOperations(ctx sdk.Context, operations types.Operations) { - store := ctx.KVStore(k.storeKey) - bz, err := operations.Marshal() - if err != nil { - panic(err) - } - store.Set(types.PendingOperationsKey(), bz) -} - -// GetPendingOperations returns the pending operations to be applied at the end of the block. -func (k Keeper) GetPendingOperations(ctx sdk.Context) types.Operations { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingOperationsKey()) - if bz == nil { - return types.Operations{} - } - var operations types.Operations - if err := operations.Unmarshal(bz); err != nil { - panic(err) - } - return operations -} - -// ClearPendingOperations clears the pending operations to be applied at the end of the block. -func (k Keeper) ClearPendingOperations(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingOperationsKey()) -} - -// SetPendingOptOuts sets the pending opt-outs to be applied at the end of the block. -func (k Keeper) SetPendingOptOuts(ctx sdk.Context, addrs types.AccountAddresses) { - store := ctx.KVStore(k.storeKey) - bz, err := addrs.Marshal() - if err != nil { - panic(err) - } - store.Set(types.PendingOptOutsKey(), bz) -} - -// GetPendingOptOuts returns the pending opt-outs to be applied at the end of the block. -func (k Keeper) GetPendingOptOuts(ctx sdk.Context) types.AccountAddresses { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingOptOutsKey()) - if bz == nil { - return types.AccountAddresses{} - } - var addrs types.AccountAddresses - if err := addrs.Unmarshal(bz); err != nil { - panic(err) - } - return addrs -} - -// ClearPendingOptOuts clears the pending opt-outs to be applied at the end of the block. -func (k Keeper) ClearPendingOptOuts(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingOptOutsKey()) -} - -// SetPendingConsensusAddrs sets the pending consensus addresses to be pruned at the end of the -// block. -func (k Keeper) SetPendingConsensusAddrs(ctx sdk.Context, addrs types.ConsensusAddresses) { - store := ctx.KVStore(k.storeKey) - bz, err := addrs.Marshal() - if err != nil { - panic(err) - } - store.Set(types.PendingConsensusAddrsKey(), bz) -} - -// GetPendingConsensusAddrs returns the pending consensus addresses to be pruned at the end of -// the block. -func (k Keeper) GetPendingConsensusAddrs(ctx sdk.Context) types.ConsensusAddresses { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingConsensusAddrsKey()) - if bz == nil { - return types.ConsensusAddresses{} - } - var addrs types.ConsensusAddresses - if err := addrs.Unmarshal(bz); err != nil { - panic(err) - } - return addrs -} - -// ClearPendingConsensusAddrs clears the pending consensus addresses to be pruned at the end of -// the block. -func (k Keeper) ClearPendingConsensusAddrs(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingConsensusAddrsKey()) -} - -// SetPendingUndelegations sets the pending undelegations to be released at the end of the -// block. -func (k Keeper) SetPendingUndelegations(ctx sdk.Context, undelegations types.UndelegationRecordKeys) { - store := ctx.KVStore(k.storeKey) - bz, err := undelegations.Marshal() - if err != nil { - panic(err) - } - store.Set(types.PendingUndelegationsKey(), bz) -} - -// GetPendingUndelegations returns the pending undelegations to be released at the end of the -// block. -func (k Keeper) GetPendingUndelegations(ctx sdk.Context) types.UndelegationRecordKeys { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingUndelegationsKey()) - if bz == nil { - return types.UndelegationRecordKeys{} - } - var undelegations types.UndelegationRecordKeys - if err := undelegations.Unmarshal(bz); err != nil { - panic(err) - } - return undelegations -} - -// ClearPendingUndelegations clears the pending undelegations to be released at the end of the -// block. -func (k Keeper) ClearPendingUndelegations(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingUndelegationsKey()) -} diff --git a/x/dogfood/keeper/pending.go b/x/dogfood/keeper/pending.go new file mode 100644 index 000000000..7d68779f8 --- /dev/null +++ b/x/dogfood/keeper/pending.go @@ -0,0 +1,132 @@ +package keeper + +import ( + "github.com/ExocoreNetwork/exocore/x/dogfood/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetPendingOperations sets the pending operations to be applied at the end of the block. +func (k Keeper) SetPendingOperations(ctx sdk.Context, operations types.Operations) { + store := ctx.KVStore(k.storeKey) + bz, err := operations.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingOperationsKey(), bz) +} + +// GetPendingOperations returns the pending operations to be applied at the end of the block. +func (k Keeper) GetPendingOperations(ctx sdk.Context) types.Operations { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingOperationsKey()) + if bz == nil { + return types.Operations{} + } + var operations types.Operations + if err := operations.Unmarshal(bz); err != nil { + panic(err) + } + return operations +} + +// ClearPendingOperations clears the pending operations to be applied at the end of the block. +func (k Keeper) ClearPendingOperations(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingOperationsKey()) +} + +// SetPendingOptOuts sets the pending opt-outs to be applied at the end of the block. +func (k Keeper) SetPendingOptOuts(ctx sdk.Context, addrs types.AccountAddresses) { + store := ctx.KVStore(k.storeKey) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingOptOutsKey(), bz) +} + +// GetPendingOptOuts returns the pending opt-outs to be applied at the end of the block. +func (k Keeper) GetPendingOptOuts(ctx sdk.Context) types.AccountAddresses { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingOptOutsKey()) + if bz == nil { + return types.AccountAddresses{} + } + var addrs types.AccountAddresses + if err := addrs.Unmarshal(bz); err != nil { + panic(err) + } + return addrs +} + +// ClearPendingOptOuts clears the pending opt-outs to be applied at the end of the block. +func (k Keeper) ClearPendingOptOuts(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingOptOutsKey()) +} + +// SetPendingConsensusAddrs sets the pending consensus addresses to be pruned at the end of the +// block. +func (k Keeper) SetPendingConsensusAddrs(ctx sdk.Context, addrs types.ConsensusAddresses) { + store := ctx.KVStore(k.storeKey) + bz, err := addrs.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingConsensusAddrsKey(), bz) +} + +// GetPendingConsensusAddrs returns the pending consensus addresses to be pruned at the end of +// the block. +func (k Keeper) GetPendingConsensusAddrs(ctx sdk.Context) types.ConsensusAddresses { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingConsensusAddrsKey()) + if bz == nil { + return types.ConsensusAddresses{} + } + var addrs types.ConsensusAddresses + if err := addrs.Unmarshal(bz); err != nil { + panic(err) + } + return addrs +} + +// ClearPendingConsensusAddrs clears the pending consensus addresses to be pruned at the end of +// the block. +func (k Keeper) ClearPendingConsensusAddrs(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingConsensusAddrsKey()) +} + +// SetPendingUndelegations sets the pending undelegations to be released at the end of the +// block. +func (k Keeper) SetPendingUndelegations(ctx sdk.Context, undelegations types.UndelegationRecordKeys) { + store := ctx.KVStore(k.storeKey) + bz, err := undelegations.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PendingUndelegationsKey(), bz) +} + +// GetPendingUndelegations returns the pending undelegations to be released at the end of the +// block. +func (k Keeper) GetPendingUndelegations(ctx sdk.Context) types.UndelegationRecordKeys { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingUndelegationsKey()) + if bz == nil { + return types.UndelegationRecordKeys{} + } + var undelegations types.UndelegationRecordKeys + if err := undelegations.Unmarshal(bz); err != nil { + panic(err) + } + return undelegations +} + +// ClearPendingUndelegations clears the pending undelegations to be released at the end of the +// block. +func (k Keeper) ClearPendingUndelegations(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingUndelegationsKey()) +} From ba3b5d89763e179c6976ad525a8c19bc812ac6d1 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:16:08 +0000 Subject: [PATCH 19/41] fix(dogfood): clear validator set only if unused --- x/dogfood/keeper/validators.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index 15c5d229b..d53a88d58 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -223,9 +223,9 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { break } } - // contract: TrackHistoricalInfo must be called after storing the validator set - // for the current block. - currentID, _ := k.GetValidatorSetID(ctx, ctx.BlockHeight()) + currentID, _ := k.GetValidatorSetID( + ctx, ctx.BlockHeight()-int64(numHistoricalEntries)+1, + ) for i := lastDeletedID; i < currentID; i++ { k.DeleteValidatorSet(ctx, i) } From 8e9dec2d034cbac50e4434b431dfcde3a5fe3c8d Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 28 Feb 2024 12:32:40 +0530 Subject: [PATCH 20/41] feat(dogfood): implement sdk staking interface (#123) * feat(dogfood): implement sdk staking interface The interface required by IBC was already implemented in `validators.go`. This PR takes that a step further and implements the interfaces required to use the dogfood module as a drop-in replacement for the SDK's staking module. The interfaces implemented are those expected by the slashing, evidence and `genutil` modules. An explanation has been provided above each function to explain why and where it is called, and if its implementation is really necessary. There are still some TODOs left in this PR that depend on the overall slashing / operator design. This branch is merged into dogfood-part6, which forms the basis of #122. * fix(dogfood): store val set id + val set at genesis, the val set id starts with 1. each time the validator set changes, the val set id of the current block is retrieved. for the next block, the val set is is stored as this id + 1. * fix(dogfood): increment val set id correctly in the case of genesis, we should not use height + 1 as the key in the mapping; rather, it should be height. in all other cases, the mapping key is height + 1. the value is the val set id in all cases. --- x/dogfood/keeper/abci.go | 11 +- x/dogfood/keeper/genesis.go | 3 +- x/dogfood/keeper/impl_sdk.go | 171 ++++++++++++++++++++++++++++ x/dogfood/keeper/keeper.go | 3 + x/dogfood/keeper/validators.go | 35 +++++- x/dogfood/types/expected_keepers.go | 15 +++ x/dogfood/types/keys.go | 3 + 7 files changed, 233 insertions(+), 8 deletions(-) create mode 100644 x/dogfood/keeper/impl_sdk.go diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go index 01750e969..30dd3950b 100644 --- a/x/dogfood/keeper/abci.go +++ b/x/dogfood/keeper/abci.go @@ -31,6 +31,13 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { k.ClearPendingConsensusAddrs(ctx) // finally, perform the actual operations of vote power changes. operations := k.GetPendingOperations(ctx) + id, _ := k.GetValidatorSetID(ctx, ctx.BlockHeight()) + if len(operations.GetList()) == 0 { + // there is no validator set change, so we just increment the block height + // and retain the same val set id mapping. + k.SetValidatorSetID(ctx, ctx.BlockHeight()+1, id) + return []abci.ValidatorUpdate{} + } res := make([]abci.ValidatorUpdate, 0, len(operations.GetList())) for _, operation := range operations.GetList() { switch operation.OperationType { @@ -54,5 +61,7 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { panic("unspecified operation type") } } - return res + // call via wrapper function so that validator info is stored. + // the id is incremented by 1 for the next block. + return k.ApplyValidatorChanges(ctx, res, id+1, false) } diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index 16f51892b..e0544924d 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -20,9 +20,8 @@ func (k Keeper) InitGenesis( // the panic is suitable here because it is being done at genesis, when the node // is not running. it means that the genesis file is malformed. panic("epoch info not found") - } - return k.ApplyValidatorChanges(ctx, genState.ValSet) + return k.ApplyValidatorChanges(ctx, genState.ValSet, types.InitialValidatorSetID, true) } // ExportGenesis returns the module's exported genesis diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go new file mode 100644 index 000000000..547f526e7 --- /dev/null +++ b/x/dogfood/keeper/impl_sdk.go @@ -0,0 +1,171 @@ +package keeper + +import ( + "cosmossdk.io/math" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" +) + +// interface guards +var _ slashingtypes.StakingKeeper = Keeper{} +var _ evidencetypes.StakingKeeper = Keeper{} +var _ genutiltypes.StakingKeeper = Keeper{} +var _ clienttypes.StakingKeeper = Keeper{} // implemented in `validators.go` + +// GetParams is an implementation of the staking interface expected by the SDK's evidence +// module. The module does not use it, but it is part of the interface. +func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params { + return stakingtypes.Params{} +} + +// IterateValidators is an implementation of the staking interface expected by the SDK's +// slashing module. The slashing module uses it for two purposes: once at genesis to +// store a mapping of pub key to cons address (which is done by our operator module), +// and then during the invariants check to ensure that the total delegated amount +// matches that of each validator. Ideally, this invariant should be implemented +// by the delegation and/or deposit module(s) instead. +func (k Keeper) IterateValidators(sdk.Context, + func(index int64, validator stakingtypes.ValidatorI) (stop bool)) { + // no op +} + +// Validator is an implementation of the staking interface expected by the SDK's +// slashing module. The slashing module uses it to obtain a validator's information at +// its addition to the list of validators, and then to unjail a validator. The former +// is used to create the pub key to cons address mapping, which we do in the operator module. +// The latter should also be implemented in the operator module, or maybe the slashing module +// depending upon the finalized design. We don't need to implement this function here because +// we are not calling the AfterValidatorCreated hook in our module, so this will never be +// reached. +func (k Keeper) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI { + panic("unimplemented on this keeper") +} + +// ValidatorByConsAddr is an implementation of the staking interface expected by the SDK's +// slashing and evidence modules. +// The slashing module calls this function when it observes downtime. The only requirement on +// the returned value is that it isn't nil, and the jailed status is accurately set (to prevent +// re-jailing of the same operator). +// The evidence module calls this function when it handles equivocation evidence. The returned +// value must not be nil and must not have an UNBONDED validator status (the default is +// unspecified), or evidence will reject it. +func (k Keeper) ValidatorByConsAddr( + ctx sdk.Context, + addr sdk.ConsAddress, +) stakingtypes.ValidatorI { + found, accAddr := k.operatorKeeper.GetOperatorAddressForChainIdAndConsAddr( + ctx, ctx.ChainID(), addr, + ) + if !found { + // replicate the behavior of the SDK's staking module + return nil + } + return stakingtypes.Validator{ + Jailed: k.operatorKeeper.IsOperatorJailedForChainId(ctx, accAddr, ctx.ChainID()), + } +} + +// Slash is an implementation of the staking interface expected by the SDK's slashing module. +// It forwards the call to SlashWithInfractionReason with Infraction_INFRACTION_UNSPECIFIED. +// It is not called within the slashing module, but is part of the interface. +func (k Keeper) Slash( + ctx sdk.Context, addr sdk.ConsAddress, + infractionHeight, power int64, + slashFactor sdk.Dec, +) math.Int { + return k.SlashWithInfractionReason( + ctx, addr, infractionHeight, power, + slashFactor, stakingtypes.Infraction_INFRACTION_UNSPECIFIED, + ) +} + +// SlashWithInfractionReason is an implementation of the staking interface expected by the +// SDK's slashing module. It is called when the slashing module observes an infraction +// of either downtime or equivocation (which is via the evidence module). +func (k Keeper) SlashWithInfractionReason( + ctx sdk.Context, addr sdk.ConsAddress, infractionHeight, power int64, + slashFactor sdk.Dec, infraction stakingtypes.Infraction, +) math.Int { + found, accAddress := k.operatorKeeper.GetOperatorAddressForChainIdAndConsAddr( + ctx, ctx.ChainID(), addr, + ) + if !found { + // TODO(mm): already slashed and removed from the set? + return math.NewInt(0) + } + // TODO(mm): add list of assets to be slashed (and not just all of them). + // based on yet to be finalized slashing design. + return k.slashingKeeper.SlashWithInfractionReason( + ctx, accAddress, infractionHeight, + power, slashFactor, infraction, + ) +} + +// Jail is an implementation of the staking interface expected by the SDK's slashing module. +// It delegates the call to the operator module. Alternatively, this may be handled +// by the slashing module depending upon the design decisions. +func (k Keeper) Jail(ctx sdk.Context, addr sdk.ConsAddress) { + k.operatorKeeper.Jail(ctx, addr, ctx.ChainID()) + // TODO(mm) + // once the operator module jails someone, a hook should be triggered + // and the validator removed from the set. same for unjailing. +} + +// Unjail is an implementation of the staking interface expected by the SDK's slashing module. +// The function is called by the slashing module only when it receives a request from the +// operator to do so. TODO(mm): We need to use the SDK's slashing module to allow for downtime +// slashing but somehow we need to prevent its Unjail function from being called by anyone. +func (k Keeper) Unjail(sdk.Context, sdk.ConsAddress) { + panic("unimplemented on this keeper") +} + +// Delegation is an implementation of the staking interface expected by the SDK's slashing +// module. The slashing module uses it to obtain the delegation information of a validator +// before unjailing it. If the slashing module's unjail function is never called, this +// function will never be called either. +func (k Keeper) Delegation( + sdk.Context, sdk.AccAddress, sdk.ValAddress, +) stakingtypes.DelegationI { + panic("unimplemented on this keeper") +} + +// MaxValidators is an implementation of the staking interface expected by the SDK's slashing +// module. It is not called within the slashing module, but is part of the interface. +// It returns the maximum number of validators allowed in the network. +func (k Keeper) MaxValidators(ctx sdk.Context) uint32 { + return k.GetMaxValidators(ctx) +} + +// GetAllValidators is an implementation of the staking interface expected by the SDK's +// slashing module. It is not called within the slashing module, but is part of the interface. +func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) { + return []stakingtypes.Validator{} +} + +// IsValidatorJailed is an implementation of the staking interface expected by the SDK's +// slashing module. It is called by the slashing module to record validator signatures +// for downtime tracking. We delegate the call to the operator keeper. +func (k Keeper) IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool { + found, accAddr := k.operatorKeeper.GetOperatorAddressForChainIdAndConsAddr( + ctx, ctx.ChainID(), addr, + ) + if !found { + // replicate the behavior of the SDK's staking module + return false + } + return k.operatorKeeper.IsOperatorJailedForChainId(ctx, accAddr, ctx.ChainID()) +} + +// ApplyAndReturnValidatorSetUpdates is an implementation of the staking interface expected +// by the SDK's genutil module. It is used in the gentx command, which we do not need to +// support. So this function does nothing. +func (k Keeper) ApplyAndReturnValidatorSetUpdates( + sdk.Context, +) (updates []abci.ValidatorUpdate, err error) { + return +} diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index 103d60c97..e85f961d0 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -26,6 +26,7 @@ type ( operatorKeeper types.OperatorKeeper delegationKeeper types.DelegationKeeper restakingKeeper types.RestakingKeeper + slashingKeeper types.SlashingKeeper } ) @@ -38,6 +39,7 @@ func NewKeeper( operatorKeeper types.OperatorKeeper, delegationKeeper types.DelegationKeeper, restakingKeeper types.RestakingKeeper, + slashingKeeper types.SlashingKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -52,6 +54,7 @@ func NewKeeper( operatorKeeper: operatorKeeper, delegationKeeper: delegationKeeper, restakingKeeper: restakingKeeper, + slashingKeeper: slashingKeeper, } } diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index d53a88d58..c41b7ba22 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -31,10 +31,10 @@ func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration { // ApplyValidatorChanges returns the validator set as is. However, it also // stores the validators that are added or those that are removed, and updates // the power for the existing validators. It also allows any hooks registered -// on the keeper to be executed. +// on the keeper to be executed. Lastly, it stores the validator set against the +// provided validator set id. func (k Keeper) ApplyValidatorChanges( - ctx sdk.Context, - changes []abci.ValidatorUpdate, + ctx sdk.Context, changes []abci.ValidatorUpdate, valSetID uint64, genesis bool, ) []abci.ValidatorUpdate { ret := []abci.ValidatorUpdate{} for _, change := range changes { @@ -42,7 +42,7 @@ func (k Keeper) ApplyValidatorChanges( pubkey, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()) if err != nil { // An error here would indicate that the validator updates - // received from other modules are invalid. + // received from other modules (or genesis) are invalid. panic(err) } addr := pubkey.Address() @@ -79,9 +79,34 @@ func (k Keeper) ApplyValidatorChanges( // to tendermint. continue } - ret = append(ret, change) } + + // store the validator set against the provided validator set id + lastVals := types.Validators{} + for _, v := range k.GetAllExocoreValidators(ctx) { + pubkey, err := v.ConsPubKey() + if err != nil { + panic(err) + } + val, err := stakingtypes.NewValidator(nil, pubkey, stakingtypes.Description{}) + if err != nil { + panic(err) + } + // Set validator to bonded status + val.Status = stakingtypes.Bonded + // Compute tokens from voting power + val.Tokens = sdk.TokensFromConsensusPower(v.Power, sdk.DefaultPowerReduction) + lastVals.List = append(lastVals.GetList(), val) + } + k.SetValidatorSet(ctx, valSetID, &lastVals) + if !genesis { + // the val set change is effective as of the next block, so height + 1. + k.SetValidatorSetID(ctx, ctx.BlockHeight()+1, valSetID) + } else { + // the val set change is effective immediately. + k.SetValidatorSetID(ctx, ctx.BlockHeight(), valSetID) + } return ret } diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 9dfd255ea..06ca74df4 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -1,8 +1,10 @@ package types import ( + "cosmossdk.io/math" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" epochsTypes "github.com/evmos/evmos/v14/x/epochs/types" ) @@ -48,6 +50,11 @@ type OperatorKeeper interface { ) bool CompleteOperatorOptOutFromChainId(sdk.Context, sdk.AccAddress, string) DeleteOperatorAddressForChainIdAndConsAddr(sdk.Context, string, sdk.ConsAddress) + GetOperatorAddressForChainIdAndConsAddr( + sdk.Context, string, sdk.ConsAddress, + ) (bool, sdk.AccAddress) + IsOperatorJailedForChainId(sdk.Context, sdk.AccAddress, string) bool + Jail(sdk.Context, sdk.ConsAddress, string) } // DelegationKeeper represents the expected keeper interface for the delegation module. @@ -66,3 +73,11 @@ type EpochsHooks interface { type RestakingKeeper interface { GetOperatorAssetValue(sdk.Context, sdk.AccAddress) (int64, error) } + +// SlashingKeeper represents the expected keeper interface for the (exo-)slashing module. +type SlashingKeeper interface { + SlashWithInfractionReason( + sdk.Context, sdk.AccAddress, int64, + int64, sdk.Dec, stakingtypes.Infraction, + ) math.Int +} diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 15e3fda9f..6397e1796 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -12,6 +12,9 @@ const ( StoreKey = ModuleName ) +// InitialValidatorSetID is the initial validator set id. +const InitialValidatorSetID = uint64(1) + const ( // ExocoreValidatorBytePrefix is the prefix for the validator store. ExocoreValidatorBytePrefix byte = iota + 1 From 3a5d824b52ee4f58cd6899d4c8bf3c3dcccca365 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:25:30 +0000 Subject: [PATCH 21/41] chore(lint): apply to dogfood --- x/dogfood/client/cli/query.go | 3 +- x/dogfood/keeper/impl_epochs_hooks.go | 2 +- x/dogfood/keeper/impl_sdk.go | 19 ++++++----- x/dogfood/keeper/queue.go | 6 ++-- x/dogfood/keeper/validators.go | 49 +++++++++++++++------------ x/dogfood/module.go | 9 +++-- x/dogfood/types/codec.go | 2 +- 7 files changed, 51 insertions(+), 39 deletions(-) diff --git a/x/dogfood/client/cli/query.go b/x/dogfood/client/cli/query.go index a4dfc065d..a1f193d8d 100644 --- a/x/dogfood/client/cli/query.go +++ b/x/dogfood/client/cli/query.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,7 +16,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(string) *cobra.Command { // Group dogfood queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/dogfood/keeper/impl_epochs_hooks.go b/x/dogfood/keeper/impl_epochs_hooks.go index af7cc5267..c17314a89 100644 --- a/x/dogfood/keeper/impl_epochs_hooks.go +++ b/x/dogfood/keeper/impl_epochs_hooks.go @@ -54,7 +54,7 @@ func (wrapper EpochsHooksWrapper) AfterEpochEnd( // BeforeEpochStart is called before an epoch starts. func (wrapper EpochsHooksWrapper) BeforeEpochStart( - ctx sdk.Context, identifier string, epoch int64, + sdk.Context, string, int64, ) { // nothing to do } diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index 547f526e7..a019bff2a 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -12,14 +12,16 @@ import ( ) // interface guards -var _ slashingtypes.StakingKeeper = Keeper{} -var _ evidencetypes.StakingKeeper = Keeper{} -var _ genutiltypes.StakingKeeper = Keeper{} -var _ clienttypes.StakingKeeper = Keeper{} // implemented in `validators.go` +var ( + _ slashingtypes.StakingKeeper = Keeper{} + _ evidencetypes.StakingKeeper = Keeper{} + _ genutiltypes.StakingKeeper = Keeper{} + _ clienttypes.StakingKeeper = Keeper{} // implemented in `validators.go` +) // GetParams is an implementation of the staking interface expected by the SDK's evidence // module. The module does not use it, but it is part of the interface. -func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params { +func (k Keeper) GetParams(sdk.Context) stakingtypes.Params { return stakingtypes.Params{} } @@ -30,7 +32,8 @@ func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params { // matches that of each validator. Ideally, this invariant should be implemented // by the delegation and/or deposit module(s) instead. func (k Keeper) IterateValidators(sdk.Context, - func(index int64, validator stakingtypes.ValidatorI) (stop bool)) { + func(index int64, validator stakingtypes.ValidatorI) (stop bool), +) { // no op } @@ -42,7 +45,7 @@ func (k Keeper) IterateValidators(sdk.Context, // depending upon the finalized design. We don't need to implement this function here because // we are not calling the AfterValidatorCreated hook in our module, so this will never be // reached. -func (k Keeper) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI { +func (k Keeper) Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI { panic("unimplemented on this keeper") } @@ -143,7 +146,7 @@ func (k Keeper) MaxValidators(ctx sdk.Context) uint32 { // GetAllValidators is an implementation of the staking interface expected by the SDK's // slashing module. It is not called within the slashing module, but is part of the interface. -func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) { +func (k Keeper) GetAllValidators(sdk.Context) (validators []stakingtypes.Validator) { return []stakingtypes.Validator{} } diff --git a/x/dogfood/keeper/queue.go b/x/dogfood/keeper/queue.go index 591962d5f..07cedfb32 100644 --- a/x/dogfood/keeper/queue.go +++ b/x/dogfood/keeper/queue.go @@ -25,10 +25,10 @@ func (k Keeper) QueueOperation( if operation.PubKey.Equal(key) { if operation.OperationType == operationType { return types.QueueResultExists - } else { - indexToDelete = i - break } + // reverse operation exists, remove it + indexToDelete = i + break } } ret := types.QueueResultSuccess diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index c41b7ba22..bdfc529d6 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -48,7 +48,8 @@ func (k Keeper) ApplyValidatorChanges( addr := pubkey.Address() val, found := k.GetValidator(ctx, addr) - if found { + switch found { + case true: // update or delete an existing validator if change.Power < 1 { k.DeleteValidator(ctx, addr) @@ -56,28 +57,32 @@ func (k Keeper) ApplyValidatorChanges( val.Power = change.Power k.SetValidator(ctx, val) } - } else if change.Power > 0 { - // create a new validator - the address is just derived from the public key and has - // no correlation with the operator address on Exocore - ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) - if err != nil { - // An error here would indicate that the validator updates - // received are invalid. - panic(err) - } - - k.SetValidator(ctx, ocVal) - err = k.Hooks().AfterValidatorBonded(ctx, sdk.ConsAddress(addr), nil) - if err != nil { - // AfterValidatorBonded is hooked by the Slashing module and should not return - // an error. If any other module were to hook it, they should also not. - panic(err) + case false: + if change.Power > 0 { + // create a new validator - the address is just derived from the public key and + // has + // no correlation with the operator address on Exocore + ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) + if err != nil { + // An error here would indicate that the validator updates + // received are invalid. + panic(err) + } + + k.SetValidator(ctx, ocVal) + err = k.Hooks().AfterValidatorBonded(ctx, sdk.ConsAddress(addr), nil) + if err != nil { + // AfterValidatorBonded is hooked by the Slashing module and should not + // return + // an error. If any other module were to hook it, they should also not. + panic(err) + } + } else { + // edge case: we received an update for 0 power + // but the validator is already deleted. Do not forward + // to tendermint. + continue } - } else { - // edge case: we received an update for 0 power - // but the validator is already deleted. Do not forward - // to tendermint. - continue } ret = append(ret, change) } diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 50d02a5d0..44483fd37 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -56,7 +56,7 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. // The default GenesisState need to be defined by the module developer and is primarily used for // testing func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { @@ -66,7 +66,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form func (AppModuleBasic) ValidateGenesis( cdc codec.JSONCodec, - config client.TxEncodingConfig, + _ client.TxEncodingConfig, bz json.RawMessage, ) error { var genState types.GenesisState @@ -81,7 +81,10 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes( clientCtx client.Context, mux *runtime.ServeMux, ) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + // this panic is safe to do because it means an error in setting up the module. + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are diff --git a/x/dogfood/types/codec.go b/x/dogfood/types/codec.go index b70e2a444..3fb01c133 100644 --- a/x/dogfood/types/codec.go +++ b/x/dogfood/types/codec.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterCodec(*codec.LegacyAmino) { } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { From ded8f3f2245d71d30253fd039bf2ef3f67733017 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:37:26 +0000 Subject: [PATCH 22/41] doc(dogfood): update minor comment --- x/dogfood/keeper/impl_sdk.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index a019bff2a..936e7c2cb 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -65,7 +65,7 @@ func (k Keeper) ValidatorByConsAddr( ctx, ctx.ChainID(), addr, ) if !found { - // replicate the behavior of the SDK's staking module + // replicate the behavior of the SDK's staking module; do not panic. return nil } return stakingtypes.Validator{ From 84a8037b615bd5dfea885c61b3867e72fa390a09 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 28 Feb 2024 12:45:52 +0000 Subject: [PATCH 23/41] chore(build): attempt to fix consensuswarn --- .github/workflows/consensuswarn.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml index ab2ba53bf..7662e31d5 100644 --- a/.github/workflows/consensuswarn.yml +++ b/.github/workflows/consensuswarn.yml @@ -18,4 +18,4 @@ jobs: - uses: orijtech/consensuswarn@main with: # example.com/pkg/path.Type.Method - roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.EndBlocker' + roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.EndBlocker' From 0debcab680c433a28aec6d606447493eb5524534 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 28 Feb 2024 12:48:17 +0000 Subject: [PATCH 24/41] Revert "chore(build): attempt to fix consensuswarn This reverts commit 84a8037b615bd5dfea885c61b3867e72fa390a09. --- .github/workflows/consensuswarn.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml index 7662e31d5..ab2ba53bf 100644 --- a/.github/workflows/consensuswarn.yml +++ b/.github/workflows/consensuswarn.yml @@ -18,4 +18,4 @@ jobs: - uses: orijtech/consensuswarn@main with: # example.com/pkg/path.Type.Method - roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.EndBlocker' + roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.EndBlocker' From 15dfdd6d47ad65f026f0ba8b2cde9070cd90b33b Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Fri, 1 Mar 2024 19:13:02 +0530 Subject: [PATCH 25/41] chore(ci): fix labeler and consensuswarn (#5) * chore(build): use `ExocoreNetwork/exocore` path * chore(build): try to fix consensus warn * chore(build): grant labeler write permissions * chore(ci): remove push labeler only PR * Revert "chore(ci): use `ExocoreNetwork/exocore`" This reverts commit cf672251506fcd9e3c96dc42c52116b395f8216a. --- .github/workflows/consensuswarn.yml | 2 +- .github/workflows/labeler.yml | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml index ab2ba53bf..7662e31d5 100644 --- a/.github/workflows/consensuswarn.yml +++ b/.github/workflows/consensuswarn.yml @@ -18,4 +18,4 @@ jobs: - uses: orijtech/consensuswarn@main with: # example.com/pkg/path.Type.Method - roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BaseApp.EndBlocker' + roots: 'github.com/ExocoreNetwork/exocore/app.ExocoreApp.DeliverTx,github.com/ExocoreNetwork/exocore/app.ExocoreApp.BeginBlocker,github.com/ExocoreNetwork/exocore/app.ExocoreApp.EndBlocker' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 28e30fd13..f54447304 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,15 +1,14 @@ name: "Pull Request Labeler" + on: - pull_request: - push: - branches: - - develop - - main - - master + pull_request_target: jobs: triage: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: actions/labeler@v4 with: From a5246192d5f55a595c30b2e4c3bd5f95569173c5 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:30:39 +0530 Subject: [PATCH 26/41] chore(ci): re-attempt fix (#8) * chore(ci): fix DeliverTx * chore(ci): disable Solidity test * chore(build): remove extra tab * chore(build): lint the proto files * chore(build): generate proto * chore(build): update for new proto * chore(ci): remove blank line * chore(lint): remove unused params * chore(ci): upgrade vuln deps * chore(ci): e2e test workflow * chore(ci): disable e2e tests, we have none * chore(ci): disable codecov upload * chore(ci): fail only high vuln deps --- .github/workflows/dependencies.yml | 2 + .github/workflows/e2e-test.yml | 2 + .github/workflows/solidity-test.yml | 2 + .github/workflows/test.yml | 4 +- Dockerfile | 4 +- Makefile | 6 +- app/app.go | 14 ++ app/tps_counter.go | 2 - go.mod | 4 +- go.sum | 4 + proto/exocore/delegation/v1/query.proto | 31 +-- proto/exocore/delegation/v1/tx.proto | 76 +++--- proto/exocore/deposit/v1/deposit.proto | 6 +- proto/exocore/deposit/v1/query.proto | 3 - proto/exocore/deposit/v1/tx.proto | 5 +- proto/exocore/native_token/v1/tx.proto | 32 ++- .../restaking_assets_manage/v1/genesis.proto | 5 +- .../restaking_assets_manage/v1/query.proto | 67 +++--- .../restaking_assets_manage/v1/tx.proto | 72 +++--- proto/exocore/reward/params.proto | 6 +- proto/exocore/reward/query.proto | 2 - proto/exocore/reward/tx.proto | 4 +- proto/exocore/slash/params.proto | 6 +- proto/exocore/slash/query.proto | 2 - proto/exocore/slash/tx.proto | 2 +- proto/exocore/withdraw/query.proto | 2 - proto/exocore/withdraw/tx.proto | 3 +- x/delegation/types/query.pb.go | 115 ++++----- x/delegation/types/tx.pb.go | 221 +++++++++-------- x/deposit/types/deposit.pb.go | 29 ++- x/deposit/types/query.pb.go | 41 ++-- x/deposit/types/tx.pb.go | 38 +-- x/native_token/types/tx.pb.go | 124 +++++----- x/restaking_assets_manage/client/cli/query.go | 6 +- .../keeper/grpc_query.go | 4 +- x/restaking_assets_manage/types/genesis.pb.go | 34 +-- x/restaking_assets_manage/types/query.pb.go | 214 +++++++++-------- .../types/query.pb.gw.go | 18 +- x/restaking_assets_manage/types/tx.pb.go | 224 ++++++++++-------- x/reward/client/cli/query_params.go | 2 +- x/reward/types/params.pb.go | 30 +-- x/reward/types/query.pb.go | 39 ++- x/reward/types/tx.pb.go | 42 ++-- x/slash/client/cli/query_params.go | 2 +- x/slash/types/params.pb.go | 30 +-- x/slash/types/query.pb.go | 34 ++- x/slash/types/tx.pb.go | 2 + x/withdraw/client/cli/query_params.go | 2 +- x/withdraw/types/query.pb.go | 42 ++-- x/withdraw/types/tx.pb.go | 39 +-- 50 files changed, 897 insertions(+), 803 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index d03ad9513..33c4860b3 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -23,6 +23,8 @@ jobs: - name: "Dependency Review" uses: actions/dependency-review-action@v3 if: env.GIT_DIFF + with: + fail-on-severity: high - name: "Go vulnerability check" run: make vulncheck if: env.GIT_DIFF diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index d6a281f3a..bdd06f6dc 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -13,6 +13,8 @@ on: jobs: test-e2e: + # disabled for now, since we don't have any e2e tests. + if: ${{ false }} runs-on: ubuntu-latest steps: - uses: actions/setup-go@v4 diff --git a/.github/workflows/solidity-test.yml b/.github/workflows/solidity-test.yml index b8b857c46..950733176 100644 --- a/.github/workflows/solidity-test.yml +++ b/.github/workflows/solidity-test.yml @@ -9,6 +9,8 @@ on: jobs: test-solidity: + # disabled for now, since we don't have any Solidity files. + if: ${{ false }} runs-on: ubuntu-latest steps: - uses: actions/setup-go@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b9406946..a81cadb22 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,9 @@ jobs: make test-unit-cover if: env.GIT_DIFF - uses: codecov/codecov-action@v3 + # disabled for now, since we don't have any codecov + if: ${{ false }} with: file: ./coverage.txt fail_ci_if_error: true - if: env.GIT_DIFF + # if: env.GIT_DIFF diff --git a/Dockerfile b/Dockerfile index e11fea07f..7ce5d7ca7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /go/src/github.com/ExocoreNetwork/exocore COPY go.mod go.sum ./ -RUN set -eux; apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0 +RUN apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0 RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \ git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \ @@ -23,7 +23,7 @@ WORKDIR /root COPY --from=build-env /go/src/github.com/ExocoreNetwork/exocore/build/exocored /usr/bin/exocored COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli -RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r3 curl=8.2.1-r0 bash=5.2.15-r5 vim=9.0.1568-r0 lz4=1.9.4-r4 rclone=1.62.2-r3 \ +RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r4 curl=8.5.0-r0 bash=5.2.15-r5 vim=9.0.2073-r0 lz4=1.9.4-r4 rclone=1.62.2-r6 \ && addgroup -g 1000 exocore \ && adduser -S -h /home/exocore -D exocore -u 1000 -G exocore diff --git a/Makefile b/Makefile index b4bc2f1e5..ac25228fc 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,9 @@ ifdef GITHUB_TOKEN DOCKER_ARGS += --secret id=GITHUB_TOKEN endif endif -NAMESPACE := tharsishq +NAMESPACE := ExocoreNetwork PROJECT := exocore -DOCKER_IMAGE := $(NAMESPACE)/$(PROJECT) +DOCKER_IMAGE := $(shell echo $(NAMESPACE)/$(PROJECT) | tr '[:upper:]' '[:lower:]') COMMIT_HASH := $(shell git rev-parse --short=7 HEAD) DOCKER_TAG := $(COMMIT_HASH) # e2e env @@ -412,7 +412,7 @@ proto-format: proto-lint: @echo "Linting Protobuf files" - @$(protoImage) buf lint --error-format=json + @$(protoImage) buf lint --error-format=json proto-check-breaking: @echo "Checking Protobuf files for breaking changes" diff --git a/app/app.go b/app/app.go index 2738f08aa..641838a91 100644 --- a/app/app.go +++ b/app/app.go @@ -1051,6 +1051,20 @@ func (app *ExocoreApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abc return app.mm.EndBlock(ctx, req) } +// The DeliverTx method is intentionally decomposed to calculate the transactions per second. +func (app *ExocoreApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { + defer func() { + // TODO: Record the count along with the code and or reason so as to display + // in the transactions per second live dashboards. + if res.IsErr() { + app.tpsCounter.incrementFailure() + } else { + app.tpsCounter.incrementSuccess() + } + }() + return app.BaseApp.DeliverTx(req) +} + // InitChainer updates at chain initialization func (app *ExocoreApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState diff --git a/app/tps_counter.go b/app/tps_counter.go index 2e6eb475b..761504556 100644 --- a/app/tps_counter.go +++ b/app/tps_counter.go @@ -41,10 +41,8 @@ func newTPSCounter(logger log.Logger) *tpsCounter { return &tpsCounter{logger: logger, doneCh: make(chan bool, 1)} } -// nolint: unused // legacy code func (tpc *tpsCounter) incrementSuccess() { atomic.AddUint64(&tpc.nSuccessful, 1) } -// nolint: unused // legacy code func (tpc *tpsCounter) incrementFailure() { atomic.AddUint64(&tpc.NFailed, 1) } const defaultTPSReportPeriod = 10 * time.Second diff --git a/go.mod b/go.mod index 8d69582df..79d900dff 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( golang.org/x/crypto v0.12.0 golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.57.1 sigs.k8s.io/yaml v1.3.0 ) @@ -97,7 +97,7 @@ require ( github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect diff --git a/go.sum b/go.sum index d77fe7088..d33d5c4a7 100644 --- a/go.sum +++ b/go.sum @@ -788,6 +788,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 h1:y87odSHhV8WSSnjuFYC+K2V6LpZtEVcjmVWxtUkXZiQ= +github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= @@ -2232,6 +2234,8 @@ google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwS google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= +google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/proto/exocore/delegation/v1/query.proto b/proto/exocore/delegation/v1/query.proto index 47650c31a..5b75bdb38 100644 --- a/proto/exocore/delegation/v1/query.proto +++ b/proto/exocore/delegation/v1/query.proto @@ -10,18 +10,18 @@ import "exocore/delegation/v1/tx.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types"; message DelegationInfoReq { - string stakerID = 1; - string assetID = 2; + string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } -message DelegationAmounts{ - string CanUndelegationAmount = 1 +message DelegationAmounts { + string can_undelegation_amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string WaitUndelegationAmount = 2 + string wait_undelegation_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -29,37 +29,40 @@ message DelegationAmounts{ ]; } -message QueryDelegationInfoResponse{ - string TotalDelegatedAmount = 1 +message QueryDelegationInfoResponse { + string total_delegated_amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - map delegationInfos = 2; + map delegation_infos = 2; } message SingleDelegationInfoReq { - string stakerID = 1; - string operatorAddr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string assetID = 3; + string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + string operator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string asset_id = 3 [(gogoproto.customname) = "AssetID"]; } message QueryOperatorInfoReq { - string OperatorAddr = 1 + string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } +// Query is the service API for the delegation module. service Query { + // OperatorInfo queries the operator information. rpc QueryOperatorInfo(QueryOperatorInfoReq) returns(OperatorInfo){ option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo"; } - // Balance queries the balance of a single coin for a single account. + // DelegationInfo queries the delegation information for {stakerID, assetID}. rpc QueryDelegationInfo(DelegationInfoReq) returns (QueryDelegationInfoResponse) { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/delegation/v1/GetDelegationInfo"; } - + // SingleDelegationInfo queries the single delegation information for + // {chain, staker, asset, operator}. rpc QuerySingleDelegationInfo(SingleDelegationInfoReq) returns(DelegationAmounts){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/delegation/v1/QuerySingleDelegationInfo"; diff --git a/proto/exocore/delegation/v1/tx.proto b/proto/exocore/delegation/v1/tx.proto index e74171137..68f8578e9 100644 --- a/proto/exocore/delegation/v1/tx.proto +++ b/proto/exocore/delegation/v1/tx.proto @@ -10,7 +10,7 @@ import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types"; message ValueField { - string Amount = 1 + string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -19,30 +19,30 @@ message ValueField { } message DelegatedSingleAssetInfo { - string AssetID = 1; - string TotalDelegatedAmount = 2 + string asset_id = 1 [(gogoproto.customname) = "AssetID"]; + string total_delegated_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - map PerOperatorAmounts = 3; + map per_operator_amounts = 3; } -message clientChainEarningAddrList { - repeated clientChainEarningAddrInfo EarningInfoList = 1; +message ClientChainEarningAddrList { + repeated ClientChainEarningAddrInfo earning_info_list = 1; } -message clientChainEarningAddrInfo { - uint64 lzClientChainID = 1; - string clientChainEarningAddr = 2; +message ClientChainEarningAddrInfo { + uint64 lz_client_chain_id = 1 [(gogoproto.customname) = "LzClientChainID"]; + string client_chain_earning_addr = 2; } -message OperatorInfo{ - string EarningsAddr = 1; - string ApproveAddr = 2; - string OperatorMetaInfo = 3; - clientChainEarningAddrList ClientChainEarningsAddr = 4; +message OperatorInfo { + string earnings_addr = 1; + string approve_addr = 2; + string operator_meta_info = 3; + ClientChainEarningAddrList client_chain_earnings_addr = 4; } message RegisterOperatorReq { @@ -51,52 +51,52 @@ message RegisterOperatorReq { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string FromAddress = 1 + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; OperatorInfo info = 2; } -message DelegationApproveInfo{ +message DelegationApproveInfo { string signature = 1; string salt = 2; } message RegisterOperatorResponse{} -message DelegationIncOrDecInfo{ +message DelegationIncOrDecInfo { option (cosmos.msg.v1.signer) = "fromAddress"; option (amino.name) = "cosmos-sdk/MsgAddOrDecreaseDelegation"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string fromAddress = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - map perOperatorAmounts = 2; + map per_operator_amounts = 2; } -message MsgDelegation{ - DelegationIncOrDecInfo baseInfo = 1; - DelegationApproveInfo approvedInfo = 2; +message MsgDelegation { + DelegationIncOrDecInfo base_info = 1; + DelegationApproveInfo approved_info = 2; } -message UndelegationRecord{ - string stakerID = 1; - string assetID = 2; - string OperatorAddr = 3 +message UndelegationRecord { + string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + string asset_id = 2 [(gogoproto.customname) = "AssetID"]; + string operator_addr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string txHash = 4; - bool isPending = 5; - uint64 BlockNumber = 6; - uint64 CompleteBlockNumber = 7; - uint64 LzTxNonce = 8; + string tx_hash = 4; + bool is_pending = 5; + uint64 block_number = 6; + uint64 complete_block_number = 7; + uint64 lz_tx_nonce = 8; string amount = 9 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string actualCompletedAmount =10 + string actual_completed_amount =10 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -105,22 +105,24 @@ message UndelegationRecord{ } message UndelegationRecordKeyList { - repeated string keyList = 1; + repeated string key_list = 1; } -message DelegationResponse{} +message DelegationResponse {} -message MsgUndelegation{ - DelegationIncOrDecInfo baseInfo = 1; +message MsgUndelegation { + DelegationIncOrDecInfo base_info = 1; } message UndelegationResponse{} // Msg defines the delegation Msg service. service Msg { option (cosmos.msg.v1.service) = true; - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse); + // DelegateAssetToOperator delegates asset to operator. rpc DelegateAssetToOperator(MsgDelegation) returns (DelegationResponse); + // UndelegateAssetFromOperator undelegates asset from operator. rpc UndelegateAssetFromOperator(MsgUndelegation) returns (UndelegationResponse); } diff --git a/proto/exocore/deposit/v1/deposit.proto b/proto/exocore/deposit/v1/deposit.proto index 19471b14a..acbc642cf 100644 --- a/proto/exocore/deposit/v1/deposit.proto +++ b/proto/exocore/deposit/v1/deposit.proto @@ -9,6 +9,8 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; // GenesisState defines the restaking_assets_manage module's genesis state. message Params { - string exoCoreLzAppAddress = 1; - string exoCoreLzAppEventTopic =2; + string exocore_lz_app_address = 1 + [(gogoproto.customname) = "ExoCoreLzAppAddress"]; + string exocore_lz_app_event_topic = 2 + [(gogoproto.customname) = "ExoCoreLzAppEventTopic"]; } diff --git a/proto/exocore/deposit/v1/query.proto b/proto/exocore/deposit/v1/query.proto index 9cf107589..0b7fd5dfa 100644 --- a/proto/exocore/deposit/v1/query.proto +++ b/proto/exocore/deposit/v1/query.proto @@ -2,10 +2,7 @@ syntax = "proto3"; package exocore.deposit.v1; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/query/v1/query.proto"; -import "cosmos_proto/cosmos.proto"; import "exocore/deposit/v1/deposit.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; diff --git a/proto/exocore/deposit/v1/tx.proto b/proto/exocore/deposit/v1/tx.proto index 8c90c3a97..b4a8b3583 100644 --- a/proto/exocore/deposit/v1/tx.proto +++ b/proto/exocore/deposit/v1/tx.proto @@ -5,7 +5,6 @@ package exocore.deposit.v1; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "amino/amino.proto"; import "exocore/deposit/v1/deposit.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; @@ -28,9 +27,9 @@ message MsgUpdateParams { // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} +// Msg defines the deposit Msg service. service Msg { - option (cosmos.msg.v1.service) = true; - + // UpdateParams updates the parameters of the deposit module. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } diff --git a/proto/exocore/native_token/v1/tx.proto b/proto/exocore/native_token/v1/tx.proto index ccfc32320..f75c1c008 100644 --- a/proto/exocore/native_token/v1/tx.proto +++ b/proto/exocore/native_token/v1/tx.proto @@ -2,44 +2,50 @@ syntax = "proto3"; package exocore.native_token.v1; -import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/native_token/types"; message ValidatorInfo { + // ValidatorStatus is the status of the validator. enum ValidatorStatus { - ACTIVE = 0; - INACTIVE = 1; - WITHDRAWN = 2; + // UNSPECIFIED is the default status of a validator. + VALIDATOR_STATUS_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "ValidatorInfo_UNSPECIFIED" ]; + // ACTIVE is the status of a validator that is currently validating. + VALIDATOR_STATUS_ACTIVE = 1[ (gogoproto.enumvalue_customname) = "ValidatorInfo_ACTIVE" ]; + // INACTIVE is the status of a validator that is not currently validating. + VALIDATOR_STATUS_INACTIVE = 2[ (gogoproto.enumvalue_customname) = "ValidatorInfo_INACTIVE" ]; + // WITHDRAWN is the status of a validator that has withdrawn from the network. + VALIDATOR_STATUS_WITHDRAWN = 3[ (gogoproto.enumvalue_customname) = "ValidatorInfo_WITHDRAWN" ]; } - ValidatorStatus Status = 1; - uint64 ValidatorIndex = 2; - string StakedBalanceGwei = 3 + ValidatorStatus status = 1; + uint64 validator_index = 2; + string staked_balance_gwei = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - uint64 MostRecentBalanceUpdateBlockNumber = 4; + uint64 most_recent_balance_update_block_number = 4; } message NativeTokenStakerInfo { - string TotalValidatorBalances = 1 + string total_validator_balances = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string UnStakedValueFromPOS = 2 + string unstaked_value_from_pos = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.customname) = "UnStakedValueFromPOS" ]; - string PodAddress =3; - map ValidatorsInfo=4; + string pod_address = 3; + map validators_info = 4; } diff --git a/proto/exocore/restaking_assets_manage/v1/genesis.proto b/proto/exocore/restaking_assets_manage/v1/genesis.proto index 651d52d15..0a1c1c99d 100644 --- a/proto/exocore/restaking_assets_manage/v1/genesis.proto +++ b/proto/exocore/restaking_assets_manage/v1/genesis.proto @@ -1,13 +1,12 @@ syntax = "proto3"; package exocore.restaking_assets_manage.v1; -import "gogoproto/gogo.proto"; import "exocore/restaking_assets_manage/v1/tx.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; // GenesisState defines the restaking_assets_manage module's genesis state. message GenesisState { - repeated ClientChainInfo DefaultSupportedClientChains = 1; - repeated AssetInfo DefaultSupportedClientChainTokens = 2; + repeated ClientChainInfo default_supported_client_chains = 1; + repeated AssetInfo default_supported_client_chain_tokens = 2; } diff --git a/proto/exocore/restaking_assets_manage/v1/query.proto b/proto/exocore/restaking_assets_manage/v1/query.proto index c9ad6aca8..da78d8879 100644 --- a/proto/exocore/restaking_assets_manage/v1/query.proto +++ b/proto/exocore/restaking_assets_manage/v1/query.proto @@ -1,110 +1,117 @@ syntax = "proto3"; package exocore.restaking_assets_manage.v1; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/query/v1/query.proto"; import "cosmos_proto/cosmos.proto"; import "exocore/restaking_assets_manage/v1/tx.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; message QueryClientChainInfo { - uint64 chainIndex = 1; + uint64 chain_index = 1; } -message QueryAllClientChainInfo{} +message QueryAllClientChainInfo {} message QueryAllClientChainInfoResponse{ - map allClientChainInfos = 1; + map all_client_chain_infos = 1; } -message QueryStakingAssetInfo{ - string assetID = 1; +message QueryStakingAssetInfo { + string asset_id = 1 [(gogoproto.customname) = "AssetID"]; } -message QueryAllStakingAssetsInfo{} +message QueryAllStakingAssetsInfo {} message QueryAllStakingAssetsInfoResponse{ - map allStakingAssetsInfo = 1; + map all_staking_assets_info = 1; } message QueryStakerAssetInfo{ - string stakerID = 1; + string staker_id = 1 [(gogoproto.customname) = "StakerID"]; } -message QueryAssetInfoResponse{ - map assetInfos = 1; +message QueryAssetInfoResponse { + map asset_infos = 1; } -message QuerySpecifiedAssetAmountReq{ - string stakerID = 1; - string assetID = 2; +message QuerySpecifiedAssetAmountReq { + string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } message QueryOperatorAssetInfos{ - string operatorAddr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message QueryOperatorAssetInfosResponse{ - map assetInfos = 1; + map asset_infos = 1; } message QueryOperatorSpecifiedAssetAmountReq{ - string operatorAddr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string assetID = 2; + string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } message QueryStakerExCoreAddr { - string StakerID = 1; + // Per https://github.com/gogo/protobuf/issues/331, grpc-gateway does not like custom names. + // So we remove the id suffix from here as well as the query. + string staker = 1; } -message QueryStakerExCoreAddrResponse{ - string ExCoreAddr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +message QueryStakerExCoreAddrResponse { + string exocore_addr = 1 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.customname) = "ExoCoreAddr" + ]; } +// Query defines the gRPC query service for the restaking_assets_manage module. service Query { - // Balance queries the balance of a single coin for a single account. + // ClientChainInfoByIndex queries the client chain info by index. rpc QueClientChainInfoByIndex(QueryClientChainInfo) returns (ClientChainInfo) { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueClientChainInfoByIndex"; } + // AllClientChainInfo queries all client chain info. rpc QueAllClientChainInfo(QueryAllClientChainInfo) returns (QueryAllClientChainInfoResponse){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueAllClientChainInfo"; } - + // StakingAssetInfo queries the staking asset info. rpc QueStakingAssetInfo(QueryStakingAssetInfo)returns(StakingAssetInfo){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakingAssetInfo"; } - + // AllStakingAssetsInfo queries all staking assets info. rpc QueAllStakingAssetsInfo(QueryAllStakingAssetsInfo)returns(QueryAllStakingAssetsInfoResponse){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueAllStakingAssetsInfo"; } - + // StakerAssetInfos queries the staker asset info. rpc QueStakerAssetInfos(QueryStakerAssetInfo)returns(QueryAssetInfoResponse){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerAssetInfos"; } - + // StakerSpecifiedAssetAmount queries the staker specified asset amount. rpc QueStakerSpecifiedAssetAmount(QuerySpecifiedAssetAmountReq)returns(StakerSingleAssetOrChangeInfo){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerSpecifiedAssetAmount"; } - + // OperatorAssetInfos queries the operator asset info. rpc QueOperatorAssetInfos(QueryOperatorAssetInfos)returns(QueryOperatorAssetInfosResponse){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueOperatorAssetInfos"; } - + // OperatorSpecifiedAssetAmount queries the operator specified asset amount. rpc QueOperatorSpecifiedAssetAmount(QueryOperatorSpecifiedAssetAmountReq) returns(OperatorSingleAssetOrChangeInfo){ option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerSpecifiedAssetAmount"; } - + // StakerExCoreAddr queries the staker exocore address. rpc QueStakerExoCoreAddr(QueryStakerExCoreAddr) returns (QueryStakerExCoreAddrResponse) { option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerExoCoreAddr/{StakerID}"; + option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerExoCoreAddr/{staker}"; } } diff --git a/proto/exocore/restaking_assets_manage/v1/tx.proto b/proto/exocore/restaking_assets_manage/v1/tx.proto index c3b308ef8..a67c51b97 100644 --- a/proto/exocore/restaking_assets_manage/v1/tx.proto +++ b/proto/exocore/restaking_assets_manage/v1/tx.proto @@ -9,35 +9,35 @@ import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; message ClientChainInfo { - string Name = 1; - string MetaInfo = 2; - uint64 ChainId = 3; - uint64 ExoCoreChainIndex = 4; - uint64 FinalizationBlocks = 5; - uint64 LayerZeroChainID = 6; - string SignatureType = 7; - uint32 AddressLength = 8; + string name = 1; + string meta_info = 2; + uint64 chain_id = 3; + uint64 exo_core_chain_index = 4; + uint64 finalization_blocks = 5; + uint64 layer_zero_chain_id = 6 [(gogoproto.customname) = "LayerZeroChainID"]; + string signature_type = 7; + uint32 address_length = 8; } message AssetInfo { - string Name = 1; - string Symbol = 2; - string Address = 3; - uint32 Decimals = 4; - string TotalSupply = 5 + string name = 1; + string symbol = 2; + string address = 3; + uint32 decimals = 4; + string total_supply = 5 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - uint64 LayerZeroChainID = 6; - uint64 ExoCoreChainIndex = 7; - string MetaInfo = 8; + uint64 layer_zero_chain_id = 6 [(gogoproto.customname) = "LayerZeroChainID"]; + uint64 exo_core_chain_index = 7; + string meta_info = 8; } message StakingAssetInfo { - AssetInfo AssetBasicInfo = 1; - string StakingTotalAmount = 2 + AssetInfo asset_basic_info = 1; + string staking_total_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -46,19 +46,19 @@ message StakingAssetInfo { } message StakerSingleAssetOrChangeInfo { - string TotalDepositAmountOrWantChangeValue = 1 + string total_deposit_amount_or_want_change_value = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string CanWithdrawAmountOrWantChangeValue = 2 + string can_withdraw_amount_or_want_change_value = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string WaitUndelegationAmountOrWantChangeValue = 3 + string wait_undelegation_amount_or_want_change_value = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -67,24 +67,24 @@ message StakerSingleAssetOrChangeInfo { } message StakerAllAssetsInfo { - map allAssetsState = 1; + map all_assets_state = 1; } message OperatorSingleAssetOrChangeInfo{ - string TotalAmountOrWantChangeValue = 1 + string total_amount_or_want_change_value = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; //todo: the field is used to mark operator's own assets and is not temporarily used now - string OperatorOwnAmountOrWantChangeValue = 2 + string operator_own_amount_or_want_change_value = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string WaitUndelegationAmountOrWantChangeValue = 3 + string wait_undelegation_amount_or_want_change_value = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -93,7 +93,7 @@ message OperatorSingleAssetOrChangeInfo{ } message OperatorAllAssetsInfo { - map allAssetsState = 1; + map all_assets_state = 1; } message MsgSetExoCoreAddr { @@ -103,11 +103,11 @@ message MsgSetExoCoreAddr { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string fromAddress = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string setAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string clientChainAddr = 3; - uint64 clientChainIndex = 4; - string StakerClientChainSignature = 5; + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string set_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string client_chain_addr = 3; + uint64 client_chain_index = 4; + string staker_client_chain_signature = 5; } message MsgSetExoCoreAddrResponse {} @@ -117,7 +117,7 @@ message RegisterClientChainReq { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string FromAddress = 1 + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; ClientChainInfo info = 2; } @@ -129,17 +129,21 @@ message RegisterAssetReq { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string FromAddress = 1 + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; AssetInfo info = 2; } message RegisterAssetResponse {} +// Msg defines the restaking_assets_manage Msg service service Msg { option (cosmos.msg.v1.service) = true; + // SetStakerExoCoreAddr sets the exocore address of the staker rpc SetStakerExoCoreAddr(MsgSetExoCoreAddr) returns (MsgSetExoCoreAddrResponse); + // RegisterClientChain registers the client chain rpc RegisterClientChain(RegisterClientChainReq) returns (RegisterClientChainResponse); + // RegisterAsset registers the asset on the client chain rpc RegisterAsset(RegisterAssetReq) returns (RegisterAssetResponse); -} \ No newline at end of file +} diff --git a/proto/exocore/reward/params.proto b/proto/exocore/reward/params.proto index 42b503560..c8b6f10f0 100644 --- a/proto/exocore/reward/params.proto +++ b/proto/exocore/reward/params.proto @@ -1,13 +1,11 @@ syntax = "proto3"; package exocore.reward; -import "gogoproto/gogo.proto"; - option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; // Params defines the parameters for the module. message Params { - string exoCoreLzAppAddress = 1; - string exoCoreLzAppEventTopic =2; + string exo_core_lz_app_address = 1; + string exo_core_lz_app_event_topic =2; } diff --git a/proto/exocore/reward/query.proto b/proto/exocore/reward/query.proto index b86e6db9c..c6d0076cc 100644 --- a/proto/exocore/reward/query.proto +++ b/proto/exocore/reward/query.proto @@ -1,9 +1,7 @@ syntax = "proto3"; package exocore.reward; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "exocore/reward/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; diff --git a/proto/exocore/reward/tx.proto b/proto/exocore/reward/tx.proto index 7eadaba52..0f73b582a 100644 --- a/proto/exocore/reward/tx.proto +++ b/proto/exocore/reward/tx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package exocore.reward; -import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; @@ -11,7 +10,8 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; // Msg defines the Msg service. service Msg { - rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + // UpdateParams updates the parameters for this module. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. diff --git a/proto/exocore/slash/params.proto b/proto/exocore/slash/params.proto index 954f75bbd..5a0788081 100644 --- a/proto/exocore/slash/params.proto +++ b/proto/exocore/slash/params.proto @@ -1,13 +1,11 @@ syntax = "proto3"; package exocore.slash; -import "gogoproto/gogo.proto"; - option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; // Params defines the parameters for the module. message Params { - string exoCoreLzAppAddress = 1; - string exoCoreLzAppEventTopic =2; + string exo_core_lz_app_address = 1; + string exo_core_lz_app_event_topic =2; } diff --git a/proto/exocore/slash/query.proto b/proto/exocore/slash/query.proto index 385e6aa2f..e42bb71ff 100644 --- a/proto/exocore/slash/query.proto +++ b/proto/exocore/slash/query.proto @@ -1,9 +1,7 @@ syntax = "proto3"; package exocore.slash; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/query/v1/query.proto"; import "exocore/slash/params.proto"; // this line is used by starport scaffolding # 1 diff --git a/proto/exocore/slash/tx.proto b/proto/exocore/slash/tx.proto index b1dc0a97d..ca071efac 100644 --- a/proto/exocore/slash/tx.proto +++ b/proto/exocore/slash/tx.proto @@ -10,7 +10,7 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; // Msg defines the Msg service. service Msg { - + // UpdateParams updates the parameters of this module. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } diff --git a/proto/exocore/withdraw/query.proto b/proto/exocore/withdraw/query.proto index b8c03dcf8..896c69d25 100644 --- a/proto/exocore/withdraw/query.proto +++ b/proto/exocore/withdraw/query.proto @@ -1,9 +1,7 @@ syntax = "proto3"; package exocore.withdraw; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "exocore/deposit/v1/deposit.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; diff --git a/proto/exocore/withdraw/tx.proto b/proto/exocore/withdraw/tx.proto index c97b62031..2053a854e 100644 --- a/proto/exocore/withdraw/tx.proto +++ b/proto/exocore/withdraw/tx.proto @@ -5,7 +5,6 @@ package exocore.withdraw; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "amino/amino.proto"; import "exocore/deposit/v1/deposit.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; @@ -27,9 +26,11 @@ message MsgUpdateParams { // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} +// Msg service defines the Msg service for this module. service Msg { option (cosmos.msg.v1.service) = true; + // UpdateParams updates the parameters of this module. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 2ee0bc8ad..4b11f9eb5 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -33,8 +33,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type DelegationInfoReq struct { - StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *DelegationInfoReq) Reset() { *m = DelegationInfoReq{} } @@ -85,8 +85,8 @@ func (m *DelegationInfoReq) GetAssetID() string { } type DelegationAmounts struct { - CanUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=CanUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"CanUndelegationAmount"` - WaitUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=WaitUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"WaitUndelegationAmount"` + CanUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=can_undelegation_amount,json=canUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_undelegation_amount"` + WaitUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=wait_undelegation_amount,json=waitUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount"` } func (m *DelegationAmounts) Reset() { *m = DelegationAmounts{} } @@ -123,8 +123,8 @@ func (m *DelegationAmounts) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationAmounts proto.InternalMessageInfo type QueryDelegationInfoResponse struct { - TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=TotalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalDelegatedAmount"` - DelegationInfos map[string]*DelegationAmounts `protobuf:"bytes,2,rep,name=delegationInfos,proto3" json:"delegationInfos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_delegated_amount,json=totalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_delegated_amount"` + DelegationInfos map[string]*DelegationAmounts `protobuf:"bytes,2,rep,name=delegation_infos,json=delegationInfos,proto3" json:"delegation_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryDelegationInfoResponse) Reset() { *m = QueryDelegationInfoResponse{} } @@ -168,9 +168,9 @@ func (m *QueryDelegationInfoResponse) GetDelegationInfos() map[string]*Delegatio } type SingleDelegationInfoReq struct { - StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` - OperatorAddr string `protobuf:"bytes,2,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` - AssetID string `protobuf:"bytes,3,opt,name=assetID,proto3" json:"assetID,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + OperatorAddr string `protobuf:"bytes,2,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + AssetID string `protobuf:"bytes,3,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *SingleDelegationInfoReq) Reset() { *m = SingleDelegationInfoReq{} } @@ -228,7 +228,7 @@ func (m *SingleDelegationInfoReq) GetAssetID() string { } type QueryOperatorInfoReq struct { - OperatorAddr string `protobuf:"bytes,1,opt,name=OperatorAddr,proto3" json:"OperatorAddr,omitempty"` + OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` } func (m *QueryOperatorInfoReq) Reset() { *m = QueryOperatorInfoReq{} } @@ -283,47 +283,50 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } var fileDescriptor_aab345e1cf20490c = []byte{ - // 630 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5f, 0x6b, 0xd3, 0x50, - 0x1c, 0xed, 0x4d, 0x9d, 0x7f, 0xee, 0x06, 0xba, 0x6b, 0xa7, 0x5d, 0x26, 0xd9, 0x8c, 0x30, 0xca, - 0xa4, 0x89, 0xab, 0x0a, 0x22, 0x55, 0xd8, 0xec, 0x18, 0x79, 0xd9, 0x30, 0x9b, 0x08, 0xbe, 0x48, - 0xd6, 0x5c, 0x63, 0x68, 0x7a, 0x6f, 0x9a, 0x7b, 0x5b, 0xdb, 0x57, 0x7d, 0xf1, 0x45, 0x10, 0xc4, - 0x2f, 0xe1, 0x93, 0x0f, 0xfd, 0x10, 0x7b, 0x1c, 0xf3, 0x45, 0x7c, 0x18, 0xd2, 0x0a, 0xbe, 0xfa, - 0x05, 0x04, 0x69, 0x92, 0x76, 0x69, 0x96, 0x6c, 0x0e, 0xf6, 0xd4, 0xdc, 0x9c, 0xd3, 0x73, 0x4e, - 0xee, 0xef, 0xe4, 0x06, 0xde, 0xc4, 0x6d, 0x5a, 0xa5, 0x1e, 0x56, 0x4d, 0xec, 0x60, 0xcb, 0xe0, - 0x36, 0x25, 0x6a, 0x6b, 0x59, 0x6d, 0x34, 0xb1, 0xd7, 0x51, 0x5c, 0x8f, 0x72, 0x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 0xa3, 0x3c, 0x59, 0x79, 0xfb, 0xed, - 0xd7, 0x27, 0xa1, 0x80, 0x16, 0xd5, 0xe4, 0xe3, 0x63, 0x1d, 0xf3, 0xb1, 0x04, 0x5f, 0x00, 0xbc, - 0x9a, 0xd0, 0x1d, 0x74, 0xf2, 0x50, 0x87, 0xb1, 0x4a, 0xa7, 0x6f, 0xa4, 0x7c, 0xff, 0xfd, 0xef, - 0xaf, 0x4b, 0xc0, 0x8f, 0xba, 0x84, 0x0a, 0xe9, 0x51, 0x63, 0xa1, 0xba, 0x00, 0xce, 0xfa, 0xb2, - 0x49, 0xcd, 0x41, 0x4a, 0x4a, 0x90, 0x94, 0x9a, 0x89, 0xff, 0xdd, 0x5b, 0xf9, 0xd1, 0x61, 0xdc, - 0x12, 0xba, 0x93, 0x12, 0x37, 0x35, 0xd8, 0xea, 0xc6, 0x6e, 0x4f, 0x02, 0x7b, 0x3d, 0x09, 0xfc, - 0xec, 0x49, 0xe0, 0x63, 0x5f, 0xca, 0xec, 0xf5, 0xa5, 0xcc, 0xf7, 0xbe, 0x94, 0x79, 0x71, 0x2f, - 0x72, 0x64, 0xac, 0x05, 0xaa, 0x1b, 0x98, 0xbf, 0xa1, 0x5e, 0x6d, 0x64, 0xd2, 0x8e, 0xda, 0xf8, - 0x87, 0xc8, 0xce, 0x79, 0xff, 0x03, 0x70, 0xf7, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x51, - 0x51, 0x30, 0xc8, 0x06, 0x00, 0x00, + // 678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x4f, 0x13, 0x4f, + 0x1c, 0xed, 0x2e, 0x7f, 0xfe, 0xc0, 0x80, 0x11, 0xc6, 0x02, 0xa5, 0x98, 0x2d, 0xae, 0x09, 0xa9, + 0x18, 0x76, 0xa5, 0x6a, 0x62, 0x8c, 0x98, 0x40, 0x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 0x98, 0x3a, 0x54, 0xc0, 0x8c, 0xa4, 0x8d, + 0x0b, 0x16, 0x34, 0x12, 0x8c, 0x24, 0xa4, 0x30, 0xfb, 0xd7, 0xb1, 0xd6, 0x97, 0xcf, 0xed, 0x16, + 0xe0, 0xbd, 0x04, 0xbb, 0x89, 0xc6, 0x56, 0x37, 0x8e, 0xda, 0x9a, 0x72, 0xdc, 0xd6, 0x94, 0xef, + 0x6d, 0x4d, 0x79, 0x77, 0xaa, 0xa5, 0x8e, 0x4f, 0xb5, 0xd4, 0xd7, 0x53, 0x2d, 0xf5, 0xe2, 0x41, + 0xe4, 0x4a, 0x59, 0x0b, 0x58, 0x37, 0xb0, 0xd8, 0xa7, 0xac, 0x72, 0x26, 0x72, 0x10, 0x95, 0x91, + 0x97, 0xcc, 0xf6, 0xff, 0xf2, 0x1b, 0x72, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x47, 0x12, + 0x54, 0x68, 0x0b, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -338,9 +341,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // OperatorInfo queries the operator information. QueryOperatorInfo(ctx context.Context, in *QueryOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) - // Balance queries the balance of a single coin for a single account. + // DelegationInfo queries the delegation information for {stakerID, assetID}. QueryDelegationInfo(ctx context.Context, in *DelegationInfoReq, opts ...grpc.CallOption) (*QueryDelegationInfoResponse, error) + // SingleDelegationInfo queries the single delegation information for + // {chain, staker, asset, operator}. QuerySingleDelegationInfo(ctx context.Context, in *SingleDelegationInfoReq, opts ...grpc.CallOption) (*DelegationAmounts, error) } @@ -381,9 +387,12 @@ func (c *queryClient) QuerySingleDelegationInfo(ctx context.Context, in *SingleD // QueryServer is the server API for Query service. type QueryServer interface { + // OperatorInfo queries the operator information. QueryOperatorInfo(context.Context, *QueryOperatorInfoReq) (*OperatorInfo, error) - // Balance queries the balance of a single coin for a single account. + // DelegationInfo queries the delegation information for {stakerID, assetID}. QueryDelegationInfo(context.Context, *DelegationInfoReq) (*QueryDelegationInfoResponse, error) + // SingleDelegationInfo queries the single delegation information for + // {chain, staker, asset, operator}. QuerySingleDelegationInfo(context.Context, *SingleDelegationInfoReq) (*DelegationAmounts, error) } diff --git a/x/delegation/types/tx.pb.go b/x/delegation/types/tx.pb.go index 06c0cdf48..757d67414 100644 --- a/x/delegation/types/tx.pb.go +++ b/x/delegation/types/tx.pb.go @@ -33,7 +33,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ValueField struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=Amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"Amount"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` } func (m *ValueField) Reset() { *m = ValueField{} } @@ -70,9 +70,9 @@ func (m *ValueField) XXX_DiscardUnknown() { var xxx_messageInfo_ValueField proto.InternalMessageInfo type DelegatedSingleAssetInfo struct { - AssetID string `protobuf:"bytes,1,opt,name=AssetID,proto3" json:"AssetID,omitempty"` - TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=TotalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalDelegatedAmount"` - PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,3,rep,name=PerOperatorAmounts,proto3" json:"PerOperatorAmounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AssetID string `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_delegated_amount,json=totalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_delegated_amount"` + PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,3,rep,name=per_operator_amounts,json=perOperatorAmounts,proto3" json:"per_operator_amounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *DelegatedSingleAssetInfo) Reset() { *m = DelegatedSingleAssetInfo{} } @@ -123,7 +123,7 @@ func (m *DelegatedSingleAssetInfo) GetPerOperatorAmounts() map[string]*ValueFiel } type ClientChainEarningAddrList struct { - EarningInfoList []*ClientChainEarningAddrInfo `protobuf:"bytes,1,rep,name=EarningInfoList,proto3" json:"EarningInfoList,omitempty"` + EarningInfoList []*ClientChainEarningAddrInfo `protobuf:"bytes,1,rep,name=earning_info_list,json=earningInfoList,proto3" json:"earning_info_list,omitempty"` } func (m *ClientChainEarningAddrList) Reset() { *m = ClientChainEarningAddrList{} } @@ -167,8 +167,8 @@ func (m *ClientChainEarningAddrList) GetEarningInfoList() []*ClientChainEarningA } type ClientChainEarningAddrInfo struct { - LzClientChainID uint64 `protobuf:"varint,1,opt,name=lzClientChainID,proto3" json:"lzClientChainID,omitempty"` - ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=clientChainEarningAddr,proto3" json:"clientChainEarningAddr,omitempty"` + LzClientChainID uint64 `protobuf:"varint,1,opt,name=lz_client_chain_id,json=lzClientChainId,proto3" json:"lz_client_chain_id,omitempty"` + ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=client_chain_earning_addr,json=clientChainEarningAddr,proto3" json:"client_chain_earning_addr,omitempty"` } func (m *ClientChainEarningAddrInfo) Reset() { *m = ClientChainEarningAddrInfo{} } @@ -219,10 +219,10 @@ func (m *ClientChainEarningAddrInfo) GetClientChainEarningAddr() string { } type OperatorInfo struct { - EarningsAddr string `protobuf:"bytes,1,opt,name=EarningsAddr,proto3" json:"EarningsAddr,omitempty"` - ApproveAddr string `protobuf:"bytes,2,opt,name=ApproveAddr,proto3" json:"ApproveAddr,omitempty"` - OperatorMetaInfo string `protobuf:"bytes,3,opt,name=OperatorMetaInfo,proto3" json:"OperatorMetaInfo,omitempty"` - ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=ClientChainEarningsAddr,proto3" json:"ClientChainEarningsAddr,omitempty"` + EarningsAddr string `protobuf:"bytes,1,opt,name=earnings_addr,json=earningsAddr,proto3" json:"earnings_addr,omitempty"` + ApproveAddr string `protobuf:"bytes,2,opt,name=approve_addr,json=approveAddr,proto3" json:"approve_addr,omitempty"` + OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` + ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=client_chain_earnings_addr,json=clientChainEarningsAddr,proto3" json:"client_chain_earnings_addr,omitempty"` } func (m *OperatorInfo) Reset() { *m = OperatorInfo{} } @@ -287,7 +287,7 @@ func (m *OperatorInfo) GetClientChainEarningsAddr() *ClientChainEarningAddrList } type RegisterOperatorReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` Info *OperatorInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } @@ -413,8 +413,8 @@ func (m *RegisterOperatorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorResponse proto.InternalMessageInfo type DelegationIncOrDecInfo struct { - FromAddress string `protobuf:"bytes,1,opt,name=fromAddress,proto3" json:"fromAddress,omitempty"` - PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,2,rep,name=perOperatorAmounts,proto3" json:"perOperatorAmounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,2,rep,name=per_operator_amounts,json=perOperatorAmounts,proto3" json:"per_operator_amounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *DelegationIncOrDecInfo) Reset() { *m = DelegationIncOrDecInfo{} } @@ -451,8 +451,8 @@ func (m *DelegationIncOrDecInfo) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationIncOrDecInfo proto.InternalMessageInfo type MsgDelegation struct { - BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=baseInfo,proto3" json:"baseInfo,omitempty"` - ApprovedInfo *DelegationApproveInfo `protobuf:"bytes,2,opt,name=approvedInfo,proto3" json:"approvedInfo,omitempty"` + BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=base_info,json=baseInfo,proto3" json:"base_info,omitempty"` + ApprovedInfo *DelegationApproveInfo `protobuf:"bytes,2,opt,name=approved_info,json=approvedInfo,proto3" json:"approved_info,omitempty"` } func (m *MsgDelegation) Reset() { *m = MsgDelegation{} } @@ -503,16 +503,16 @@ func (m *MsgDelegation) GetApprovedInfo() *DelegationApproveInfo { } type UndelegationRecord struct { - StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` - OperatorAddr string `protobuf:"bytes,3,opt,name=OperatorAddr,proto3" json:"OperatorAddr,omitempty"` - TxHash string `protobuf:"bytes,4,opt,name=txHash,proto3" json:"txHash,omitempty"` - IsPending bool `protobuf:"varint,5,opt,name=isPending,proto3" json:"isPending,omitempty"` - BlockNumber uint64 `protobuf:"varint,6,opt,name=BlockNumber,proto3" json:"BlockNumber,omitempty"` - CompleteBlockNumber uint64 `protobuf:"varint,7,opt,name=CompleteBlockNumber,proto3" json:"CompleteBlockNumber,omitempty"` - LzTxNonce uint64 `protobuf:"varint,8,opt,name=LzTxNonce,proto3" json:"LzTxNonce,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + OperatorAddr string `protobuf:"bytes,3,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + IsPending bool `protobuf:"varint,5,opt,name=is_pending,json=isPending,proto3" json:"is_pending,omitempty"` + BlockNumber uint64 `protobuf:"varint,6,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + CompleteBlockNumber uint64 `protobuf:"varint,7,opt,name=complete_block_number,json=completeBlockNumber,proto3" json:"complete_block_number,omitempty"` + LzTxNonce uint64 `protobuf:"varint,8,opt,name=lz_tx_nonce,json=lzTxNonce,proto3" json:"lz_tx_nonce,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - ActualCompletedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=actualCompletedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"actualCompletedAmount"` + ActualCompletedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=actual_completed_amount,json=actualCompletedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"actual_completed_amount"` } func (m *UndelegationRecord) Reset() { *m = UndelegationRecord{} } @@ -605,7 +605,7 @@ func (m *UndelegationRecord) GetLzTxNonce() uint64 { } type UndelegationRecordKeyList struct { - KeyList []string `protobuf:"bytes,1,rep,name=keyList,proto3" json:"keyList,omitempty"` + KeyList []string `protobuf:"bytes,1,rep,name=key_list,json=keyList,proto3" json:"key_list,omitempty"` } func (m *UndelegationRecordKeyList) Reset() { *m = UndelegationRecordKeyList{} } @@ -685,7 +685,7 @@ func (m *DelegationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationResponse proto.InternalMessageInfo type MsgUndelegation struct { - BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=baseInfo,proto3" json:"baseInfo,omitempty"` + BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=base_info,json=baseInfo,proto3" json:"base_info,omitempty"` } func (m *MsgUndelegation) Reset() { *m = MsgUndelegation{} } @@ -768,8 +768,8 @@ func init() { proto.RegisterType((*ValueField)(nil), "exocore.delegation.v1.ValueField") proto.RegisterType((*DelegatedSingleAssetInfo)(nil), "exocore.delegation.v1.DelegatedSingleAssetInfo") proto.RegisterMapType((map[string]*ValueField)(nil), "exocore.delegation.v1.DelegatedSingleAssetInfo.PerOperatorAmountsEntry") - proto.RegisterType((*ClientChainEarningAddrList)(nil), "exocore.delegation.v1.clientChainEarningAddrList") - proto.RegisterType((*ClientChainEarningAddrInfo)(nil), "exocore.delegation.v1.clientChainEarningAddrInfo") + proto.RegisterType((*ClientChainEarningAddrList)(nil), "exocore.delegation.v1.ClientChainEarningAddrList") + proto.RegisterType((*ClientChainEarningAddrInfo)(nil), "exocore.delegation.v1.ClientChainEarningAddrInfo") proto.RegisterType((*OperatorInfo)(nil), "exocore.delegation.v1.OperatorInfo") proto.RegisterType((*RegisterOperatorReq)(nil), "exocore.delegation.v1.RegisterOperatorReq") proto.RegisterType((*DelegationApproveInfo)(nil), "exocore.delegation.v1.DelegationApproveInfo") @@ -787,76 +787,83 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/tx.proto", fileDescriptor_16596a15a828f109) } var fileDescriptor_16596a15a828f109 = []byte{ - // 1090 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xf6, 0xc4, 0xf9, 0x2d, 0x07, 0x25, 0xf4, 0xe6, 0x67, 0x76, 0x40, 0x4e, 0x18, 0x60, 0x15, - 0x02, 0xb1, 0x49, 0x58, 0x58, 0x14, 0xed, 0x25, 0x7f, 0x0b, 0x16, 0x9b, 0x6c, 0x34, 0x1b, 0x38, - 0x00, 0x12, 0x9a, 0x8c, 0x3b, 0x93, 0xc1, 0xe3, 0xee, 0xa1, 0xbb, 0x9d, 0xb5, 0xf7, 0x80, 0x10, - 0x27, 0xe0, 0xc4, 0x23, 0xec, 0x03, 0x70, 0xc8, 0x61, 0x1f, 0x80, 0xe3, 0x1e, 0x57, 0x7b, 0x42, - 0x48, 0xac, 0x50, 0x72, 0x08, 0x17, 0x1e, 0x00, 0x4e, 0x68, 0xba, 0xdb, 0x9e, 0x71, 0xec, 0x21, - 0x44, 0x8a, 0xc4, 0x25, 0x99, 0xae, 0xaa, 0xfe, 0xbe, 0xea, 0xaa, 0xea, 0xaa, 0x36, 0x14, 0x71, - 0x93, 0x7a, 0x94, 0xe1, 0x72, 0x15, 0x87, 0xd8, 0x77, 0x45, 0x40, 0x49, 0xf9, 0x68, 0xb9, 0x2c, - 0x9a, 0xa5, 0x88, 0x51, 0x41, 0xd1, 0xb4, 0xd6, 0x97, 0x12, 0x7d, 0xe9, 0x68, 0xd9, 0x9a, 0xf5, - 0x28, 0xaf, 0x53, 0x5e, 0xae, 0x73, 0x3f, 0x36, 0xaf, 0x73, 0x5f, 0xd9, 0x5b, 0xd7, 0x95, 0xe2, - 0x0b, 0xb9, 0x2a, 0xab, 0x85, 0x56, 0x4d, 0xf9, 0xd4, 0xa7, 0x4a, 0x1e, 0x7f, 0x69, 0xe9, 0x8b, - 0x6e, 0x3d, 0x20, 0xb4, 0x2c, 0xff, 0x2a, 0x91, 0xbd, 0x0f, 0xf0, 0x89, 0x1b, 0x36, 0xf0, 0x9d, - 0x00, 0x87, 0x55, 0xb4, 0x07, 0xc3, 0x6b, 0x75, 0xda, 0x20, 0xc2, 0x34, 0xe6, 0x8d, 0x85, 0xb1, - 0xf5, 0xdb, 0x4f, 0x9e, 0xcf, 0xe5, 0x7e, 0x7d, 0x3e, 0x77, 0xc3, 0x0f, 0xc4, 0x61, 0x63, 0xbf, - 0xe4, 0xd1, 0xba, 0xe6, 0xd1, 0xff, 0x96, 0x78, 0xb5, 0x56, 0x16, 0xad, 0x08, 0xf3, 0x52, 0x85, - 0x88, 0x67, 0x8f, 0x97, 0x40, 0xbb, 0x51, 0x21, 0xc2, 0xd1, 0x58, 0xf6, 0xf7, 0x79, 0x30, 0x37, - 0xd5, 0x91, 0x70, 0xf5, 0x7e, 0x40, 0xfc, 0x10, 0xaf, 0x71, 0x8e, 0x45, 0x85, 0x1c, 0x50, 0x64, - 0xc2, 0x88, 0x5a, 0x6c, 0x2a, 0x4e, 0xa7, 0xbd, 0x44, 0x11, 0x4c, 0xed, 0x51, 0xe1, 0x86, 0x9d, - 0xad, 0xda, 0xb5, 0x81, 0x2b, 0x70, 0xad, 0x2f, 0x32, 0x7a, 0x00, 0x68, 0x17, 0xb3, 0x7b, 0x11, - 0x66, 0xae, 0xa0, 0x4c, 0x09, 0xb9, 0x99, 0x9f, 0xcf, 0x2f, 0x14, 0x56, 0x3e, 0x28, 0xf5, 0xcd, - 0x4e, 0x29, 0xeb, 0x60, 0xa5, 0x5e, 0xa4, 0x2d, 0x22, 0x58, 0xcb, 0xe9, 0x43, 0x61, 0x1d, 0xc2, - 0x6c, 0x86, 0x39, 0x9a, 0x84, 0x7c, 0x0d, 0xb7, 0x74, 0x6c, 0xe2, 0x4f, 0x74, 0x0b, 0x86, 0x8e, - 0xe2, 0x94, 0xc9, 0x40, 0x14, 0x56, 0x5e, 0xc9, 0x70, 0x2c, 0x49, 0xab, 0xa3, 0xec, 0x57, 0x07, - 0xde, 0x37, 0xec, 0x16, 0x58, 0x5e, 0x18, 0x60, 0x22, 0x36,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 0xe9, 0x7c, 0x0e, - 0x13, 0xdb, 0xdc, 0x4f, 0xe3, 0x5d, 0x61, 0xe5, 0xdb, 0x33, 0x30, 0xd5, 0xed, 0xaa, 0x62, 0x5d, - 0xf9, 0x6d, 0x00, 0xf2, 0xdb, 0xdc, 0x47, 0x14, 0x26, 0xcf, 0xb7, 0x43, 0xb4, 0x98, 0x41, 0xd6, - 0x67, 0x88, 0x58, 0xe5, 0xff, 0x6c, 0xab, 0x88, 0xd1, 0x97, 0x30, 0xdb, 0x7e, 0x2a, 0xc9, 0x37, - 0xd2, 0x1e, 0xed, 0xf0, 0xbe, 0x96, 0x81, 0xd5, 0xd5, 0x16, 0xac, 0x37, 0x2e, 0x0c, 0x45, 0x87, - 0x8b, 0xc1, 0x4b, 0x9d, 0xc3, 0x2b, 0xb6, 0x78, 0xe0, 0x74, 0xf8, 0x6e, 0x64, 0xf3, 0xa5, 0x63, - 0x66, 0xbd, 0x99, 0x61, 0xd7, 0x2f, 0xb0, 0xd6, 0xd0, 0x37, 0x67, 0xc7, 0x8b, 0xc6, 0xfa, 0xce, - 0x93, 0x93, 0xa2, 0xf1, 0xf4, 0xa4, 0x68, 0xfc, 0x7e, 0x52, 0x34, 0x7e, 0x3c, 0x2d, 0xe6, 0x9e, - 0x9e, 0x16, 0x73, 0xbf, 0x9c, 0x16, 0x73, 0x9f, 0xde, 0x4c, 0x55, 0xe2, 0x96, 0xc2, 0xdd, 0xc1, - 0xe2, 0x01, 0x65, 0xb5, 0x72, 0xfb, 0x77, 0x41, 0x33, 0xfd, 0xcb, 0x40, 0xd6, 0xe6, 0xfe, 0xb0, - 0x7c, 0xa6, 0xbf, 0xf3, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0xf9, 0x36, 0xba, 0x3c, 0x0c, - 0x00, 0x00, + // 1205 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xc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0x61, + 0x6e, 0x08, 0x54, 0x02, 0xa5, 0x49, 0x11, 0x04, 0x2e, 0xcc, 0x88, 0x8a, 0xbf, 0x58, 0x29, 0xfc, + 0xcc, 0x6b, 0x85, 0x83, 0x51, 0x8b, 0x00, 0xd4, 0x5f, 0x14, 0x38, 0xa9, 0x61, 0xdb, 0x61, 0x3c, + 0xea, 0x3f, 0x0d, 0x7f, 0x89, 0xde, 0x81, 0xdc, 0x8e, 0x47, 0x3b, 0x02, 0x16, 0x33, 0x16, 0x0c, + 0x6b, 0xf1, 0xf1, 0x83, 0xd5, 0x7c, 0x30, 0x48, 0xeb, 0x92, 0x73, 0x8b, 0x7b, 0x0e, 0xb1, 0xb5, + 0xac, 0x2f, 0x1d, 0x90, 0xd0, 0x65, 0x98, 0x11, 0x41, 0xca, 0x06, 0x3d, 0x33, 0xc5, 0xdd, 0x78, + 0xb6, 0x35, 0xa1, 0x70, 0xe5, 0xd2, 0xb7, 0xf7, 0x2a, 0x89, 0x3f, 0xef, 0x55, 0x12, 0xdf, 0x3c, + 0xbd, 0xbf, 0x92, 0xbd, 0x16, 0x99, 0xfc, 0xee, 0xe9, 0xfd, 0x95, 0x42, 0x6c, 0xb2, 0xe3, 0xba, + 0x6a, 0x03, 0x16, 0xeb, 0x23, 0xcb, 0xeb, 0x32, 0xf5, 0x22, 0x99, 0x2f, 0x43, 0x86, 0x39, 0x36, + 0x31, 0x78, 0xcf, 0xc3, 0x41, 0xf9, 0x22, 0x02, 0x42, 0x30, 0xc3, 0x0c, 0x37, 0xd8, 0x28, 0x9a, + 0x78, 0x56, 0x4b, 0x50, 0x3c, 0x98, 0x0d, 0xd6, 0xa5, 0x84, 0x61, 0xf5, 0xef, 0x24, 0x2c, 0x45, + 0x38, 0x0d, 0x62, 0xde, 0xf0, 0xea, 0xd8, 0x14, 0x40, 0xff, 0x29, 0x5b, 0x77, 0xa7, 0xec, 0x9d, + 0xa4, 0x98, 0xbb, 0xcd, 0xe7, 0xef, 0x9d, 0x67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5, 0x08, 0xcb, 0x83, 0x97, 0x46, 0xc1, 0x4b, 0x34, 0xff, 0x78, 0x1a, 0xe1, 0x9d, 0x9d, + 0x8e, 0x17, 0xcf, 0x59, 0xe9, 0xf5, 0x29, 0x72, 0x93, 0x12, 0x5b, 0x3a, 0xf6, 0xf5, 0xd3, 0xfb, + 0x2b, 0xca, 0xc6, 0xf6, 0xc3, 0x61, 0x59, 0x79, 0x34, 0x2c, 0x2b, 0x7f, 0x0c, 0xcb, 0xca, 0xf7, + 0x4f, 0xca, 0x89, 0x47, 0x4f, 0xca, 0x89, 0x5f, 0x9f, 0x94, 0x13, 0x9f, 0x5f, 0x8a, 0xf5, 0xe2, + 0xa6, 0xb4, 0xbb, 0x8d, 0xf9, 0x5d, 0xea, 0xb5, 0x6b, 0xe1, 0xd7, 0x47, 0x3f, 0xfe, 0xfd, 0x21, + 0xba, 0xb3, 0x39, 0x2b, 0x3e, 0x06, 0xde, 0xf8, 0x27, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x02, 0xa2, + 0x16, 0xa2, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -871,9 +878,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) + // DelegateAssetToOperator delegates asset to operator. DelegateAssetToOperator(ctx context.Context, in *MsgDelegation, opts ...grpc.CallOption) (*DelegationResponse, error) + // UndelegateAssetFromOperator undelegates asset from operator. UndelegateAssetFromOperator(ctx context.Context, in *MsgUndelegation, opts ...grpc.CallOption) (*UndelegationResponse, error) } @@ -914,9 +923,11 @@ func (c *msgClient) UndelegateAssetFromOperator(ctx context.Context, in *MsgUnde // MsgServer is the server API for Msg service. type MsgServer interface { - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. RegisterOperator(context.Context, *RegisterOperatorReq) (*RegisterOperatorResponse, error) + // DelegateAssetToOperator delegates asset to operator. DelegateAssetToOperator(context.Context, *MsgDelegation) (*DelegationResponse, error) + // UndelegateAssetFromOperator undelegates asset from operator. UndelegateAssetFromOperator(context.Context, *MsgUndelegation) (*UndelegationResponse, error) } @@ -2291,10 +2302,10 @@ func (m *ClientChainEarningAddrList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: clientChainEarningAddrList: wiretype end group for non-group") + return fmt.Errorf("proto: ClientChainEarningAddrList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: clientChainEarningAddrList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClientChainEarningAddrList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2375,10 +2386,10 @@ func (m *ClientChainEarningAddrInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: clientChainEarningAddrInfo: wiretype end group for non-group") + return fmt.Errorf("proto: ClientChainEarningAddrInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: clientChainEarningAddrInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClientChainEarningAddrInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/deposit/types/deposit.pb.go b/x/deposit/types/deposit.pb.go index 584a21388..7dd66f3bb 100644 --- a/x/deposit/types/deposit.pb.go +++ b/x/deposit/types/deposit.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the restaking_assets_manage module's genesis state. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exoCoreLzAppAddress,proto3" json:"exoCoreLzAppAddress,omitempty"` - ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exoCoreLzAppEventTopic,proto3" json:"exoCoreLzAppEventTopic,omitempty"` + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exocore_lz_app_address,json=exocoreLzAppAddress,proto3" json:"exocore_lz_app_address,omitempty"` + ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exocore_lz_app_event_topic,json=exocoreLzAppEventTopic,proto3" json:"exocore_lz_app_event_topic,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -83,20 +83,23 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/deposit.proto", fileDescriptor_bb743e1548b62476) } var fileDescriptor_bb743e1548b62476 = []byte{ - // 205 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0x84, 0x31, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x84, 0xa0, 0x2a, 0xf4, 0x60, 0xc2, 0x65, 0x86, 0x52, - 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x69, 0x7d, 0x10, 0x0b, 0xa2, 0x52, 0xa9, 0x88, 0x8b, 0x2d, - 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, 0x80, 0x4b, 0x38, 0xb5, 0x22, 0xdf, 0x39, 0xbf, 0x28, - 0xd5, 0xa7, 0xca, 0xb1, 0xa0, 0xc0, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, - 0x51, 0x83, 0x33, 0x08, 0x9b, 0x94, 0x90, 0x19, 0x97, 0x18, 0xb2, 0xb0, 0x6b, 0x59, 0x6a, 0x5e, - 0x49, 0x48, 0x7e, 0x41, 0x66, 0xb2, 0x04, 0x13, 0x58, 0x13, 0x0e, 0x59, 0x27, 0xef, 0x13, 0x8f, - 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, - 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, - 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0x85, 0x78, 0xc1, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, - 0xe6, 0xe7, 0x0a, 0xb8, 0xaf, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xfe, 0x30, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x87, 0x19, 0xe5, 0x20, 0x15, 0x01, 0x00, 0x00, + 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x69, 0x7d, 0x10, 0x0b, 0xa2, 0x52, 0x69, 0x1d, 0x23, 0x17, + 0x5b, 0x40, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x90, 0x0f, 0x97, 0x18, 0x54, 0x5b, 0x7c, 0x4e, 0x55, + 0x7c, 0x62, 0x41, 0x41, 0x7c, 0x62, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, + 0x06, 0xa7, 0x93, 0xf8, 0xa3, 0x7b, 0xf2, 0xc2, 0xae, 0x15, 0xf9, 0xce, 0xf9, 0x45, 0xa9, 0x3e, + 0x55, 0x8e, 0x05, 0x05, 0x8e, 0x10, 0xe9, 0x20, 0x61, 0xa8, 0x36, 0x64, 0x41, 0xa1, 0x30, 0x2e, + 0x29, 0x34, 0xd3, 0x52, 0xcb, 0x52, 0xf3, 0x4a, 0xe2, 0x4b, 0xf2, 0x0b, 0x32, 0x93, 0x25, 0x98, + 0xc0, 0x26, 0x4a, 0x3d, 0xba, 0x27, 0x2f, 0x86, 0x6c, 0xa2, 0x2b, 0x48, 0x49, 0x08, 0x48, 0x45, + 0x90, 0x18, 0xb2, 0xa1, 0x08, 0x71, 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, + 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, + 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0x85, + 0x68, 0xf6, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x87, 0x05, 0x58, 0x05, 0x3c, 0xc8, 0x4a, + 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x81, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xfc, + 0x66, 0x03, 0x60, 0x52, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/deposit/types/query.pb.go b/x/deposit/types/query.pb.go index 5647536a0..a13c1ed80 100644 --- a/x/deposit/types/query.pb.go +++ b/x/deposit/types/query.pb.go @@ -6,9 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -122,26 +119,24 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/query.proto", fileDescriptor_715f16e6b5833923) } var fileDescriptor_715f16e6b5833923 = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4b, 0xfc, 0x30, - 0x18, 0xc6, 0x9b, 0x3f, 0xfc, 0x3b, 0xc4, 0x2d, 0xde, 0xa0, 0xf1, 0x08, 0x47, 0x07, 0x75, 0x4a, - 0x68, 0xfd, 0x06, 0x82, 0x83, 0x08, 0xa2, 0x8e, 0x2e, 0xd2, 0xab, 0xa1, 0x16, 0x6d, 0xdf, 0x5c, - 0x93, 0x9e, 0x77, 0x83, 0x8b, 0x83, 0xb3, 0xe0, 0x97, 0x72, 0x3c, 0x70, 0x71, 0x94, 0xd6, 0x0f, - 0x22, 0x97, 0xc4, 0x03, 0xbd, 0x82, 0x5b, 0xf2, 0xfe, 0x9e, 0xe7, 0xc9, 0xf3, 0x06, 0x33, 0x39, - 0x83, 0x0c, 0x6a, 0x29, 0xae, 0xa5, 0x02, 0x5d, 0x18, 0x31, 0x8d, 0xc5, 0xa4, 0x91, 0xf5, 0x9c, - 0xab, 0x1a, 0x0c, 0x10, 0xe2, 0x39, 0xf7, 0x9c, 0x4f, 0x63, 0x3a, 0xc8, 0x21, 0x07, 0x8b, 0xc5, - 0xf2, 0xe4, 0x94, 0x74, 0x98, 0x03, 0xe4, 0x77, 0x52, 0xa4, 0xaa, 0x10, 0x69, 0x55, 0x81, 0x49, - 0x4d, 0x01, 0x95, 0xf6, 0x74, 0x27, 0x03, 0x5d, 0x82, 0x76, 0xd9, 0xbf, 0x1e, 0xa1, 0xdb, 0x0e, - 0x5e, 0xb9, 0x4c, 0x77, 0xf1, 0x68, 0xd4, 0xd3, 0xef, 0xbb, 0x8a, 0x55, 0x44, 0x03, 0x4c, 0xce, - 0x97, 0x59, 0x67, 0x69, 0x9d, 0x96, 0xfa, 0x42, 0x4e, 0x1a, 0xa9, 0x4d, 0x74, 0x8c, 0x37, 0x7f, - 0x4c, 0xb5, 0x82, 0x4a, 0x4b, 0x92, 0xe0, 0x50, 0xd9, 0xc9, 0x16, 0x1a, 0xa1, 0xfd, 0x8d, 0x84, - 0xf2, 0xf5, 0xfd, 0xb8, 0xf7, 0x78, 0x65, 0xf2, 0x84, 0xf0, 0x7f, 0x9b, 0x45, 0x1e, 0x70, 0xe8, - 0x18, 0xd9, 0xed, 0xf3, 0xad, 0xd7, 0xa0, 0x7b, 0x7f, 0xea, 0x5c, 0xb1, 0x28, 0x7a, 0x7c, 0xfb, - 0x7c, 0xf9, 0x37, 0x24, 0x54, 0xf4, 0x2c, 0xec, 0xb4, 0x87, 0x27, 0xaf, 0x2d, 0x43, 0x8b, 0x96, - 0xa1, 0x8f, 0x96, 0xa1, 0xe7, 0x8e, 0x05, 0x8b, 0x8e, 0x05, 0xef, 0x1d, 0x0b, 0x2e, 0xe3, 0xbc, - 0x30, 0x37, 0xcd, 0x98, 0x67, 0x50, 0x8a, 0x23, 0xe7, 0x3f, 0x95, 0xe6, 0x1e, 0xea, 0xdb, 0x55, - 0xdc, 0x6c, 0x15, 0x68, 0xe6, 0x4a, 0xea, 0x71, 0x68, 0x7f, 0xef, 0xe0, 0x2b, 0x00, 0x00, 0xff, - 0xff, 0x5f, 0x20, 0xfd, 0x7d, 0x01, 0x02, 0x00, 0x00, + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, + 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xeb, 0x41, + 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x64, 0xd2, 0xf3,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37, 0xb0, + 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x7a, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x83, 0x9e, 0x93, 0xef, 0xb3, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/deposit/types/tx.pb.go b/x/deposit/types/tx.pb.go index f5cb2ac2e..89a03e49b 100644 --- a/x/deposit/types/tx.pb.go +++ b/x/deposit/types/tx.pb.go @@ -8,7 +8,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -135,29 +134,28 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/tx.proto", fileDescriptor_d4939a0226905392) } var fileDescriptor_d4939a0226905392 = []byte{ - // 339 bytes of a gzipped FileDescriptorProto + // 329 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4a, 0xea, 0x41, 0x25, 0xf5, 0xca, 0x0c, 0xa5, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0x41, 0x6a, 0x73, 0x8b, 0xd3, 0x21, 0x8a, 0xa5, 0x24, 0x21, 0x12, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x95, 0x12, - 0x49, 0xcf, 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x50, 0x51, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, - 0x7d, 0x30, 0x09, 0x15, 0x52, 0xc0, 0xe2, 0x1a, 0x98, 0xdd, 0x60, 0x15, 0x4a, 0x93, 0x19, 0xb9, - 0xf8, 0x7d, 0x8b, 0xd3, 0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x03, 0x12, 0x8b, 0x12, 0x73, 0x8b, - 0x85, 0xcc, 0xb8, 0x38, 0x13, 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, - 0x18, 0x35, 0x38, 0x9d, 0x24, 0x2e, 0x6d, 0xd1, 0x15, 0x81, 0xba, 0xc1, 0x31, 0x25, 0xa5, 0x28, - 0xb5, 0xb8, 0x38, 0xb8, 0xa4, 0x28, 0x33, 0x2f, 0x3d, 0x08, 0xa1, 0x54, 0xc8, 0x82, 0x8b, 0xad, - 0x00, 0x6c, 0x82, 0x04, 0x93, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x94, 0x1e, 0xa6, 0x7f, 0xf5, 0x20, - 0x76, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x6f, 0xc5, 0xd7, 0xf4, 0x7c, 0x83, - 0x16, 0xc2, 0x24, 0x25, 0x49, 0x2e, 0x71, 0x34, 0x47, 0x05, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, - 0xa7, 0x1a, 0xe5, 0x71, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x25, 0x70, 0xf1, 0xa0, 0xb8, 0x59, 0x19, - 0x9b, 0x5d, 0x68, 0x66, 0x48, 0x69, 0x13, 0xa1, 0x08, 0x66, 0x91, 0x14, 0x6b, 0xc3, 0xf3, 0x0d, - 0x5a, 0x8c, 0x4e, 0xde, 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, 0x98, - 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x0a, 0x31, 0xd7, 0x2f, 0xb5, - 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0x16, 0xec, 0x15, 0xf0, 0x80, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, - 0x4e, 0x62, 0x03, 0x07, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x32, 0xea, 0x25, 0xb9, 0x26, - 0x02, 0x00, 0x00, + 0x49, 0xcf, 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x50, 0x51, 0x05, 0x2c, 0x56, 0xc3, 0x2c, 0x02, + 0xab, 0x50, 0x9a, 0xcc, 0xc8, 0xc5, 0xef, 0x5b, 0x9c, 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, + 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0x64, 0xc6, 0xc5, 0x99, 0x58, 0x5a, 0x92, 0x91, 0x5f, 0x94, + 0x59, 0x52, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0x71, 0x69, 0x8b, 0xae, 0x08, 0xd4, + 0x42, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x84, + 0x52, 0x21, 0x0b, 0x2e, 0xb6, 0x02, 0xb0, 0x09, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, + 0x7a, 0x98, 0x9e, 0xd3, 0x83, 0xd8, 0xe1, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0xbd, + 0x15, 0x5f, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0x93, 0x94, 0x24, 0xb9, 0xc4, 0xd1, 0x1c, 0x15, 0x94, + 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, 0x94, 0xc7, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x94, 0xc0, + 0xc5, 0x83, 0xe2, 0x66, 0x65, 0x6c, 0x76, 0xa1, 0x99, 0x21, 0xa5, 0x4d, 0x84, 0x22, 0x98, 0x45, + 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, + 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, + 0x2b, 0xc4, 0x5c, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x58, 0xb0, 0x57, 0xc0, 0x03, + 0xbe, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0xe8, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xe6, 0xe4, 0x92, 0x15, 0x13, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -172,6 +170,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // UpdateParams updates the parameters of the deposit module. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -194,6 +193,7 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // UpdateParams updates the parameters of the deposit module. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } diff --git a/x/native_token/types/tx.pb.go b/x/native_token/types/tx.pb.go index 16e996410..7f23bb815 100644 --- a/x/native_token/types/tx.pb.go +++ b/x/native_token/types/tx.pb.go @@ -7,7 +7,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -26,24 +25,32 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ValidatorStatus is the status of the validator. type ValidatorInfo_ValidatorStatus int32 const ( - ValidatorInfo_ACTIVE ValidatorInfo_ValidatorStatus = 0 - ValidatorInfo_INACTIVE ValidatorInfo_ValidatorStatus = 1 - ValidatorInfo_WITHDRAWN ValidatorInfo_ValidatorStatus = 2 + // UNSPECIFIED is the default status of a validator. + ValidatorInfo_ValidatorInfo_UNSPECIFIED ValidatorInfo_ValidatorStatus = 0 + // ACTIVE is the status of a validator that is currently validating. + ValidatorInfo_ValidatorInfo_ACTIVE ValidatorInfo_ValidatorStatus = 1 + // INACTIVE is the status of a validator that is not currently validating. + ValidatorInfo_ValidatorInfo_INACTIVE ValidatorInfo_ValidatorStatus = 2 + // WITHDRAWN is the status of a validator that has withdrawn from the network. + ValidatorInfo_ValidatorInfo_WITHDRAWN ValidatorInfo_ValidatorStatus = 3 ) var ValidatorInfo_ValidatorStatus_name = map[int32]string{ - 0: "ACTIVE", - 1: "INACTIVE", - 2: "WITHDRAWN", + 0: "VALIDATOR_STATUS_UNSPECIFIED", + 1: "VALIDATOR_STATUS_ACTIVE", + 2: "VALIDATOR_STATUS_INACTIVE", + 3: "VALIDATOR_STATUS_WITHDRAWN", } var ValidatorInfo_ValidatorStatus_value = map[string]int32{ - "ACTIVE": 0, - "INACTIVE": 1, - "WITHDRAWN": 2, + "VALIDATOR_STATUS_UNSPECIFIED": 0, + "VALIDATOR_STATUS_ACTIVE": 1, + "VALIDATOR_STATUS_INACTIVE": 2, + "VALIDATOR_STATUS_WITHDRAWN": 3, } func (x ValidatorInfo_ValidatorStatus) String() string { @@ -55,10 +62,10 @@ func (ValidatorInfo_ValidatorStatus) EnumDescriptor() ([]byte, []int) { } type ValidatorInfo struct { - Status ValidatorInfo_ValidatorStatus `protobuf:"varint,1,opt,name=Status,proto3,enum=exocore.native_token.v1.ValidatorInfo_ValidatorStatus" json:"Status,omitempty"` - ValidatorIndex uint64 `protobuf:"varint,2,opt,name=ValidatorIndex,proto3" json:"ValidatorIndex,omitempty"` - StakedBalanceGwei github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=StakedBalanceGwei,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"StakedBalanceGwei"` - MostRecentBalanceUpdateBlockNumber uint64 `protobuf:"varint,4,opt,name=MostRecentBalanceUpdateBlockNumber,proto3" json:"MostRecentBalanceUpdateBlockNumber,omitempty"` + Status ValidatorInfo_ValidatorStatus `protobuf:"varint,1,opt,name=status,proto3,enum=exocore.native_token.v1.ValidatorInfo_ValidatorStatus" json:"status,omitempty"` + ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + StakedBalanceGwei github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=staked_balance_gwei,json=stakedBalanceGwei,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"staked_balance_gwei"` + MostRecentBalanceUpdateBlockNumber uint64 `protobuf:"varint,4,opt,name=most_recent_balance_update_block_number,json=mostRecentBalanceUpdateBlockNumber,proto3" json:"most_recent_balance_update_block_number,omitempty"` } func (m *ValidatorInfo) Reset() { *m = ValidatorInfo{} } @@ -98,7 +105,7 @@ func (m *ValidatorInfo) GetStatus() ValidatorInfo_ValidatorStatus { if m != nil { return m.Status } - return ValidatorInfo_ACTIVE + return ValidatorInfo_ValidatorInfo_UNSPECIFIED } func (m *ValidatorInfo) GetValidatorIndex() uint64 { @@ -116,10 +123,10 @@ func (m *ValidatorInfo) GetMostRecentBalanceUpdateBlockNumber() uint64 { } type NativeTokenStakerInfo struct { - TotalValidatorBalances github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=TotalValidatorBalances,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalValidatorBalances"` - UnStakedValueFromPOS github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=UnStakedValueFromPOS,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"UnStakedValueFromPOS"` - PodAddress string `protobuf:"bytes,3,opt,name=PodAddress,proto3" json:"PodAddress,omitempty"` - ValidatorsInfo map[string]*ValidatorInfo `protobuf:"bytes,4,rep,name=ValidatorsInfo,proto3" json:"ValidatorsInfo,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + TotalValidatorBalances github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_validator_balances,json=totalValidatorBalances,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_validator_balances"` + UnStakedValueFromPOS github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=unstaked_value_from_pos,json=unstakedValueFromPos,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"unstaked_value_from_pos"` + PodAddress string `protobuf:"bytes,3,opt,name=pod_address,json=podAddress,proto3" json:"pod_address,omitempty"` + ValidatorsInfo map[string]*ValidatorInfo `protobuf:"bytes,4,rep,name=validators_info,json=validatorsInfo,proto3" json:"validators_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *NativeTokenStakerInfo) Reset() { *m = NativeTokenStakerInfo{} } @@ -179,41 +186,50 @@ func init() { func init() { proto.RegisterFile("exocore/native_token/v1/tx.proto", fileDescriptor_769c53c072051eb9) } var fileDescriptor_769c53c072051eb9 = []byte{ - // 534 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0x93, 0x12, 0xd1, 0x29, 0x2d, 0x61, 0x29, 0x34, 0xe4, 0xe0, 0x46, 0x39, 0x44, 0xb9, - 0xd4, 0x56, 0x83, 0x54, 0xa1, 0xaa, 0x97, 0x18, 0x02, 0xf8, 0x80, 0x89, 0x9c, 0x34, 0x95, 0xb8, - 0x54, 0x1b, 0x7b, 0x31, 0xae, 0x7f, 0x36, 0xf2, 0x6e, 0xd2, 0xe4, 0x2d, 0x78, 0x18, 0x1e, 0xa2, - 0xc7, 0x8a, 0x13, 0xe2, 0x50, 0xa1, 0xe4, 0x1d, 0xb8, 0x82, 0xec, 0x35, 0xe0, 0x84, 0x44, 0xaa, - 0xd4, 0xd3, 0xee, 0xfc, 0x7c, 0xdf, 0xce, 0x7c, 0xb3, 0xbb, 0x50, 0x25, 0x13, 0x6a, 0xd1, 0x88, - 0xa8, 0x21, 0xe6, 0xee, 0x98, 0x9c, 0x73, 0xea, 0x91, 0x50, 0x1d, 0x1f, 0xaa, 0x7c, 0xa2, 0x0c, - 0x23, 0xca, 0x29, 0xda, 0x4b, 0x33, 0x94, 0x6c, 0x86, 0x32, 0x3e, 0xac, 0xec, 0x59, 0x94, 0x05, - 0x94, 0xa9, 0x01, 0x73, 0x62, 0x40, 0xc0, 0x1c, 0x81, 0xa8, 0x3c, 0x13, 0x81, 0xf3, 0xc4, 0x52, - 0x85, 0x91, 0x86, 0x76, 0x1d, 0xea, 0x50, 0xe1, 0x8f, 0x77, 0xc2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f3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x55, - 0x62, 0x2e, 0x5a, 0x04, 0x00, 0x00, + // 680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xda, 0x4a, + 0x18, 0xc5, 0xc0, 0x8d, 0x94, 0x89, 0x6e, 0xc2, 0x9d, 0x70, 0x03, 0xf1, 0xbd, 0x05, 0x8b, 0x45, + 0xc2, 0x26, 0xa0, 0xa4, 0x6a, 0xd4, 0x9f, 0x48, 0x15, 0x24, 0xa4, 0xb5, 0x54, 0x39, 0x91, 0x6d, + 0x88, 0xd4, 0xcd, 0xc8, 0xe0, 0x09, 0xb5, 0x0c, 0x1e, 0xe4, 0x19, 0x1c, 0xb2, 0xec, 0x96, 0x6e, + 0xba, 0xea, 0x8e, 0xb7, 0xe8, 0x43, 0x64, 0xd7, 0xa8, 0xab, 0xaa, 0x8b, 0xa8, 0x22, 0x2f, 0x52, + 0x79, 0xc6, 0x04, 0xc8, 0x8f, 0xd4, 0xaa, 0x2b, 0x7b, 0x66, 0xce, 0x39, 0x33, 0x73, 0xe6, 0x7c, + 0x1f, 0x50, 0xf0, 0x80, 0xb4, 0x88, 0x8f, 0xcb, 0x9e, 0xc5, 0x9c, 0x00, 0x23, 0x46, 0x5c, 0xec, + 0x95, 0x83, 0xed, 0x32, 0x1b, 0x94, 0x7a, 0x3e, 0x61, 0x04, 0x66, 0x22, 0x44, 0x69, 0x16, 0x51, + 0x0a, 0xb6, 0xe5, 0xf5, 0x16, 0xa1, 0x5d, 0x42, 0x11, 0x87, 0x95, 0xc5, 0x40, 0x70, 0xe4, 0x74, + 0x9b, 0xb4, 0x89, 0x98, 0x0f, 0xff, 0xc4, 0x6c, 0xe1, 0x4b, 0x12, 0xfc, 0xdd, 0xb0, 0x3a, 0x8e, + 0x6d, 0x31, 0xe2, 0xab, 0xde, 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42, 0x61, 0x1e, 0x2c, 0xf5, 0x88, 0x8d, 0x2c, 0xdb, 0xf6, 0x31, 0xa5, 0x22, 0xde, 0x3a, 0xe8, + 0x11, 0xbb, 0x22, 0x66, 0xa0, 0x3b, 0x53, 0x30, 0x14, 0x39, 0xde, 0x29, 0xc9, 0x26, 0x95, 0x44, + 0x71, 0x69, 0xa7, 0xfa, 0x60, 0x25, 0xde, 0xeb, 0xf7, 0xb4, 0x22, 0x69, 0x38, 0xac, 0x79, 0xcc, + 0x3f, 0x9f, 0x29, 0x3a, 0x3e, 0x29, 0x3b, 0x60, 0xf5, 0x1e, 0x18, 0x4c, 0x81, 0x84, 0x8b, 0xcf, + 0xc5, 0xab, 0xe8, 0xe1, 0x2f, 0xdc, 0x03, 0x7f, 0x71, 0xeb, 0xb8, 0x63, 0x4b, 0x3b, 0x1b, 0xbf, + 0xd6, 0x15, 0x74, 0x41, 0x7a, 0x1e, 0x7f, 0x2a, 0x55, 0x8f, 0x2f, 0xc6, 0x39, 0xe9, 0x72, 0x9c, + 0x93, 0x7e, 0x8c, 0x73, 0xd2, 0xc7, 0xeb, 0x5c, 0xec, 0xf2, 0x3a, 0x17, 0xfb, 0x76, 0x9d, 0x8b, + 0xbd, 0xdd, 0x9d, 0xb1, 0xbd, 0x26, 0x64, 0x35, 0xcc, 0xce, 0x88, 0xef, 0x96, 0x27, 0xad, 0x70, + 0x30, 0xdf, 0x0c, 0xf9, 0x53, 0x34, 0x17, 0x78, 0x0f, 0x7b, 0xfc, 0x33, 0x00, 0x00, 0xff, 0xff, + 0x97, 0x08, 0xb9, 0x58, 0x31, 0x05, 0x00, 0x00, } func (m *ValidatorInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/restaking_assets_manage/client/cli/query.go b/x/restaking_assets_manage/client/cli/query.go index 889ec9926..cce124677 100644 --- a/x/restaking_assets_manage/client/cli/query.go +++ b/x/restaking_assets_manage/client/cli/query.go @@ -76,7 +76,7 @@ func QueAllClientChainInfo() *cobra.Command { Short: "Get all client chain info", Long: "Get all client chain info", Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -138,7 +138,7 @@ func QueAllStakingAssetsInfo() *cobra.Command { Short: "Get all staking asset info", Long: "Get all staking asset info", Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -301,7 +301,7 @@ func QueStakerExoCoreAddr() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakerExCoreAddr{ - StakerID: args[0], + Staker: args[0], } res, err := queryClient.QueStakerExoCoreAddr(context.Background(), req) if err != nil { diff --git a/x/restaking_assets_manage/keeper/grpc_query.go b/x/restaking_assets_manage/keeper/grpc_query.go index 37e61a503..f5717a312 100644 --- a/x/restaking_assets_manage/keeper/grpc_query.go +++ b/x/restaking_assets_manage/keeper/grpc_query.go @@ -85,9 +85,9 @@ func (k Keeper) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *restak // QueStakerExoCoreAddr outdated,will be deprecated func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *restakingtype.QueryStakerExCoreAddr) (*restakingtype.QueryStakerExCoreAddrResponse, error) { c := sdk.UnwrapSDKContext(ctx) - exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.StakerID) + exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.Staker) if err != nil { return nil, err } - return &restakingtype.QueryStakerExCoreAddrResponse{ExCoreAddr: exoCoreAddr}, nil + return &restakingtype.QueryStakerExCoreAddrResponse{ExoCoreAddr: exoCoreAddr}, nil } diff --git a/x/restaking_assets_manage/types/genesis.pb.go b/x/restaking_assets_manage/types/genesis.pb.go index 1852a552c..ebc7961f0 100644 --- a/x/restaking_assets_manage/types/genesis.pb.go +++ b/x/restaking_assets_manage/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -25,8 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the restaking_assets_manage module's genesis state. type GenesisState struct { - DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=DefaultSupportedClientChains,proto3" json:"DefaultSupportedClientChains,omitempty"` - DefaultSupportedClientChainTokens []*AssetInfo `protobuf:"bytes,2,rep,name=DefaultSupportedClientChainTokens,proto3" json:"DefaultSupportedClientChainTokens,omitempty"` + DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=default_supported_client_chains,json=defaultSupportedClientChains,proto3" json:"default_supported_client_chains,omitempty"` + DefaultSupportedClientChainTokens []*AssetInfo `protobuf:"bytes,2,rep,name=default_supported_client_chain_tokens,json=defaultSupportedClientChainTokens,proto3" json:"default_supported_client_chain_tokens,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -85,24 +84,25 @@ func init() { } var fileDescriptor_554af23024865cd5 = []byte{ - // 268 bytes of a gzipped FileDescriptorProto + // 275 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0x8f, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0x29, 0x8e, 0xcf, 0x4d, 0xcc, 0x4b, 0x4c, 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x82, 0xea, - 0xd0, 0xc3, 0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97, 0x9c, 0x9f, 0xab, 0xef, 0x0a, 0xb1, 0xd5, 0x2f, 0xb5, 0xa4, + 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0x16, 0xdc, 0x15, 0x38, 0x03, 0xbc, 0xa4, 0xb2, 0x20, 0xb5, 0x38, + 0x89, 0x0d, 0x1c, 0xe2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x38, 0x87, 0xab, 0xf6, + 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/restaking_assets_manage/types/query.pb.go b/x/restaking_assets_manage/types/query.pb.go index b95e30b2a..1b9dc6ac4 100644 --- a/x/restaking_assets_manage/types/query.pb.go +++ b/x/restaking_assets_manage/types/query.pb.go @@ -32,7 +32,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type QueryClientChainInfo struct { - ChainIndex uint64 `protobuf:"varint,1,opt,name=chainIndex,proto3" json:"chainIndex,omitempty"` + ChainIndex uint64 `protobuf:"varint,1,opt,name=chain_index,json=chainIndex,proto3" json:"chain_index,omitempty"` } func (m *QueryClientChainInfo) Reset() { *m = QueryClientChainInfo{} } @@ -112,7 +112,7 @@ func (m *QueryAllClientChainInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllClientChainInfo proto.InternalMessageInfo type QueryAllClientChainInfoResponse struct { - AllClientChainInfos map[uint64]*ClientChainInfo `protobuf:"bytes,1,rep,name=allClientChainInfos,proto3" json:"allClientChainInfos,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AllClientChainInfos map[uint64]*ClientChainInfo `protobuf:"bytes,1,rep,name=all_client_chain_infos,json=allClientChainInfos,proto3" json:"all_client_chain_infos,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryAllClientChainInfoResponse) Reset() { *m = QueryAllClientChainInfoResponse{} } @@ -156,7 +156,7 @@ func (m *QueryAllClientChainInfoResponse) GetAllClientChainInfos() map[uint64]*C } type QueryStakingAssetInfo struct { - AssetID string `protobuf:"bytes,1,opt,name=assetID,proto3" json:"assetID,omitempty"` + AssetID string `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *QueryStakingAssetInfo) Reset() { *m = QueryStakingAssetInfo{} } @@ -236,7 +236,7 @@ func (m *QueryAllStakingAssetsInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllStakingAssetsInfo proto.InternalMessageInfo type QueryAllStakingAssetsInfoResponse struct { - AllStakingAssetsInfo map[string]*StakingAssetInfo `protobuf:"bytes,1,rep,name=allStakingAssetsInfo,proto3" json:"allStakingAssetsInfo,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AllStakingAssetsInfo map[string]*StakingAssetInfo `protobuf:"bytes,1,rep,name=all_staking_assets_info,json=allStakingAssetsInfo,proto3" json:"all_staking_assets_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryAllStakingAssetsInfoResponse) Reset() { *m = QueryAllStakingAssetsInfoResponse{} } @@ -280,7 +280,7 @@ func (m *QueryAllStakingAssetsInfoResponse) GetAllStakingAssetsInfo() map[string } type QueryStakerAssetInfo struct { - StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` } func (m *QueryStakerAssetInfo) Reset() { *m = QueryStakerAssetInfo{} } @@ -324,7 +324,7 @@ func (m *QueryStakerAssetInfo) GetStakerID() string { } type QueryAssetInfoResponse struct { - AssetInfos map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=assetInfos,proto3" json:"assetInfos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AssetInfos map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=asset_infos,json=assetInfos,proto3" json:"asset_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryAssetInfoResponse) Reset() { *m = QueryAssetInfoResponse{} } @@ -368,8 +368,8 @@ func (m *QueryAssetInfoResponse) GetAssetInfos() map[string]*StakerSingleAssetOr } type QuerySpecifiedAssetAmountReq struct { - StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *QuerySpecifiedAssetAmountReq) Reset() { *m = QuerySpecifiedAssetAmountReq{} } @@ -420,7 +420,7 @@ func (m *QuerySpecifiedAssetAmountReq) GetAssetID() string { } type QueryOperatorAssetInfos struct { - OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` + OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` } func (m *QueryOperatorAssetInfos) Reset() { *m = QueryOperatorAssetInfos{} } @@ -464,7 +464,7 @@ func (m *QueryOperatorAssetInfos) GetOperatorAddr() string { } type QueryOperatorAssetInfosResponse struct { - AssetInfos map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=assetInfos,proto3" json:"assetInfos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AssetInfos map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=asset_infos,json=assetInfos,proto3" json:"asset_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryOperatorAssetInfosResponse) Reset() { *m = QueryOperatorAssetInfosResponse{} } @@ -508,8 +508,8 @@ func (m *QueryOperatorAssetInfosResponse) GetAssetInfos() map[string]*OperatorSi } type QueryOperatorSpecifiedAssetAmountReq struct { - OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` + OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *QueryOperatorSpecifiedAssetAmountReq) Reset() { *m = QueryOperatorSpecifiedAssetAmountReq{} } @@ -560,7 +560,9 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) GetAssetID() string { } type QueryStakerExCoreAddr struct { - StakerID string `protobuf:"bytes,1,opt,name=StakerID,proto3" json:"StakerID,omitempty"` + // Per https://github.com/gogo/protobuf/issues/331, grpc-gateway does not like custom names. + // So we remove the id suffix from here as well as the query. + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` } func (m *QueryStakerExCoreAddr) Reset() { *m = QueryStakerExCoreAddr{} } @@ -596,15 +598,15 @@ func (m *QueryStakerExCoreAddr) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakerExCoreAddr proto.InternalMessageInfo -func (m *QueryStakerExCoreAddr) GetStakerID() string { +func (m *QueryStakerExCoreAddr) GetStaker() string { if m != nil { - return m.StakerID + return m.Staker } return "" } type QueryStakerExCoreAddrResponse struct { - ExCoreAddr string `protobuf:"bytes,1,opt,name=ExCoreAddr,proto3" json:"ExCoreAddr,omitempty"` + ExoCoreAddr string `protobuf:"bytes,1,opt,name=exocore_addr,json=exocoreAddr,proto3" json:"exocore_addr,omitempty"` } func (m *QueryStakerExCoreAddrResponse) Reset() { *m = QueryStakerExCoreAddrResponse{} } @@ -640,9 +642,9 @@ func (m *QueryStakerExCoreAddrResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakerExCoreAddrResponse proto.InternalMessageInfo -func (m *QueryStakerExCoreAddrResponse) GetExCoreAddr() string { +func (m *QueryStakerExCoreAddrResponse) GetExoCoreAddr() string { if m != nil { - return m.ExCoreAddr + return m.ExoCoreAddr } return "" } @@ -673,68 +675,72 @@ func init() { } var fileDescriptor_6d13900d4f268106 = []byte{ - // 975 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0xe3, 0x44, - 0x18, 0xee, 0x64, 0x59, 0xd8, 0x9d, 0x45, 0x62, 0x35, 0x1b, 0x20, 0xf1, 0x2e, 0xa1, 0x58, 0x1c, - 0x2a, 0x10, 0xb6, 0x9a, 0x22, 0x48, 0x36, 0x54, 0x90, 0x7a, 0x83, 0xb6, 0x3d, 0xec, 0xd2, 0x04, - 0xa9, 0x2a, 0x20, 0x45, 0x6e, 0x32, 0x75, 0x4d, 0x13, 0x4f, 0xea, 0x71, 0x4a, 0xa2, 0xaa, 0xa8, - 0xea, 0x05, 0x4e, 0x08, 0xa9, 0x37, 0xf8, 0x11, 0x70, 0xe0, 0xc0, 0x4f, 0xe0, 0xc0, 0xa1, 0x80, - 0x84, 0x38, 0x42, 0x8b, 0x40, 0xdc, 0xf9, 0x01, 0xab, 0xcc, 0xf8, 0x2b, 0x8e, 0x9d, 0x4e, 0x3e, - 0x6e, 0x99, 0x99, 0xf7, 0xeb, 0x79, 0x9f, 0xf1, 0xfb, 0x4c, 0xa0, 0x82, 0x7b, 0xa4, 0x41, 0x6c, - 0xac, 0xda, 0x98, 0x3a, 0xfa, 0xbe, 0x69, 0x19, 0x75, 0x9d, 0x52, 0xec, 0xd0, 0x7a, 0x5b, 0xb7,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, 0xc6, 0x97, 0xff, 0x7e, 0xff, 0x1a, 0x38, 0xfd, 0xed, 0xef, 0xb3, 0xd4, - 0xbb, 0x68, 0x55, 0x15, 0x10, 0xff, 0xe4, 0xd2, 0xff, 0x02, 0xac, 0xe7, 0xa3, 0x4a, 0x88, 0x4a, - 0x33, 0x48, 0xb2, 0xa4, 0xcd, 0x41, 0xcf, 0xe5, 0xf7, 0x03, 0x9c, 0x25, 0x54, 0x14, 0xc4, 0x19, - 0x83, 0xe4, 0x67, 0x00, 0xef, 0x6c, 0x76, 0xf1, 0x88, 0xd6, 0x16, 0x85, 0x8b, 0x8c, 0xba, 0x4a, - 0x53, 0xa9, 0x8e, 0xfc, 0x20, 0x00, 0x54, 0x44, 0x6f, 0x0b, 0x02, 0x1a, 0x29, 0xfb, 0x3f, 0xc0, - 0xa6, 0x63, 0x9c, 0x66, 0xa2, 0xd5, 0x99, 0x24, 0x5c, 0xaa, 0xcc, 0xe5, 0x05, 0x20, 0x3f, 0x0c, - 0x70, 0xae, 0xa2, 0x92, 0x38, 0x71, 0xa3, 0x78, 0x7e, 0x09, 0xa8, 0xc3, 0x61, 0x15, 0x28, 0x4c, - 0x44, 0x5d, 0xc8, 0x55, 0xba, 0x3f, 0xbd, 0x16, 0x4f, 0xcf, 0xdf, 0x50, 0xed, 0xff, 0x03, 0x36, - 0xb1, 0x5c, 0x89, 0x8d, 0x19, 0xb1, 0xe8, 0x3d, 0x71, 0x74, 0xf1, 0x13, 0x5a, 0x9a, 0x5d, 0xe4, - 0xe5, 0x47, 0x01, 0x58, 0x0d, 0x95, 0x27, 0x02, 0x1b, 0x0b, 0xca, 0x9d, 0x34, 0x31, 0x92, 0x5e, - 0x9a, 0x41, 0x5c, 0x27, 0x98, 0x34, 0xc9, 0xca, 0x3c, 0xdd, 0xa4, 0x89, 0x41, 0x72, 0xc2, 0x9f, - 0x17, 0xe3, 0xf4, 0x13, 0x3d, 0x9c, 0xb8, 0xe0, 0x24, 0x92, 0xe7, 0x21, 0xff, 0x73, 0xa7, 0xf9, - 0x1f, 0xc0, 0xde, 0xd3, 0x9e, 0x1a, 0x13, 0x5f, 0xc3, 0x8b, 0x13, 0x7e, 0xb2, 0x81, 0x0e, 0x8b, - 0xdd, 0xe6, 0xb1, 0x8f, 0x00, 0xf9, 0x83, 0x00, 0x66, 0x05, 0x69, 0x13, 0xc1, 0x0c, 0x81, 0x50, - 0x8f, 0xbc, 0x67, 0xc7, 0xf1, 0xda, 0xc7, 0x3f, 0x5d, 0xe4, 0xc0, 0xf9, 0x45, 0x0e, 0xfc, 0x79, - 0x91, 0x03, 0x5f, 0x5f, 0xe6, 0x16, 0xce, 0x2f, 0x73, 0x0b, 0x7f, 0x5c, 0xe6, 0x16, 0x3e, 0x2a, - 0x1b, 0xa6, 0xb3, 0xd7, 0xdd, 0x51, 0x1a, 0xa4, 0xad, 0x56, 0x78, 0xa2, 0x47, 0xd8, 0xf9, 0x8c, - 0xd8, 0xfb, 0x7e, 0xde, 0x5e, 0x62, 0x66, 0xa7, 0xdf, 0xc1, 0x74, 0xe7, 0x69, 0xf6, 0x5f, 0x7d, - 0xe5, 0x49, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x2b, 0xcf, 0xb5, 0x9a, 0x10, 0x00, 0x00, + // 1039 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0xb8, 0xb4, 0x4d, 0xc6, 0x41, 0x54, 0xd3, 0x90, 0x3a, 0xdb, 0x62, 0x87, 0x15, 0x82, + 0x00, 0x62, 0x57, 0x4d, 0x91, 0x9a, 0x34, 0x8a, 0x8a, 0xe3, 0x18, 0xd5, 0x39, 0xb4, 0xaa, 0x73, + 0xe0, 0x53, 0x5a, 0x6d, 0xbd, 0x93, 0xcd, 0xca, 0xce, 0x8e, 0xb3, 0xb3, 0x0e, 0xb6, 0x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, 0xc8, 0x81, 0x59, 0x30, 0x13, 0x44, 0xca, 0x23, + 0xb8, 0x94, 0x6a, 0x12, 0x85, 0x66, 0x8e, 0x43, 0xb3, 0x33, 0x08, 0xcd, 0xfb, 0x32, 0x49, 0xc7, + 0xfb, 0x1e, 0xc5, 0xa6, 0x28, 0x3e, 0x92, 0x40, 0x07, 0x7b, 0x21, 0x34, 0x6f, 0xc3, 0x39, 0xca, + 0xae, 0x42, 0x6c, 0xe6, 0xbb, 0xc7, 0x85, 0x59, 0xae, 0x57, 0xd9, 0xae, 0xce, 0x72, 0x71, 0xc5, + 0x52, 0x9f, 0x66, 0xe0, 0x22, 0xef, 0x4b, 0x3f, 0x40, 0xaf, 0xeb, 0x75, 0x98, 0x15, 0x00, 0x47, + 0x9e, 0xff, 0x8e, 0x7c, 0xa3, 0xe3, 0x0e, 0xb5, 0xfe, 0x8d, 0x78, 0xec, 0xd0, 0xec, 0x5f, 0x28, + 0x8f, 0x01, 0x7c, 0x25, 0x26, 0x4f, 0x68, 0xe0, 0x47, 0x83, 0x0d, 0x2c, 0xca, 0x36, 0x10, 0x7b, + 0xbb, 0x8e, 0x6b, 0x37, 0x30, 0x8b, 0x70, 0xcf, 0x2b, 0xed, 0x9b, 0xae, 0x8d, 0xe3, 0xdd, 0x3c, + 0x84, 0xd7, 0x78, 0x37, 0x9b, 0xb8, 0xe6, 0xec, 0x39, 0xd8, 0x62, 0xda, 0xc5, 0x03, 0xd2, 0x72, + 0xfd, 0x2a, 0x3e, 0x1c, 0xa1, 0xab, 0x03, 0xdf, 0x46, 0xe6, 0x94, 0x6f, 0xe3, 0x63, 0x31, 0xac, + 0xee, 0x35, 0xb1, 0x67, 0xfa, 0x24, 0x84, 0x90, 0xa2, 0x4d, 0xf8, 0x32, 0x11, 0xb7, 0x86, 0x69, + 0x59, 0x9e, 0x88, 0x98, 0xfb, 0xfd, 0xa7, 0xf7, 0x16, 0xc4, 0xb0, 0x2d, 0x5a, 0x96, 0x87, 0x29, + 0x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xcf, 0xba, 0x79, 0xf0, 0x77, + 0x37, 0x0f, 0xbe, 0x3a, 0xc9, 0xcf, 0x3c, 0x3b, 0xc9, 0xcf, 0xfc, 0x75, 0x92, 0x9f, 0xf9, 0xb4, + 0x68, 0x3b, 0xfe, 0x7e, 0xeb, 0x81, 0x56, 0x23, 0x07, 0x7a, 0x99, 0x87, 0xb9, 0x8b, 0xfd, 0x2f, + 0x88, 0x57, 0xef, 0x47, 0x6d, 0xa7, 0xc6, 0xf5, 0x3b, 0x4d, 0x4c, 0x1f, 0x5c, 0x60, 0xff, 0x05, + 0xdc, 0x78, 0x11, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x1a, 0xd9, 0x0e, 0xfa, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -749,15 +755,23 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Balance queries the balance of a single coin for a single account. + // ClientChainInfoByIndex queries the client chain info by index. QueClientChainInfoByIndex(ctx context.Context, in *QueryClientChainInfo, opts ...grpc.CallOption) (*ClientChainInfo, error) + // AllClientChainInfo queries all client chain info. QueAllClientChainInfo(ctx context.Context, in *QueryAllClientChainInfo, opts ...grpc.CallOption) (*QueryAllClientChainInfoResponse, error) + // StakingAssetInfo queries the staking asset info. QueStakingAssetInfo(ctx context.Context, in *QueryStakingAssetInfo, opts ...grpc.CallOption) (*StakingAssetInfo, error) + // AllStakingAssetsInfo queries all staking assets info. QueAllStakingAssetsInfo(ctx context.Context, in *QueryAllStakingAssetsInfo, opts ...grpc.CallOption) (*QueryAllStakingAssetsInfoResponse, error) + // StakerAssetInfos queries the staker asset info. QueStakerAssetInfos(ctx context.Context, in *QueryStakerAssetInfo, opts ...grpc.CallOption) (*QueryAssetInfoResponse, error) + // StakerSpecifiedAssetAmount queries the staker specified asset amount. QueStakerSpecifiedAssetAmount(ctx context.Context, in *QuerySpecifiedAssetAmountReq, opts ...grpc.CallOption) (*StakerSingleAssetOrChangeInfo, error) + // OperatorAssetInfos queries the operator asset info. QueOperatorAssetInfos(ctx context.Context, in *QueryOperatorAssetInfos, opts ...grpc.CallOption) (*QueryOperatorAssetInfosResponse, error) + // OperatorSpecifiedAssetAmount queries the operator specified asset amount. QueOperatorSpecifiedAssetAmount(ctx context.Context, in *QueryOperatorSpecifiedAssetAmountReq, opts ...grpc.CallOption) (*OperatorSingleAssetOrChangeInfo, error) + // StakerExCoreAddr queries the staker exocore address. QueStakerExoCoreAddr(ctx context.Context, in *QueryStakerExCoreAddr, opts ...grpc.CallOption) (*QueryStakerExCoreAddrResponse, error) } @@ -852,15 +866,23 @@ func (c *queryClient) QueStakerExoCoreAddr(ctx context.Context, in *QueryStakerE // QueryServer is the server API for Query service. type QueryServer interface { - // Balance queries the balance of a single coin for a single account. + // ClientChainInfoByIndex queries the client chain info by index. QueClientChainInfoByIndex(context.Context, *QueryClientChainInfo) (*ClientChainInfo, error) + // AllClientChainInfo queries all client chain info. QueAllClientChainInfo(context.Context, *QueryAllClientChainInfo) (*QueryAllClientChainInfoResponse, error) + // StakingAssetInfo queries the staking asset info. QueStakingAssetInfo(context.Context, *QueryStakingAssetInfo) (*StakingAssetInfo, error) + // AllStakingAssetsInfo queries all staking assets info. QueAllStakingAssetsInfo(context.Context, *QueryAllStakingAssetsInfo) (*QueryAllStakingAssetsInfoResponse, error) + // StakerAssetInfos queries the staker asset info. QueStakerAssetInfos(context.Context, *QueryStakerAssetInfo) (*QueryAssetInfoResponse, error) + // StakerSpecifiedAssetAmount queries the staker specified asset amount. QueStakerSpecifiedAssetAmount(context.Context, *QuerySpecifiedAssetAmountReq) (*StakerSingleAssetOrChangeInfo, error) + // OperatorAssetInfos queries the operator asset info. QueOperatorAssetInfos(context.Context, *QueryOperatorAssetInfos) (*QueryOperatorAssetInfosResponse, error) + // OperatorSpecifiedAssetAmount queries the operator specified asset amount. QueOperatorSpecifiedAssetAmount(context.Context, *QueryOperatorSpecifiedAssetAmountReq) (*OperatorSingleAssetOrChangeInfo, error) + // StakerExCoreAddr queries the staker exocore address. QueStakerExoCoreAddr(context.Context, *QueryStakerExCoreAddr) (*QueryStakerExCoreAddrResponse, error) } @@ -1559,10 +1581,10 @@ func (m *QueryStakerExCoreAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.StakerID) > 0 { - i -= len(m.StakerID) - copy(dAtA[i:], m.StakerID) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Staker))) i-- dAtA[i] = 0xa } @@ -1589,10 +1611,10 @@ func (m *QueryStakerExCoreAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.ExCoreAddr) > 0 { - i -= len(m.ExCoreAddr) - copy(dAtA[i:], m.ExCoreAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ExCoreAddr))) + if len(m.ExoCoreAddr) > 0 { + i -= len(m.ExoCoreAddr) + copy(dAtA[i:], m.ExoCoreAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ExoCoreAddr))) i-- dAtA[i] = 0xa } @@ -1807,7 +1829,7 @@ func (m *QueryStakerExCoreAddr) Size() (n int) { } var l int _ = l - l = len(m.StakerID) + l = len(m.Staker) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1820,7 +1842,7 @@ func (m *QueryStakerExCoreAddrResponse) Size() (n int) { } var l int _ = l - l = len(m.ExCoreAddr) + l = len(m.ExoCoreAddr) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3209,7 +3231,7 @@ func (m *QueryStakerExCoreAddr) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3237,7 +3259,7 @@ func (m *QueryStakerExCoreAddr) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerID = string(dAtA[iNdEx:postIndex]) + m.Staker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3291,7 +3313,7 @@ func (m *QueryStakerExCoreAddrResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExCoreAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExoCoreAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3319,7 +3341,7 @@ func (m *QueryStakerExCoreAddrResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ExCoreAddr = string(dAtA[iNdEx:postIndex]) + m.ExoCoreAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/restaking_assets_manage/types/query.pb.gw.go b/x/restaking_assets_manage/types/query.pb.gw.go index 0dbf2efec..8d90490fe 100644 --- a/x/restaking_assets_manage/types/query.pb.gw.go +++ b/x/restaking_assets_manage/types/query.pb.gw.go @@ -296,15 +296,15 @@ func request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler runtime _ = err ) - val, ok = pathParams["StakerID"] + val, ok = pathParams["staker"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerID") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "staker") } - protoReq.StakerID, err = runtime.String(val) + protoReq.Staker, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerID", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "staker", err) } msg, err := client.QueStakerExoCoreAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -323,15 +323,15 @@ func local_request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler r _ = err ) - val, ok = pathParams["StakerID"] + val, ok = pathParams["staker"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerID") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "staker") } - protoReq.StakerID, err = runtime.String(val) + protoReq.Staker, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerID", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "staker", err) } msg, err := server.QueStakerExoCoreAddr(ctx, &protoReq) @@ -793,7 +793,7 @@ var ( pattern_Query_QueOperatorSpecifiedAssetAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerSpecifiedAssetAmount"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueStakerExoCoreAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerExoCoreAddr", "StakerID"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueStakerExoCoreAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerExoCoreAddr", "staker"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/restaking_assets_manage/types/tx.pb.go b/x/restaking_assets_manage/types/tx.pb.go index 709249830..e299d2655 100644 --- a/x/restaking_assets_manage/types/tx.pb.go +++ b/x/restaking_assets_manage/types/tx.pb.go @@ -33,14 +33,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ClientChainInfo struct { - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - MetaInfo string `protobuf:"bytes,2,opt,name=MetaInfo,proto3" json:"MetaInfo,omitempty"` - ChainId uint64 `protobuf:"varint,3,opt,name=ChainId,proto3" json:"ChainId,omitempty"` - ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=ExoCoreChainIndex,proto3" json:"ExoCoreChainIndex,omitempty"` - FinalizationBlocks uint64 `protobuf:"varint,5,opt,name=FinalizationBlocks,proto3" json:"FinalizationBlocks,omitempty"` - LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=LayerZeroChainID,proto3" json:"LayerZeroChainID,omitempty"` - SignatureType string `protobuf:"bytes,7,opt,name=SignatureType,proto3" json:"SignatureType,omitempty"` - AddressLength uint32 `protobuf:"varint,8,opt,name=AddressLength,proto3" json:"AddressLength,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MetaInfo string `protobuf:"bytes,2,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` + ChainId uint64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` + FinalizationBlocks uint64 `protobuf:"varint,5,opt,name=finalization_blocks,json=finalizationBlocks,proto3" json:"finalization_blocks,omitempty"` + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` + SignatureType string `protobuf:"bytes,7,opt,name=signature_type,json=signatureType,proto3" json:"signature_type,omitempty"` + AddressLength uint32 `protobuf:"varint,8,opt,name=address_length,json=addressLength,proto3" json:"address_length,omitempty"` } func (m *ClientChainInfo) Reset() { *m = ClientChainInfo{} } @@ -133,14 +133,14 @@ func (m *ClientChainInfo) GetAddressLength() uint32 { } type AssetInfo struct { - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Symbol string `protobuf:"bytes,2,opt,name=Symbol,proto3" json:"Symbol,omitempty"` - Address string `protobuf:"bytes,3,opt,name=Address,proto3" json:"Address,omitempty"` - Decimals uint32 `protobuf:"varint,4,opt,name=Decimals,proto3" json:"Decimals,omitempty"` - TotalSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=TotalSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalSupply"` - LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=LayerZeroChainID,proto3" json:"LayerZeroChainID,omitempty"` - ExoCoreChainIndex uint64 `protobuf:"varint,7,opt,name=ExoCoreChainIndex,proto3" json:"ExoCoreChainIndex,omitempty"` - MetaInfo string `protobuf:"bytes,8,opt,name=MetaInfo,proto3" json:"MetaInfo,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` + TotalSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_supply,json=totalSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_supply"` + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` + ExoCoreChainIndex uint64 `protobuf:"varint,7,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` + MetaInfo string `protobuf:"bytes,8,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` } func (m *AssetInfo) Reset() { *m = AssetInfo{} } @@ -226,8 +226,8 @@ func (m *AssetInfo) GetMetaInfo() string { } type StakingAssetInfo struct { - AssetBasicInfo *AssetInfo `protobuf:"bytes,1,opt,name=AssetBasicInfo,proto3" json:"AssetBasicInfo,omitempty"` - StakingTotalAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=StakingTotalAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"StakingTotalAmount"` + AssetBasicInfo *AssetInfo `protobuf:"bytes,1,opt,name=asset_basic_info,json=assetBasicInfo,proto3" json:"asset_basic_info,omitempty"` + StakingTotalAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=staking_total_amount,json=stakingTotalAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"staking_total_amount"` } func (m *StakingAssetInfo) Reset() { *m = StakingAssetInfo{} } @@ -271,9 +271,9 @@ func (m *StakingAssetInfo) GetAssetBasicInfo() *AssetInfo { } type StakerSingleAssetOrChangeInfo struct { - TotalDepositAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=TotalDepositAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalDepositAmountOrWantChangeValue"` - CanWithdrawAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=CanWithdrawAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"CanWithdrawAmountOrWantChangeValue"` - WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=WaitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"WaitUndelegationAmountOrWantChangeValue"` + TotalDepositAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_deposit_amount_or_want_change_value,json=totalDepositAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_deposit_amount_or_want_change_value"` + CanWithdrawAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=can_withdraw_amount_or_want_change_value,json=canWithdrawAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_withdraw_amount_or_want_change_value"` + WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` } func (m *StakerSingleAssetOrChangeInfo) Reset() { *m = StakerSingleAssetOrChangeInfo{} } @@ -310,7 +310,7 @@ func (m *StakerSingleAssetOrChangeInfo) XXX_DiscardUnknown() { var xxx_messageInfo_StakerSingleAssetOrChangeInfo proto.InternalMessageInfo type StakerAllAssetsInfo struct { - AllAssetsState map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=allAssetsState,proto3" json:"allAssetsState,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AllAssetsState map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=all_assets_state,json=allAssetsState,proto3" json:"all_assets_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *StakerAllAssetsInfo) Reset() { *m = StakerAllAssetsInfo{} } @@ -354,10 +354,10 @@ func (m *StakerAllAssetsInfo) GetAllAssetsState() map[string]*StakerSingleAssetO } type OperatorSingleAssetOrChangeInfo struct { - TotalAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=TotalAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalAmountOrWantChangeValue"` + TotalAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_amount_or_want_change_value,json=totalAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_amount_or_want_change_value"` // todo: the field is used to mark operator's own assets and is not temporarily used now - OperatorOwnAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=OperatorOwnAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"OperatorOwnAmountOrWantChangeValue"` - WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=WaitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"WaitUndelegationAmountOrWantChangeValue"` + OperatorOwnAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=operator_own_amount_or_want_change_value,json=operatorOwnAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_own_amount_or_want_change_value"` + WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` } func (m *OperatorSingleAssetOrChangeInfo) Reset() { *m = OperatorSingleAssetOrChangeInfo{} } @@ -394,7 +394,7 @@ func (m *OperatorSingleAssetOrChangeInfo) XXX_DiscardUnknown() { var xxx_messageInfo_OperatorSingleAssetOrChangeInfo proto.InternalMessageInfo type OperatorAllAssetsInfo struct { - AllAssetsState map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=allAssetsState,proto3" json:"allAssetsState,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AllAssetsState map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=all_assets_state,json=allAssetsState,proto3" json:"all_assets_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *OperatorAllAssetsInfo) Reset() { *m = OperatorAllAssetsInfo{} } @@ -438,11 +438,11 @@ func (m *OperatorAllAssetsInfo) GetAllAssetsState() map[string]*OperatorSingleAs } type MsgSetExoCoreAddr struct { - FromAddress string `protobuf:"bytes,1,opt,name=fromAddress,proto3" json:"fromAddress,omitempty"` - SetAddress string `protobuf:"bytes,2,opt,name=setAddress,proto3" json:"setAddress,omitempty"` - ClientChainAddr string `protobuf:"bytes,3,opt,name=clientChainAddr,proto3" json:"clientChainAddr,omitempty"` - ClientChainIndex uint64 `protobuf:"varint,4,opt,name=clientChainIndex,proto3" json:"clientChainIndex,omitempty"` - StakerClientChainSignature string `protobuf:"bytes,5,opt,name=StakerClientChainSignature,proto3" json:"StakerClientChainSignature,omitempty"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + SetAddress string `protobuf:"bytes,2,opt,name=set_address,json=setAddress,proto3" json:"set_address,omitempty"` + ClientChainAddr string `protobuf:"bytes,3,opt,name=client_chain_addr,json=clientChainAddr,proto3" json:"client_chain_addr,omitempty"` + ClientChainIndex uint64 `protobuf:"varint,4,opt,name=client_chain_index,json=clientChainIndex,proto3" json:"client_chain_index,omitempty"` + StakerClientChainSignature string `protobuf:"bytes,5,opt,name=staker_client_chain_signature,json=stakerClientChainSignature,proto3" json:"staker_client_chain_signature,omitempty"` } func (m *MsgSetExoCoreAddr) Reset() { *m = MsgSetExoCoreAddr{} } @@ -515,7 +515,7 @@ func (m *MsgSetExoCoreAddrResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetExoCoreAddrResponse proto.InternalMessageInfo type RegisterClientChainReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` Info *ClientChainInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } @@ -589,7 +589,7 @@ func (m *RegisterClientChainResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterClientChainResponse proto.InternalMessageInfo type RegisterAssetReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` Info *AssetInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } @@ -685,78 +685,86 @@ func init() { } var fileDescriptor_b24e66e530cc30d1 = []byte{ - // 1129 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4d, 0x4f, 0x1b, 0xc7, - 0x1b, 0xf7, 0xda, 0xbc, 0x3e, 0x16, 0x09, 0x0c, 0x24, 0x59, 0x9c, 0x7f, 0x0c, 0xda, 0x7f, 0xd5, - 0x22, 0x5a, 0x6c, 0x85, 0x34, 0x55, 0x4a, 0xdf, 0x64, 0x0c, 0x54, 0xa8, 0x21, 0x48, 0xeb, 0xa4, - 0xa8, 0xa9, 0x54, 0x34, 0xd8, 0x93, 0x65, 0xc5, 0xee, 0x8c, 0xbb, 0x33, 0x06, 0xdc, 0x13, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xed, 0xa1, 0xbd, 0xe6, 0x23, 0x50, 0x35, 0xdf, 0xa0, 0x17, 0x0e, - 0x3d, 0x44, 0xb9, 0x24, 0xca, 0x21, 0xaa, 0xe0, 0x40, 0x3f, 0x46, 0xb5, 0xb3, 0xbb, 0xb0, 0x8b, - 0xd7, 0xb0, 0x40, 0x22, 0xf5, 0x62, 0xef, 0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64, 0x16, 0xa4, 0x85, 0x7e, 0x51, 0x60, 0x30, 0xa6, 0x35, 0x68, - 0x2a, 0x89, 0xdb, 0x78, 0xbe, 0xe6, 0x3e, 0x3a, 0xb3, 0xad, 0x9f, 0xd4, 0x96, 0x02, 0x7d, 0x11, - 0x14, 0xd1, 0xdb, 0xa7, 0x71, 0x19, 0x50, 0x28, 0xf7, 0xee, 0x19, 0xac, 0xbc, 0x14, 0x72, 0x9d, - 0x5b, 0xfb, 0xdb, 0xe3, 0xca, 0xf4, 0xe7, 0x3b, 0xbb, 0x79, 0xe5, 0xf1, 0x6e, 0x5e, 0xf9, 0x7b, - 0x37, 0xaf, 0xfc, 0xb4, 0x97, 0x4f, 0x3d, 0xde, 0xcb, 0xa7, 0x9e, 0xed, 0xe5, 0x53, 0xf7, 0x4b, - 0xa1, 0xfb, 0x69, 0xd6, 0x8b, 0x72, 0x87, 0x88, 0x0d, 0xe6, 0xac, 0x15, 0x83, 0x37, 0xc0, 0x66, - 0xdb, 0x8f, 0x63, 0x79, 0x7d, 0xad, 0x74, 0xc9, 0x8f, 0xd3, 0x1b, 0xff, 0x06, 0x00, 0x00, 0xff, - 0xff, 0x91, 0x6a, 0xc4, 0xed, 0x4c, 0x0f, 0x00, 0x00, + // 1252 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xda, 0x69, 0x93, 0x8c, 0x9b, 0xd6, 0xd9, 0xb8, 0xad, 0xe3, 0x52, 0xbb, 0x18, 0x01, + 0x21, 0x10, 0x5b, 0x4d, 0x29, 0xa2, 0x29, 0x08, 0x39, 0x6e, 0x40, 0x11, 0x0d, 0x91, 0xd6, 0x85, + 0x88, 0x72, 0x58, 0x4d, 0x76, 0x27, 0x9b, 0x55, 0x76, 0x67, 0xcc, 0xce, 0x38, 0xb6, 0x7b, 0xaa, + 0x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, 0x90, 0x4c, 0x12, 0x98, 0x0d, 0x88, 0x19, 0x2f, 0x31, 0x76, 0x90, 0xb9, + 0x0e, 0xbd, 0xba, 0xe2, 0xde, 0x31, 0x71, 0xbe, 0x24, 0xc2, 0xdd, 0x92, 0xd1, 0x24, 0xce, 0xc5, + 0x60, 0x09, 0x8a, 0x9b, 0x03, 0x3b, 0xe8, 0x13, 0x1e, 0x48, 0xff, 0x41, 0x03, 0x13, 0x16, 0xc4, + 0x66, 0xc3, 0x65, 0xab, 0x76, 0x00, 0x1b, 0x07, 0xa2, 0x3a, 0x89, 0xea, 0x15, 0x2c, 0x88, 0x97, + 0x54, 0xb0, 0x5e, 0xa0, 0x7e, 0xd1, 0xc0, 0x54, 0x03, 0xba, 0xcc, 0xac, 0x63, 0x1b, 0x79, 0xc8, + 0x91, 0x37, 0xcb, 0x41, 0xc8, 0x12, 0x27, 0x80, 0xec, 0x55, 0x1e, 0xf2, 0xe3, 0x8e, 0x88, 0x3d, + 0xe0, 0x15, 0x7e, 0x8c, 0x83, 0x31, 0xd9, 0xec, 0xb2, 0xe7, 0x89, 0x4e, 0x53, 0xd1, 0xe2, 0x3a, + 0x48, 0x41, 0xcf, 0x0b, 0x69, 0x4a, 0x19, 0x64, 0xbc, 0x91, 0x89, 0x89, 0xe4, 0xf4, 0x87, 0xfd, + 0xb0, 0xb9, 0x8b, 0xcb, 0x62, 0x7b, 0x55, 0xe5, 0xde, 0xe6, 0x30, 0x0b, 0x5a, 0xc6, 0x59, 0x18, + 0x11, 0x66, 0xbf, 0xd4, 0xc0, 0x58, 0x17, 0x3d, 0x3d, 0x05, 0x12, 0x6b, 0xa8, 0xa5, 0xae, 0x31, + 0xfe, 0xa9, 0x2f, 0x81, 0x53, 0x7b, 0x8d, 0x4c, 0x4e, 0x97, 0xfb, 0x47, 0xd5, 0x83, 0xd5, 0x86, + 0xf4, 0x37, 0x13, 0x7f, 0x5b, 0x2b, 0xfc, 0x95, 0x00, 0xf9, 0xc5, 0x1a,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xd4, 0x7d, 0x0d, 0x8c, 0x44, 0xaa, 0xa8, 0xbf, 0x79, 0x18, 0x97, + 0x21, 0x87, 0xb2, 0x37, 0x8e, 0x60, 0x25, 0x21, 0x64, 0x4f, 0xdd, 0xdf, 0xdd, 0x98, 0xd4, 0x66, + 0x3f, 0x7b, 0xb4, 0x9d, 0xd3, 0x1e, 0x6f, 0xe7, 0xb4, 0x27, 0xdb, 0x39, 0xed, 0xfb, 0x9d, 0x5c, + 0xec, 0xf1, 0x4e, 0x2e, 0xf6, 0xfb, 0x4e, 0x2e, 0x76, 0xb7, 0xdc, 0xf1, 0x58, 0xcd, 0xc9, 0x28, + 0x1f, 0x21, 0xd6, 0x20, 0xc1, 0x5a, 0x29, 0xbc, 0x03, 0x9a, 0x3d, 0x7f, 0x91, 0x8b, 0xb7, 0x6c, + 0xf9, 0xb4, 0xf8, 0x45, 0x7c, 0xed, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0xd7, 0xe5, 0x53, + 0xc1, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -771,8 +779,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // SetStakerExoCoreAddr sets the exocore address of the staker SetStakerExoCoreAddr(ctx context.Context, in *MsgSetExoCoreAddr, opts ...grpc.CallOption) (*MsgSetExoCoreAddrResponse, error) + // RegisterClientChain registers the client chain RegisterClientChain(ctx context.Context, in *RegisterClientChainReq, opts ...grpc.CallOption) (*RegisterClientChainResponse, error) + // RegisterAsset registers the asset on the client chain RegisterAsset(ctx context.Context, in *RegisterAssetReq, opts ...grpc.CallOption) (*RegisterAssetResponse, error) } @@ -813,8 +824,11 @@ func (c *msgClient) RegisterAsset(ctx context.Context, in *RegisterAssetReq, opt // MsgServer is the server API for Msg service. type MsgServer interface { + // SetStakerExoCoreAddr sets the exocore address of the staker SetStakerExoCoreAddr(context.Context, *MsgSetExoCoreAddr) (*MsgSetExoCoreAddrResponse, error) + // RegisterClientChain registers the client chain RegisterClientChain(context.Context, *RegisterClientChainReq) (*RegisterClientChainResponse, error) + // RegisterAsset registers the asset on the client chain RegisterAsset(context.Context, *RegisterAssetReq) (*RegisterAssetResponse, error) } diff --git a/x/reward/client/cli/query_params.go b/x/reward/client/cli/query_params.go index c660a95eb..3ff8296a5 100644 --- a/x/reward/client/cli/query_params.go +++ b/x/reward/client/cli/query_params.go @@ -13,7 +13,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/reward/types/params.pb.go b/x/reward/types/params.pb.go index 7ce7c11a7..2eee77c1d 100644 --- a/x/reward/types/params.pb.go +++ b/x/reward/types/params.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -25,8 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exoCoreLzAppAddress,proto3" json:"exoCoreLzAppAddress,omitempty"` - ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exoCoreLzAppEventTopic,proto3" json:"exoCoreLzAppEventTopic,omitempty"` + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exo_core_lz_app_event_topic,json=exoCoreLzAppEventTopic,proto3" json:"exo_core_lz_app_event_topic,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -83,20 +82,21 @@ func init() { func init() { proto.RegisterFile("exocore/reward/params.proto", fileDescriptor_1a29ebcfb63d5930) } var fileDescriptor_1a29ebcfb63d5930 = []byte{ - // 201 bytes of a gzipped FileDescriptorProto + // 212 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, - 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0xa5, 0x44, - 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x52, 0x11, 0x17, 0x5b, 0x00, - 0x58, 0x97, 0x90, 0x01, 0x97, 0x70, 0x6a, 0x45, 0xbe, 0x73, 0x7e, 0x51, 0xaa, 0x4f, 0x95, 0x63, - 0x41, 0x81, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, - 0x36, 0x29, 0x21, 0x33, 0x2e, 0x31, 0x64, 0x61, 0xd7, 0xb2, 0xd4, 0xbc, 0x92, 0x90, 0xfc, 0x82, - 0xcc, 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 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, 0xab, - 0xef, 0x0a, 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, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0xe6, 0xbb, 0x0a, 0x98, 0xff, 0x4a, 0x2a, 0x0b, 0x52, + 0x8b, 0x93, 0xd8, 0xc0, 0xfe, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf8, 0xf4, 0x7a, 0x66, + 0xfe, 0x00, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/query.pb.go b/x/reward/types/query.pb.go index 4e81c4f0e..db0a870f4 100644 --- a/x/reward/types/query.pb.go +++ b/x/reward/types/query.pb.go @@ -6,8 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -121,26 +119,23 @@ func init() { func init() { proto.RegisterFile("exocore/reward/query.proto", fileDescriptor_03321eafc9126bed) } var fileDescriptor_03321eafc9126bed = []byte{ - // 292 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x41, 0x4b, 0xc3, 0x30, - 0x14, 0xc7, 0x57, 0xc1, 0x1d, 0x22, 0x78, 0x88, 0x63, 0x8c, 0x2a, 0x41, 0xea, 0x45, 0x3c, 0x24, - 0x6e, 0x7e, 0x03, 0x61, 0x17, 0x0f, 0xa2, 0x1e, 0xbd, 0xa5, 0xf3, 0x11, 0x8b, 0xb6, 0x2f, 0x4d, - 0x52, 0xb7, 0x79, 0xf4, 0x13, 0x08, 0x7e, 0x29, 0x8f, 0x03, 0x2f, 0x1e, 0xa5, 0xf5, 0x83, 0xc8, - 0x9a, 0x28, 0x6c, 0x8a, 0xb7, 0xf2, 0xfe, 0xbf, 0xff, 0xaf, 0xef, 0x85, 0xc4, 0x30, 0xc3, 0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 0x39, 0xb8, 0x29, 0x9a, 0xbb, 0x1f, 0xd5, 0xec, 0x5b, 0xe6, 0xe6, - 0x1a, 0x6c, 0xda, 0x6d, 0xdf, 0xea, 0xe4, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x6d, 0xb6, 0xc4, - 0xd6, 0x01, 0x00, 0x00, + // 252 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, + 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xe9, 0x41, 0xe4, 0xa4, 0x64, 0xd2, + 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, + 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xaa, 0xa5, 0xa4, 0xd1, 0x4c, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, + 0x85, 0x4a, 0x2a, 0x89, 0x70, 0x09, 0x05, 0x82, 0x4c, 0x0e, 0x00, 0x0b, 0x06, 0xa5, 0x16, 0x96, + 0xa6, 0x16, 0x97, 0x28, 0xb9, 0x72, 0x09, 0xa3, 0x88, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, + 0xe9, 0x71, 0xb1, 0x41, 0x34, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe9, 0xa1, 0x3a, + 0x44, 0x0f, 0xaa, 0x1e, 0xaa, 0xca, 0xa8, 0x8a, 0x8b, 0x15, 0x6c, 0x8c, 0x50, 0x21, 0x17, 0x1b, + 0x44, 0x4a, 0x48, 0x09, 0x5d, 0x0b, 0xa6, 0xed, 0x52, 0xca, 0x78, 0xd5, 0x40, 0xdc, 0xa2, 0x24, + 0xd7, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x09, 0x21, 0x31, 0x7d, 0xac, 0xde, 0x73, 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, 0x7d, 0x57, 0x88, 0x5e, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xb8, + 0x51, 0x15, 0x30, 0xc3, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x61, 0x65, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0xcc, 0x67, 0x12, 0x8f, 0x94, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/tx.pb.go b/x/reward/types/tx.pb.go index d3a6bd2bd..0c0785142 100644 --- a/x/reward/types/tx.pb.go +++ b/x/reward/types/tx.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -135,28 +134,27 @@ func init() { func init() { proto.RegisterFile("exocore/reward/tx.proto", fileDescriptor_9cd4863caedb1c8f) } var fileDescriptor_9cd4863caedb1c8f = []byte{ - // 330 bytes of a gzipped FileDescriptorProto + // 311 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00,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, 0xb9, 0xc5, 0xe9, 0xfa, 0x65, 0x86, 0x20, + 0x0a, 0x2a, 0x21, 0x8d, 0x66, 0x65, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0x97, 0x52, 0x3f, 0x23, + 0x17, 0xbf, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, 0x00, 0x58, 0x46, 0xc8, 0x8c, + 0x8b, 0x33, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, + 0xd3, 0x49, 0xe2, 0xd2, 0x16, 0x5d, 0x11, 0xa8, 0x75, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, + 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x41, 0x08, 0xa5, 0x42, 0x26, 0x5c, 0x6c, 0x10, 0xb3, 0x25, + 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x50, 0xfd, 0xa4, 0x07, 0x31, 0xdf, 0x89, 0xe5, + 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x5a, 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0xa6, 0x28, + 0x49, 0x72, 0x89, 0xa3, 0x39, 0x28, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28, 0x9e, + 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x82, 0x8b, 0x07, 0xc5, 0xbd, 0xf2, 0xe8, 0xf6, 0xa0, 0xe9, + 0x97, 0x52, 0x27, 0xa0, 0x00, 0x66, 0x81, 0x93, 0xd7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, + 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, + 0xcb, 0x31, 0x44, 0x19, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, + 0x42, 0x0c, 0xf3, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x87, 0x05, 0x6f, 0x05, 0x3c, 0x4e, + 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x01, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x00, + 0xa2, 0xad, 0x10, 0xf2, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -171,6 +169,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // UpdateParams updates the parameters for this module. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -193,6 +192,7 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // UpdateParams updates the parameters for this module. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } diff --git a/x/slash/client/cli/query_params.go b/x/slash/client/cli/query_params.go index de5afc25d..82182a6e9 100644 --- a/x/slash/client/cli/query_params.go +++ b/x/slash/client/cli/query_params.go @@ -12,7 +12,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/slash/types/params.pb.go b/x/slash/types/params.pb.go index dbded7051..ddf28cf58 100644 --- a/x/slash/types/params.pb.go +++ b/x/slash/types/params.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -25,8 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exoCoreLzAppAddress,proto3" json:"exoCoreLzAppAddress,omitempty"` - ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exoCoreLzAppEventTopic,proto3" json:"exoCoreLzAppEventTopic,omitempty"` + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exo_core_lz_app_event_topic,json=exoCoreLzAppEventTopic,proto3" json:"exo_core_lz_app_event_topic,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -83,20 +82,21 @@ func init() { func init() { proto.RegisterFile("exocore/slash/params.proto", fileDescriptor_a98d46ef8bcc0f8a) } var fileDescriptor_a98d46ef8bcc0f8a = []byte{ - // 200 bytes of a gzipped FileDescriptorProto + // 211 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0xca, 0xe9, 0x81, 0xe5, 0xa4, 0x44, 0xd2, - 0xf3, 0xd3, 0xf3, 0xc1, 0x32, 0xfa, 0x20, 0x16, 0x44, 0x91, 0x52, 0x11, 0x17, 0x5b, 0x00, 0x58, - 0x93, 0x90, 0x01, 0x97, 0x70, 0x6a, 0x45, 0xbe, 0x73, 0x7e, 0x51, 0xaa, 0x4f, 0x95, 0x63, 0x41, - 0x81, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x36, - 0x29, 0x21, 0x33, 0x2e, 0x31, 0x64, 0x61, 0xd7, 0xb2, 0xd4, 0xbc, 0x92, 0x90, 0xfc, 0x82, 0xcc, - 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0x9e, 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, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, - 0x0a, 0x71, 0xbd, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0xcc, 0xa3, 0x15, 0x50, 0xaf, - 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x7d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0x6f, 0x99, 0x26, 0xee, 0x08, 0x01, 0x00, 0x00, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0xca, 0xe9, 0x81, 0xe5, 0x94, 0xaa, 0xb9, + 0xd8, 0x02, 0xc0, 0xd2, 0x42, 0x26, 0x5c, 0xe2, 0xa9, 0x15, 0xf9, 0xf1, 0x20, 0xb9, 0xf8, 0x9c, + 0xaa, 0xf8, 0xc4, 0x82, 0x82, 0xf8, 0xc4, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0x62, 0x09, 0x46, 0x05, + 0x46, 0x0d, 0xce, 0x20, 0xe1, 0xd4, 0x8a, 0x7c, 0xe7, 0xfc, 0xa2, 0x54, 0x9f, 0x2a, 0xc7, 0x82, + 0x02, 0x47, 0x88, 0x94, 0x90, 0x35, 0x97, 0x34, 0xba, 0xae, 0xd4, 0xb2, 0xd4, 0xbc, 0x92, 0xf8, + 0x92, 0xfc, 0x82, 0xcc, 0x64, 0x09, 0x26, 0xb0, 0x4e, 0x31, 0x64, 0x9d, 0xae, 0x20, 0xe9, 0x10, + 0x90, 0xac, 0x93, 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, + 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa7, + 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, 0x42, 0x1c, 0xec, 0x97, 0x5a, + 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x0f, 0xf3, 0x5b, 0x05, 0xd4, 0x77, 0x25, 0x95, 0x05, 0xa9, 0xc5, + 0x49, 0x6c, 0x60, 0xdf, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x74, 0xb3, 0x99, 0x42, 0xfb, + 0x00, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/types/query.pb.go b/x/slash/types/query.pb.go index b79a22056..897e60527 100644 --- a/x/slash/types/query.pb.go +++ b/x/slash/types/query.pb.go @@ -6,8 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -121,25 +119,23 @@ func init() { func init() { proto.RegisterFile("exocore/slash/query.proto", fileDescriptor_8cd6399098c1a574) } var fileDescriptor_8cd6399098c1a574 = []byte{ - // 278 bytes of a gzipped FileDescriptorProto + // 251 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xe9, 0x81, 0xa5, 0xa4, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x32, 0xfa, 0x20, 0x16, 0x44, 0x91, 0x94, 0x4c, 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, - 0xaa, 0x7e, 0x62, 0x41, 0xa6, 0x7e, 0x62, 0x5e, 0x5e, 0x7e, 0x49, 0x62, 0x49, 0x66, 0x7e, 0x5e, - 0x31, 0x54, 0x56, 0x3a, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x18, 0x62, 0xac, 0x7e, 0x99, 0x21, 0xb2, - 0xf9, 0x52, 0x52, 0xa8, 0x56, 0x17, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x35, 0x2a, 0x89, 0x70, 0x09, - 0x05, 0x82, 0x94, 0x06, 0x80, 0x05, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x5c, 0xb8, - 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x74, 0xb9, 0xd8, 0x20, 0x9a, 0x25, - 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf5, 0x50, 0x5c, 0xae, 0x07, 0x55, 0x0e, 0x55, 0x64, - 0x54, 0xce, 0xc5, 0x0a, 0x36, 0x45, 0x28, 0x8f, 0x8b, 0x0d, 0x22, 0x25, 0xa4, 0x88, 0xa6, 0x03, - 0xd3, 0x6e, 0x29, 0x25, 0x7c, 0x4a, 0x20, 0x0e, 0x51, 0x92, 0x6d, 0xba, 0xfc, 0x64, 0x32, 0x93, - 0xb8, 0x90, 0xa8, 0x3e, 0x36, 0xaf, 0x39, 0x79, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x2b, - 0x44, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0x36, 0xdc, 0xa4, 0x0a, 0xa8, 0x59, 0x25, 0x95, - 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x60, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x61, 0xd5, - 0xbc, 0x52, 0xbf, 0x01, 0x00, 0x00, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xe9, 0x81, 0xa5, 0xa4, 0x64, 0xd2, 0xf3, + 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, + 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0x8a, 0xa5, 0xa4, 0x50, 0xcd, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x85, + 0xca, 0x29, 0x89, 0x70, 0x09, 0x05, 0x82, 0xcc, 0x0d, 0x00, 0x0b, 0x06, 0xa5, 0x16, 0x96, 0xa6, + 0x16, 0x97, 0x28, 0xb9, 0x70, 0x09, 0xa3, 0x88, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0xe9, + 0x72, 0xb1, 0x41, 0x34, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xea, 0xa1, 0x38, 0x43, + 0x0f, 0xaa, 0x1c, 0xaa, 0xc8, 0xa8, 0x9c, 0x8b, 0x15, 0x6c, 0x8a, 0x50, 0x1e, 0x17, 0x1b, 0x44, + 0x4a, 0x48, 0x11, 0x4d, 0x07, 0xa6, 0xdd, 0x52, 0x4a, 0xf8, 0x94, 0x40, 0x1c, 0xa2, 0x24, 0xdb, + 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x71, 0x21, 0x51, 0x7d, 0x6c, 0x5e, 0x73, 0xf2, 0x3c, 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, 0xfd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0x7d, 0x57, 0x88, 0x56, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xb8, 0x49, + 0x15, 0x50, 0xb3, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xc1, 0x64, 0x0c, 0x08, 0x00, + 0x00, 0xff, 0xff, 0xdb, 0x6e, 0xd4, 0x35, 0x8c, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/slash/types/tx.pb.go b/x/slash/types/tx.pb.go index 89c83dc28..e74333c39 100644 --- a/x/slash/types/tx.pb.go +++ b/x/slash/types/tx.pb.go @@ -169,6 +169,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // UpdateParams updates the parameters of this module. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -191,6 +192,7 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // UpdateParams updates the parameters of this module. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } diff --git a/x/withdraw/client/cli/query_params.go b/x/withdraw/client/cli/query_params.go index c60b32bfe..0c9ac046c 100644 --- a/x/withdraw/client/cli/query_params.go +++ b/x/withdraw/client/cli/query_params.go @@ -13,7 +13,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/withdraw/types/query.pb.go b/x/withdraw/types/query.pb.go index 0f71e5881..f57852462 100644 --- a/x/withdraw/types/query.pb.go +++ b/x/withdraw/types/query.pb.go @@ -7,8 +7,6 @@ import ( context "context" fmt "fmt" types "github.com/ExocoreNetwork/exocore/x/deposit/types" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -122,27 +120,25 @@ func init() { func init() { proto.RegisterFile("exocore/withdraw/query.proto", fileDescriptor_59bca5e59812c328) } var fileDescriptor_59bca5e59812c328 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4b, 0x03, 0x31, - 0x14, 0xc7, 0x7b, 0x82, 0x1d, 0xe2, 0x22, 0xb1, 0x43, 0x39, 0x4a, 0x28, 0x45, 0x41, 0x1c, 0x12, - 0xee, 0xfc, 0x06, 0x82, 0x83, 0x20, 0xa2, 0x8e, 0x6e, 0xb9, 0xf6, 0x91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0x7c, 0xf4, 0x0f, 0x15, 0x4a, 0x0d, 0xfa, 0x4f, 0x6f, 0x9f, 0x2f, 0x3b, 0x31, 0xed, - 0x8a, 0xad, 0xe3, 0x87, 0x0a, 0x67, 0x97, 0xaf, 0x6b, 0x16, 0xad, 0xd6, 0x2c, 0xfa, 0x58, 0xb3, - 0xe8, 0xb9, 0x64, 0xad, 0x55, 0xc9, 0x5a, 0xef, 0x25, 0x6b, 0xdd, 0xa5, 0x4a, 0xfb, 0xf1, 0x2c, - 0xe3, 0x43, 0x9c, 0x88, 0xf3, 0xb0, 0x7d, 0x05, 0xbe, 0x40, 0x7b, 0xff, 0x2d, 0x5b, 0xfc, 0xe8, - 0xfc, 0xd2, 0x80, 0xcb, 0xda, 0xd5, 0xe1, 0x4e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xea, 0xd2, - 0x25, 0x41, 0xec, 0x01, 0x00, 0x00, + // 275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0x2c, 0x4d, + 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xca, 0xea, 0xc1, 0x64, 0xa5, + 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, + 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xea, 0xa5, 0x14, 0x60, 0xa6, 0xa5, 0xa4, 0x16, + 0xe4, 0x17, 0x67, 0x96, 0xe8, 0x97, 0x19, 0xc2, 0x98, 0x10, 0x15, 0x4a, 0x22, 0x5c, 0x42, 0x81, + 0x20, 0x0b, 0x02, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, + 0x3c, 0xb9, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x8c, 0xb8, 0xd8, 0x0a, + 0xc0, 0x22, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x30, 0xf7, 0xc0, 0x0c, 0x2d, + 0x33, 0xd4, 0x83, 0xea, 0x81, 0xaa, 0x34, 0x6a, 0x60, 0xe4, 0x62, 0x05, 0x9b, 0x25, 0x54, 0xce, + 0xc5, 0x06, 0x91, 0x13, 0x52, 0xd1, 0x43, 0xf7, 0x87, 0x1e, 0xa6, 0x23, 0xa4, 0x54, 0x09, 0xa8, + 0x82, 0x38, 0x4a, 0x49, 0xa1, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x52, 0x42, 0x12, 0xfa, 0x18, 0x41, + 0x07, 0x71, 0x82, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, + 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, + 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, 0x42, 0x74, 0xfb, 0xa5, + 0x96, 0x94, 0xe7, 0x17, 0x65, 0xc3, 0x0d, 0xab, 0x40, 0x18, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, + 0xc4, 0x06, 0x0e, 0x38, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xc5, 0xbb, 0x00, 0xaa, + 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/withdraw/types/tx.pb.go b/x/withdraw/types/tx.pb.go index b7af85d30..1ff2f56bd 100644 --- a/x/withdraw/types/tx.pb.go +++ b/x/withdraw/types/tx.pb.go @@ -9,7 +9,6 @@ import ( types "github.com/ExocoreNetwork/exocore/x/deposit/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -136,29 +135,29 @@ func init() { func init() { proto.RegisterFile("exocore/withdraw/tx.proto", fileDescriptor_9fa45fb8759a8d92) } var fileDescriptor_9fa45fb8759a8d92 = []byte{ - // 348 bytes of a gzipped FileDescriptorProto + // 337 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xe9, 0xc1, 0xa4, 0xa4, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xa9, 0x94, 0x24, 0x44, 0x22, 0x1e, 0xcc, 0xd3, 0x87, 0x70, 0xa0, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x10, - 0x71, 0x10, 0x0b, 0x2a, 0x2a, 0x98, 0x98, 0x9b, 0x99, 0x97, 0xaf, 0x0f, 0x26, 0xa1, 0x42, 0x0a, - 0x30, 0x97, 0xa4, 0xa4, 0x16, 0xe4, 0x17, 0x67, 0x96, 0x80, 0x6c, 0x80, 0x32, 0x21, 0x2a, 0x94, - 0x26, 0x33, 0x72, 0xf1, 0xfb, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, 0xa4, 0x06, 0x24, 0x16, - 0x25, 0xe6, 0x16, 0x0b, 0x99, 0x71, 0x71, 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, - 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x83, 0x63, - 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x90, - 0x05, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x29, 0x3d, 0x98, - 0x6f, 0x61, 0x76, 0x96, 0x19, 0xea, 0x41, 0xec, 0x70, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, - 0xaa, 0xde, 0x8a, 0xaf, 0xe9, 0xf9, 0x06, 0x2d, 0x84, 0x49, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x8e, - 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x35, 0xca, 0xe2, 0x62, 0xf6, 0x2d, 0x4e, 0x17, - 0x8a, 0xe1, 0xe2, 0x41, 0x71, 0xb3, 0xa2, 0x1e, 0x7a, 0xc8, 0xea, 0xa1, 0x99, 0x20, 0xa5, 0x49, - 0x50, 0x09, 0xcc, 0x12, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0x7c, 0x4e, 0x3c, 0x92, - 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, - 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x28, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, - 0x39, 0x3f, 0x57, 0xdf, 0x15, 0x62, 0xaa, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0x2c, - 0xc8, 0x2b, 0x90, 0xa2, 0xbf, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0xe2, 0xc6, 0x80, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xbb, 0x4a, 0x31, 0x2f, 0x1f, 0x02, 0x00, 0x00, + 0x71, 0x10, 0x0b, 0x2a, 0xaa, 0x00, 0xb3, 0x36, 0x25, 0xb5, 0x20, 0xbf, 0x38, 0xb3, 0x04, 0x64, + 0x1c, 0x94, 0x09, 0x51, 0xa1, 0x34, 0x99, 0x91, 0x8b, 0xdf, 0xb7, 0x38, 0x3d, 0xb4, 0x20, 0x25, + 0xb1, 0x24, 0x35, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, 0x8c, 0x8b, 0x33, 0xb1, 0xb4, 0x24, + 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xe2, 0xd2, 0x16, + 0x5d, 0x11, 0xa8, 0x85, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xc1, 0x25, 0x45, 0x99, 0x79, + 0xe9, 0x41, 0x08, 0xa5, 0x42, 0x16, 0x5c, 0x6c, 0x05, 0x60, 0x13, 0x24, 0x98, 0x14, 0x18, 0x35, + 0xb8, 0x8d, 0xa4, 0xf4, 0x60, 0x5e, 0x83, 0xd9, 0x59, 0x66, 0xa8, 0x07, 0xb1, 0xc3, 0x89, 0xe5, + 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x7a, 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0x26, 0x29, + 0x49, 0x72, 0x89, 0xa3, 0x39, 0x2a, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28, 0x8b, + 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x86, 0x8b, 0x07, 0xc5, 0xcd, 0x8a, 0x7a, 0xe8, 0xc1, 0xa8, + 0x87, 0x66, 0x82, 0x94, 0x26, 0x41, 0x25, 0x30, 0x4b, 0xa4, 0x58, 0x1b, 0x9e, 0x6f, 0xd0, 0x62, + 0x74, 0xf2, 0x39, 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, 0xa3, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x57, 0x88, 0xa9, 0x7e, 0xa9, 0x25, 0xe5, + 0xf9, 0x45, 0xd9, 0xfa, 0xb0, 0x20, 0xaf, 0x40, 0x8a, 0xeb, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, + 0x70, 0x88, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x0b, 0x2a, 0x73, 0x0c, 0x02, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -173,6 +172,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // UpdateParams updates the parameters of this module. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -195,6 +195,7 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // UpdateParams updates the parameters of this module. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } From c894d538712503074cd8797a1cad76a5d61e0ec9 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:03:53 +0530 Subject: [PATCH 27/41] chore(ci): buf compare against develop HEAD (#9) * chore(ci): buf compare against develop HEAD ...and not develop HEAD~1. I don't know how this was missed. * proto(reward): remove blank lines almost empty commit to trigger the `proto.yml` CI. --- .github/workflows/proto.yml | 2 +- proto/exocore/reward/tx.proto | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 7ff62e3a9..75e72fb35 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -41,4 +41,4 @@ jobs: - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" - against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto" + against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},subdir=proto" diff --git a/proto/exocore/reward/tx.proto b/proto/exocore/reward/tx.proto index 0f73b582a..961aaaf62 100644 --- a/proto/exocore/reward/tx.proto +++ b/proto/exocore/reward/tx.proto @@ -31,5 +31,3 @@ message MsgUpdateParams { // MsgUpdateParams message. // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} - - From 65e90a6400ac45dfd6171a948952901cd909cdba Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:03:59 +0530 Subject: [PATCH 28/41] chore(ci): fix super linter config (#10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(ci): fix super linter config The super-linter.yml workflow seems to be running on pull requests and branches. However, for pull requests, it fails silently with the logs reporting an error. On branches, it fails actually with an ❌ emoji. * chore(ci): update super linter version * chore(ci): remove should_follow_golang_style for proto files, should_follow_golang_style can be removed. * chore(ci): disable infra-as-code linter * chore(ci): run protolint autofix * chore(ci): add comments to all fields * doc(ci): add comment to explain HEAD~1 * chore(build): run buf generate --- .github/workflows/proto.yml | 4 + .github/workflows/super-linter.yml | 7 +- .protolint.yml | 58 ++-- proto/exocore/delegation/v1/query.proto | 27 +- proto/exocore/delegation/v1/tx.proto | 58 +++- proto/exocore/deposit/v1/deposit.proto | 2 + proto/exocore/deposit/v1/query.proto | 3 +- proto/exocore/deposit/v1/tx.proto | 2 +- proto/exocore/native_token/v1/tx.proto | 16 +- .../restaking_assets_manage/v1/genesis.proto | 5 + .../restaking_assets_manage/v1/query.proto | 47 ++- .../restaking_assets_manage/v1/tx.proto | 74 ++++- proto/exocore/reward/genesis.proto | 3 +- proto/exocore/reward/params.proto | 5 +- proto/exocore/reward/query.proto | 2 +- proto/exocore/reward/tx.proto | 4 +- proto/exocore/reward/types.proto | 28 +- proto/exocore/slash/genesis.proto | 3 +- proto/exocore/slash/params.proto | 4 +- proto/exocore/slash/query.proto | 2 +- proto/exocore/slash/tx.proto | 4 +- proto/exocore/withdraw/query.proto | 2 +- proto/exocore/withdraw/tx.proto | 2 +- x/delegation/types/query.pb.go | 115 ++++---- x/delegation/types/tx.pb.go | 244 +++++++++------- x/deposit/types/deposit.pb.go | 4 +- x/deposit/types/query.pb.go | 31 +- x/deposit/types/tx.pb.go | 34 +-- x/native_token/types/tx.pb.go | 122 ++++---- x/restaking_assets_manage/types/genesis.pb.go | 9 +- x/restaking_assets_manage/types/query.pb.go | 147 ++++++---- x/restaking_assets_manage/types/tx.pb.go | 267 +++++++++++------- x/reward/types/genesis.pb.go | 23 +- x/reward/types/params.pb.go | 4 +- x/reward/types/query.pb.go | 26 +- x/reward/types/tx.pb.go | 36 +-- x/reward/types/types.pb.go | 40 +-- x/slash/types/genesis.pb.go | 25 +- x/slash/types/params.pb.go | 4 +- x/slash/types/query.pb.go | 26 +- x/slash/types/tx.pb.go | 38 +-- x/withdraw/types/query.pb.go | 32 +-- x/withdraw/types/tx.pb.go | 26 +- 43 files changed, 1002 insertions(+), 613 deletions(-) diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 75e72fb35..d450c6f3a 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -41,4 +41,8 @@ jobs: - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" + # previously, this ran on ref=HEAD~1, which is incorrect as it can + # only be used to compare within a branch. it is designed to run + # on a PR, so it must compare the HEAD of the base branch against + # the PR branch. against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},subdir=proto" diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 6ef2521d8..b13c9fd4e 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Lint Code Base - uses: github/super-linter@v5 + uses: super-linter/super-linter@v6.3.0 # x-release-please-version env: LINTER_RULES_PATH: / YAML_CONFIG_FILE: .yamllint @@ -33,6 +33,9 @@ jobs: VALIDATE_NATURAL_LANGUAGE: false VALIDATE_OPENAPI: false VALIDATE_JSCPD: false + # separate workflow VALIDATE_GO: false - DEFAULT_BRANCH: "master" + VALIDATE_GO_MODULES: false + # TODO: enable docker coverage later + VALIDATE_CHECKOV: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.protolint.yml b/.protolint.yml index bb2b72883..6d6ebf7de 100644 --- a/.protolint.yml +++ b/.protolint.yml @@ -138,35 +138,35 @@ lint: # ## Available conventions are "lower_camel_case", "upper_snake_case", or "lower_snake_case". # convention: upper_snake_case - # MESSAGES_HAVE_COMMENT rule option. - messages_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true - - # SERVICES_HAVE_COMMENT rule option. - services_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true - - # RPCS_HAVE_COMMENT rule option. - rpcs_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true - - # FIELDS_HAVE_COMMENT rule option. - fields_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true - - # ENUMS_HAVE_COMMENT rule option. - enums_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true - - # ENUM_FIELDS_HAVE_COMMENT rule option. - enum_fields_have_comment: - # Comments need to begin with the name of the thing being described. default is false. - should_follow_golang_style: true + # # MESSAGES_HAVE_COMMENT rule option. + # messages_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true + + # # SERVICES_HAVE_COMMENT rule option. + # services_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true + + # # RPCS_HAVE_COMMENT rule option. + # rpcs_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true + + # # FIELDS_HAVE_COMMENT rule option. + # fields_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true + + # # ENUMS_HAVE_COMMENT rule option. + # enums_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true + + # # ENUM_FIELDS_HAVE_COMMENT rule option. + # enum_fields_have_comment: + # # Comments need to begin with the name of the thing being described. default is false. + # should_follow_golang_style: true # # SYNTAX_CONSISTENT rule option. # syntax_consistent: diff --git a/proto/exocore/delegation/v1/query.proto b/proto/exocore/delegation/v1/query.proto index 5b75bdb38..4d4316f8d 100644 --- a/proto/exocore/delegation/v1/query.proto +++ b/proto/exocore/delegation/v1/query.proto @@ -1,26 +1,33 @@ syntax = "proto3"; package exocore.delegation.v1; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; import "cosmos/query/v1/query.proto"; import "cosmos_proto/cosmos.proto"; import "exocore/delegation/v1/tx.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types"; +// DelegationInfoReq is the request to obtain the delegation information +// by staker id and asset id. message DelegationInfoReq { + // staker_id is the staker id. string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + // asset_id is the asset id. string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } +// DelegationAmounts is the delegation amount response for a single delegation. message DelegationAmounts { + // can_undelegation_amount is the amount that can be undelegated. string can_undelegation_amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // wait_undelegation_amount is the amount that is waiting to be unbonded. string wait_undelegation_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -29,23 +36,33 @@ message DelegationAmounts { ]; } +// QueryDelegationInfoResponse is the response for delegations by staker id and +// asset id. message QueryDelegationInfoResponse { + // total_delegated_amount is the total amount that is delegated. string total_delegated_amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - map delegation_infos = 2; + // delegation_infos is the delegation information for each operator. + map delegation_infos = 2; } +// SingleDelegationInfoReq is the request to obtain the single delegation information. message SingleDelegationInfoReq { + // staker_id is the staker id. string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + // operator_addr is the operator address. string operator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // asset_id is the asset id. string asset_id = 3 [(gogoproto.customname) = "AssetID"]; } +// QueryOperatorInfoReq is the request to obtain the operator information. message QueryOperatorInfoReq { + // operator_addr is the operator address. string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -53,7 +70,7 @@ message QueryOperatorInfoReq { // Query is the service API for the delegation module. service Query { // OperatorInfo queries the operator information. - rpc QueryOperatorInfo(QueryOperatorInfoReq) returns(OperatorInfo){ + rpc QueryOperatorInfo(QueryOperatorInfoReq) returns (OperatorInfo) { option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo"; } // DelegationInfo queries the delegation information for {stakerID, assetID}. @@ -63,7 +80,7 @@ service Query { } // SingleDelegationInfo queries the single delegation information for // {chain, staker, asset, operator}. - rpc QuerySingleDelegationInfo(SingleDelegationInfoReq) returns(DelegationAmounts){ + rpc QuerySingleDelegationInfo(SingleDelegationInfoReq) returns (DelegationAmounts) { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/delegation/v1/QuerySingleDelegationInfo"; } diff --git a/proto/exocore/delegation/v1/tx.proto b/proto/exocore/delegation/v1/tx.proto index 68f8578e9..d5b6c4e2a 100644 --- a/proto/exocore/delegation/v1/tx.proto +++ b/proto/exocore/delegation/v1/tx.proto @@ -2,14 +2,16 @@ syntax = "proto3"; package exocore.delegation.v1; +import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types"; +// ValueField is a field that holds a value of sdk.Int type. message ValueField { + // amount is the amount of the asset, as an sdk.Int. string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -18,51 +20,73 @@ message ValueField { ]; } +// DelegatedSingleAssetInfo is a single asset info that is delegated by a staker. message DelegatedSingleAssetInfo { + // asset_id is the asset id. string asset_id = 1 [(gogoproto.customname) = "AssetID"]; + // total_delegated_amount is the total amount of the asset delegated. string total_delegated_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // per_operator_amounts is the amount of the asset delegated to each operator. map per_operator_amounts = 3; } +// ClientChainEarningAddrList is the list of client chain earning addresses. message ClientChainEarningAddrList { + // earning_info_list is the contents of ClientChainEarningAddrList. repeated ClientChainEarningAddrInfo earning_info_list = 1; } +// ClientChainEarningAddrInfo is the client chain earning address info. message ClientChainEarningAddrInfo { + // lz_client_chain_id is the layer0 client chain id. uint64 lz_client_chain_id = 1 [(gogoproto.customname) = "LzClientChainID"]; + // client_chain_earning_addr is the client chain earning address. string client_chain_earning_addr = 2; } +// OperatorInfo is the operator info. message OperatorInfo { + // earnings_addr is the earnings address. string earnings_addr = 1; + // approve_addr is the approve address. string approve_addr = 2; + // operator_meta_info is the operator meta info. string operator_meta_info = 3; + // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningAddrList client_chain_earnings_addr = 4; } +// RegisterOperatorReq is the request to register a new operator. message RegisterOperatorReq { option (cosmos.msg.v1.signer) = "FromAddress"; option (amino.name) = "cosmos-sdk/OperatorInfo"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // from_address is the address of the operator (sdk.AccAddress). string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // info is the operator info. OperatorInfo info = 2; } +// DelegationApproveInfo is the delegation approve info. message DelegationApproveInfo { + // signature of the delegation approve info. string signature = 1; + // salt within the signature. string salt = 2; } -message RegisterOperatorResponse{} +// RegisterOperatorResponse is the response to a register operator request. +message RegisterOperatorResponse {} +// DelegationIncOrDecInfo is the delegation increase or decrease info. message DelegationIncOrDecInfo { option (cosmos.msg.v1.signer) = "fromAddress"; option (amino.name) = "cosmos-sdk/MsgAddOrDecreaseDelegation"; @@ -70,32 +94,49 @@ message DelegationIncOrDecInfo { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // from_address is the staker address string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // per_operator_amounts is the amount of the asset delegated to each operator. map per_operator_amounts = 2; } +// MsgDelegation is the delegation Msg. message MsgDelegation { + // base_info is the delegation increase or decrease request container. DelegationIncOrDecInfo base_info = 1; + // approved_info is the delegation increase or decrease response container. DelegationApproveInfo approved_info = 2; } +// UndelegationRecord is the undelegation record, keyed by a RecordKey. message UndelegationRecord { + // staker_id is the staker id. string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + // asset_id is the asset id. string asset_id = 2 [(gogoproto.customname) = "AssetID"]; - string operator_addr = 3 - [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // operator_addr is the operator address. + string operator_addr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // tx_hash is the transaction hash on the client chain. string tx_hash = 4; + // is_pending is the flag to indicate if the undelegation is pending. bool is_pending = 5; + // block_number is the block number on Exocore. uint64 block_number = 6; + // complete_block_number is the block number on Exocore at which the undelegation + // should be completed. uint64 complete_block_number = 7; + // lz_tx_nonce is the nonce of the transaction on the client chain. uint64 lz_tx_nonce = 8; + // amount is the amount of the asset to be undelegated. string amount = 9 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // actual_completed_amount is the actual amount of the asset that has been + // undelegated so far. it may be lower than the amount in the case of slashing. string actual_completed_amount =10 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -104,16 +145,23 @@ message UndelegationRecord { ]; } +// UndelegationRecordKeyList is the list of undelegation records. message UndelegationRecordKeyList { + // key_list is the list of undelegation record keys. repeated string key_list = 1; } +// DelegationResponse is the response to a delegation request. message DelegationResponse {} +// MsgUndelegation is the undelegation Msg. message MsgUndelegation { + // base_info is the delegation increase or decrease request container. DelegationIncOrDecInfo base_info = 1; } -message UndelegationResponse{} + +// UndelegationResponse is the response to an undelegation request. +message UndelegationResponse {} // Msg defines the delegation Msg service. service Msg { diff --git a/proto/exocore/deposit/v1/deposit.proto b/proto/exocore/deposit/v1/deposit.proto index acbc642cf..df2652407 100644 --- a/proto/exocore/deposit/v1/deposit.proto +++ b/proto/exocore/deposit/v1/deposit.proto @@ -9,8 +9,10 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; // GenesisState defines the restaking_assets_manage module's genesis state. message Params { + // exocore_lz_app_address is the address of the exocore lz app. string exocore_lz_app_address = 1 [(gogoproto.customname) = "ExoCoreLzAppAddress"]; + // exocore_lz_app_event_topic is the topic of the exocore lz app event. string exocore_lz_app_event_topic = 2 [(gogoproto.customname) = "ExoCoreLzAppEventTopic"]; } diff --git a/proto/exocore/deposit/v1/query.proto b/proto/exocore/deposit/v1/query.proto index 0b7fd5dfa..4a02b57c5 100644 --- a/proto/exocore/deposit/v1/query.proto +++ b/proto/exocore/deposit/v1/query.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package exocore.deposit.v1; -import "google/api/annotations.proto"; import "exocore/deposit/v1/deposit.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; @@ -13,6 +13,7 @@ message QueryParamsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC // method. message QueryParamsResponse { + // params defines the parameters for this module. Params params = 1 ; } diff --git a/proto/exocore/deposit/v1/tx.proto b/proto/exocore/deposit/v1/tx.proto index b4a8b3583..6758f22d8 100644 --- a/proto/exocore/deposit/v1/tx.proto +++ b/proto/exocore/deposit/v1/tx.proto @@ -4,8 +4,8 @@ package exocore.deposit.v1; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; import "exocore/deposit/v1/deposit.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types"; diff --git a/proto/exocore/native_token/v1/tx.proto b/proto/exocore/native_token/v1/tx.proto index f75c1c008..03bd89105 100644 --- a/proto/exocore/native_token/v1/tx.proto +++ b/proto/exocore/native_token/v1/tx.proto @@ -7,6 +7,7 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/native_token/types"; +// ValidatorInfo is the information about a validator. message ValidatorInfo { // ValidatorStatus is the status of the validator. enum ValidatorStatus { @@ -19,32 +20,41 @@ message ValidatorInfo { // WITHDRAWN is the status of a validator that has withdrawn from the network. VALIDATOR_STATUS_WITHDRAWN = 3[ (gogoproto.enumvalue_customname) = "ValidatorInfo_WITHDRAWN" ]; } + // status is the validator's status as an enum. ValidatorStatus status = 1; + // validator_index is the index of the validator in the set of validators. uint64 validator_index = 2; + // staked_balance_gwei is the amount of native token staked by the validator in gwei. string staked_balance_gwei = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // most_recent_balance_update_block_number is the block number at which the + // validator's balance was last updated. uint64 most_recent_balance_update_block_number = 4; } +// NativeTokenStakerInfo is the information about a native token staker. message NativeTokenStakerInfo { + // total_validator_balances is the total amount of native token staked. string total_validator_balances = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - string unstaked_value_from_pos = 2 + // unstaked_value_from_pod is the value unstaked from the pod. + string unstaked_value_from_pod = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false, - (gogoproto.customname) = "UnStakedValueFromPOS" + (gogoproto.nullable) = false ]; + // pod_address is the pod address. string pod_address = 3; + // validators_info is the information about the validators, indexed by address. map validators_info = 4; } diff --git a/proto/exocore/restaking_assets_manage/v1/genesis.proto b/proto/exocore/restaking_assets_manage/v1/genesis.proto index 0a1c1c99d..d5069548e 100644 --- a/proto/exocore/restaking_assets_manage/v1/genesis.proto +++ b/proto/exocore/restaking_assets_manage/v1/genesis.proto @@ -6,7 +6,12 @@ import "exocore/restaking_assets_manage/v1/tx.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; // GenesisState defines the restaking_assets_manage module's genesis state. +// TODO: make this state exportable for the case of chain restarts. message GenesisState { + // default_supported_client_chains is the list of supported client chains, + // that are supported by default. repeated ClientChainInfo default_supported_client_chains = 1; + // default_supported_client_chain_tokens is the list of supported client chain tokens, + // that are supported by default. repeated AssetInfo default_supported_client_chain_tokens = 2; } diff --git a/proto/exocore/restaking_assets_manage/v1/query.proto b/proto/exocore/restaking_assets_manage/v1/query.proto index da78d8879..bdde829e1 100644 --- a/proto/exocore/restaking_assets_manage/v1/query.proto +++ b/proto/exocore/restaking_assets_manage/v1/query.proto @@ -1,65 +1,96 @@ syntax = "proto3"; package exocore.restaking_assets_manage.v1; -import "google/api/annotations.proto"; import "cosmos/query/v1/query.proto"; import "cosmos_proto/cosmos.proto"; import "exocore/restaking_assets_manage/v1/tx.proto"; import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; +// QueryClientChainInfo is the query for getting the client chain info by index. message QueryClientChainInfo { + // chain_index is the index of the chain. uint64 chain_index = 1; } +// QueryAllClientChainInfo is the query for all client chains info. message QueryAllClientChainInfo {} -message QueryAllClientChainInfoResponse{ + +// QueryAllClientChainInfoResponse is the response for all client chains info. +message QueryAllClientChainInfoResponse { + // all_client_chain_infos is the all client chain info, indexed by the chain index. map all_client_chain_infos = 1; } +// QueryStakingAssetInfo is the query for getting the staking asset info. message QueryStakingAssetInfo { + // asset_id is the asset for which the query is made. string asset_id = 1 [(gogoproto.customname) = "AssetID"]; } +// QueryAllStakingAssetsInfo is the query for getting all staking assets info. message QueryAllStakingAssetsInfo {} -message QueryAllStakingAssetsInfoResponse{ + +// QueryAllStakingAssetsInfoResponse is the response for all staking assets info, +// indexed by the asset id. +message QueryAllStakingAssetsInfoResponse { + // all_staking_assets_info is the response for all staking assets info. map all_staking_assets_info = 1; } -message QueryStakerAssetInfo{ +// QueryStakerAssetInfo is the query for getting the staker asset info. +message QueryStakerAssetInfo { + // stake_id is the staker id for which the query is made. string staker_id = 1 [(gogoproto.customname) = "StakerID"]; } + +// QueryAssetInfoResponse is the response for the staker asset info. message QueryAssetInfoResponse { + // asset_infos is the response for the staker asset info, indexed by the asset id. map asset_infos = 1; } +// QuerySpecifiedAssetAmountReq is the query for getting the staker specified asset amount. message QuerySpecifiedAssetAmountReq { + // staker_id is the staker id for which the query is made. string staker_id = 1 [(gogoproto.customname) = "StakerID"]; + // asset_id is the asset for which the query is made. string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } - -message QueryOperatorAssetInfos{ +// QueryOperatorAssetInfos is the query for getting the operator asset info. +message QueryOperatorAssetInfos { + // operator_addr is the operator address for which the query is made. string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -message QueryOperatorAssetInfosResponse{ +// QueryOperatorAssetInfosResponse is the response to the operator asset info query. +message QueryOperatorAssetInfosResponse { + // asset_infos is the response for the operator asset info, indexed by the asset id. map asset_infos = 1; } -message QueryOperatorSpecifiedAssetAmountReq{ +// QueryOperatorSpecifiedAssetAmountReq is the query for getting the operator +// specified asset amount. +message QueryOperatorSpecifiedAssetAmountReq { + // operator_addr is the operator address for which the query is made. string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // asset_id is the asset for which the query is made. string asset_id = 2 [(gogoproto.customname) = "AssetID"]; } +// QueryStakerExCoreAddr is the query for getting the staker exocore address. message QueryStakerExCoreAddr { // Per https://github.com/gogo/protobuf/issues/331, grpc-gateway does not like custom names. // So we remove the id suffix from here as well as the query. string staker = 1; } +// QueryStakerExCoreAddrResponse is the response for the staker exocore address query. message QueryStakerExCoreAddrResponse { + // exocore_addr is the exocore address of the staker. string exocore_addr = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.customname) = "ExoCoreAddr" diff --git a/proto/exocore/restaking_assets_manage/v1/tx.proto b/proto/exocore/restaking_assets_manage/v1/tx.proto index a67c51b97..49eb87d8f 100644 --- a/proto/exocore/restaking_assets_manage/v1/tx.proto +++ b/proto/exocore/restaking_assets_manage/v1/tx.proto @@ -1,42 +1,64 @@ syntax = "proto3"; package exocore.restaking_assets_manage.v1; +import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; +// ClientChainInfo defines the client chain information. message ClientChainInfo { + // name of the client chain, like "Ethereum". string name = 1; + // meta_info about the client chain, like "Ethereum blockchain". string meta_info = 2; + // chain_id of the client chain. Not necessarily the EVM chain id. uint64 chain_id = 3; + // exo_core_chain_index is the index of the client chain within the exosystem. uint64 exo_core_chain_index = 4; + // finalization_blocks is the number of blocks to wait for finalization. uint64 finalization_blocks = 5; + // layer_zero_chain_id is the chain id of the client chain, according to L0. + // https://layerzero.gitbook.io/docs/technical-reference/mainnet/supported-chain-ids uint64 layer_zero_chain_id = 6 [(gogoproto.customname) = "LayerZeroChainID"]; + // signature_type is the type of signature used to sign the client chain address. string signature_type = 7; + // client_chain_addr is the length of addresses on the client chain. uint32 address_length = 8; } +// AssetInfo defines the information for an asset to be used in staking. message AssetInfo { + // name of the asset, like "Tether USD" string name = 1; + // symbol of the asset, like "USDT" string symbol = 2; + // address of the asset on the client chain string address = 3; + // decimals used in the asset, typically 6 or 18. uint32 decimals = 4; + // total_supply of the asset, to be used in checks. string total_supply = 5 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // layer_zero_chain_id is the chain id of the asset, according to L0. uint64 layer_zero_chain_id = 6 [(gogoproto.customname) = "LayerZeroChainID"]; + // exo_core_chain_index is the index of the client chain within the exosystem. uint64 exo_core_chain_index = 7; + // meta_info about the asset, like "Tether USD on Ethereum blockchain". string meta_info = 8; } +// StakingAssetInfo defines the information for an asset to be used in staking. message StakingAssetInfo { + // asset_basic_info is the basic information of the asset. AssetInfo asset_basic_info = 1; + // staking_total_amount is the total amount of the asset staked. string staking_total_amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -45,19 +67,29 @@ message StakingAssetInfo { ]; } +// StakerSingleAssetOrChangeInfo defines the information for a single asset or its change. +// The type is an overloaded type and is used in two contexts: +// 1. A staker's deposited, withdrawable, and currently unbonding amount. +// 2. The values by which #1 is to be changed / has been changed. message StakerSingleAssetOrChangeInfo { + // total_deposit_amount_or_want_change_value is the total amount of the asset deposited + // or the amount by which it can change. string total_deposit_amount_or_want_change_value = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // can_withdraw_amount_or_want_change_value is the amount that can be withdrawn + // or the amount by which it can change. string can_withdraw_amount_or_want_change_value = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // or the amount by which it can change. string wait_undelegation_amount_or_want_change_value = 3 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -66,17 +98,26 @@ message StakerSingleAssetOrChangeInfo { ]; } +// StakerAllAssetsInfo defines the information for all assets of a staker. +// It is indexed by the asset_id. message StakerAllAssetsInfo { + // all_assets_state is the state of all assets of the staker. map all_assets_state = 1; } -message OperatorSingleAssetOrChangeInfo{ +// OperatorSingleAssetOrChangeInfo defines the information for a single asset or its change, +// for an operator. It is also overloaded like StakerSingleAssetOrChangeInfo. +message OperatorSingleAssetOrChangeInfo { + // total_amount_or_want_change_value is the total amount of the asset deposited + // or the amount by which it can change. string total_amount_or_want_change_value = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // operator_own_amount_or_want_change_value is the amount that the operator owns + // or the amount by which it can change. //todo: the field is used to mark operator's own assets and is not temporarily used now string operator_own_amount_or_want_change_value = 2 [ @@ -84,6 +125,8 @@ message OperatorSingleAssetOrChangeInfo{ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // or the amount by which it can change. string wait_undelegation_amount_or_want_change_value = 3 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -92,10 +135,15 @@ message OperatorSingleAssetOrChangeInfo{ ]; } +// OperatorAllAssetsInfo defines the information for all assets of an operator, +// indexed by the asset_id. message OperatorAllAssetsInfo { + // all_assets_state is the state of all assets of the operator. map all_assets_state = 1; } +// MsgSetExoCoreAddr defines the MsgSetExoCoreAddr message used to set the +// exocore address of the staker. message MsgSetExoCoreAddr { option (cosmos.msg.v1.signer) = "fromAddress"; option (amino.name) = "exocore/MsgSetExoCoreAddr"; @@ -103,43 +151,61 @@ message MsgSetExoCoreAddr { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // from_address is the address of the staker. string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // set_address is the address to be set. string set_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // client_chain_addr is the address of the client chain. string client_chain_addr = 3; + // client_chain_index is the index of the client chain within the exosystem. uint64 client_chain_index = 4; + // staker_client_chain_signature is the signature of the staker's address + // on the client chain. string staker_client_chain_signature = 5; } + +// MsgSetExoCoreAddrResponse defines the MsgSetExoCoreAddrResponse message used to return the +// response of the MsgSetExoCoreAddr message. message MsgSetExoCoreAddrResponse {} +// RegisterClientChainReq is a request to register a client chain. message RegisterClientChainReq { option (cosmos.msg.v1.signer) = "FromAddress"; option (amino.name) = "cosmos-sdk/RegisterClientChain"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // from_address is the address of the message sender. string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // info is the information of the client chain. ClientChainInfo info = 2; } + +// RegisterClientChainResponse is the response to the RegisterClientChainReq message. message RegisterClientChainResponse {} +// RegisterAssetReq is a request to register an asset on the client chain within +// Exocore. message RegisterAssetReq { option (cosmos.msg.v1.signer) = "FromAddress"; option (amino.name) = "cosmos-sdk/RegisterAsset"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + // from_address is the address of the message sender. string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // info is the information of the asset. AssetInfo info = 2; } + +// RegisterAssetResponse is the response to the RegisterAssetReq message. message RegisterAssetResponse {} // Msg defines the restaking_assets_manage Msg service service Msg { - option (cosmos.msg.v1.service) = true; - // SetStakerExoCoreAddr sets the exocore address of the staker rpc SetStakerExoCoreAddr(MsgSetExoCoreAddr) returns (MsgSetExoCoreAddrResponse); // RegisterClientChain registers the client chain diff --git a/proto/exocore/reward/genesis.proto b/proto/exocore/reward/genesis.proto index 66c8aa11a..01799667a 100644 --- a/proto/exocore/reward/genesis.proto +++ b/proto/exocore/reward/genesis.proto @@ -1,12 +1,13 @@ syntax = "proto3"; package exocore.reward; -import "gogoproto/gogo.proto"; import "exocore/reward/params.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; // GenesisState defines the reward module's genesis state. message GenesisState { + // params represents the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/exocore/reward/params.proto b/proto/exocore/reward/params.proto index c8b6f10f0..fe12aa2d0 100644 --- a/proto/exocore/reward/params.proto +++ b/proto/exocore/reward/params.proto @@ -5,7 +5,8 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; // Params defines the parameters for the module. message Params { + // exo_core_lz_app_address is the address of the L0 app. string exo_core_lz_app_address = 1; - string exo_core_lz_app_event_topic =2; - + // exo_core_lz_app_event_topic is the topic of the L0 app. + string exo_core_lz_app_event_topic =2; } diff --git a/proto/exocore/reward/query.proto b/proto/exocore/reward/query.proto index c6d0076cc..5bb043545 100644 --- a/proto/exocore/reward/query.proto +++ b/proto/exocore/reward/query.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package exocore.reward; -import "google/api/annotations.proto"; import "exocore/reward/params.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; diff --git a/proto/exocore/reward/tx.proto b/proto/exocore/reward/tx.proto index 961aaaf62..d0c74e531 100644 --- a/proto/exocore/reward/tx.proto +++ b/proto/exocore/reward/tx.proto @@ -1,10 +1,10 @@ syntax = "proto3"; package exocore.reward; -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; import "exocore/reward/params.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; diff --git a/proto/exocore/reward/types.proto b/proto/exocore/reward/types.proto index f87dbe1c8..e8b5db1d1 100644 --- a/proto/exocore/reward/types.proto +++ b/proto/exocore/reward/types.proto @@ -1,22 +1,30 @@ syntax = "proto3"; + package exocore.reward; -option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; -import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/ExocoreNetwork/exocore/x/reward/types"; + option (gogoproto.goproto_getters_all) = false; +// Pool is a reward pool. message Pool { - message Reward { - bytes validator = 1 [ (gogoproto.casttype) = + // Reward is the reward for a validator. + message Reward { + // validator is the validator address, as an `sdk.ValAddress`. + bytes validator = 1 [ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress" ]; - repeated cosmos.base.v1beta1.Coin coins = 2 [ + // coins is the reward amount, as `sdk.Coins`. + repeated cosmos.base.v1beta1.Coin coins = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - - } - - string name = 1; - repeated Reward rewards = 2 [ (gogoproto.nullable) = false ]; + } + // name is the name of the pool. + string name = 1; + // rewards is the rewards for the pool, by validator. + repeated Reward rewards = 2 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/exocore/slash/genesis.proto b/proto/exocore/slash/genesis.proto index 0e6702092..07012d7da 100644 --- a/proto/exocore/slash/genesis.proto +++ b/proto/exocore/slash/genesis.proto @@ -1,14 +1,15 @@ syntax = "proto3"; package exocore.slash; -import "gogoproto/gogo.proto"; import "exocore/slash/params.proto"; +import "gogoproto/gogo.proto"; // this line is used by starport scaffolding # genesis/proto/import option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; // GenesisState defines the exoslash module's genesis state. message GenesisState { + // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/exocore/slash/params.proto b/proto/exocore/slash/params.proto index 5a0788081..977d42f20 100644 --- a/proto/exocore/slash/params.proto +++ b/proto/exocore/slash/params.proto @@ -5,7 +5,9 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; // Params defines the parameters for the module. message Params { + // exo_core_lz_app_address defines the address of the lz app string exo_core_lz_app_address = 1; - string exo_core_lz_app_event_topic =2; + // exo_core_lz_app_event_topic defines the topic of the lz app + string exo_core_lz_app_event_topic = 2; } diff --git a/proto/exocore/slash/query.proto b/proto/exocore/slash/query.proto index e42bb71ff..e3613fc3a 100644 --- a/proto/exocore/slash/query.proto +++ b/proto/exocore/slash/query.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package exocore.slash; -import "google/api/annotations.proto"; import "exocore/slash/params.proto"; +import "google/api/annotations.proto"; // this line is used by starport scaffolding # 1 option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; diff --git a/proto/exocore/slash/tx.proto b/proto/exocore/slash/tx.proto index ca071efac..b23736d4a 100644 --- a/proto/exocore/slash/tx.proto +++ b/proto/exocore/slash/tx.proto @@ -1,10 +1,10 @@ syntax = "proto3"; package exocore.slash; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; import "exocore/slash/params.proto"; import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/msg/v1/msg.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/slash/types"; diff --git a/proto/exocore/withdraw/query.proto b/proto/exocore/withdraw/query.proto index 896c69d25..919d2ec9c 100644 --- a/proto/exocore/withdraw/query.proto +++ b/proto/exocore/withdraw/query.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package exocore.withdraw; -import "google/api/annotations.proto"; import "exocore/deposit/v1/deposit.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; diff --git a/proto/exocore/withdraw/tx.proto b/proto/exocore/withdraw/tx.proto index 2053a854e..c88670e8e 100644 --- a/proto/exocore/withdraw/tx.proto +++ b/proto/exocore/withdraw/tx.proto @@ -4,8 +4,8 @@ package exocore.withdraw; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; import "exocore/deposit/v1/deposit.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; // MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 4b11f9eb5..55dd872d0 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -32,9 +32,13 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// DelegationInfoReq is the request to obtain the delegation information +// by staker id and asset id. type DelegationInfoReq struct { + // staker_id is the staker id. StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *DelegationInfoReq) Reset() { *m = DelegationInfoReq{} } @@ -84,8 +88,11 @@ func (m *DelegationInfoReq) GetAssetID() string { return "" } +// DelegationAmounts is the delegation amount response for a single delegation. type DelegationAmounts struct { - CanUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=can_undelegation_amount,json=canUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_undelegation_amount"` + // can_undelegation_amount is the amount that can be undelegated. + CanUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=can_undelegation_amount,json=canUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_undelegation_amount"` + // wait_undelegation_amount is the amount that is waiting to be unbonded. WaitUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=wait_undelegation_amount,json=waitUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount"` } @@ -122,9 +129,13 @@ func (m *DelegationAmounts) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationAmounts proto.InternalMessageInfo +// QueryDelegationInfoResponse is the response for delegations by staker id and +// asset id. type QueryDelegationInfoResponse struct { + // total_delegated_amount is the total amount that is delegated. TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_delegated_amount,json=totalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_delegated_amount"` - DelegationInfos map[string]*DelegationAmounts `protobuf:"bytes,2,rep,name=delegation_infos,json=delegationInfos,proto3" json:"delegation_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // delegation_infos is the delegation information for each operator. + DelegationInfos map[string]*DelegationAmounts `protobuf:"bytes,2,rep,name=delegation_infos,json=delegationInfos,proto3" json:"delegation_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *QueryDelegationInfoResponse) Reset() { *m = QueryDelegationInfoResponse{} } @@ -167,10 +178,14 @@ func (m *QueryDelegationInfoResponse) GetDelegationInfos() map[string]*Delegatio return nil } +// SingleDelegationInfoReq is the request to obtain the single delegation information. type SingleDelegationInfoReq struct { - StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + // staker_id is the staker id. + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + // operator_addr is the operator address. OperatorAddr string `protobuf:"bytes,2,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` - AssetID string `protobuf:"bytes,3,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,3,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *SingleDelegationInfoReq) Reset() { *m = SingleDelegationInfoReq{} } @@ -227,7 +242,9 @@ func (m *SingleDelegationInfoReq) GetAssetID() string { return "" } +// QueryOperatorInfoReq is the request to obtain the operator information. type QueryOperatorInfoReq struct { + // operator_addr is the operator address. OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` } @@ -283,50 +300,50 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } var fileDescriptor_aab345e1cf20490c = []byte{ - // 678 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x4f, 0x13, 0x4f, - 0x1c, 0xed, 0x2e, 0x7f, 0xfe, 0xc0, 0x80, 0x11, 0xc6, 0x02, 0xa5, 0x98, 0x2d, 0xae, 0x09, 0xa9, - 0x18, 0x76, 0xa5, 0x6a, 0x62, 0x8c, 0x98, 0x40, 0x4a, 0xc8, 0x5e, 0x30, 0x2e, 0xe1, 0xe2, 0xa5, - 0x19, 0xba, 0xc3, 0xba, 0x69, 0x99, 0x29, 0x33, 0xd3, 0x42, 0x8f, 0xea, 0xc5, 0xa3, 0x89, 0xf1, - 0x4b, 0xe8, 0xc5, 0x03, 0x1f, 0x82, 0x23, 0xc1, 0x8b, 0xf1, 0xd0, 0x98, 0x62, 0xe2, 0x07, 0xf0, - 0x0b, 0x98, 0x9d, 0xdd, 0xc2, 0xb6, 0xdd, 0x45, 0x89, 0x9c, 0xba,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x53, 0x2d, 0xf5, 0xe2, 0x41, - 0xe4, 0x4a, 0x59, 0x0b, 0x58, 0x37, 0xb0, 0xd8, 0xa7, 0xac, 0x72, 0x26, 0x72, 0x10, 0x95, 0x91, - 0x97, 0xcc, 0xf6, 0xff, 0xf2, 0x1b, 0x72, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x47, 0x12, - 0x54, 0x68, 0x0b, 0x07, 0x00, 0x00, + // 676 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0x96, 0x1f, 0x3f, 0x60, 0xc0, 0x08, 0x63, 0x81, 0x52, 0xcc, 0x16, 0xd7, 0x84, 0x54, + 0x0c, 0xbb, 0x52, 0x35, 0x31, 0x46, 0x4c, 0x20, 0x25, 0x64, 0x2f, 0x18, 0x97, 0x70, 0xf1, 0xd2, + 0x0c, 0xdd, 0x61, 0xdd, 0xb4, 0xcc, 0x94, 0x99, 0x69, 0xa1, 0x47, 0xf5, 0xe2, 0xd1, 0xc4, 0xf8, + 0x25, 0xf4, 0xe2, 0x81, 0x0f, 0xc1, 0x91, 0xe0, 0xc5, 0x78, 0x68, 0x4c, 0x31, 0xf1, 0x03, 0xf8, + 0x05, 0xcc, 0xce, 0x4e, 0xa1, 0x7f, 0x76, 0x51, 0x22, 0xa7, 0xee, 0xbe, 0x7f, 0x9e, 0xe7, 0x99, + 0xf7, 0x7d, 0x76, 0x0a, 0x6e, 0xe1, 0x03, 0x5a, 0xa2, 0x0c, 0x5b, 0x2e, 0xae, 0x60, 0x0f, 0x09, + 0x9f, 0x12, 0xab, 0xbe, 0x64, 0xed, 0xd5, 0x30, 0x6b, 0x98, 0x55, 0x46, 0x05, 0x85, 0x93, 0xaa, + 0xc4, 0x3c, 0x2f, 0x31, 0xeb, 0x4b, 0x99, 0xd9, 0x12, 0xe5, 0xb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0x56, 0xda, 0x47, 0xaf, 0x5d, 0x86, 0x3e, + 0xff, 0xe6, 0x3f, 0x30, 0x28, 0x71, 0xe1, 0x07, 0x0d, 0x4c, 0xf4, 0x31, 0xc0, 0xbb, 0x17, 0x2d, + 0xbb, 0x47, 0x4b, 0xe6, 0x76, 0x4c, 0x71, 0x67, 0x9d, 0x61, 0xbe, 0xfe, 0xf2, 0xe3, 0x7d, 0x32, + 0x07, 0xe7, 0xad, 0xe8, 0x5b, 0x6b, 0x1d, 0x8b, 0x2e, 0x05, 0x1f, 0x35, 0x70, 0x23, 0xc2, 0x5a, + 0xf0, 0xcf, 0x3b, 0x6f, 0xcb, 0xca, 0x5f, 0xde, 0xb0, 0xc6, 0xc3, 0xb7, 0x3f, 0x3f, 0x2f, 0x68, + 0x52, 0xea, 0x02, 0xcc, 0xc5, 0x4b, 0xed, 0x11, 0x75, 0xa8, 0x81, 0x19, 0x09, 0x1b, 0x65, 0x2c, + 0x68, 0xc6, 0x08, 0x89, 0x71, 0x61, 0xe6, 0xaf, 0x6d, 0x6d, 0x2c, 0x9f, 0xcb, 0xcd, 0xc3, 0x7b, + 0x31, 0x72, 0x63, 0x85, 0xad, 0x6e, 0x1c, 0xb5, 0x74, 0xed, 0xb8, 0xa5, 0x6b, 0xdf, 0x5b, 0xba, + 0xf6, 0xee, 0x54, 0x4f, 0x1c, 0x9f, 0xea, 0x89, 0xaf, 0xa7, 0x7a, 0xe2, 0xc5, 0x83, 0x8e, 0x2b, + 0x65, 0x2d, 0x44, 0xdd, 0xc0, 0x62, 0x9f, 0xb2, 0xf2, 0x19, 0xc9, 0x41, 0x27, 0x8d, 0xbc, 0x64, + 0xb6, 0xff, 0x97, 0xff, 0x21, 0xf7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xde, 0x68, 0x9a, 0xc7, + 0x0b, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/delegation/types/tx.pb.go b/x/delegation/types/tx.pb.go index 757d67414..82266f9cf 100644 --- a/x/delegation/types/tx.pb.go +++ b/x/delegation/types/tx.pb.go @@ -32,7 +32,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ValueField is a field that holds a value of sdk.Int type. type ValueField struct { + // amount is the amount of the asset, as an sdk.Int. Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` } @@ -69,10 +71,14 @@ func (m *ValueField) XXX_DiscardUnknown() { var xxx_messageInfo_ValueField proto.InternalMessageInfo +// DelegatedSingleAssetInfo is a single asset info that is delegated by a staker. type DelegatedSingleAssetInfo struct { - AssetID string `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // total_delegated_amount is the total amount of the asset delegated. TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_delegated_amount,json=totalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_delegated_amount"` - PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,3,rep,name=per_operator_amounts,json=perOperatorAmounts,proto3" json:"per_operator_amounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // per_operator_amounts is the amount of the asset delegated to each operator. + PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,3,rep,name=per_operator_amounts,json=perOperatorAmounts,proto3" json:"per_operator_amounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *DelegatedSingleAssetInfo) Reset() { *m = DelegatedSingleAssetInfo{} } @@ -122,7 +128,9 @@ func (m *DelegatedSingleAssetInfo) GetPerOperatorAmounts() map[string]*ValueFiel return nil } +// ClientChainEarningAddrList is the list of client chain earning addresses. type ClientChainEarningAddrList struct { + // earning_info_list is the contents of ClientChainEarningAddrList. EarningInfoList []*ClientChainEarningAddrInfo `protobuf:"bytes,1,rep,name=earning_info_list,json=earningInfoList,proto3" json:"earning_info_list,omitempty"` } @@ -166,8 +174,11 @@ func (m *ClientChainEarningAddrList) GetEarningInfoList() []*ClientChainEarningA return nil } +// ClientChainEarningAddrInfo is the client chain earning address info. type ClientChainEarningAddrInfo struct { - LzClientChainID uint64 `protobuf:"varint,1,opt,name=lz_client_chain_id,json=lzClientChainId,proto3" json:"lz_client_chain_id,omitempty"` + // lz_client_chain_id is the layer0 client chain id. + LzClientChainID uint64 `protobuf:"varint,1,opt,name=lz_client_chain_id,json=lzClientChainId,proto3" json:"lz_client_chain_id,omitempty"` + // client_chain_earning_addr is the client chain earning address. ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=client_chain_earning_addr,json=clientChainEarningAddr,proto3" json:"client_chain_earning_addr,omitempty"` } @@ -218,10 +229,15 @@ func (m *ClientChainEarningAddrInfo) GetClientChainEarningAddr() string { return "" } +// OperatorInfo is the operator info. type OperatorInfo struct { - EarningsAddr string `protobuf:"bytes,1,opt,name=earnings_addr,json=earningsAddr,proto3" json:"earnings_addr,omitempty"` - ApproveAddr string `protobuf:"bytes,2,opt,name=approve_addr,json=approveAddr,proto3" json:"approve_addr,omitempty"` - OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` + // earnings_addr is the earnings address. + EarningsAddr string `protobuf:"bytes,1,opt,name=earnings_addr,json=earningsAddr,proto3" json:"earnings_addr,omitempty"` + // approve_addr is the approve address. + ApproveAddr string `protobuf:"bytes,2,opt,name=approve_addr,json=approveAddr,proto3" json:"approve_addr,omitempty"` + // operator_meta_info is the operator meta info. + OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` + // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=client_chain_earnings_addr,json=clientChainEarningsAddr,proto3" json:"client_chain_earnings_addr,omitempty"` } @@ -286,9 +302,12 @@ func (m *OperatorInfo) GetClientChainEarningsAddr() *ClientChainEarningAddrList return nil } +// RegisterOperatorReq is the request to register a new operator. type RegisterOperatorReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *OperatorInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the address of the operator (sdk.AccAddress). + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // info is the operator info. + Info *OperatorInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterOperatorReq) Reset() { *m = RegisterOperatorReq{} } @@ -324,9 +343,12 @@ func (m *RegisterOperatorReq) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorReq proto.InternalMessageInfo +// DelegationApproveInfo is the delegation approve info. type DelegationApproveInfo struct { + // signature of the delegation approve info. Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` - Salt string `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"` + // salt within the signature. + Salt string `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"` } func (m *DelegationApproveInfo) Reset() { *m = DelegationApproveInfo{} } @@ -376,6 +398,7 @@ func (m *DelegationApproveInfo) GetSalt() string { return "" } +// RegisterOperatorResponse is the response to a register operator request. type RegisterOperatorResponse struct { } @@ -412,8 +435,11 @@ func (m *RegisterOperatorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorResponse proto.InternalMessageInfo +// DelegationIncOrDecInfo is the delegation increase or decrease info. type DelegationIncOrDecInfo struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // from_address is the staker address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // per_operator_amounts is the amount of the asset delegated to each operator. PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,2,rep,name=per_operator_amounts,json=perOperatorAmounts,proto3" json:"per_operator_amounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -450,9 +476,12 @@ func (m *DelegationIncOrDecInfo) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationIncOrDecInfo proto.InternalMessageInfo +// MsgDelegation is the delegation Msg. type MsgDelegation struct { - BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=base_info,json=baseInfo,proto3" json:"base_info,omitempty"` - ApprovedInfo *DelegationApproveInfo `protobuf:"bytes,2,opt,name=approved_info,json=approvedInfo,proto3" json:"approved_info,omitempty"` + // base_info is the delegation increase or decrease request container. + BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=base_info,json=baseInfo,proto3" json:"base_info,omitempty"` + // approved_info is the delegation increase or decrease response container. + ApprovedInfo *DelegationApproveInfo `protobuf:"bytes,2,opt,name=approved_info,json=approvedInfo,proto3" json:"approved_info,omitempty"` } func (m *MsgDelegation) Reset() { *m = MsgDelegation{} } @@ -502,16 +531,29 @@ func (m *MsgDelegation) GetApprovedInfo() *DelegationApproveInfo { return nil } +// UndelegationRecord is the undelegation record, keyed by a RecordKey. type UndelegationRecord struct { - StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` - OperatorAddr string `protobuf:"bytes,3,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` - TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - IsPending bool `protobuf:"varint,5,opt,name=is_pending,json=isPending,proto3" json:"is_pending,omitempty"` - BlockNumber uint64 `protobuf:"varint,6,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - CompleteBlockNumber uint64 `protobuf:"varint,7,opt,name=complete_block_number,json=completeBlockNumber,proto3" json:"complete_block_number,omitempty"` - LzTxNonce uint64 `protobuf:"varint,8,opt,name=lz_tx_nonce,json=lzTxNonce,proto3" json:"lz_tx_nonce,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + // staker_id is the staker id. + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // operator_addr is the operator address. + OperatorAddr string `protobuf:"bytes,3,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + // tx_hash is the transaction hash on the client chain. + TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + // is_pending is the flag to indicate if the undelegation is pending. + IsPending bool `protobuf:"varint,5,opt,name=is_pending,json=isPending,proto3" json:"is_pending,omitempty"` + // block_number is the block number on Exocore. + BlockNumber uint64 `protobuf:"varint,6,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // complete_block_number is the block number on Exocore at which the undelegation + // should be completed. + CompleteBlockNumber uint64 `protobuf:"varint,7,opt,name=complete_block_number,json=completeBlockNumber,proto3" json:"complete_block_number,omitempty"` + // lz_tx_nonce is the nonce of the transaction on the client chain. + LzTxNonce uint64 `protobuf:"varint,8,opt,name=lz_tx_nonce,json=lzTxNonce,proto3" json:"lz_tx_nonce,omitempty"` + // amount is the amount of the asset to be undelegated. + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + // actual_completed_amount is the actual amount of the asset that has been + // undelegated so far. it may be lower than the amount in the case of slashing. ActualCompletedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=actual_completed_amount,json=actualCompletedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"actual_completed_amount"` } @@ -604,7 +646,9 @@ func (m *UndelegationRecord) GetLzTxNonce() uint64 { return 0 } +// UndelegationRecordKeyList is the list of undelegation records. type UndelegationRecordKeyList struct { + // key_list is the list of undelegation record keys. KeyList []string `protobuf:"bytes,1,rep,name=key_list,json=keyList,proto3" json:"key_list,omitempty"` } @@ -648,6 +692,7 @@ func (m *UndelegationRecordKeyList) GetKeyList() []string { return nil } +// DelegationResponse is the response to a delegation request. type DelegationResponse struct { } @@ -684,7 +729,9 @@ func (m *DelegationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationResponse proto.InternalMessageInfo +// MsgUndelegation is the undelegation Msg. type MsgUndelegation struct { + // base_info is the delegation increase or decrease request container. BaseInfo *DelegationIncOrDecInfo `protobuf:"bytes,1,opt,name=base_info,json=baseInfo,proto3" json:"base_info,omitempty"` } @@ -728,6 +775,7 @@ func (m *MsgUndelegation) GetBaseInfo() *DelegationIncOrDecInfo { return nil } +// UndelegationResponse is the response to an undelegation request. type UndelegationResponse struct { } @@ -787,83 +835,83 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/tx.proto", fileDescriptor_16596a15a828f109) } var fileDescriptor_16596a15a828f109 = []byte{ - // 1205 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0xdb, 0x54, - 0x1c, 0x8f, 0x93, 0xae, 0x4d, 0xbe, 0x49, 0xd5, 0xed, 0x2d, 0x6d, 0xd2, 0x00, 0xc9, 0xe6, 0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, 0xf5, 0x29, 0x72, 0x93, 0x12, 0x5b, 0x3a, 0xf6, 0xf5, 0xd3, 0xfb, - 0x2b, 0xca, 0xc6, 0xf6, 0xc3, 0x61, 0x59, 0x79, 0x34, 0x2c, 0x2b, 0x7f, 0x0c, 0xcb, 0xca, 0xf7, - 0x4f, 0xca, 0x89, 0x47, 0x4f, 0xca, 0x89, 0x5f, 0x9f, 0x94, 0x13, 0x9f, 0x5f, 0x8a, 0xf5, 0xe2, - 0xa6, 0xb4, 0xbb, 0x8d, 0xf9, 0x5d, 0xea, 0xb5, 0x6b, 0xe1, 0xd7, 0x47, 0x3f, 0xfe, 0xfd, 0x21, - 0xba, 0xb3, 0x39, 0x2b, 0x3e, 0x06, 0xde, 0xf8, 0x27, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x02, 0xa2, - 0x16, 0xa2, 0x0c, 0x00, 0x00, + // 1207 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xda, 0x69, 0x62, 0x3f, 0x3b, 0x4a, 0x3b, 0x75, 0x62, 0xc7, 0x80, 0xdd, 0x6e, 0xa1, + 0x6a, 0x43, 0x63, 0xab, 0xa1, 0xa2, 0x50, 0x40, 0x22, 0xa9, 0x53, 0x30, 0x34, 0x69, 0xd9, 0x16, + 0x0e, 0x48, 0xd5, 0x6a, 0xbd, 0x3b, 0x59, 0x2f, 0x5e, 0xcf, 0x98, 0x9d, 0x71, 0x6a, 0x87, 0x0b, + 0xe2, 0x84, 0x38, 0x71, 0x45, 0x5c, 0xca, 0x17, 0x40, 0x3d, 0xf4, 0x0b, 0x70, 0xeb, 0xb1, 0xea, + 0x09, 0x21, 0x11, 0x21, 0xf7, 0x50, 0x3e, 0x00, 0x47, 0x0e, 0x68, 0x67, 0x76, 0xbd, 0xeb, 0xc6, + 0x6e, 0xa8, 0xc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, 0xb8, 0x5f, 0x99, 0x93, 0x06, 0x75, + 0x6d, 0x4e, 0x28, 0x1b, 0x16, 0xf2, 0x60, 0x89, 0x53, 0x6e, 0xb8, 0xba, 0x15, 0x22, 0xe9, 0x41, + 0xa8, 0xc9, 0x23, 0x08, 0x35, 0x2f, 0xb0, 0x47, 0x41, 0xae, 0x0b, 0x64, 0x34, 0x80, 0x7c, 0x17, + 0x7b, 0x3a, 0xed, 0x62, 0xcf, 0xe0, 0xd4, 0x0b, 0x08, 0x59, 0x31, 0x75, 0x2a, 0x75, 0x2e, 0xbb, + 0xf6, 0x41, 0x75, 0x62, 0xbf, 0xaa, 0xd3, 0x52, 0xad, 0xde, 0xc4, 0xde, 0x8d, 0x00, 0x4a, 0x12, + 0xb0, 0x4d, 0xc2, 0xbd, 0x81, 0x86, 0xba, 0x07, 0x14, 0xa5, 0x16, 0x14, 0xa6, 0x98, 0xa3, 0xe3, + 0x90, 0x6a, 0xe3, 0x81, 0x2c, 0x96, 0xe6, 0xff, 0x44, 0x97, 0xe1, 0xd8, 0xae, 0xdf, 0x44, 0x51, + 0x8a, 0xec, 0xda, 0xe9, 0x29, 0x81, 0x45, 0x8d, 0xd6, 0xa4, 0xfd, 0x95, 0xe4, 0x5b, 0x8a, 0xfa, + 0x15, 0x94, 0xae, 0xba, 0x0e, 0x26, 0xfc, 0x6a, 0xcb, 0x70, 0xc8, 0xa6, 0xe1, 0x11, 0x87, 0xd8, + 0xeb, 0x96, 0xe5, 0x5d, 0x77, 0x18, 0x47, 0x77, 0xe0, 0x04, 0x96, 0x22, 0xdd, 0x21, 0x3b, 0x54, + 0x77, 0x1d, 0xe6, 0x0f, 0x87, 0x9f, 0xff, 0xc5, 0x29, 0x34, 0x93, 0xd1, 0xfc, 0x0a, 0x68, 0x0b, + 0x01, 0x96, 0xff, 0xe0, 0xc3, 0xab, 0x3f, 0x28, 0xd3, 0xd8, 0xc5, 0x70, 0xbc, 0x0f, 0xc8, 0xdd, + 0xd3, 0x4d,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6f, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x26, + 0x9a, 0x38, 0xa1, 0xa2, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/deposit/types/deposit.pb.go b/x/deposit/types/deposit.pb.go index 7dd66f3bb..7b6c68395 100644 --- a/x/deposit/types/deposit.pb.go +++ b/x/deposit/types/deposit.pb.go @@ -25,7 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the restaking_assets_manage module's genesis state. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exocore_lz_app_address,json=exocoreLzAppAddress,proto3" json:"exocore_lz_app_address,omitempty"` + // exocore_lz_app_address is the address of the exocore lz app. + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exocore_lz_app_address,json=exocoreLzAppAddress,proto3" json:"exocore_lz_app_address,omitempty"` + // exocore_lz_app_event_topic is the topic of the exocore lz app event. ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exocore_lz_app_event_topic,json=exocoreLzAppEventTopic,proto3" json:"exocore_lz_app_event_topic,omitempty"` } diff --git a/x/deposit/types/query.pb.go b/x/deposit/types/query.pb.go index a13c1ed80..becbd9a79 100644 --- a/x/deposit/types/query.pb.go +++ b/x/deposit/types/query.pb.go @@ -68,6 +68,7 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is the response type for the Query/Params RPC // method. type QueryParamsResponse struct { + // params defines the parameters for this module. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } @@ -119,24 +120,24 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/query.proto", fileDescriptor_715f16e6b5833923) } var fileDescriptor_715f16e6b5833923 = []byte{ - // 264 bytes of a gzipped FileDescriptorProto + // 263 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe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x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, - 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x77, 0x85, 0xe8, 0xf7, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0x1b, 0x57, 0x01, 0x37, 0xb0, - 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x7a, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x83, 0x9e, 0x93, 0xef, 0xb3, 0x01, 0x00, 0x00, + 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x14, 0xb0, 0xe8, 0x81, 0x49, 0x83, 0x75, 0x49, 0xc9, 0xa4, 0xe7, + 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, + 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x64, 0x95, 0x44, 0xb8, 0x84, 0x02, 0x41, 0x56, 0x04, 0x24, 0x16, + 0x25, 0xe6, 0x16, 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x28, 0x79, 0x72, 0x09, 0xa3, 0x88, + 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x19, 0x71, 0xb1, 0x15, 0x80, 0x45, 0x24, 0x18, 0x15, + 0x18, 0x35, 0xb8, 0x8d, 0xa4, 0xf4, 0x30, 0x5d, 0xa4, 0x07, 0xd5, 0x03, 0x55, 0x69, 0xd4, 0xc6, + 0xc8, 0xc5, 0x0a, 0x36, 0x4b, 0xa8, 0x96, 0x8b, 0x0d, 0x22, 0x27, 0xa4, 0x86, 0x4d, 0x1f, 0xa6, + 0x33, 0xa4, 0xd4, 0x09, 0xaa, 0x83, 0x38, 0x4c, 0x49, 0xa9, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x32, + 0x42, 0x52, 0xfa, 0x58, 0x82, 0x03, 0xa2, 0xd6, 0xc9, 0xfb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, + 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, + 0x5d, 0x21, 0xfa, 0xfd, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xe1, 0xc6, 0x55, 0xc0, 0x0d, 0x2c, + 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x9e, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x59, + 0x1e, 0x95, 0x6f, 0xb3, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/deposit/types/tx.pb.go b/x/deposit/types/tx.pb.go index 89a03e49b..1ea759566 100644 --- a/x/deposit/types/tx.pb.go +++ b/x/deposit/types/tx.pb.go @@ -139,23 +139,23 @@ var fileDescriptor_d4939a0226905392 = []byte{ 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4a, 0xea, 0x41, 0x25, 0xf5, 0xca, 0x0c, 0xa5, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0x41, 0x6a, 0x73, - 0x8b, 0xd3, 0x21, 0x8a, 0xa5, 0x24, 0x21, 0x12, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x95, 0x12, - 0x49, 0xcf, 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x50, 0x51, 0x05, 0x2c, 0x56, 0xc3, 0x2c, 0x02, - 0xab, 0x50, 0x9a, 0xcc, 0xc8, 0xc5, 0xef, 0x5b, 0x9c, 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, - 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0x64, 0xc6, 0xc5, 0x99, 0x58, 0x5a, 0x92, 0x91, 0x5f, 0x94, - 0x59, 0x52, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0x71, 0x69, 0x8b, 0xae, 0x08, 0xd4, - 0x42, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x84, - 0x52, 0x21, 0x0b, 0x2e, 0xb6, 0x02, 0xb0, 0x09, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, - 0x7a, 0x98, 0x9e, 0xd3, 0x83, 0xd8, 0xe1, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0xbd, - 0x15, 0x5f, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0x93, 0x94, 0x24, 0xb9, 0xc4, 0xd1, 0x1c, 0x15, 0x94, - 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, 0x94, 0xc7, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x94, 0xc0, - 0xc5, 0x83, 0xe2, 0x66, 0x65, 0x6c, 0x76, 0xa1, 0x99, 0x21, 0xa5, 0x4d, 0x84, 0x22, 0x98, 0x45, - 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, - 0x2b, 0xc4, 0x5c, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x58, 0xb0, 0x57, 0xc0, 0x03, - 0xbe, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0xe8, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xe6, 0xe4, 0x92, 0x15, 0x13, 0x02, 0x00, 0x00, + 0x8b, 0xd3, 0x21, 0x8a, 0xa5, 0x24, 0x21, 0x12, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x95, 0x52, + 0xc0, 0x62, 0x09, 0xcc, 0x48, 0x88, 0x0a, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x88, 0x4e, 0x10, 0x0b, + 0x22, 0xaa, 0x34, 0x99, 0x91, 0x8b, 0xdf, 0xb7, 0x38, 0x3d, 0xb4, 0x20, 0x25, 0xb1, 0x24, 0x35, + 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, 0x8c, 0x8b, 0x33, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, + 0xb3, 0xa4, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xe2, 0xd2, 0x16, 0x5d, 0x11, 0xa8, + 0x85, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x41, 0x08, + 0xa5, 0x42, 0x16, 0x5c, 0x6c, 0x05, 0x60, 0x13, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xa4, + 0xf4, 0x30, 0x3d, 0xa7, 0x07, 0xb1, 0xc3, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x7a, + 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0x26, 0x29, 0x49, 0x72, 0x89, 0xa3, 0x39, 0x2a, 0x28, + 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28, 0x8f, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x81, + 0x8b, 0x07, 0xc5, 0xcd, 0xca, 0xd8, 0xec, 0x42, 0x33, 0x43, 0x4a, 0x9b, 0x08, 0x45, 0x30, 0x8b, + 0xa4, 0x58, 0x1b, 0x9e, 0x6f, 0xd0, 0x62, 0x74, 0xf2, 0x3e, 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, 0xc3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, + 0x57, 0x88, 0xb9, 0x7e, 0xa9, 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0xfa, 0xb0, 0xc8, 0xa8, 0x80, 0x47, + 0x47, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xd0, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x1b, 0x3a, 0x48, 0x09, 0x13, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/native_token/types/tx.pb.go b/x/native_token/types/tx.pb.go index 7f23bb815..e373d9728 100644 --- a/x/native_token/types/tx.pb.go +++ b/x/native_token/types/tx.pb.go @@ -61,11 +61,17 @@ func (ValidatorInfo_ValidatorStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_769c53c072051eb9, []int{0, 0} } +// ValidatorInfo is the information about a validator. type ValidatorInfo struct { - Status ValidatorInfo_ValidatorStatus `protobuf:"varint,1,opt,name=status,proto3,enum=exocore.native_token.v1.ValidatorInfo_ValidatorStatus" json:"status,omitempty"` - ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` - StakedBalanceGwei github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=staked_balance_gwei,json=stakedBalanceGwei,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"staked_balance_gwei"` - MostRecentBalanceUpdateBlockNumber uint64 `protobuf:"varint,4,opt,name=most_recent_balance_update_block_number,json=mostRecentBalanceUpdateBlockNumber,proto3" json:"most_recent_balance_update_block_number,omitempty"` + // status is the validator's status as an enum. + Status ValidatorInfo_ValidatorStatus `protobuf:"varint,1,opt,name=status,proto3,enum=exocore.native_token.v1.ValidatorInfo_ValidatorStatus" json:"status,omitempty"` + // validator_index is the index of the validator in the set of validators. + ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + // staked_balance_gwei is the amount of native token staked by the validator in gwei. + StakedBalanceGwei github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=staked_balance_gwei,json=stakedBalanceGwei,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"staked_balance_gwei"` + // most_recent_balance_update_block_number is the block number at which the + // validator's balance was last updated. + MostRecentBalanceUpdateBlockNumber uint64 `protobuf:"varint,4,opt,name=most_recent_balance_update_block_number,json=mostRecentBalanceUpdateBlockNumber,proto3" json:"most_recent_balance_update_block_number,omitempty"` } func (m *ValidatorInfo) Reset() { *m = ValidatorInfo{} } @@ -122,11 +128,16 @@ func (m *ValidatorInfo) GetMostRecentBalanceUpdateBlockNumber() uint64 { return 0 } +// NativeTokenStakerInfo is the information about a native token staker. type NativeTokenStakerInfo struct { + // total_validator_balances is the total amount of native token staked. TotalValidatorBalances github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_validator_balances,json=totalValidatorBalances,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_validator_balances"` - UnStakedValueFromPOS github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=unstaked_value_from_pos,json=unstakedValueFromPos,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"unstaked_value_from_pos"` - PodAddress string `protobuf:"bytes,3,opt,name=pod_address,json=podAddress,proto3" json:"pod_address,omitempty"` - ValidatorsInfo map[string]*ValidatorInfo `protobuf:"bytes,4,rep,name=validators_info,json=validatorsInfo,proto3" json:"validators_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // unstaked_value_from_pod is the value unstaked from the pod. + UnstakedValueFromPod github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=unstaked_value_from_pod,json=unstakedValueFromPod,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"unstaked_value_from_pod"` + // pod_address is the pod address. + PodAddress string `protobuf:"bytes,3,opt,name=pod_address,json=podAddress,proto3" json:"pod_address,omitempty"` + // validators_info is the information about the validators, indexed by address. + ValidatorsInfo map[string]*ValidatorInfo `protobuf:"bytes,4,rep,name=validators_info,json=validatorsInfo,proto3" json:"validators_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *NativeTokenStakerInfo) Reset() { *m = NativeTokenStakerInfo{} } @@ -186,50 +197,49 @@ func init() { func init() { proto.RegisterFile("exocore/native_token/v1/tx.proto", fileDescriptor_769c53c072051eb9) } var fileDescriptor_769c53c072051eb9 = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0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, 0xde, 0x29, 0xc9, 0x26, 0x95, 0x44, - 0x71, 0x69, 0xa7, 0xfa, 0x60, 0x25, 0xde, 0xeb, 0xf7, 0xb4, 0x22, 0x69, 0x38, 0xac, 0x79, 0xcc, - 0x3f, 0x9f, 0x29, 0x3a, 0x3e, 0x29, 0x3b, 0x60, 0xf5, 0x1e, 0x18, 0x4c, 0x81, 0x84, 0x8b, 0xcf, - 0xc5, 0xab, 0xe8, 0xe1, 0x2f, 0xdc, 0x03, 0x7f, 0x71, 0xeb, 0xb8, 0x63, 0x4b, 0x3b, 0x1b, 0xbf, - 0xd6, 0x15, 0x74, 0x41, 0x7a, 0x1e, 0x7f, 0x2a, 0x55, 0x8f, 0x2f, 0xc6, 0x39, 0xe9, 0x72, 0x9c, - 0x93, 0x7e, 0x8c, 0x73, 0xd2, 0xc7, 0xeb, 0x5c, 0xec, 0xf2, 0x3a, 0x17, 0xfb, 0x76, 0x9d, 0x8b, - 0xbd, 0xdd, 0x9d, 0xb1, 0xbd, 0x26, 0x64, 0x35, 0xcc, 0xce, 0x88, 0xef, 0x96, 0x27, 0xad, 0x70, - 0x30, 0xdf, 0x0c, 0xf9, 0x53, 0x34, 0x17, 0x78, 0x0f, 0x7b, 0xfc, 0x33, 0x00, 0x00, 0xff, 0xff, - 0x97, 0x08, 0xb9, 0x58, 0x31, 0x05, 0x00, 0x00, + // 661 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x4e, 0xdb, 0x4c, + 0x14, 0x8d, 0x93, 0x7c, 0x48, 0xdf, 0xa0, 0x42, 0x3a, 0x50, 0x62, 0xdc, 0x36, 0x58, 0x59, 0x40, + 0x36, 0x38, 0x82, 0xaa, 0xa8, 0x3f, 0x48, 0x55, 0x02, 0xa1, 0xb5, 0x54, 0xb9, 0xc8, 0x09, 0x41, + 0xea, 0x66, 0xe4, 0xc4, 0x43, 0x6a, 0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 0xe5, 0xe2, 0x2a, 0xa7, 0xfc, 0xba, 0xca, + 0x29, 0x5f, 0xae, 0x73, 0x89, 0x8b, 0xeb, 0x5c, 0xe2, 0xc7, 0x75, 0x2e, 0xf1, 0x71, 0x67, 0xc2, + 0xde, 0x8a, 0x94, 0xb5, 0x30, 0x3f, 0xa5, 0x81, 0x5f, 0x1c, 0xdd, 0x78, 0xfd, 0xe9, 0x3b, 0x4f, + 0x58, 0xde, 0x98, 0x13, 0x57, 0xd5, 0xb3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x92, 0xf9, 0xbe, + 0xe1, 0x18, 0x05, 0x00, 0x00, } func (m *ValidatorInfo) Marshal() (dAtA []byte, err error) { @@ -334,9 +344,9 @@ func (m *NativeTokenStakerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } { - size := m.UnStakedValueFromPOS.Size() + size := m.UnstakedValueFromPod.Size() i -= size - if _, err := m.UnStakedValueFromPOS.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.UnstakedValueFromPod.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -395,7 +405,7 @@ func (m *NativeTokenStakerInfo) Size() (n int) { _ = l l = m.TotalValidatorBalances.Size() n += 1 + l + sovTx(uint64(l)) - l = m.UnStakedValueFromPOS.Size() + l = m.UnstakedValueFromPod.Size() n += 1 + l + sovTx(uint64(l)) l = len(m.PodAddress) if l > 0 { @@ -629,7 +639,7 @@ func (m *NativeTokenStakerInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnStakedValueFromPOS", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UnstakedValueFromPod", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -657,7 +667,7 @@ func (m *NativeTokenStakerInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.UnStakedValueFromPOS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.UnstakedValueFromPod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/restaking_assets_manage/types/genesis.pb.go b/x/restaking_assets_manage/types/genesis.pb.go index ebc7961f0..818735621 100644 --- a/x/restaking_assets_manage/types/genesis.pb.go +++ b/x/restaking_assets_manage/types/genesis.pb.go @@ -23,9 +23,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the restaking_assets_manage module's genesis state. +// TODO: make this state exportable for the case of chain restarts. type GenesisState struct { - DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=default_supported_client_chains,json=defaultSupportedClientChains,proto3" json:"default_supported_client_chains,omitempty"` - DefaultSupportedClientChainTokens []*AssetInfo `protobuf:"bytes,2,rep,name=default_supported_client_chain_tokens,json=defaultSupportedClientChainTokens,proto3" json:"default_supported_client_chain_tokens,omitempty"` + // default_supported_client_chains is the list of supported client chains, + // that are supported by default. + DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=default_supported_client_chains,json=defaultSupportedClientChains,proto3" json:"default_supported_client_chains,omitempty"` + // default_supported_client_chain_tokens is the list of supported client chain tokens, + // that are supported by default. + DefaultSupportedClientChainTokens []*AssetInfo `protobuf:"bytes,2,rep,name=default_supported_client_chain_tokens,json=defaultSupportedClientChainTokens,proto3" json:"default_supported_client_chain_tokens,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } diff --git a/x/restaking_assets_manage/types/query.pb.go b/x/restaking_assets_manage/types/query.pb.go index 1b9dc6ac4..48d348813 100644 --- a/x/restaking_assets_manage/types/query.pb.go +++ b/x/restaking_assets_manage/types/query.pb.go @@ -31,7 +31,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryClientChainInfo is the query for getting the client chain info by index. type QueryClientChainInfo struct { + // chain_index is the index of the chain. ChainIndex uint64 `protobuf:"varint,1,opt,name=chain_index,json=chainIndex,proto3" json:"chain_index,omitempty"` } @@ -75,6 +77,7 @@ func (m *QueryClientChainInfo) GetChainIndex() uint64 { return 0 } +// QueryAllClientChainInfo is the query for all client chains info. type QueryAllClientChainInfo struct { } @@ -111,7 +114,9 @@ func (m *QueryAllClientChainInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllClientChainInfo proto.InternalMessageInfo +// QueryAllClientChainInfoResponse is the response for all client chains info. type QueryAllClientChainInfoResponse struct { + // all_client_chain_infos is the all client chain info, indexed by the chain index. AllClientChainInfos map[uint64]*ClientChainInfo `protobuf:"bytes,1,rep,name=all_client_chain_infos,json=allClientChainInfos,proto3" json:"all_client_chain_infos,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -155,7 +160,9 @@ func (m *QueryAllClientChainInfoResponse) GetAllClientChainInfos() map[uint64]*C return nil } +// QueryStakingAssetInfo is the query for getting the staking asset info. type QueryStakingAssetInfo struct { + // asset_id is the asset for which the query is made. AssetID string `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } @@ -199,6 +206,7 @@ func (m *QueryStakingAssetInfo) GetAssetID() string { return "" } +// QueryAllStakingAssetsInfo is the query for getting all staking assets info. type QueryAllStakingAssetsInfo struct { } @@ -235,7 +243,10 @@ func (m *QueryAllStakingAssetsInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllStakingAssetsInfo proto.InternalMessageInfo +// QueryAllStakingAssetsInfoResponse is the response for all staking assets info, +// indexed by the asset id. type QueryAllStakingAssetsInfoResponse struct { + // all_staking_assets_info is the response for all staking assets info. AllStakingAssetsInfo map[string]*StakingAssetInfo `protobuf:"bytes,1,rep,name=all_staking_assets_info,json=allStakingAssetsInfo,proto3" json:"all_staking_assets_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -279,7 +290,9 @@ func (m *QueryAllStakingAssetsInfoResponse) GetAllStakingAssetsInfo() map[string return nil } +// QueryStakerAssetInfo is the query for getting the staker asset info. type QueryStakerAssetInfo struct { + // stake_id is the staker id for which the query is made. StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` } @@ -323,7 +336,9 @@ func (m *QueryStakerAssetInfo) GetStakerID() string { return "" } +// QueryAssetInfoResponse is the response for the staker asset info. type QueryAssetInfoResponse struct { + // asset_infos is the response for the staker asset info, indexed by the asset id. AssetInfos map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=asset_infos,json=assetInfos,proto3" json:"asset_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -367,9 +382,12 @@ func (m *QueryAssetInfoResponse) GetAssetInfos() map[string]*StakerSingleAssetOr return nil } +// QuerySpecifiedAssetAmountReq is the query for getting the staker specified asset amount. type QuerySpecifiedAssetAmountReq struct { + // staker_id is the staker id for which the query is made. StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // asset_id is the asset for which the query is made. + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *QuerySpecifiedAssetAmountReq) Reset() { *m = QuerySpecifiedAssetAmountReq{} } @@ -419,7 +437,9 @@ func (m *QuerySpecifiedAssetAmountReq) GetAssetID() string { return "" } +// QueryOperatorAssetInfos is the query for getting the operator asset info. type QueryOperatorAssetInfos struct { + // operator_addr is the operator address for which the query is made. OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` } @@ -463,7 +483,9 @@ func (m *QueryOperatorAssetInfos) GetOperatorAddr() string { return "" } +// QueryOperatorAssetInfosResponse is the response to the operator asset info query. type QueryOperatorAssetInfosResponse struct { + // asset_infos is the response for the operator asset info, indexed by the asset id. AssetInfos map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=asset_infos,json=assetInfos,proto3" json:"asset_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -507,9 +529,13 @@ func (m *QueryOperatorAssetInfosResponse) GetAssetInfos() map[string]*OperatorSi return nil } +// QueryOperatorSpecifiedAssetAmountReq is the query for getting the operator +// specified asset amount. type QueryOperatorSpecifiedAssetAmountReq struct { + // operator_addr is the operator address for which the query is made. OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` - AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // asset_id is the asset for which the query is made. + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *QueryOperatorSpecifiedAssetAmountReq) Reset() { *m = QueryOperatorSpecifiedAssetAmountReq{} } @@ -559,6 +585,7 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) GetAssetID() string { return "" } +// QueryStakerExCoreAddr is the query for getting the staker exocore address. type QueryStakerExCoreAddr struct { // Per https://github.com/gogo/protobuf/issues/331, grpc-gateway does not like custom names. // So we remove the id suffix from here as well as the query. @@ -605,7 +632,9 @@ func (m *QueryStakerExCoreAddr) GetStaker() string { return "" } +// QueryStakerExCoreAddrResponse is the response for the staker exocore address query. type QueryStakerExCoreAddrResponse struct { + // exocore_addr is the exocore address of the staker. ExoCoreAddr string `protobuf:"bytes,1,opt,name=exocore_addr,json=exocoreAddr,proto3" json:"exocore_addr,omitempty"` } @@ -675,7 +704,7 @@ func init() { } var fileDescriptor_6d13900d4f268106 = []byte{ - // 1039 bytes of a gzipped FileDescriptorProto + // 1038 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4d, 0x6f, 0x1b, 0x45, 0x18, 0xce, 0xb8, 0xb4, 0x4d, 0xc6, 0x41, 0x54, 0xd3, 0x90, 0x3a, 0xdb, 0x62, 0x87, 0x15, 0x82, 0x00, 0x62, 0x57, 0x4d, 0x91, 0x9a, 0x34, 0x8a, 0x8a, 0xe3, 0x18, 0xd5, 0x39, 0xb4, 0xaa, 0x73, @@ -685,62 +714,62 @@ var fileDescriptor_6d13900d4f268106 = []byte{ 0xde, 0x4d, 0xc6, 0x1f, 0x37, 0xcf, 0xbc, 0xdf, 0xef, 0x33, 0xfb, 0x3e, 0xaf, 0x0c, 0x35, 0xdc, 0x26, 0x35, 0xe2, 0x61, 0xdd, 0xc3, 0xd4, 0x37, 0xeb, 0x8e, 0x6b, 0x1b, 0x26, 0xa5, 0xd8, 0xa7, 0xc6, 0x81, 0xe9, 0x9a, 0x36, 0xd6, 0x8f, 0xae, 0xeb, 0x87, 0x2d, 0xec, 0x75, 0xb4, 0xa6, 0x47, - 0x7c, 0x82, 0x54, 0xa1, 0xaf, 0xa5, 0xe8, 0x6b, 0x47, 0xd7, 0x95, 0x6b, 0x36, 0x21, 0x76, 0x03, - 0xeb, 0x66, 0xd3, 0xd1, 0x4d, 0xd7, 0x25, 0xbe, 0xe9, 0x3b, 0xc4, 0xa5, 0xdc, 0x83, 0x72, 0xb5, - 0x46, 0xe8, 0x01, 0xa1, 0xdc, 0x6b, 0xcc, 0xbd, 0xb2, 0xc4, 0x85, 0x06, 0x3b, 0xe9, 0xfc, 0x20, - 0x44, 0xef, 0x4a, 0x64, 0xea, 0xb7, 0x85, 0xf2, 0x82, 0x4d, 0x6c, 0xc2, 0x9d, 0x04, 0xbf, 0xf8, - 0xad, 0x7a, 0x13, 0x2e, 0xdc, 0x0f, 0x82, 0x95, 0x1a, 0x0e, 0x76, 0xfd,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, - 0xf5, 0x54, 0x69, 0x1f, 0x94, 0x6f, 0x01, 0xbc, 0x12, 0x80, 0x12, 0xcb, 0x3f, 0x80, 0x45, 0xa0, - 0x62, 0x8c, 0x82, 0x4a, 0x6a, 0x20, 0x2d, 0x49, 0xc8, 0x81, 0x59, 0x30, 0x13, 0x44, 0xca, 0x23, - 0xb8, 0x94, 0x6a, 0x12, 0x85, 0x66, 0x8e, 0x43, 0xb3, 0x33, 0x08, 0xcd, 0xfb, 0x32, 0x49, 0xc7, - 0xfb, 0x1e, 0xc5, 0xa6, 0x28, 0x3e, 0x92, 0x40, 0x07, 0x7b, 0x21, 0x34, 0x6f, 0xc3, 0x39, 0xca, - 0xae, 0x42, 0x6c, 0xe6, 0xbb, 0xc7, 0x85, 0x59, 0xae, 0x57, 0xd9, 0xae, 0xce, 0x72, 0x71, 0xc5, - 0x52, 0x9f, 0x66, 0xe0, 0x22, 0xef, 0x4b, 0x3f, 0x40, 0xaf, 0xeb, 0x75, 0x98, 0x15, 0x00, 0x47, - 0x9e, 0xff, 0x8e, 0x7c, 0xa3, 0xe3, 0x0e, 0xb5, 0xfe, 0x8d, 0x78, 0xec, 0xd0, 0xec, 0x5f, 0x28, - 0x8f, 0x01, 0x7c, 0x25, 0x26, 0x4f, 0x68, 0xe0, 0x47, 0x83, 0x0d, 0x2c, 0xca, 0x36, 0x10, 0x7b, - 0xbb, 0x8e, 0x6b, 0x37, 0x30, 0x8b, 0x70, 0xcf, 0x2b, 0xed, 0x9b, 0xae, 0x8d, 0xe3, 0xdd, 0x3c, - 0x84, 0xd7, 0x78, 0x37, 0x9b, 0xb8, 0xe6, 0xec, 0x39, 0xd8, 0x62, 0xda, 0xc5, 0x03, 0xd2, 0x72, - 0xfd, 0x2a, 0x3e, 0x1c, 0xa1, 0xab, 0x03, 0xdf, 0x46, 0xe6, 0x94, 0x6f, 0xe3, 0x63, 0x31, 0xac, - 0xee, 0x35, 0xb1, 0x67, 0xfa, 0x24, 0x84, 0x90, 0xa2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ed, 0x1c, 0x58, 0x06, 0x2b, + 0x2f, 0x55, 0x61, 0x8d, 0xcb, 0x2d, 0xdc, 0x56, 0x97, 0xe0, 0x15, 0x66, 0x58, 0x6c, 0x34, 0x62, + 0xb6, 0xea, 0x8f, 0x19, 0x58, 0x48, 0x91, 0x55, 0x31, 0x6d, 0x12, 0x97, 0x62, 0xf4, 0x35, 0x80, + 0x8b, 0x66, 0xa3, 0x61, 0xd4, 0x98, 0xdc, 0xe8, 0xc5, 0xda, 0x23, 0x34, 0x07, 0x96, 0xcf, 0xad, + 0x64, 0x57, 0x3f, 0xd7, 0xce, 0x6e, 0xab, 0x76, 0x46, 0x14, 0x6d, 0x58, 0x44, 0xcb, 0xae, 0xef, + 0x75, 0xaa, 0x97, 0xcd, 0x61, 0x89, 0xf2, 0x10, 0xe6, 0xd2, 0x0c, 0xd0, 0x25, 0x78, 0xae, 0x8e, + 0x3b, 0xa2, 0x0f, 0xc1, 0x4f, 0x54, 0x81, 0xe7, 0x8f, 0xcc, 0x46, 0x0b, 0xe7, 0x32, 0xcb, 0x60, + 0x25, 0xbb, 0x7a, 0x43, 0x26, 0xdf, 0x78, 0x9e, 0xdc, 0xc3, 0xad, 0xcc, 0x1a, 0x50, 0x6f, 0xc3, + 0x57, 0x59, 0x35, 0xbb, 0xdc, 0xb6, 0x18, 0x98, 0x32, 0x24, 0xde, 0x84, 0xb3, 0xcc, 0x8f, 0xe1, + 0x58, 0x2c, 0xfc, 0xdc, 0x56, 0xb6, 0x7b, 0x5c, 0xb8, 0xc8, 0x15, 0xb6, 0xab, 0x17, 0x99, 0xb0, + 0x62, 0xa9, 0x57, 0xe1, 0x52, 0xaf, 0x1d, 0x51, 0x1f, 0x94, 0x41, 0xf2, 0x73, 0x06, 0xbe, 0x9e, + 0x2a, 0xed, 0x83, 0xf2, 0x2d, 0x80, 0x57, 0x02, 0x50, 0x62, 0xf9, 0x07, 0xb0, 0x08, 0x54, 0x8c, + 0x51, 0x50, 0x49, 0x0d, 0xa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0x67, 0xbf, 0x74, 0xf3, 0xe0, 0x59, 0x37, 0x0f, 0xfe, 0xee, 0xe6, + 0xc1, 0x57, 0x27, 0xf9, 0x99, 0x67, 0x27, 0xf9, 0x99, 0xbf, 0x4e, 0xf2, 0x33, 0x9f, 0x16, 0x6d, + 0xc7, 0xdf, 0x6f, 0x3d, 0xd0, 0x6a, 0xe4, 0x40, 0x2f, 0xf3, 0x30, 0x77, 0xb1, 0xff, 0x05, 0xf1, + 0xea, 0xfd, 0xa8, 0xed, 0xd4, 0xb8, 0x7e, 0xa7, 0x89, 0xe9, 0x83, 0x0b, 0xec, 0xbf, 0x80, 0x1b, + 0x2f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x87, 0x86, 0xe8, 0xfa, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/restaking_assets_manage/types/tx.pb.go b/x/restaking_assets_manage/types/tx.pb.go index e299d2655..b287edae2 100644 --- a/x/restaking_assets_manage/types/tx.pb.go +++ b/x/restaking_assets_manage/types/tx.pb.go @@ -32,15 +32,25 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ClientChainInfo defines the client chain information. type ClientChainInfo struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - MetaInfo string `protobuf:"bytes,2,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` - ChainId uint64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` + // name of the client chain, like "Ethereum". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // meta_info about the client chain, like "Ethereum blockchain". + MetaInfo string `protobuf:"bytes,2,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` + // chain_id of the client chain. Not necessarily the EVM chain id. + ChainId uint64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // exo_core_chain_index is the index of the client chain within the exosystem. + ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` + // finalization_blocks is the number of blocks to wait for finalization. FinalizationBlocks uint64 `protobuf:"varint,5,opt,name=finalization_blocks,json=finalizationBlocks,proto3" json:"finalization_blocks,omitempty"` - LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` - SignatureType string `protobuf:"bytes,7,opt,name=signature_type,json=signatureType,proto3" json:"signature_type,omitempty"` - AddressLength uint32 `protobuf:"varint,8,opt,name=address_length,json=addressLength,proto3" json:"address_length,omitempty"` + // layer_zero_chain_id is the chain id of the client chain, according to L0. + // https://layerzero.gitbook.io/docs/technical-reference/mainnet/supported-chain-ids + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` + // signature_type is the type of signature used to sign the client chain address. + SignatureType string `protobuf:"bytes,7,opt,name=signature_type,json=signatureType,proto3" json:"signature_type,omitempty"` + // client_chain_addr is the length of addresses on the client chain. + AddressLength uint32 `protobuf:"varint,8,opt,name=address_length,json=addressLength,proto3" json:"address_length,omitempty"` } func (m *ClientChainInfo) Reset() { *m = ClientChainInfo{} } @@ -132,15 +142,24 @@ func (m *ClientChainInfo) GetAddressLength() uint32 { return 0 } +// AssetInfo defines the information for an asset to be used in staking. type AssetInfo struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` - TotalSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_supply,json=totalSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_supply"` - LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` - ExoCoreChainIndex uint64 `protobuf:"varint,7,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` - MetaInfo string `protobuf:"bytes,8,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` + // name of the asset, like "Tether USD" + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // symbol of the asset, like "USDT" + Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"` + // address of the asset on the client chain + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + // decimals used in the asset, typically 6 or 18. + Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` + // total_supply of the asset, to be used in checks. + TotalSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_supply,json=totalSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_supply"` + // layer_zero_chain_id is the chain id of the asset, according to L0. + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=layer_zero_chain_id,json=layerZeroChainId,proto3" json:"layer_zero_chain_id,omitempty"` + // exo_core_chain_index is the index of the client chain within the exosystem. + ExoCoreChainIndex uint64 `protobuf:"varint,7,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` + // meta_info about the asset, like "Tether USD on Ethereum blockchain". + MetaInfo string `protobuf:"bytes,8,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` } func (m *AssetInfo) Reset() { *m = AssetInfo{} } @@ -225,8 +244,11 @@ func (m *AssetInfo) GetMetaInfo() string { return "" } +// StakingAssetInfo defines the information for an asset to be used in staking. type StakingAssetInfo struct { - AssetBasicInfo *AssetInfo `protobuf:"bytes,1,opt,name=asset_basic_info,json=assetBasicInfo,proto3" json:"asset_basic_info,omitempty"` + // asset_basic_info is the basic information of the asset. + AssetBasicInfo *AssetInfo `protobuf:"bytes,1,opt,name=asset_basic_info,json=assetBasicInfo,proto3" json:"asset_basic_info,omitempty"` + // staking_total_amount is the total amount of the asset staked. StakingTotalAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=staking_total_amount,json=stakingTotalAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"staking_total_amount"` } @@ -270,9 +292,19 @@ func (m *StakingAssetInfo) GetAssetBasicInfo() *AssetInfo { return nil } +// StakerSingleAssetOrChangeInfo defines the information for a single asset or its change. +// The type is an overloaded type and is used in two contexts: +// 1. A staker's deposited, withdrawable, and currently unbonding amount. +// 2. The values by which #1 is to be changed / has been changed. type StakerSingleAssetOrChangeInfo struct { - TotalDepositAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_deposit_amount_or_want_change_value,json=totalDepositAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_deposit_amount_or_want_change_value"` - CanWithdrawAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=can_withdraw_amount_or_want_change_value,json=canWithdrawAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_withdraw_amount_or_want_change_value"` + // total_deposit_amount_or_want_change_value is the total amount of the asset deposited + // or the amount by which it can change. + TotalDepositAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_deposit_amount_or_want_change_value,json=totalDepositAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_deposit_amount_or_want_change_value"` + // can_withdraw_amount_or_want_change_value is the amount that can be withdrawn + // or the amount by which it can change. + CanWithdrawAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=can_withdraw_amount_or_want_change_value,json=canWithdrawAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_withdraw_amount_or_want_change_value"` + // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // or the amount by which it can change. WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` } @@ -309,7 +341,10 @@ func (m *StakerSingleAssetOrChangeInfo) XXX_DiscardUnknown() { var xxx_messageInfo_StakerSingleAssetOrChangeInfo proto.InternalMessageInfo +// StakerAllAssetsInfo defines the information for all assets of a staker. +// It is indexed by the asset_id. type StakerAllAssetsInfo struct { + // all_assets_state is the state of all assets of the staker. AllAssetsState map[string]*StakerSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=all_assets_state,json=allAssetsState,proto3" json:"all_assets_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -353,10 +388,18 @@ func (m *StakerAllAssetsInfo) GetAllAssetsState() map[string]*StakerSingleAssetO return nil } +// OperatorSingleAssetOrChangeInfo defines the information for a single asset or its change, +// for an operator. It is also overloaded like StakerSingleAssetOrChangeInfo. type OperatorSingleAssetOrChangeInfo struct { + // total_amount_or_want_change_value is the total amount of the asset deposited + // or the amount by which it can change. TotalAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_amount_or_want_change_value,json=totalAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_amount_or_want_change_value"` + // operator_own_amount_or_want_change_value is the amount that the operator owns + // or the amount by which it can change. // todo: the field is used to mark operator's own assets and is not temporarily used now - OperatorOwnAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=operator_own_amount_or_want_change_value,json=operatorOwnAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_own_amount_or_want_change_value"` + OperatorOwnAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=operator_own_amount_or_want_change_value,json=operatorOwnAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_own_amount_or_want_change_value"` + // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // or the amount by which it can change. WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` } @@ -393,7 +436,10 @@ func (m *OperatorSingleAssetOrChangeInfo) XXX_DiscardUnknown() { var xxx_messageInfo_OperatorSingleAssetOrChangeInfo proto.InternalMessageInfo +// OperatorAllAssetsInfo defines the information for all assets of an operator, +// indexed by the asset_id. type OperatorAllAssetsInfo struct { + // all_assets_state is the state of all assets of the operator. AllAssetsState map[string]*OperatorSingleAssetOrChangeInfo `protobuf:"bytes,1,rep,name=all_assets_state,json=allAssetsState,proto3" json:"all_assets_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -437,11 +483,19 @@ func (m *OperatorAllAssetsInfo) GetAllAssetsState() map[string]*OperatorSingleAs return nil } +// MsgSetExoCoreAddr defines the MsgSetExoCoreAddr message used to set the +// exocore address of the staker. type MsgSetExoCoreAddr struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - SetAddress string `protobuf:"bytes,2,opt,name=set_address,json=setAddress,proto3" json:"set_address,omitempty"` - ClientChainAddr string `protobuf:"bytes,3,opt,name=client_chain_addr,json=clientChainAddr,proto3" json:"client_chain_addr,omitempty"` - ClientChainIndex uint64 `protobuf:"varint,4,opt,name=client_chain_index,json=clientChainIndex,proto3" json:"client_chain_index,omitempty"` + // from_address is the address of the staker. + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // set_address is the address to be set. + SetAddress string `protobuf:"bytes,2,opt,name=set_address,json=setAddress,proto3" json:"set_address,omitempty"` + // client_chain_addr is the address of the client chain. + ClientChainAddr string `protobuf:"bytes,3,opt,name=client_chain_addr,json=clientChainAddr,proto3" json:"client_chain_addr,omitempty"` + // client_chain_index is the index of the client chain within the exosystem. + ClientChainIndex uint64 `protobuf:"varint,4,opt,name=client_chain_index,json=clientChainIndex,proto3" json:"client_chain_index,omitempty"` + // staker_client_chain_signature is the signature of the staker's address + // on the client chain. StakerClientChainSignature string `protobuf:"bytes,5,opt,name=staker_client_chain_signature,json=stakerClientChainSignature,proto3" json:"staker_client_chain_signature,omitempty"` } @@ -478,6 +532,8 @@ func (m *MsgSetExoCoreAddr) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetExoCoreAddr proto.InternalMessageInfo +// MsgSetExoCoreAddrResponse defines the MsgSetExoCoreAddrResponse message used to return the +// response of the MsgSetExoCoreAddr message. type MsgSetExoCoreAddrResponse struct { } @@ -514,9 +570,12 @@ func (m *MsgSetExoCoreAddrResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetExoCoreAddrResponse proto.InternalMessageInfo +// RegisterClientChainReq is a request to register a client chain. type RegisterClientChainReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *ClientChainInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the address of the message sender. + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // info is the information of the client chain. + Info *ClientChainInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterClientChainReq) Reset() { *m = RegisterClientChainReq{} } @@ -552,6 +611,7 @@ func (m *RegisterClientChainReq) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterClientChainReq proto.InternalMessageInfo +// RegisterClientChainResponse is the response to the RegisterClientChainReq message. type RegisterClientChainResponse struct { } @@ -588,9 +648,13 @@ func (m *RegisterClientChainResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterClientChainResponse proto.InternalMessageInfo +// RegisterAssetReq is a request to register an asset on the client chain within +// Exocore. type RegisterAssetReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *AssetInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the address of the message sender. + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // info is the information of the asset. + Info *AssetInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterAssetReq) Reset() { *m = RegisterAssetReq{} } @@ -626,6 +690,7 @@ func (m *RegisterAssetReq) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterAssetReq proto.InternalMessageInfo +// RegisterAssetResponse is the response to the RegisterAssetReq message. type RegisterAssetResponse struct { } @@ -685,86 +750,86 @@ func init() { } var fileDescriptor_b24e66e530cc30d1 = []byte{ - // 1252 bytes of a gzipped FileDescriptorProto + // 1251 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x14, 0xf7, 0xda, 0x69, 0x93, 0x8c, 0x9b, 0xd6, 0xd9, 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 0x88, 0xae, 0x83, 0x01, 0x0c, 0x7d, 0x94, 0xd1, 0xae, 0x68, 0x13, 0xc3, 0x86, 0xf8, 0xd6, - 0x2f, 0x81, 0x61, 0x1f, 0x31, 0x68, 0xba, 0x78, 0x85, 0x64, 0xe2, 0x62, 0x63, 0x88, 0x0b, 0x84, - 0xc1, 0x38, 0x18, 0xb2, 0xb8, 0xb5, 0xe9, 0xda, 0x99, 0xc4, 0x15, 0x6d, 0x62, 0xc0, 0x18, 0x14, - 0xeb, 0x79, 0x5b, 0x2f, 0x81, 0x34, 0x6a, 0x12, 0x93, 0xe7, 0x68, 0x2a, 0x1d, 0x6c, 0xa3, 0x66, - 0x66, 0x40, 0xa8, 0x8d, 0xa2, 0x26, 0xa9, 0x90, 0x00, 0xa9, 0xd8, 0x36, 0x6a, 0xea, 0x25, 0x30, - 0xb6, 0xe2, 0x62, 0xe8, 0xb9, 0xf7, 0x20, 0x73, 0x09, 0x36, 0x97, 0x3d, 0x62, 0xad, 0xd1, 0xcc, - 0x29, 0xa1, 0xaf, 0x77, 0x6e, 0xcd, 0x8a, 0x1d, 0xbd, 0x02, 0xc6, 0x3c, 0xd8, 0x42, 0x81, 0x79, - 0x0f, 0x05, 0xc4, 0x6c, 0xe3, 0x38, 0xcd, 0x0d, 0x66, 0xd3, 0xdb, 0x5b, 0xf9, 0xd4, 0x6d, 0xbe, - 0x7d, 0x17, 0x05, 0x44, 0x86, 0xb9, 0x65, 0xa4, 0xbc, 0xa8, 0xc4, 0xd6, 0x5f, 0x06, 0x67, 0xa9, - 0xeb, 0x60, 0xc8, 0xea, 0x01, 0x32, 0x59, 0xab, 0x86, 0x32, 0x83, 0x22, 0xc7, 0x91, 0xb6, 0xf4, - 0x4e, 0xab, 0x86, 0xb8, 0x1a, 0xb4, 0xed, 0x00, 0x51, 0x6a, 0x7a, 0x08, 0x3b, 0x6c, 0x35, 0x33, - 0x74, 0x45, 0x9b, 0x18, 0x31, 0x46, 0x94, 0xf4, 0xb6, 0x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x00, 0x00, 0xff, 0xff, 0x0b, 0x33, 0xb6, 0xf5, 0xc1, + 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/genesis.pb.go b/x/reward/types/genesis.pb.go index 0d0363ec8..4564eb397 100644 --- a/x/reward/types/genesis.pb.go +++ b/x/reward/types/genesis.pb.go @@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the reward module's genesis state. type GenesisState struct { + // params represents the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -75,20 +76,20 @@ func init() { func init() { proto.RegisterFile("exocore/reward/genesis.proto", fileDescriptor_4ccfae99a1ae8f42) } var fileDescriptor_4ccfae99a1ae8f42 = []byte{ - // 195 bytes of a gzipped FileDescriptorProto + // 194 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x41, 0x64, 0xa5, - 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, - 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x23, 0x94, 0x5c, 0xb8, 0x78, 0xdc, 0x21, 0x66, 0x06, 0x97, - 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x70, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, - 0xc4, 0xf4, 0x50, 0xed, 0xd0, 0x0b, 0x00, 0xcb, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, - 0x55, 0xeb, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, - 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, - 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0x93, 0xfc, 0x52, 0x4b, - 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0xce, 0xaa, 0x80, 0x39, 0xac, 0xa4, 0xb2, 0x20, 0xb5, 0x38, - 0x89, 0x0d, 0xec, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x1d, 0xec, 0xf9, 0xfb, - 0x00, 0x00, 0x00, + 0xa4, 0xd1, 0x54, 0x17, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x15, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, + 0x83, 0x99, 0xfa, 0x20, 0x16, 0x44, 0x54, 0xc9, 0x85, 0x8b, 0xc7, 0x1d, 0x62, 0x66, 0x70, 0x49, + 0x62, 0x49, 0xaa, 0x90, 0x09, 0x17, 0x1b, 0x44, 0x97, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, + 0x98, 0x1e, 0xaa, 0x1d, 0x7a, 0x01, 0x60, 0x59, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, + 0x6a, 0x9d, 0xbc, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, + 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x20, 0x3d, + 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xdf, 0x15, 0x62, 0x92, 0x5f, 0x6a, 0x49, + 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0xcc, 0xb1, 0x15, 0x30, 0xe7, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, + 0xb1, 0x81, 0x1d, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbe, 0xa2, 0x6c, 0x2d, 0xfb, 0x00, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/params.pb.go b/x/reward/types/params.pb.go index 2eee77c1d..05e43f3d2 100644 --- a/x/reward/types/params.pb.go +++ b/x/reward/types/params.pb.go @@ -24,7 +24,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + // exo_core_lz_app_address is the address of the L0 app. + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + // exo_core_lz_app_event_topic is the topic of the L0 app. ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exo_core_lz_app_event_topic,json=exoCoreLzAppEventTopic,proto3" json:"exo_core_lz_app_event_topic,omitempty"` } diff --git a/x/reward/types/query.pb.go b/x/reward/types/query.pb.go index db0a870f4..13c3882c3 100644 --- a/x/reward/types/query.pb.go +++ b/x/reward/types/query.pb.go @@ -122,20 +122,20 @@ var fileDescriptor_03321eafc9126bed = []byte{ // 252 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0xc8, 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ca, 0xa8, 0x8a, 0x8b, 0x15, 0x6c, 0x8c, 0x50, 0x21, 0x17, 0x1b, - 0x44, 0x4a, 0x48, 0x09, 0x5d, 0x0b, 0xa6, 0xed, 0x52, 0xca, 0x78, 0xd5, 0x40, 0xdc, 0xa2, 0x24, - 0xd7, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x09, 0x21, 0x31, 0x7d, 0xac, 0xde, 0x73, 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, 0x7d, 0x57, 0x88, 0x5e, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xb8, - 0x51, 0x15, 0x30, 0xc3, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x61, 0x65, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0xcc, 0x67, 0x12, 0x8f, 0x94, 0x01, 0x00, 0x00, + 0xe9, 0x71, 0xb1, 0x41, 0x8c, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd3, 0x43, 0x75, + 0x88, 0x1e, 0x54, 0x3d, 0x54, 0x95, 0x51, 0x15, 0x17, 0x2b, 0xd8, 0x18, 0xa1, 0x42, 0x2e, 0x36, + 0x88, 0x94, 0x90, 0x12, 0xba, 0x16, 0x4c, 0xdb, 0xa5, 0x94, 0xf1, 0xaa, 0x81, 0xb8, 0x45, 0x49, + 0xae, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x12, 0x42, 0x62, 0xfa, 0x58, 0x3d, 0xef, 0xe4, 0x75, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, + 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, + 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0xbd, 0x7e, 0xa9, 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0x70, + 0xa3, 0x2a, 0x60, 0x86, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xc3, 0xca, 0x18, 0x10, + 0x00, 0x00, 0xff, 0xff, 0xda, 0x66, 0x92, 0x77, 0x94, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/tx.pb.go b/x/reward/types/tx.pb.go index 0c0785142..19052baa8 100644 --- a/x/reward/types/tx.pb.go +++ b/x/reward/types/tx.pb.go @@ -137,24 +137,24 @@ var fileDescriptor_9cd4863caedb1c8f = []byte{ // 311 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, - 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x3c, - 0x44, 0x02, 0xc2, 0x81, 0x4a, 0x89, 0x43, 0x78, 0xfa, 0xb9, 0xc5, 0xe9, 0xfa, 0x65, 0x86, 0x20, - 0x0a, 0x2a, 0x21, 0x8d, 0x66, 0x65, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0x97, 0x52, 0x3f, 0x23, - 0x17, 0xbf, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, 0x00, 0x58, 0x46, 0xc8, 0x8c, - 0x8b, 0x33, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, - 0xd3, 0x49, 0xe2, 0xd2, 0x16, 0x5d, 0x11, 0xa8, 0x75, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, - 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x41, 0x08, 0xa5, 0x42, 0x26, 0x5c, 0x6c, 0x10, 0xb3, 0x25, - 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x50, 0xfd, 0xa4, 0x07, 0x31, 0xdf, 0x89, 0xe5, - 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x5a, 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0xa6, 0x28, - 0x49, 0x72, 0x89, 0xa3, 0x39, 0x28, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28, 0x9e, - 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x82, 0x8b, 0x07, 0xc5, 0xbd, 0xf2, 0xe8, 0xf6, 0xa0, 0xe9, - 0x97, 0x52, 0x27, 0xa0, 0x00, 0x66, 0x81, 0x93, 0xd7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, - 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, - 0xcb, 0x31, 0x44, 0x19, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, - 0x42, 0x0c, 0xf3, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x87, 0x05, 0x6f, 0x05, 0x3c, 0x4e, - 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x01, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x00, - 0xa2, 0xad, 0x10, 0xf2, 0x01, 0x00, 0x00, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0xa4, 0xc4, 0x93, 0xf3, 0x8b, 0x73, + 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xa1, 0x94, 0x24, 0x44, + 0x22, 0x1e, 0xcc, 0xd3, 0x87, 0x70, 0xa0, 0x52, 0xd2, 0x68, 0x86, 0x17, 0x24, 0x16, 0x25, 0xe6, + 0xc2, 0x24, 0x45, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0x9a, 0x40, 0x2c, 0x88, 0xa8, 0x52, 0x3f, 0x23, + 0x17, 0xbf, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, 0x00, 0x58, 0xbd, 0x90, 0x19, + 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, + 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0xbb, 0x1c, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, + 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x83, 0x10, 0x4a, 0x85, 0x4c, 0xb8, 0xd8, 0x20, 0x36, 0x4a, + 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe9, 0xa1, 0xfa, 0x49, 0x0f, 0x62, 0xbe, 0x13, 0xcb, + 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xb5, 0x56, 0x7c, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0x4c, 0x51, + 0x92, 0xe4, 0x12, 0x47, 0x73, 0x50, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x51, 0x3c, + 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x04, 0x17, 0x0f, 0x8a, 0x7b, 0xe5, 0xd1, 0xed, 0x41, 0xd3, + 0x2f, 0xa5, 0x4e, 0x40, 0x01, 0xcc, 0x02, 0x27, 0xaf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, + 0x96, 0x63, 0x88, 0x32, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, + 0x85, 0x18, 0xe6, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x0f, 0x0b, 0xf4, 0x0a, 0x78, 0x9c, + 0x56, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, 0xd8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x95, + 0xcb, 0xe8, 0x83, 0xf2, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/types.pb.go b/x/reward/types/types.pb.go index bf693dde9..b9a98b83d 100644 --- a/x/reward/types/types.pb.go +++ b/x/reward/types/types.pb.go @@ -25,8 +25,11 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Pool is a reward pool. type Pool struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // name is the name of the pool. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // rewards is the rewards for the pool, by validator. Rewards []Pool_Reward `protobuf:"bytes,2,rep,name=rewards,proto3" json:"rewards"` } @@ -63,9 +66,12 @@ func (m *Pool) XXX_DiscardUnknown() { var xxx_messageInfo_Pool proto.InternalMessageInfo +// Reward is the reward for a validator. type Pool_Reward struct { + // validator is the validator address, as an `sdk.ValAddress`. Validator github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator,omitempty"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` + // coins is the reward amount, as `sdk.Coins`. + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` } func (m *Pool_Reward) Reset() { *m = Pool_Reward{} } @@ -114,22 +120,22 @@ var fileDescriptor_620cd6dbeff3c5e2 = []byte{ 0x14, 0x8e, 0x4b, 0x29, 0xaa, 0x41, 0x0c, 0x16, 0x43, 0x09, 0x92, 0x5b, 0x31, 0x75, 0xa9, 0xdd, 0xc2, 0xc8, 0x44, 0x10, 0x6b, 0x41, 0x19, 0x18, 0xd8, 0x9c, 0xc4, 0x2a, 0x51, 0x7f, 0x5e, 0x65, 0x9b, 0xb6, 0xdc, 0x82, 0x89, 0x43, 0x70, 0x06, 0x0e, 0xd0, 0xb1, 0x23, 0x53, 0x81, 0xe6, 0x16, - 0x4c, 0xc8, 0x71, 0x22, 0xe8, 0xc6, 0xe4, 0x27, 0x7d, 0xfe, 0xfe, 0xde, 0xc3, 0xbe, 0x5c, 0x40, + 0x4c, 0xc8, 0x71, 0x22, 0xe8, 0xc6, 0x94, 0x4f, 0x79, 0xfe, 0xfe, 0xde, 0xc3,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 0x4c, 0x12, 0x25, 0xb5, + 0x0e, 0x7f, 0x35, 0x88, 0xc0, 0xbb, 0xb6, 0x59, 0x19, 0xeb, 0x98, 0x39, 0x1e, 0xb3, 0xdd, 0x59, + 0xd1, 0x9d, 0x5d, 0x41, 0x3a, 0x09, 0xba, 0x36, 0xd4, 0xeb, 0x47, 0xb3, 0xfd, 0x0f, 0x2f, 0x4b, + 0xd0, 0xa1, 0x53, 0x0e, 0xfa, 0xcb, 0x2f, 0xea, 0x2d, 0x37, 0x14, 0xad, 0x36, 0x14, 0x7d, 0x6e, + 0x28, 0x7a, 0xce, 0xa8, 0xb7, 0xca, 0xa8, 0xf7, 0x9e, 0x51, 0xef, 0xbe, 0xfb, 0x47, 0xee, 0xda, + 0xad, 0xa4, 0x2f, 0xcd, 0x1c, 0xd4, 0x90, 0x97, 0x27, 0x5b, 0x6c, 0x1d, 0x2d, 0xaa, 0xe5, 0xfb, + 0x3e, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xf1, 0x7b, 0x17, 0xd3, 0x01, 0x00, 0x00, } func (m *Pool) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/types/genesis.pb.go b/x/slash/types/genesis.pb.go index ab8531252..aec53a255 100644 --- a/x/slash/types/genesis.pb.go +++ b/x/slash/types/genesis.pb.go @@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the exoslash module's genesis state. type GenesisState struct { + // params defines all the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -75,20 +76,20 @@ func init() { func init() { proto.RegisterFile("exocore/slash/genesis.proto", fileDescriptor_0800c20695e285d5) } var fileDescriptor_0800c20695e285d5 = []byte{ - // 194 bytes of a gzipped FileDescriptorProto + // 193 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 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, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xea, 0x81, 0x25, 0xa5, 0xa4, + 0x50, 0xd5, 0x16, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x95, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, + 0x99, 0xfa, 0x20, 0x16, 0x44, 0x54, 0xc9, 0x99, 0x8b, 0xc7, 0x1d, 0x62, 0x62, 0x70, 0x49, 0x62, + 0x49, 0xaa, 0x90, 0x31, 0x17, 0x1b, 0x44, 0x97, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xa8, + 0x1e, 0x8a, 0x0d, 0x7a, 0x01, 0x60, 0x49, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x4a, + 0x9d, 0x3c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, + 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x3f, 0x3d, 0xb3, + 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xdf, 0x15, 0x62, 0x90, 0x5f, 0x6a, 0x49, 0x79, + 0x7e, 0x51, 0xb6, 0x3e, 0xcc, 0xa9, 0x15, 0x50, 0xc7, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, + 0x81, 0x9d, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x42, 0xf5, 0x1f, 0x8b, 0xf6, 0x00, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/types/params.pb.go b/x/slash/types/params.pb.go index ddf28cf58..065131cf0 100644 --- a/x/slash/types/params.pb.go +++ b/x/slash/types/params.pb.go @@ -24,7 +24,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + // exo_core_lz_app_address defines the address of the lz app + ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exo_core_lz_app_address,json=exoCoreLzAppAddress,proto3" json:"exo_core_lz_app_address,omitempty"` + // exo_core_lz_app_event_topic defines the topic of the lz app ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exo_core_lz_app_event_topic,json=exoCoreLzAppEventTopic,proto3" json:"exo_core_lz_app_event_topic,omitempty"` } diff --git a/x/slash/types/query.pb.go b/x/slash/types/query.pb.go index 897e60527..7c26071b8 100644 --- a/x/slash/types/query.pb.go +++ b/x/slash/types/query.pb.go @@ -122,20 +122,20 @@ var fileDescriptor_8cd6399098c1a574 = []byte{ // 251 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xe9, 0x81, 0xa5, 0xa4, 0x64, 0xd2, 0xf3, - 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, - 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0x8a, 0xa5, 0xa4, 0x50, 0xcd, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x85, - 0xca, 0x29, 0x89, 0x70, 0x09, 0x05, 0x82, 0xcc, 0x0d, 0x00, 0x0b, 0x06, 0xa5, 0x16, 0x96, 0xa6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, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xb8, 0x49, - 0x15, 0x50, 0xb3, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xc1, 0x64, 0x0c, 0x08, 0x00, - 0x00, 0xff, 0xff, 0xdb, 0x6e, 0xd4, 0x35, 0x8c, 0x01, 0x00, 0x00, + 0x72, 0xb1, 0x41, 0x8c, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd5, 0x43, 0x71, 0x86, + 0x1e, 0x54, 0x39, 0x54, 0x91, 0x51, 0x39, 0x17, 0x2b, 0xd8, 0x14, 0xa1, 0x3c, 0x2e, 0x36, 0x88, + 0x94, 0x90, 0x22, 0x9a, 0x0e, 0x4c, 0xbb, 0xa5, 0x94, 0xf0, 0x29, 0x81, 0x38, 0x44, 0x49, 0xb6, + 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0xe2, 0x42, 0xa2, 0xfa, 0xd8, 0x3c, 0xee, 0xe4, 0x79, 0xe2, 0x91, + 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, + 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xfa, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0xad, 0x7e, 0xa9, 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0x70, 0x93, + 0x2a, 0xa0, 0x66, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x83, 0xc9, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0x41, 0xdf, 0xc3, 0x4f, 0x8c, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/slash/types/tx.pb.go b/x/slash/types/tx.pb.go index e74333c39..78a818b45 100644 --- a/x/slash/types/tx.pb.go +++ b/x/slash/types/tx.pb.go @@ -134,27 +134,27 @@ func init() { func init() { proto.RegisterFile("exocore/slash/tx.proto", fileDescriptor_6ec062c35f00efd9) } var fileDescriptor_6ec062c35f00efd9 = []byte{ - // 311 bytes of a gzipped FileDescriptorProto + // 310 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x8a, 0xeb, 0x81, 0xc5, 0xa5, 0xa4, 0x50, 0x95, 0x15, 0x24, 0x16, - 0x25, 0xe6, 0x16, 0x43, 0x94, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x99, 0xfa, 0x20, 0x16, - 0x54, 0x54, 0x32, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x38, 0x1e, 0x22, 0x01, 0xe1, 0x40, 0xa5, 0xc4, - 0x21, 0x3c, 0xfd, 0xdc, 0xe2, 0x74, 0xfd, 0x32, 0x43, 0x10, 0x05, 0x91, 0x50, 0xea, 0x63, 0xe4, - 0xe2, 0xf7, 0x2d, 0x4e, 0x0f, 0x2d, 0x48, 0x49, 0x2c, 0x49, 0x0d, 0x00, 0xdb, 0x21, 0x64, 0xc6, - 0xc5, 0x99, 0x58, 0x5a, 0x92, 0x91, 0x5f, 0x94, 0x59, 0x52, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, - 0xe9, 0x24, 0x71, 0x69, 0x8b, 0xae, 0x08, 0xd4, 0x44, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, - 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 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f5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0x9d, 0x94, 0x24, 0x44, 0x22, + 0x1e, 0xcc, 0xd3, 0x87, 0x70, 0xa0, 0x52, 0x52, 0xa8, 0x46, 0x17, 0x24, 0x16, 0x25, 0xe6, 0xc2, + 0xe4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0x7a, 0x40, 0x2c, 0x88, 0xa8, 0x52, 0x1f, 0x23, 0x17, + 0xbf, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, 0x00, 0x58, 0xbd, 0x90, 0x19, 0x17, + 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, + 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0xab, 0x1c, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x83, + 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x83, 0x10, 0x4a, 0x85, 0x8c, 0xb9, 0xd8, 0x20, 0x36, 0x4a, 0x30, + 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xea, 0xa1, 0xf8, 0x48, 0x0f, 0x62, 0xbc, 0x13, 0xcb, 0x89, + 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xa5, 0x56, 0x7c, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0x0c, 0x51, 0x92, + 0xe4, 0x12, 0x47, 0x73, 0x4f, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x51, 0x2c, 0x17, + 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x18, 0x17, 0x0f, 0x8a, 0x73, 0xe5, 0xd0, 0xac, 0x41, 0xd3, 0x2e, + 0xa5, 0x86, 0x5f, 0x1e, 0x66, 0xbc, 0x93, 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, + 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, + 0x31, 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, 0x42, + 0xcc, 0xf2, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x87, 0x05, 0x78, 0x05, 0x2c, 0x36, 0x2b, + 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x81, 0x6b, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xc9, + 0x74, 0x09, 0xeb, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/withdraw/types/query.pb.go b/x/withdraw/types/query.pb.go index f57852462..1bf71d1d1 100644 --- a/x/withdraw/types/query.pb.go +++ b/x/withdraw/types/query.pb.go @@ -120,25 +120,25 @@ func init() { func init() { proto.RegisterFile("exocore/withdraw/query.proto", fileDescriptor_59bca5e59812c328) } var fileDescriptor_59bca5e59812c328 = []byte{ - // 275 bytes of a gzipped FileDescriptorProto + // 274 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xca, 0xea, 0xc1, 0x64, 0xa5, - 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, - 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xea, 0xa5, 0x14, 0x60, 0xa6, 0xa5, 0xa4, 0x16, - 0xe4, 0x17, 0x67, 0x96, 0xe8, 0x97, 0x19, 0xc2, 0x98, 0x10, 0x15, 0x4a, 0x22, 0x5c, 0x42, 0x81, - 0x20, 0x0b, 0x02, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, - 0x3c, 0xb9, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x8c, 0xb8, 0xd8, 0x0a, - 0xc0, 0x22, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x30, 0xf7, 0xc0, 0x0c, 0x2d, - 0x33, 0xd4, 0x83, 0xea, 0x81, 0xaa, 0x34, 0x6a, 0x60, 0xe4, 0x62, 0x05, 0x9b, 0x25, 0x54, 0xce, - 0xc5, 0x06, 0x91, 0x13, 0x52, 0xd1, 0x43, 0xf7, 0x87, 0x1e, 0xa6, 0x23, 0xa4, 0x54, 0x09, 0xa8, - 0x82, 0x38, 0x4a, 0x49, 0xa1, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x52, 0x42, 0x12, 0xfa, 0x18, 0x41, - 0x07, 0x71, 0x82, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, - 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, - 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xbb, 0x42, 0x74, 0xfb, 0xa5, - 0x96, 0x94, 0xe7, 0x17, 0x65, 0xc3, 0x0d, 0xab, 0x40, 0x18, 0x57, 0x52, 0x59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, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x46, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0xdd, 0x7e, 0xa9, + 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0x70, 0xc3, 0x2a, 0x10, 0xc6, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, + 0xb1, 0x81, 0x03, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x21, 0x6f, 0x4e, 0x7e, 0xaa, 0x01, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/withdraw/types/tx.pb.go b/x/withdraw/types/tx.pb.go index 1ff2f56bd..39a8673c3 100644 --- a/x/withdraw/types/tx.pb.go +++ b/x/withdraw/types/tx.pb.go @@ -140,23 +140,23 @@ var fileDescriptor_9fa45fb8759a8d92 = []byte{ 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xe9, 0xc1, 0xa4, 0xa4, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xa9, 0x94, - 0x24, 0x44, 0x22, 0x1e, 0xcc, 0xd3, 0x87, 0x70, 0xa0, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x10, - 0x71, 0x10, 0x0b, 0x2a, 0xaa, 0x00, 0xb3, 0x36, 0x25, 0xb5, 0x20, 0xbf, 0x38, 0xb3, 0x04, 0x64, - 0x1c, 0x94, 0x09, 0x51, 0xa1, 0x34, 0x99, 0x91,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, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x46, 0xe9, 0x99, + 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0x53, 0xfd, 0x52, 0x4b, 0xca, + 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0x11, 0x51, 0x81, 0x14, 0xd7, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, + 0xe0, 0x10, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0xe8, 0x1c, 0x17, 0x0c, 0x02, 0x00, 0x00, } From 8258c4617221d4aedd4b30bddb3838f09cf71cf0 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:54:36 +0000 Subject: [PATCH 29/41] chore(build): respond to gosec comments --- x/dogfood/keeper/abci.go | 10 ++- x/dogfood/keeper/opt_out.go | 20 +++-- x/dogfood/keeper/pending.go | 28 +++---- x/dogfood/keeper/unbonding.go | 8 +- x/dogfood/keeper/validators.go | 142 ++++++++++++++++++--------------- x/dogfood/types/keys.go | 63 ++++++++++++--- x/dogfood/types/params.go | 5 +- 7 files changed, 164 insertions(+), 112 deletions(-) diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go index 30dd3950b..a9641c68d 100644 --- a/x/dogfood/keeper/abci.go +++ b/x/dogfood/keeper/abci.go @@ -31,11 +31,11 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { k.ClearPendingConsensusAddrs(ctx) // finally, perform the actual operations of vote power changes. operations := k.GetPendingOperations(ctx) - id, _ := k.GetValidatorSetID(ctx, ctx.BlockHeight()) + id, _ := k.getValidatorSetID(ctx, ctx.BlockHeight()) if len(operations.GetList()) == 0 { // there is no validator set change, so we just increment the block height // and retain the same val set id mapping. - k.SetValidatorSetID(ctx, ctx.BlockHeight()+1, id) + k.setValidatorSetID(ctx, ctx.BlockHeight()+1, id) return []abci.ValidatorUpdate{} } res := make([]abci.ValidatorUpdate, 0, len(operations.GetList())) @@ -46,7 +46,8 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { ctx, operation.OperatorAddress, ) if err != nil { - panic(err) + // this should never happen, but if it does, we just skip the operation. + continue } res = append(res, abci.ValidatorUpdate{ PubKey: operation.PubKey, @@ -58,7 +59,8 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { Power: 0, }) case types.KeyOpUnspecified: - panic("unspecified operation type") + // this should never happen, but if it does, we just skip the operation. + continue } } // call via wrapper function so that validator info is stored. diff --git a/x/dogfood/keeper/opt_out.go b/x/dogfood/keeper/opt_out.go index 939d747e3..837fc925f 100644 --- a/x/dogfood/keeper/opt_out.go +++ b/x/dogfood/keeper/opt_out.go @@ -21,7 +21,8 @@ func (k Keeper) GetOptOutsToFinish( ctx sdk.Context, epoch int64, ) [][]byte { store := ctx.KVStore(k.storeKey) - key := types.OptOutsToFinishKey(epoch) + // the epochs module validates at genesis that epoch is non-negative. + key, _ := types.OptOutsToFinishKey(epoch) bz := store.Get(key) if bz == nil { return [][]byte{} @@ -39,7 +40,7 @@ func (k Keeper) setOptOutsToFinish( ctx sdk.Context, epoch int64, addrs types.AccountAddresses, ) { store := ctx.KVStore(k.storeKey) - key := types.OptOutsToFinishKey(epoch) + key, _ := types.OptOutsToFinishKey(epoch) bz, err := addrs.Marshal() if err != nil { panic(err) @@ -61,7 +62,7 @@ func (k Keeper) RemoveOptOutToFinish(ctx sdk.Context, epoch int64, addr sdk.AccA // finished at the end of the provided epoch. func (k Keeper) ClearOptOutsToFinish(ctx sdk.Context, epoch int64) { store := ctx.KVStore(k.storeKey) - key := types.OptOutsToFinishKey(epoch) + key, _ := types.OptOutsToFinishKey(epoch) store.Delete(key) } @@ -71,7 +72,8 @@ func (k Keeper) SetOperatorOptOutFinishEpoch( ) { store := ctx.KVStore(k.storeKey) key := types.OperatorOptOutFinishEpochKey(operatorAddr) - bz := sdk.Uint64ToBigEndian(uint64(epoch)) + uepoch, _ := types.SafeInt64ToUint64(epoch) + bz := sdk.Uint64ToBigEndian(uepoch) store.Set(key, bz) } @@ -86,7 +88,9 @@ func (k Keeper) GetOperatorOptOutFinishEpoch( if bz == nil { return -1 } - return int64(sdk.BigEndianToUint64(bz)) + // max int64 is 9 quintillion, and max uint64 is double of that. + // it is too far in the future to be a concern. + return int64(sdk.BigEndianToUint64(bz)) // #nosec G701 // see above. } // DeleteOperatorOptOutFinishEpoch deletes the epoch at which an operator's opt out will be @@ -115,7 +119,7 @@ func (k Keeper) GetConsensusAddrsToPrune( ctx sdk.Context, epoch int64, ) [][]byte { store := ctx.KVStore(k.storeKey) - key := types.ConsensusAddrsToPruneKey(epoch) + key, _ := types.ConsensusAddrsToPruneKey(epoch) bz := store.Get(key) if bz == nil { return [][]byte{} @@ -143,7 +147,7 @@ func (k Keeper) DeleteConsensusAddrToPrune( // epoch. func (k Keeper) ClearConsensusAddrsToPrune(ctx sdk.Context, epoch int64) { store := ctx.KVStore(k.storeKey) - key := types.ConsensusAddrsToPruneKey(epoch) + key, _ := types.ConsensusAddrsToPruneKey(epoch) store.Delete(key) } @@ -153,7 +157,7 @@ func (k Keeper) setConsensusAddrsToPrune( ctx sdk.Context, epoch int64, addrs types.ConsensusAddresses, ) { store := ctx.KVStore(k.storeKey) - key := types.ConsensusAddrsToPruneKey(epoch) + key, _ := types.ConsensusAddrsToPruneKey(epoch) bz, err := addrs.Marshal() if err != nil { panic(err) diff --git a/x/dogfood/keeper/pending.go b/x/dogfood/keeper/pending.go index 7d68779f8..9bf05ae17 100644 --- a/x/dogfood/keeper/pending.go +++ b/x/dogfood/keeper/pending.go @@ -24,7 +24,7 @@ func (k Keeper) GetPendingOperations(ctx sdk.Context) types.Operations { } var operations types.Operations if err := operations.Unmarshal(bz); err != nil { - panic(err) + return types.Operations{} } return operations } @@ -38,10 +38,7 @@ func (k Keeper) ClearPendingOperations(ctx sdk.Context) { // SetPendingOptOuts sets the pending opt-outs to be applied at the end of the block. func (k Keeper) SetPendingOptOuts(ctx sdk.Context, addrs types.AccountAddresses) { store := ctx.KVStore(k.storeKey) - bz, err := addrs.Marshal() - if err != nil { - panic(err) - } + bz := k.cdc.MustMarshal(&addrs) store.Set(types.PendingOptOutsKey(), bz) } @@ -54,7 +51,7 @@ func (k Keeper) GetPendingOptOuts(ctx sdk.Context) types.AccountAddresses { } var addrs types.AccountAddresses if err := addrs.Unmarshal(bz); err != nil { - panic(err) + return types.AccountAddresses{} } return addrs } @@ -69,10 +66,7 @@ func (k Keeper) ClearPendingOptOuts(ctx sdk.Context) { // block. func (k Keeper) SetPendingConsensusAddrs(ctx sdk.Context, addrs types.ConsensusAddresses) { store := ctx.KVStore(k.storeKey) - bz, err := addrs.Marshal() - if err != nil { - panic(err) - } + bz := k.cdc.MustMarshal(&addrs) store.Set(types.PendingConsensusAddrsKey(), bz) } @@ -86,7 +80,7 @@ func (k Keeper) GetPendingConsensusAddrs(ctx sdk.Context) types.ConsensusAddress } var addrs types.ConsensusAddresses if err := addrs.Unmarshal(bz); err != nil { - panic(err) + return types.ConsensusAddresses{} } return addrs } @@ -100,12 +94,12 @@ func (k Keeper) ClearPendingConsensusAddrs(ctx sdk.Context) { // SetPendingUndelegations sets the pending undelegations to be released at the end of the // block. -func (k Keeper) SetPendingUndelegations(ctx sdk.Context, undelegations types.UndelegationRecordKeys) { +func (k Keeper) SetPendingUndelegations( + ctx sdk.Context, + undelegations types.UndelegationRecordKeys, +) { store := ctx.KVStore(k.storeKey) - bz, err := undelegations.Marshal() - if err != nil { - panic(err) - } + bz := k.cdc.MustMarshal(&undelegations) store.Set(types.PendingUndelegationsKey(), bz) } @@ -119,7 +113,7 @@ func (k Keeper) GetPendingUndelegations(ctx sdk.Context) types.UndelegationRecor } var undelegations types.UndelegationRecordKeys if err := undelegations.Unmarshal(bz); err != nil { - panic(err) + return types.UndelegationRecordKeys{} } return undelegations } diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index 9e588e63a..4070c87dc 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -54,7 +54,7 @@ func (k Keeper) GetUnbondingCompletionEpoch( // goes into effect at the beginning of epoch 6. the information // should be held for 7 epochs, so it should be deleted at the // beginning of epoch 13 or the end of epoch 12. - return epochInfo.CurrentEpoch + int64(unbondingEpochs) + return epochInfo.CurrentEpoch + int64(unbondingEpochs) // #nosec G701 } // AppendUndelegationsToMature stores that the undelegation with recordKey should be @@ -75,7 +75,7 @@ func (k Keeper) GetUndelegationsToMature( ctx sdk.Context, epoch int64, ) [][]byte { store := ctx.KVStore(k.storeKey) - key := types.UnbondingReleaseMaturityKey(epoch) + key, _ := types.UnbondingReleaseMaturityKey(epoch) bz := store.Get(key) if bz == nil { return [][]byte{} @@ -94,7 +94,7 @@ func (k Keeper) ClearUndelegationsToMature( ctx sdk.Context, epoch int64, ) { store := ctx.KVStore(k.storeKey) - key := types.UnbondingReleaseMaturityKey(epoch) + key, _ := types.UnbondingReleaseMaturityKey(epoch) store.Delete(key) } @@ -104,7 +104,7 @@ func (k Keeper) setUndelegationsToMature( ctx sdk.Context, epoch int64, undelegationRecords types.UndelegationRecordKeys, ) { store := ctx.KVStore(k.storeKey) - key := types.UnbondingReleaseMaturityKey(epoch) + key, _ := types.UnbondingReleaseMaturityKey(epoch) val, err := undelegationRecords.Marshal() if err != nil { panic(err) diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index bdfc529d6..cb61ca7de 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -41,9 +41,10 @@ func (k Keeper) ApplyValidatorChanges( // convert TM pubkey to SDK pubkey pubkey, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()) if err != nil { - // An error here would indicate that the validator updates - // received from other modules (or genesis) are invalid. - panic(err) + // An error here would indicate that this change is invalid. + // In no situation it should happen, however, if it does, + // we do not panic. Simply skip the change. + continue } addr := pubkey.Address() val, found := k.GetValidator(ctx, addr) @@ -60,22 +61,19 @@ func (k Keeper) ApplyValidatorChanges( case false: if change.Power > 0 { // create a new validator - the address is just derived from the public key and - // has - // no correlation with the operator address on Exocore + // has no correlation with the operator address on Exocore ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) if err != nil { - // An error here would indicate that the validator updates - // received are invalid. - panic(err) + continue } - - k.SetValidator(ctx, ocVal) - err = k.Hooks().AfterValidatorBonded(ctx, sdk.ConsAddress(addr), nil) + cc, writeFunc := ctx.CacheContext() + k.SetValidator(cc, ocVal) + err = k.Hooks().AfterValidatorBonded(cc, sdk.ConsAddress(addr), nil) if err != nil { - // AfterValidatorBonded is hooked by the Slashing module and should not - // return - // an error. If any other module were to hook it, they should also not. - panic(err) + // If an error is returned, the validator is not added to the `ret` slice. + continue + } else { + writeFunc() } } else { // edge case: we received an update for 0 power @@ -90,27 +88,23 @@ func (k Keeper) ApplyValidatorChanges( // store the validator set against the provided validator set id lastVals := types.Validators{} for _, v := range k.GetAllExocoreValidators(ctx) { - pubkey, err := v.ConsPubKey() - if err != nil { - panic(err) - } - val, err := stakingtypes.NewValidator(nil, pubkey, stakingtypes.Description{}) - if err != nil { - panic(err) - } + // we stored the validators above, so this will never fail. + pubkey, _ := v.ConsPubKey() + // This calls NewAnyWithValue internally, which we have already done. + val, _ := stakingtypes.NewValidator(nil, pubkey, stakingtypes.Description{}) // Set validator to bonded status val.Status = stakingtypes.Bonded // Compute tokens from voting power val.Tokens = sdk.TokensFromConsensusPower(v.Power, sdk.DefaultPowerReduction) lastVals.List = append(lastVals.GetList(), val) } - k.SetValidatorSet(ctx, valSetID, &lastVals) + k.setValidatorSet(ctx, valSetID, &lastVals) if !genesis { // the val set change is effective as of the next block, so height + 1. - k.SetValidatorSetID(ctx, ctx.BlockHeight()+1, valSetID) + k.setValidatorSetID(ctx, ctx.BlockHeight()+1, valSetID) } else { // the val set change is effective immediately. - k.SetValidatorSetID(ctx, ctx.BlockHeight(), valSetID) + k.setValidatorSetID(ctx, ctx.BlockHeight(), valSetID) } return ret } @@ -167,17 +161,17 @@ func (k Keeper) GetAllExocoreValidators( func (k Keeper) GetHistoricalInfo( ctx sdk.Context, height int64, ) (stakingtypes.HistoricalInfo, bool) { - headerSubset, found := k.GetBlockHeader(ctx, height) + headerSubset, found := k.getBlockHeader(ctx, height) if !found { // only panic in the case of an unmarshal error return stakingtypes.HistoricalInfo{}, false } - valSetID, found := k.GetValidatorSetID(ctx, height) + valSetID, found := k.getValidatorSetID(ctx, height) if !found { // only panic in the case of an unmarshal error return stakingtypes.HistoricalInfo{}, false } - valSet, found := k.GetValidatorSet(ctx, valSetID) + valSet, found := k.getValidatorSet(ctx, valSetID) if !found { // only panic in the case of an unmarshal error return stakingtypes.HistoricalInfo{}, false @@ -192,9 +186,10 @@ func (k Keeper) GetHistoricalInfo( ), true } -// SetValidatorSet sets the validator set at a given id. This is -// (intentionally) not exported in the genesis state. -func (k Keeper) SetValidatorSet( +// setValidatorSet sets the validator set at a given id. This is +// (intentionally) not exported in the genesis state. It can therefore +// be a private function. +func (k Keeper) setValidatorSet( ctx sdk.Context, id uint64, vs *types.Validators, ) { store := ctx.KVStore(k.storeKey) @@ -203,8 +198,8 @@ func (k Keeper) SetValidatorSet( store.Set(key, value) } -// GetValidatorSet gets the validator set at a given id. -func (k Keeper) GetValidatorSet( +// getValidatorSet gets the validator set at a given id. +func (k Keeper) getValidatorSet( ctx sdk.Context, id uint64, ) (*types.Validators, bool) { store := ctx.KVStore(k.storeKey) @@ -218,8 +213,8 @@ func (k Keeper) GetValidatorSet( return &hi, true } -// DeleteValidatorSet deletes the validator set at a given id. -func (k Keeper) DeleteValidatorSet(ctx sdk.Context, id uint64) { +// deleteValidatorSet deletes the validator set at a given id. +func (k Keeper) deleteValidatorSet(ctx sdk.Context, id uint64) { store := ctx.KVStore(k.storeKey) key := types.ValidatorSetKey(id) store.Delete(key) @@ -231,7 +226,8 @@ func (k Keeper) DeleteValidatorSet(ctx sdk.Context, id uint64) { // event. Otherwise, it is constant. The header, however, will change at every block. Since // the Cosmos SDK does not allow for the retrieval of a past block header, we store the header // ourselves in this function. The validator set is stored when it changes at the end of an -// epoch or at a slashing event in the corresponding functions. +// epoch or at a slashing event in the corresponding functions. It is called within the EndBlock +// of the module, so it is kept public. func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { // Get the number of historical entries to persist, as the number of block heights. numHistoricalEntries := k.GetHistoricalEntries(ctx) @@ -241,23 +237,23 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { // they must be only deleted if no other block is using them. lastDeletedID := uint64(0) // contract: starts from 1. for i := ctx.BlockHeight() - int64(numHistoricalEntries); i >= 0; i-- { - _, found := k.GetBlockHeader(ctx, i) + _, found := k.getBlockHeader(ctx, i) if found { // because they are deleted together, and saved one after the other, // since the block header exists, so must the validator set id. - lastDeletedID, _ = k.GetValidatorSetID(ctx, i+1) + lastDeletedID, _ = k.getValidatorSetID(ctx, i+1) // clear both the header and the mapping - k.DeleteBlockHeader(ctx, i) - k.DeleteValidatorSetID(ctx, i) + k.deleteBlockHeader(ctx, i) + k.deleteValidatorSetID(ctx, i) } else { break } } - currentID, _ := k.GetValidatorSetID( - ctx, ctx.BlockHeight()-int64(numHistoricalEntries)+1, + currentID, _ := k.getValidatorSetID(ctx, + ctx.BlockHeight()-int64(numHistoricalEntries)+1, // #nosec G701 // uint32 < int64 always ) for i := lastDeletedID; i < currentID; i++ { - k.DeleteValidatorSet(ctx, i) + k.deleteValidatorSet(ctx, i) } // if there is no need to persist historicalInfo, return. @@ -266,7 +262,7 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { } // store the header - k.StoreBlockHeader(ctx) + k.storeBlockHeader(ctx) // we have stored: // before TrackHistoricalInfo: ValidatorSetID for height, and the validator set. @@ -297,13 +293,17 @@ func (k Keeper) MustGetCurrentValidatorsAsABCIUpdates(ctx sdk.Context) []abci.Va return valUpdates } -// GetValidatorSetID returns the identifier of the validator set at a given height. +// getValidatorSetID returns the identifier of the validator set at a given height. // It is used to "share" the validator set entries across multiple heights within an epoch. // Typically, the validator set should change only at the end of an epoch. However, in the -// case of a slashing occurrence, the validator set may change within an epoch. -func (k Keeper) GetValidatorSetID(ctx sdk.Context, height int64) (uint64, bool) { +// case of a slashing occurrence, the validator set may change within an epoch. This info +// is not exported in the genesis, so it is private. +func (k Keeper) getValidatorSetID(ctx sdk.Context, height int64) (uint64, bool) { store := ctx.KVStore(k.storeKey) - key := types.ValidatorSetIDKey(height) + key, ok := types.ValidatorSetIDKey(height) + if !ok { + return 0, false + } value := store.Get(key) if value == nil { return 0, false @@ -311,44 +311,54 @@ func (k Keeper) GetValidatorSetID(ctx sdk.Context, height int64) (uint64, bool) return sdk.BigEndianToUint64(value), true } -// SetValidatorSetID sets the identifier of the validator set at a given height. -func (k Keeper) SetValidatorSetID(ctx sdk.Context, height int64, id uint64) { +// setValidatorSetID sets the identifier of the validator set at a given height. +func (k Keeper) setValidatorSetID(ctx sdk.Context, height int64, id uint64) { store := ctx.KVStore(k.storeKey) - key := types.ValidatorSetIDKey(height) + // SetValidatorSetID is called with ctx.BlockHeight which Cosmos + // guarantees to be positive. + key, _ := types.ValidatorSetIDKey(height) value := sdk.Uint64ToBigEndian(id) store.Set(key, value) } -// DeleteValidatorSetID deletes the identifier of the validator set at a given height. -func (k Keeper) DeleteValidatorSetID(ctx sdk.Context, height int64) { +// deleteValidatorSetID deletes the identifier of the validator set at a given height. +func (k Keeper) deleteValidatorSetID(ctx sdk.Context, height int64) { store := ctx.KVStore(k.storeKey) - key := types.ValidatorSetIDKey(height) + // i don't care if we delete a key that is meaningless + key, _ := types.ValidatorSetIDKey(height) store.Delete(key) } -// GetBlockHeader returns the block header at a given height. -func (k Keeper) GetBlockHeader(ctx sdk.Context, height int64) (types.HeaderSubset, bool) { +// getBlockHeader returns the block header at a given height. It is called during IBC's +// GetHistoricalInfo call. Since it is an external call, we will validate that height +// should be non-negative. This info is not exported in the genesis, so it is private. +func (k Keeper) getBlockHeader(ctx sdk.Context, height int64) (types.HeaderSubset, bool) { store := ctx.KVStore(k.storeKey) - key := types.HeaderKey(height) - var header types.HeaderSubset + key, ok := types.HeaderKey(height) + if !ok { + return types.HeaderSubset{}, false + } value := store.Get(key) if value == nil { - return header, false + return types.HeaderSubset{}, false } + var header types.HeaderSubset k.cdc.MustUnmarshal(value, &header) return header, true } -// SetBlockHeader sets the block header at a given height. -func (k Keeper) DeleteBlockHeader(ctx sdk.Context, height int64) { +// deleteBlockHeader deletes the block header at a given height. +func (k Keeper) deleteBlockHeader(ctx sdk.Context, height int64) { store := ctx.KVStore(k.storeKey) - key := types.HeaderKey(height) + // i don't care if we delete a key that is meaningless + key, _ := types.HeaderKey(height) store.Delete(key) } -// StoreBlockHeader stores the block header subset as of the current height. -func (k Keeper) StoreBlockHeader(ctx sdk.Context) { - key := types.HeaderKey(ctx.BlockHeight()) +// storeBlockHeader stores the block header subset as of the current height. +func (k Keeper) storeBlockHeader(ctx sdk.Context) { + // ctx.BlockHeight() is positive so we don't need to validate + key, _ := types.HeaderKey(ctx.BlockHeight()) sdkHeader := ctx.BlockHeader() header := types.HeaderSubset{ Time: sdkHeader.Time, diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 6397e1796..1303fb4d0 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -75,15 +75,27 @@ func ValidatorSetKey(id uint64) []byte { } // ValidatorSetIDKey returns the key for the validator set id store. -func ValidatorSetIDKey(height int64) []byte { - bz := sdk.Uint64ToBigEndian(uint64(height)) - return append([]byte{ValidatorSetIDBytePrefix}, bz...) +func ValidatorSetIDKey(height int64) ([]byte, bool) { + uheight, ok := SafeInt64ToUint64(height) + if !ok { + return nil, false + } + return append( + []byte{ValidatorSetIDBytePrefix}, + sdk.Uint64ToBigEndian(uheight)..., + ), true } // HeaderKey returns the key for the header store. -func HeaderKey(height int64) []byte { - bz := sdk.Uint64ToBigEndian(uint64(height)) - return append([]byte{HeaderBytePrefix}, bz...) +func HeaderKey(height int64) ([]byte, bool) { + uheight, ok := SafeInt64ToUint64(height) + if !ok { + return nil, false + } + return append( + []byte{HeaderBytePrefix}, + sdk.Uint64ToBigEndian(uheight)..., + ), true } // QueuedOperationsKey returns the key for the queued operations store. @@ -93,8 +105,15 @@ func QueuedOperationsKey() []byte { // OptOutsToFinishKey returns the key for the operator opt out maturity store (epoch -> list of // addresses). -func OptOutsToFinishKey(epoch int64) []byte { - return append([]byte{OptOutsToFinishBytePrefix}, sdk.Uint64ToBigEndian(uint64(epoch))...) +func OptOutsToFinishKey(epoch int64) ([]byte, bool) { + uepoch, ok := SafeInt64ToUint64(epoch) + if !ok { + return nil, false + } + return append( + []byte{OptOutsToFinishBytePrefix}, + sdk.Uint64ToBigEndian(uepoch)..., + ), true } // OperatorOptOutFinishEpochKey is the key for the operator opt out maturity store @@ -105,18 +124,28 @@ func OperatorOptOutFinishEpochKey(address sdk.AccAddress) []byte { // ConsensusAddrsToPruneKey is the key to lookup the list of operator consensus addresses that // can be pruned from the operator module at the provided epoch. -func ConsensusAddrsToPruneKey(epoch int64) []byte { +func ConsensusAddrsToPruneKey(epoch int64) ([]byte, bool) { + uepoch, ok := SafeInt64ToUint64(epoch) + if !ok { + return nil, false + } return append( []byte{ConsensusAddrsToPruneBytePrefix}, - sdk.Uint64ToBigEndian(uint64(epoch))...) + sdk.Uint64ToBigEndian(uepoch)..., + ), true } // UnbondingReleaseMaturityKey is the key to lookup the list of undelegations that will mature // at the provided epoch. -func UnbondingReleaseMaturityKey(epoch int64) []byte { +func UnbondingReleaseMaturityKey(epoch int64) ([]byte, bool) { + uepoch, ok := SafeInt64ToUint64(epoch) + if !ok { + return nil, false + } return append( []byte{UnbondingReleaseMaturityBytePrefix}, - sdk.Uint64ToBigEndian(uint64(epoch))...) + sdk.Uint64ToBigEndian(uepoch)..., + ), true } // PendingOperationsKey returns the key for the pending operations store. @@ -139,3 +168,13 @@ func PendingConsensusAddrsKey() []byte { func PendingUndelegationsKey() []byte { return []byte{PendingUndelegationsByte} } + +// SafeInt64ToUint64 is a wrapper function to convert an int64 +// to a uint64. It returns (0, false) if the conversion is not possible. +// This is safe as long as the int64 is non-negative. +func SafeInt64ToUint64(id int64) (uint64, bool) { + if id < 0 { + return 0, false + } + return uint64(id), true // #nosec G701 // already checked. +} diff --git a/x/dogfood/types/params.go b/x/dogfood/types/params.go index 97fb4f583..f1b272b56 100644 --- a/x/dogfood/types/params.go +++ b/x/dogfood/types/params.go @@ -123,6 +123,9 @@ func ValidatePositiveUint32(i interface{}) error { // String implements the Stringer interface. Ths interface is required as part of the // proto.Message interface, which is used in the query server. func (p Params) String() string { - out, _ := yaml.Marshal(p) + out, err := yaml.Marshal(p) + if err != nil { + return "" + } return string(out) } From 57f60a429a9e94ce445b83d580bb556e3096adce Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:56:42 +0000 Subject: [PATCH 30/41] chore(build): remove unused proto import --- proto/exocore/dogfood/v1/query.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/exocore/dogfood/v1/query.proto b/proto/exocore/dogfood/v1/query.proto index 9f1a73ae7..51d9424a4 100644 --- a/proto/exocore/dogfood/v1/query.proto +++ b/proto/exocore/dogfood/v1/query.proto @@ -4,7 +4,6 @@ package exocore.dogfood.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "exocore/dogfood/v1/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; From 7bba29fe8be3cd6b01b0d9afdc7c8d761e9d760c Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:58:09 +0000 Subject: [PATCH 31/41] chore(dogfood): respond to golangci-lint --- x/dogfood/client/cli/query.go | 2 +- x/dogfood/keeper/validators.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/x/dogfood/client/cli/query.go b/x/dogfood/client/cli/query.go index a1f193d8d..eac3ceae4 100644 --- a/x/dogfood/client/cli/query.go +++ b/x/dogfood/client/cli/query.go @@ -39,7 +39,7 @@ func CmdQueryParams() *cobra.Command { Use: "params", Short: "shows the parameters of the module", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index cb61ca7de..8c4b1147a 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -72,9 +72,8 @@ func (k Keeper) ApplyValidatorChanges( if err != nil { // If an error is returned, the validator is not added to the `ret` slice. continue - } else { - writeFunc() } + writeFunc() } else { // edge case: we received an update for 0 power // but the validator is already deleted. Do not forward From 55a228cf5a8862e95cddaafa658b41135cdf422a Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:00:17 +0000 Subject: [PATCH 32/41] chore(dogfood): lint the proto files --- proto/exocore/dogfood/v1/dogfood.proto | 95 ++++++++++++++------------ proto/exocore/dogfood/v1/query.proto | 2 +- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index 21c5b350b..8f5ad37f5 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -6,22 +6,22 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; +import "cosmos/staking/v1beta1/staking.proto"; import "cosmos_proto/cosmos.proto"; import "tendermint/crypto/keys.proto"; -import "cosmos/staking/v1beta1/staking.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; // ExocoreValidator is a validator that is part of the Exocore network. It is // used to validate and sign blocks and transactions. message ExocoreValidator { - // The address, as derived from the consensus key. It has no relation - // with the operator's account address. - bytes address = 1; - // Last known power - int64 power = 2; - // pubkey is the consensus public key of the validator, as a Protobuf Any. - google.protobuf.Any pubkey = 3 [ + // The address, as derived from the consensus key. It has no relation + // with the operator's account address. + bytes address = 1; + // Last known power + int64 power = 2; + // pubkey is the consensus public key of the validator, as a Protobuf Any. + google.protobuf.Any pubkey = 3 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" ]; @@ -30,79 +30,84 @@ message ExocoreValidator { // OperationType is used to indicate the type of operation that is being // cached by the module to create the updated validator set. enum OperationType { - option (gogoproto.goproto_enum_prefix) = false; - // KeyOpUnspecified is used to indicate that the operation type is not specified. - // This should never be used. - OPERATION_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "KeyOpUnspecified" ]; - // KeyAddition is used to indicate that the operation is a key addition. - OPERATION_TYPE_ADDITION_OR_UPDATE = 1 [ (gogoproto.enumvalue_customname) = "KeyAdditionOrUpdate" ]; - // KeyRemoval is used to indicate that the operation is a key removal. Typically - // this is done due to key replacement mechanism and not directly. - OPERATION_TYPE_REMOVAL = 2 [ (gogoproto.enumvalue_customname) = "KeyRemoval" ]; + option (gogoproto.goproto_enum_prefix) = false; + // KeyOpUnspecified is used to indicate that the operation type is not specified. + // This should never be used. + OPERATION_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "KeyOpUnspecified" ]; + // KeyAddition is used to indicate that the operation is a key addition. + OPERATION_TYPE_ADDITION_OR_UPDATE = 1 [ (gogoproto.enumvalue_customname) = "KeyAdditionOrUpdate" ]; + // KeyRemoval is used to indicate that the operation is a key removal. Typically + // this is done due to key replacement mechanism and not directly. + OPERATION_TYPE_REMOVAL = 2 [ (gogoproto.enumvalue_customname) = "KeyRemoval" ]; } // QueueResultType is used to indicate the result of the queue operation. enum QueueResultType { - option (gogoproto.goproto_enum_prefix) = false; - // QueueResultUnspecified is used to indicate that the queue result type is not specified. - QUEUE_RESULT_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "QueueResultUnspecified" ]; - // QueueResultSuccess is used to indicate that the queue operation was successful. - QUEUE_RESULT_TYPE_SUCCESS = 1 [ (gogoproto.enumvalue_customname) = "QueueResultSuccess" ]; - // QueueResultExists is used to indicate that the queue operation failed because the - // operation already exists in the queue. - QUEUE_RESULT_TYPE_EXISTS = 2 [ (gogoproto.enumvalue_customname) = "QueueResultExists" ]; - // QueueResultRemoved is used to indicate that the queue operation resulted in an existing - // operation being removed from the queue. - QUEUE_RESULT_TYPE_REMOVED = 3 [ (gogoproto.enumvalue_customname) = "QueueResultRemoved" ]; + option (gogoproto.goproto_enum_prefix) = false; + // QueueResultUnspecified is used to indicate that the queue result type is not specified. + QUEUE_RESULT_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "QueueResultUnspecified" ]; + // QueueResultSuccess is used to indicate that the queue operation was successful. + QUEUE_RESULT_TYPE_SUCCESS = 1 [ (gogoproto.enumvalue_customname) = "QueueResultSuccess" ]; + // QueueResultExists is used to indicate that the queue operation failed because the + // operation already exists in the queue. + QUEUE_RESULT_TYPE_EXISTS = 2 [ (gogoproto.enumvalue_customname) = "QueueResultExists" ]; + // QueueResultRemoved is used to indicate that the queue operation resulted in an existing + // operation being removed from the queue. + QUEUE_RESULT_TYPE_REMOVED = 3 [ (gogoproto.enumvalue_customname) = "QueueResultRemoved" ]; } // Operation is used to indicate the operation that is being cached by the module // to create the updated validator set. message Operation { - // OperationType is the type of the operation (addition / removal). - OperationType operation_type = 1; - // OperatorAddress is the sdk.AccAddress of the operator. - bytes operator_address = 2; - // PubKey is the public key for which the operation is being applied. - tendermint.crypto.PublicKey pub_key = 3 [(gogoproto.nullable) = false]; + // OperationType is the type of the operation (addition / removal). + OperationType operation_type = 1; + // OperatorAddress is the sdk.AccAddress of the operator. + bytes operator_address = 2; + // PubKey is the public key for which the operation is being applied. + tendermint.crypto.PublicKey pub_key = 3 [(gogoproto.nullable) = false]; } // Operations is a collection of Operation. message Operations { - repeated Operation list = 1 [(gogoproto.nullable) = false]; + // list is the list of operations. + repeated Operation list = 1 [(gogoproto.nullable) = false]; } // AccountAddresses represents a list of account addresses. It is used to store the list of // operator addresses whose operations are maturing at an epoch. message AccountAddresses { - repeated bytes list = 1; + // list is the list of account addresses. + repeated bytes list = 1; } // ConsensusAddresses represents a list of account addresses. It is used to store the list of // addresses (which correspond to operator public keys) to delete at the end of an epoch. message ConsensusAddresses { - repeated bytes list = 1; + // list is the list of consensus addresses. + repeated bytes list = 1; } // UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a // list of undelegation records to mature in the delegation module at the end of the epoch. message UndelegationRecordKeys { - repeated bytes list = 1; + // list is the list of undelegation record keys. + repeated bytes list = 1; } // Validators is a list of validators stored according to the staking module. message Validators { - repeated cosmos.staking.v1beta1.Validator list = 1 [(gogoproto.nullable) = false]; + // list is the list of validators. + repeated cosmos.staking.v1beta1.Validator list = 1 [(gogoproto.nullable) = false]; } // HeaderSubset is a subset of the block header that is relevant to the IBC codebase. It is // stored for each height and then converted to the `tm.Header` object after queried. It is // pruned when the information is no longer needed according to the `HistoricalEntries` param. message HeaderSubset { - // timestamp of the block - google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - // validators for the next block - bytes next_validators_hash = 2; - // state after txs from the previous block - bytes app_hash = 3; + // timestamp of the block + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // validators for the next block + bytes next_validators_hash = 2; + // state after txs from the previous block + bytes app_hash = 3; } \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/query.proto b/proto/exocore/dogfood/v1/query.proto index 51d9424a4..111b0c8e8 100644 --- a/proto/exocore/dogfood/v1/query.proto +++ b/proto/exocore/dogfood/v1/query.proto @@ -2,9 +2,9 @@ syntax = "proto3"; package exocore.dogfood.v1; +import "exocore/dogfood/v1/params.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "exocore/dogfood/v1/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; From ca658d8b6dd15a0540cc23b10c57f3fdfb490f0b Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:01:15 +0000 Subject: [PATCH 33/41] build(dogfood): regenerate proto code --- x/dogfood/types/dogfood.pb.go | 109 ++++++++++++++++++---------------- x/dogfood/types/query.pb.go | 41 ++++++------- 2 files changed, 76 insertions(+), 74 deletions(-) diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index fc3868a19..876f5c4c1 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -237,6 +237,7 @@ func (m *Operation) GetPubKey() crypto.PublicKey { // Operations is a collection of Operation. type Operations struct { + // list is the list of operations. List []Operation `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` } @@ -283,6 +284,7 @@ func (m *Operations) GetList() []Operation { // AccountAddresses represents a list of account addresses. It is used to store the list of // operator addresses whose operations are maturing at an epoch. type AccountAddresses struct { + // list is the list of account addresses. List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } @@ -329,6 +331,7 @@ func (m *AccountAddresses) GetList() [][]byte { // ConsensusAddresses represents a list of account addresses. It is used to store the list of // addresses (which correspond to operator public keys) to delete at the end of an epoch. type ConsensusAddresses struct { + // list is the list of consensus addresses. List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } @@ -375,6 +378,7 @@ func (m *ConsensusAddresses) GetList() [][]byte { // UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a // list of undelegation records to mature in the delegation module at the end of the epoch. type UndelegationRecordKeys struct { + // list is the list of undelegation record keys. List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } @@ -420,6 +424,7 @@ func (m *UndelegationRecordKeys) GetList() [][]byte { // Validators is a list of validators stored according to the staking module. type Validators struct { + // list is the list of validators. List []types1.Validator `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` } @@ -546,60 +551,60 @@ func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescrip var fileDescriptor_071b9989c501c3f2 = []byte{ // 857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcf, 0x6f, 0xe3, 0x44, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x41, 0x6f, 0xe3, 0x44, 0x14, 0x8e, 0x9b, 0xb2, 0xbb, 0x4c, 0xbb, 0x5d, 0x33, 0x84, 0x6e, 0x6a, 0xed, 0xa6, 0x6e, 0x84, 0x50, 0xa8, 0xc0, 0x26, 0x2d, 0x08, 0x04, 0x02, 0x29, 0x6d, 0x8c, 0x1a, 0x65, 0x69, 0xb2, 0x76, - 0xbc, 0x02, 0x2e, 0x96, 0x63, 0xbf, 0xa6, 0x56, 0x13, 0xcf, 0xc8, 0x33, 0xce, 0xd6, 0xff, 0x01, - 0xca, 0x69, 0x2f, 0x1c, 0x73, 0x42, 0xfc, 0x07, 0x48, 0x9c, 0xb8, 0xaf, 0x38, 0xed, 0x91, 0xd3, - 0x82, 0xda, 0xff, 0x80, 0x1b, 0x37, 0xe4, 0x5f, 0xa9, 0xb7, 0xa9, 0x7a, 0xf3, 0x9b, 0xf7, 0xbe, - 0x37, 0xdf, 0xe7, 0xf7, 0xcd, 0x43, 0x32, 0x9c,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0x96, 0x7c, 0xbc, 0x4b, 0xd8, 0xf0, 0x4e, 0xe2, 0xb9, 0xfd, 0xff, 0x03, 0x00, 0x00, 0xff, - 0xff, 0x41, 0xe1, 0x03, 0x2c, 0x04, 0x06, 0x00, 0x00, + 0xbc, 0x02, 0x2e, 0x96, 0x63, 0xbf, 0xa6, 0x56, 0x13, 0x8f, 0xe5, 0x19, 0x67, 0xeb, 0x7f, 0x80, + 0x72, 0xda, 0x0b, 0xc7, 0x9c, 0x10, 0xff, 0x00, 0x89, 0x13, 0xf7, 0x15, 0xa7, 0x3d, 0x72, 0x5a, + 0x50, 0xfb, 0x0f, 0xb8, 0x71, 0x43, 0xb6, 0xc7, 0xa9, 0xb7, 0xa9, 0x7a, 0x9b, 0x37, 0xef, 0x7d, + 0xf3, 0xbe, 0x6f, 0xe6, 0x9b, 0x87, 0x64, 0x38, 0x27, 0x0e, 0x09, 0x41, 0x75, 0xc9, 0xe8, 0x84, + 0x10, 0x57, 0x9d, 0x36, 0xf3, 0xa5, 0x12, 0x84, 0x84, 0x11, 0x8c, 0x79, 0x85, 0x92, 0x6f, 0x4f, + 0x9b, 0x52, 0x65, 0x44, 0x46, 0x24, 0x4d, 0xab, 0xc9, 0x2a, 0xab, 0x94, 0xb6, 0x46, 0x84, 0x8c, + 0xc6, 0xa0, 0xa6, 0xd1, 0x30, 0x3a, 0x51, 0x6d, 0x3f, 0xe6, 0xa9, 0xed, 0xeb, 0x29, 0xe6, 0x4d, + 0x80, 0x32, 0x7b, 0x12, 0xf0, 0x82, 0xf7, 0x1d, 0x42, 0x27, 0x84, 0xaa, 0x94, 0xd9, 0x67, 0x9e, + 0x3f, 0x52, 0xa7, 0xcd, 0x21, 0x30, 0xbb, 0x99, 0xc7, 0x79, 0x87, 0xac, 0xca, 0xca, 0x5a, 0x67, + 0x01, 0x4f, 0x3d, 0x62, 0xe0, 0xbb, 0x10, 0x4e, 0x3c, 0x9f, 0xa9, 0x4e, 0x18, 0x07, 0x8c, 0xa8, +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d, 0xdf, 0x31, 0x06, 0x86, 0xb8, 0x22, 0xbd, 0x37, 0x9b, 0xcb, 0xef, 0x14, 0x50, 0xda, 0xb9, + 0x47, 0x19, 0xbd, 0xb9, 0x57, 0xaa, 0x59, 0x6b, 0x8b, 0xe5, 0xa5, 0x5e, 0xa9, 0x76, 0x70, 0x33, + 0xed, 0x07, 0xdd, 0x97, 0x17, 0x35, 0xe1, 0xd5, 0x45, 0x4d, 0xf8, 0xe7, 0xa2, 0x26, 0xbc, 0xb8, + 0xac, 0x95, 0x5e, 0x5d, 0xd6, 0x4a, 0x7f, 0x5d, 0xd6, 0x4a, 0x3f, 0x36, 0x47, 0x1e, 0x3b, 0x8d, + 0x86, 0x8a, 0x43, 0x26, 0x2a, 0x9f, 0x74, 0xc7, 0xc0, 0x9e, 0x93, 0xf0, 0x4c, 0xcd, 0x47, 0xfc, + 0xf9, 0x62, 0xc8, 0x27, 0xb3, 0x84, 0x0e, 0xef, 0xa4, 0x9e, 0xdb, 0xff, 0x3f, 0x00, 0x00, 0xff, + 0xff, 0x99, 0xab, 0xaa, 0x75, 0x04, 0x06, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { diff --git a/x/dogfood/types/query.pb.go b/x/dogfood/types/query.pb.go index ec851da1b..c1d854133 100644 --- a/x/dogfood/types/query.pb.go +++ b/x/dogfood/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -121,27 +120,25 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/query.proto", fileDescriptor_e23d51a3dceb1c68) } var fileDescriptor_e23d51a3dceb1c68 = []byte{ - // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90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, 0x76, 0x42, 0xb6, 0xbc, 0x12, 0x73, 0x9e, 0xee, 0xfa, 0xf4, 0xb3, 0x15, 0xf4, - 0x3c, 0xdf, 0x79, 0x41, 0x78, 0xa3, 0x4e, 0x24, 0x4f, 0xb8, 0xe1, 0x08, 0x72, 0xb0, 0xca, 0xbd, - 0x5c, 0x26, 0x3c, 0xfc, 0x97, 0x73, 0xf5, 0xda, 0xad, 0xe7, 0xf7, 0xef, 0xb7, 0xb5, 0x5d, 0xb2, - 0xcd, 0xff, 0x6e, 0xed, 0x5a, 0x74, 0xcf, 0xa7, 0x25, 0x45, 0xb3, 0x92, 0xa2, 0xaf, 0x92, 0xa2, - 0xd7, 0x8a, 0x06, 0xb3, 0x8a, 0x06, 0x1f, 0x15, 0x0d, 0x6e, 0x22, 0x95, 0xd8, 0xbb, 0x3c, 0x66, - 0x7d, 0x18, 0xf2, 0x33, 0x67, 0xbe, 0x90, 0xf6, 0x11, 0xb2, 0xfb, 0x45, 0xd6, 0x78, 0x91, 0x66, - 0x27, 0x5a, 0x9a, 0xb8, 0x51, 0x1f, 0xf0, 0xe4, 0x27, 0x00, 0x00, 0xff, 0xff, 0x19, 0xa2, 0xb5, - 0x7c, 0xf7, 0x01, 0x00, 0x00, + // 282 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xad, 0xc8, 0x4f, + 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, + 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xeb, 0x41, + 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0xe4, 0xb1, 0xe8, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x86, 0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 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x1b, 0x6e, 0x56, 0x05, + 0xdc, 0xb4, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x00, 0x1a, 0x03, 0x02, 0x00, 0x00, + 0xff, 0xff, 0xef, 0xf0, 0x5f, 0x7f, 0xcb, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 931a8e1380814e2faf0b08abe861573cb2fb1525 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:10:06 +0000 Subject: [PATCH 34/41] chore(dogfood): ignore redundant gosec errors --- x/dogfood/keeper/validators.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index 8c4b1147a..294545c97 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -88,9 +88,11 @@ func (k Keeper) ApplyValidatorChanges( lastVals := types.Validators{} for _, v := range k.GetAllExocoreValidators(ctx) { // we stored the validators above, so this will never fail. - pubkey, _ := v.ConsPubKey() + pubkey, _ := v.ConsPubKey() // #nosec G703 // This calls NewAnyWithValue internally, which we have already done. - val, _ := stakingtypes.NewValidator(nil, pubkey, stakingtypes.Description{}) + val, _ := stakingtypes.NewValidator( // #nosec G703 + nil, pubkey, stakingtypes.Description{}, + ) // Set validator to bonded status val.Status = stakingtypes.Bonded // Compute tokens from voting power @@ -229,13 +231,16 @@ func (k Keeper) deleteValidatorSet(ctx sdk.Context, id uint64) { // of the module, so it is kept public. func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { // Get the number of historical entries to persist, as the number of block heights. - numHistoricalEntries := k.GetHistoricalEntries(ctx) + // #nosec G701 // uint32 fits into int64 always. + numHistoricalEntries := int64( + k.GetHistoricalEntries(ctx), + ) // we are deleting headers, say, from, 0 to 999 at block 1999 // for these headers, we must find the corresponding validator set ids to delete. // they must be only deleted if no other block is using them. lastDeletedID := uint64(0) // contract: starts from 1. - for i := ctx.BlockHeight() - int64(numHistoricalEntries); i >= 0; i-- { + for i := ctx.BlockHeight() - numHistoricalEntries; i >= 0; i-- { _, found := k.getBlockHeader(ctx, i) if found { // because they are deleted together, and saved one after the other, @@ -249,7 +254,7 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { } } currentID, _ := k.getValidatorSetID(ctx, - ctx.BlockHeight()-int64(numHistoricalEntries)+1, // #nosec G701 // uint32 < int64 always + ctx.BlockHeight()-numHistoricalEntries+1, ) for i := lastDeletedID; i < currentID; i++ { k.deleteValidatorSet(ctx, i) From 59fce84a2148e8e330028ea368f2f0ac1359696a Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:14:38 +0000 Subject: [PATCH 35/41] chore(dogfood): ignore redundant gosec warning The `// #nosec G703` line needs to be placed above the multi-line statement that it is ignoring, not in the middle of the statement which contains the part to ignore. --- x/dogfood/keeper/validators.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index 294545c97..13336a37f 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -89,8 +89,8 @@ func (k Keeper) ApplyValidatorChanges( for _, v := range k.GetAllExocoreValidators(ctx) { // we stored the validators above, so this will never fail. pubkey, _ := v.ConsPubKey() // #nosec G703 - // This calls NewAnyWithValue internally, which we have already done. - val, _ := stakingtypes.NewValidator( // #nosec G703 + // #nosec G703 // This calls NewAnyWithValue internally, which we have already done. + val, _ := stakingtypes.NewValidator( nil, pubkey, stakingtypes.Description{}, ) // Set validator to bonded status From 72e1a6ffa34c0e4bae37e0faeb9b4f40a5f04d89 Mon Sep 17 00:00:00 2001 From: TimmyExogenous Date: Wed, 28 Feb 2024 15:19:34 +0800 Subject: [PATCH 36/41] delete the code related to setting ExoCoreLzAppAddress to fix the bug when set parameter --- precompiles/withdraw/withdraw_test.go | 6 - proto/exocore/withdraw/query.proto | 24 -- proto/exocore/withdraw/tx.proto | 36 -- x/withdraw/client/cli/query.go | 2 +- x/withdraw/client/cli/query_params.go | 36 -- x/withdraw/client/cli/tx.go | 48 +-- x/withdraw/keeper/msg_server.go | 21 - x/withdraw/keeper/params.go | 18 - x/withdraw/keeper/params_test.go | 18 - x/withdraw/keeper/query.go | 7 - x/withdraw/keeper/query_params.go | 19 - x/withdraw/module.go | 34 +- x/withdraw/types/codec.go | 50 --- x/withdraw/types/genesis.go | 24 -- x/withdraw/types/genesis.pb.go | 320 -------------- x/withdraw/types/genesis_test.go | 41 -- x/withdraw/types/msg.go | 27 -- x/withdraw/types/params.go | 32 -- x/withdraw/types/params.pb.go | 369 ---------------- x/withdraw/types/query.pb.go | 542 ----------------------- x/withdraw/types/query.pb.gw.go | 153 ------- x/withdraw/types/tx.pb.go | 597 -------------------------- x/withdraw/types/types.go | 1 - 23 files changed, 9 insertions(+), 2416 deletions(-) delete mode 100644 proto/exocore/withdraw/query.proto delete mode 100644 proto/exocore/withdraw/tx.proto delete mode 100644 x/withdraw/client/cli/query_params.go delete mode 100644 x/withdraw/keeper/msg_server.go delete mode 100644 x/withdraw/keeper/params_test.go delete mode 100644 x/withdraw/keeper/query.go delete mode 100644 x/withdraw/keeper/query_params.go delete mode 100644 x/withdraw/types/codec.go delete mode 100644 x/withdraw/types/genesis.go delete mode 100644 x/withdraw/types/genesis.pb.go delete mode 100644 x/withdraw/types/genesis_test.go delete mode 100644 x/withdraw/types/msg.go delete mode 100644 x/withdraw/types/params.go delete mode 100644 x/withdraw/types/params.pb.go delete mode 100644 x/withdraw/types/query.pb.go delete mode 100644 x/withdraw/types/query.pb.gw.go delete mode 100644 x/withdraw/types/tx.pb.go delete mode 100644 x/withdraw/types/types.go diff --git a/precompiles/withdraw/withdraw_test.go b/precompiles/withdraw/withdraw_test.go index bb4eb7fc7..0ac0e40c9 100644 --- a/precompiles/withdraw/withdraw_test.go +++ b/precompiles/withdraw/withdraw_test.go @@ -145,12 +145,6 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) s.Require().NoError(err) depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) - withdrawModuleParam := &depositparams.Params{ - ExoCoreLzAppAddress: s.address.String(), - ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, - } - err = s.app.WithdrawKeeper.SetParams(s.ctx, withdrawModuleParam) - s.Require().NoError(err) return commonMalleate() }, returnBytes: successRet, diff --git a/proto/exocore/withdraw/query.proto b/proto/exocore/withdraw/query.proto deleted file mode 100644 index 919d2ec9c..000000000 --- a/proto/exocore/withdraw/query.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package exocore.withdraw; - -import "exocore/deposit/v1/deposit.proto"; -import "google/api/annotations.proto"; - -option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/exocore/withdraw/params"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - exocore.deposit.v1.Params params = 1; -} \ No newline at end of file diff --git a/proto/exocore/withdraw/tx.proto b/proto/exocore/withdraw/tx.proto deleted file mode 100644 index c88670e8e..000000000 --- a/proto/exocore/withdraw/tx.proto +++ /dev/null @@ -1,36 +0,0 @@ - -syntax = "proto3"; -package exocore.withdraw; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "exocore/deposit/v1/deposit.proto"; -import "gogoproto/gogo.proto"; -option go_package = "github.com/ExocoreNetwork/exocore/x/withdraw/types"; - -// MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. -// Since: cosmos-sdk 0.47 -message MsgUpdateParams { - // todo: temporarily not update configuration through gov module - option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // params defines the x/evm parameters to update. - // NOTE: All parameters must be supplied. - exocore.deposit.v1.Params params = 2 [(gogoproto.nullable) = false]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// Since: cosmos-sdk 0.47 -message MsgUpdateParamsResponse {} - -// Msg service defines the Msg service for this module. -service Msg { - - option (cosmos.msg.v1.service) = true; - - // UpdateParams updates the parameters of this module. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); -} diff --git a/x/withdraw/client/cli/query.go b/x/withdraw/client/cli/query.go index c657de13e..229a8827e 100644 --- a/x/withdraw/client/cli/query.go +++ b/x/withdraw/client/cli/query.go @@ -24,7 +24,7 @@ func GetQueryCmd(string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand() // this line is used by starport scaffolding # 1 return cmd diff --git a/x/withdraw/client/cli/query_params.go b/x/withdraw/client/cli/query_params.go deleted file mode 100644 index 0c9ac046c..000000000 --- a/x/withdraw/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/ExocoreNetwork/exocore/x/withdraw/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/withdraw/client/cli/tx.go b/x/withdraw/client/cli/tx.go index 3f8afd530..cca9df077 100644 --- a/x/withdraw/client/cli/tx.go +++ b/x/withdraw/client/cli/tx.go @@ -2,63 +2,23 @@ package cli import ( "fmt" + "github.com/ExocoreNetwork/exocore/x/withdraw/types" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - - // "github.com/cosmos/cosmos-sdk/client/flags" - paramstypes "github.com/ExocoreNetwork/exocore/x/deposit/types" - "github.com/ExocoreNetwork/exocore/x/withdraw/types" ) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ - Use: paramstypes.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", paramstypes.ModuleName), + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - cmd.AddCommand( - UpdateParams(), - ) - - return cmd -} - -// UpdateParams todo: it should be a gov proposal command in future. -func UpdateParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "UpdateParams ExoCoreLZAppAddr ExoCoreLzAppEventTopic", - Short: "set ExoCoreLZAppAddr and ExoCoreLzAppEventTopic params to withdraw module", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - cliCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - sender := cliCtx.GetFromAddress() - msg := &types.MsgUpdateParams{ - Authority: sender.String(), - Params: paramstypes.Params{ - ExoCoreLzAppAddress: args[0], - ExoCoreLzAppEventTopic: args[1], - }, - } - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) + cmd.AddCommand() return cmd } diff --git a/x/withdraw/keeper/msg_server.go b/x/withdraw/keeper/msg_server.go deleted file mode 100644 index b28983140..000000000 --- a/x/withdraw/keeper/msg_server.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/ExocoreNetwork/exocore/x/withdraw/types" -) - -// nolint: unused // To be implemented when creating the requests. -type msgServer struct { - Keeper -} - -func (k Keeper) UpdateParams(context.Context, *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - // c := sdk.UnwrapSDKContext(ctx) - // err := k.SetParams(c, ¶ms.Params) - // if err != nil { - // return nil, err - // } - return nil, nil -} diff --git a/x/withdraw/keeper/params.go b/x/withdraw/keeper/params.go index dadd48482..6c6537003 100644 --- a/x/withdraw/keeper/params.go +++ b/x/withdraw/keeper/params.go @@ -21,21 +21,3 @@ func (k Keeper) GetParams(ctx sdk.Context) (*paramstypes.Params, error) { // Uify the way to obtain Params from deposit keeper return k.depositKeeper.GetParams(ctx) } - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params *paramstypes.Params) error { - // // check if addr is evm address - // if !common.IsHexAddress(params.ExoCoreLzAppAddress) { - // return types.ErrInvalidEvmAddressFormat - // } - // if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { - // return types.ErrInvalidLzUaTopicIDLength - // } - // params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress) - // params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic) - // store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) - // bz := k.cdc.MustMarshal(params) - // store.Set(types.ParamsKey, bz) - // return nil - return k.depositKeeper.SetParams(ctx, params) -} diff --git a/x/withdraw/keeper/params_test.go b/x/withdraw/keeper/params_test.go deleted file mode 100644 index 37f43c88b..000000000 --- a/x/withdraw/keeper/params_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper_test - -import ( - paramstypes "github.com/ExocoreNetwork/exocore/x/deposit/types" -) - -func (suite *KeeperTestSuite) TestParams() { - params := ¶mstypes.Params{ - ExoCoreLzAppAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", - ExoCoreLzAppEventTopic: "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec", - } - err := suite.app.WithdrawKeeper.SetParams(suite.ctx, params) - suite.NoError(err) - - getParams, err := suite.app.WithdrawKeeper.GetParams(suite.ctx) - suite.NoError(err) - suite.Equal(*params, *getParams) -} diff --git a/x/withdraw/keeper/query.go b/x/withdraw/keeper/query.go deleted file mode 100644 index f6e51ad1c..000000000 --- a/x/withdraw/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/ExocoreNetwork/exocore/x/withdraw/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/withdraw/keeper/query_params.go b/x/withdraw/keeper/query_params.go deleted file mode 100644 index 27d691691..000000000 --- a/x/withdraw/keeper/query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/ExocoreNetwork/exocore/x/withdraw/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - c := sdk.UnwrapSDKContext(goCtx) - params, err := k.GetParams(c) - if err != nil { - return nil, err - } - return &types.QueryParamsResponse{ - Params: params, - }, nil -} diff --git a/x/withdraw/module.go b/x/withdraw/module.go index a01e2e564..0a0b3c92e 100644 --- a/x/withdraw/module.go +++ b/x/withdraw/module.go @@ -1,10 +1,6 @@ package withdraw import ( - "context" - "encoding/json" - "fmt" - // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -49,35 +45,13 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { - panic(err) - } -} +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module func (a AppModuleBasic) GetTxCmd() *cobra.Command { @@ -113,7 +87,7 @@ func NewAppModule( // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + //types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) diff --git a/x/withdraw/types/codec.go b/x/withdraw/types/codec.go deleted file mode 100644 index 021ff6751..000000000 --- a/x/withdraw/types/codec.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global erc20 module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding. - // - // The actual codec used for serialization should be provided to modules/erc20 and - // defined at the application level. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino JSON compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) -) - -const ( - // Amino names - updateParamsName = "exocore/MsgUpdateParamsForWithdraw" -) - -// NOTE: This is required for the GetSignBytes function -func init() { - RegisterLegacyAminoCodec(amino) - amino.Seal() -} - -// RegisterInterfaces register implementations -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgUpdateParams{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -// RegisterLegacyAminoCodec registers the necessary x/revenue interfaces and -// concrete types on the provided LegacyAmino codec. These types are used for -// Amino JSON serialization and EIP-712 compatibility. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil) -} diff --git a/x/withdraw/types/genesis.go b/x/withdraw/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/withdraw/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/withdraw/types/genesis.pb.go b/x/withdraw/types/genesis.pb.go deleted file mode 100644 index 59fbfa94b..000000000 --- a/x/withdraw/types/genesis.pb.go +++ /dev/null @@ -1,320 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: exocore/withdraw/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - 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 - -// GenesisState defines the withdraw module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_a840e4e75e554053, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "exocore.withdraw.GenesisState") -} - -func init() { proto.RegisterFile("exocore/withdraw/genesis.proto", fileDescriptor_a840e4e75e554053) } - -var fileDescriptor_a840e4e75e554053 = []byte{ - // 185 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x4f, 0x4f, 0xcd, - 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xca, 0xeb, 0xc1, - 0xe4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x94, 0x2c, - 0x86, 0x39, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x63, 0x94, 0xdc, 0xb8, 0x78, 0xdc, 0x21, 0xe6, - 0x06, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x71, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, - 0xb8, 0x8d, 0x24, 0xf4, 0xd0, 0xed, 0xd1, 0x0b, 0x00, 0xcb, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, - 0x10, 0x04, 0x55, 0xed, 0x64, 0x7b, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, - 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, - 0xca, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x30, 0xb7, 0x54, 0x20, - 0x5c, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x8d, 0x31, 0x20, 0x00, 0x00, 0xff, - 0xff, 0xdc, 0x77, 0x24, 0x66, 0xf6, 0x00, 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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 ErrIntOverflowGenesis - } - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/withdraw/types/genesis_test.go b/x/withdraw/types/genesis_test.go deleted file mode 100644 index 05b369d81..000000000 --- a/x/withdraw/types/genesis_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/ExocoreNetwork/exocore/x/withdraw/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/withdraw/types/msg.go b/x/withdraw/types/msg.go deleted file mode 100644 index bc29c4af4..000000000 --- a/x/withdraw/types/msg.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ sdk.Msg = &MsgUpdateParams{} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { - addr := sdk.MustAccAddressFromBech32(m.Authority) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check of the provided data -func (m *MsgUpdateParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return errorsmod.Wrap(err, "invalid from address") - } - return nil -} - -// GetSignBytes implements the LegacyMsg interface. -func (m *MsgUpdateParams) GetSignBytes() []byte { - return nil -} diff --git a/x/withdraw/types/params.go b/x/withdraw/types/params.go deleted file mode 100644 index 4f3215e35..000000000 --- a/x/withdraw/types/params.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} diff --git a/x/withdraw/types/params.pb.go b/x/withdraw/types/params.pb.go deleted file mode 100644 index d57539549..000000000 --- a/x/withdraw/types/params.pb.go +++ /dev/null @@ -1,369 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: exocore/withdraw/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - 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 - -// Params defines the parameters for the module. -type Params struct { - ExoCoreLzAppAddress string `protobuf:"bytes,1,opt,name=exoCoreLzAppAddress,proto3" json:"exoCoreLzAppAddress,omitempty"` - ExoCoreLzAppEventTopic string `protobuf:"bytes,2,opt,name=exoCoreLzAppEventTopic,proto3" json:"exoCoreLzAppEventTopic,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_35a6d42797266547, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetExoCoreLzAppAddress() string { - if m != nil { - return m.ExoCoreLzAppAddress - } - return "" -} - -func (m *Params) GetExoCoreLzAppEventTopic() string { - if m != nil { - return m.ExoCoreLzAppEventTopic - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "exocore.withdraw.Params") -} - -func init() { proto.RegisterFile("exocore/withdraw/params.proto", fileDescriptor_35a6d42797266547) } - -var fileDescriptor_35a6d42797266547 = []byte{ - // 192 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0x48, 0x2c, - 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xeb, 0xc1, 0xa4, - 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x52, 0x11, 0x17, - 0x5b, 0x00, 0x58, 0x9f, 0x90, 0x01, 0x97, 0x70, 0x6a, 0x45, 0xbe, 0x73, 0x7e, 0x51, 0xaa, 0x4f, - 0x95, 0x63, 0x41, 0x81, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, - 0x67, 0x10, 0x36, 0x29, 0x21, 0x33, 0x2e, 0x31, 0x64, 0x61, 0xd7, 0xb2, 0xd4, 0xbc, 0x92, 0x90, - 0xfc, 0x82, 0xcc, 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0xb6, 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, 0xa5, 0x9c, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, - 0x9f, 0xab, 0x0f, 0xf3, 0x5f, 0x05, 0xc2, 0x87, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, - 0x97, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x56, 0x86, 0xd8, 0xa9, 0x02, 0x01, 0x00, 0x00, -} - -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ExoCoreLzAppEventTopic) > 0 { - i -= len(m.ExoCoreLzAppEventTopic) - copy(dAtA[i:], m.ExoCoreLzAppEventTopic) - i = encodeVarintParams(dAtA, i, uint64(len(m.ExoCoreLzAppEventTopic))) - i-- - dAtA[i] = 0x12 - } - if len(m.ExoCoreLzAppAddress) > 0 { - i -= len(m.ExoCoreLzAppAddress) - copy(dAtA[i:], m.ExoCoreLzAppAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.ExoCoreLzAppAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ExoCoreLzAppAddress) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.ExoCoreLzAppEventTopic) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) 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 ErrIntOverflowParams - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExoCoreLzAppAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExoCoreLzAppAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExoCoreLzAppEventTopic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExoCoreLzAppEventTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/withdraw/types/query.pb.go b/x/withdraw/types/query.pb.go deleted file mode 100644 index 1bf71d1d1..000000000 --- a/x/withdraw/types/query.pb.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: exocore/withdraw/query.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/ExocoreNetwork/exocore/x/deposit/types" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 - -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_59bca5e59812c328, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params *types.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_59bca5e59812c328, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *types.Params { - if m != nil { - return m.Params - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "exocore.withdraw.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "exocore.withdraw.QueryParamsResponse") -} - -func init() { proto.RegisterFile("exocore/withdraw/query.proto", fileDescriptor_59bca5e59812c328) } - -var fileDescriptor_59bca5e59812c328 = []byte{ - // 274 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0x2c, 0x4d, - 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xca, 0xea, 0xc1, 0x64, 0xa5, - 0x14, 0x60, 0xea, 0x53, 0x52, 0x0b, 0xf2, 0x8b, 0x33, 0x4b, 0xf4, 0xcb, 0x0c, 0x61, 0x4c, 0x88, - 0x1e, 0x29, 0x99, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0xfd, 0xc4, 0x82, 0x4c, 0xfd, 0xc4, 0xbc, - 0xbc, 0xfc, 0x92, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0x62, 0x88, 0xac, 0x92, 0x08, 0x97, 0x50, 0x20, - 0xc8, 0x82, 0x80, 0xc4, 0xa2, 0xc4, 0xdc, 0xe2, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x25, - 0x4f, 0x2e, 0x61, 0x14, 0xd1, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x21, 0x23, 0x2e, 0xb6, 0x02, - 0xb0, 0x88, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x94, 0x1e, 0xcc, 0x3d, 0x30, 0x2b, 0xcb, - 0x0c, 0xf5, 0xa0, 0x7a, 0xa0, 0x2a, 0x8d, 0x1a, 0x18, 0xb9, 0x58, 0xc1, 0x66, 0x09, 0x95, 0x73, - 0xb1, 0x41, 0xe4, 0x84, 0x54, 0xf4, 0xd0, 0xfd, 0xa1, 0x87, 0xe9, 0x08, 0x29, 0x55, 0x02, 0xaa, - 0x20, 0x8e, 0x52, 0x52, 0x68, 0xba, 0xfc, 0x64, 0x32, 0x93, 0x94, 0x90, 0x84, 0x3e, 0x46, 0xd0, - 0x41, 0x9c, 0xe0, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x46, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0xdd, 0x7e, 0xa9, - 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0x70, 0xc3, 0x2a, 0x10, 0xc6, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, - 0xb1, 0x81, 0x03, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x21, 0x6f, 0x4e, 0x7e, 0xaa, 0x01, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/exocore.withdraw.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.withdraw.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "exocore.withdraw.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "exocore/withdraw/query.proto", -} - -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) 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 ErrIntOverflowQuery - } - 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: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) 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 ErrIntOverflowQuery - } - 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: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &types.Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(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, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/withdraw/types/query.pb.gw.go b/x/withdraw/types/query.pb.gw.go deleted file mode 100644 index 5b7cd856b..000000000 --- a/x/withdraw/types/query.pb.gw.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: exocore/withdraw/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "withdraw", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage -) diff --git a/x/withdraw/types/tx.pb.go b/x/withdraw/types/tx.pb.go deleted file mode 100644 index 39a8673c3..000000000 --- a/x/withdraw/types/tx.pb.go +++ /dev/null @@ -1,597 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: exocore/withdraw/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/ExocoreNetwork/exocore/x/deposit/types" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 - -// MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. -// Since: cosmos-sdk 0.47 -type MsgUpdateParams struct { - // authority is the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/evm parameters to update. - // NOTE: All parameters must be supplied. - Params types.Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_9fa45fb8759a8d92, []int{0} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() types.Params { - if m != nil { - return m.Params - } - return types.Params{} -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fa45fb8759a8d92, []int{1} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgUpdateParams)(nil), "exocore.withdraw.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "exocore.withdraw.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("exocore/withdraw/tx.proto", fileDescriptor_9fa45fb8759a8d92) } - -var fileDescriptor_9fa45fb8759a8d92 = []byte{ - // 337 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0xa9, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xe9, 0xc1, 0xa4, 0xa4, 0xc4, 0x93, 0xf3, - 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xa9, 0x94, - 0x24, 0x44, 0x22, 0x1e, 0xcc, 0xd3, 0x87, 0x70, 0xa0, 0x52, 0x0a, 0x30, 0x0b, 0x52, 0x52, 0x0b, - 0xf2, 0x8b, 0x33, 0x4b, 0x40, 0x1a, 0xa1, 0x4c, 0xa8, 0x0a, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x88, - 0x4e, 0x10, 0x0b, 0x22, 0xaa, 0x34, 0x99, 0x91, 0x8b, 0xdf, 0xb7, 0x38, 0x3d, 0xb4, 0x20, 0x25, - 0xb1, 0x24, 0x35, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, 0x8c, 0x8b, 0x33, 0xb1, 0xb4, 0x24, - 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xe2, 0xd2, 0x16, - 0x5d, 0x11, 0xa8, 0x85, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xc1, 0x25, 0x45, 0x99, 0x79, - 0xe9, 0x41, 0x08, 0xa5, 0x42, 0x16, 0x5c, 0x6c, 0x05, 0x60, 0x13, 0x24, 0x98, 0x14, 0x18, 0x35, - 0xb8, 0x8d, 0xa4, 0xf4, 0x60, 0x5e, 0x83, 0xb9, 0xa4, 0xcc, 0x50, 0x0f, 0x62, 0x87, 0x13, 0xcb, - 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xf5, 0x56, 0x7c, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0x4c, 0x52, - 0x92, 0xe4, 0x12, 0x47, 0x73, 0x54, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x51, 0x16, - 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x0c, 0x17, 0x0f, 0x8a, 0x9b, 0x15, 0xf5, 0xd0, 0x83, 0x51, - 0x0f, 0xcd, 0x04, 0x29, 0x4d, 0x82, 0x4a, 0x60, 0x96, 0x48, 0xb1, 0x36, 0x3c, 0xdf, 0xa0, 0xc5, - 0xe8, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x46, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0x53, 0xfd, 0x52, 0x4b, 0xca, - 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0x11, 0x51, 0x81, 0x14, 0xd7, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, - 0xe0, 0x10, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0xe8, 0x1c, 0x17, 0x0c, 0x02, 0x00, - 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // UpdateParams updates the parameters of this module. - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/exocore.withdraw.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // UpdateParams updates the parameters of this module. - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.withdraw.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "exocore.withdraw.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "exocore/withdraw/tx.proto", -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: 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 skipTx(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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/withdraw/types/types.go b/x/withdraw/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/withdraw/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types From 3002441fa8b2eec74f370909ef8d2224ce08ec8a Mon Sep 17 00:00:00 2001 From: TimmyExogenous Date: Wed, 28 Feb 2024 17:56:24 +0800 Subject: [PATCH 37/41] fix the error for golangci-lint use shared test utils to refine the test codes fix the problem in tests caused by denom rename --- app/ethtest_helper.go | 2 +- app/export.go | 60 ++++- app/test_helpers.go | 8 +- go.mod | 2 + precompiles/delegation/delegation_test.go | 122 +++++---- precompiles/delegation/setup_test.go | 41 +--- precompiles/delegation/utils_test.go | 197 --------------- precompiles/deposit/deposit_integrate_test.go | 33 +-- precompiles/deposit/deposit_test.go | 46 ++-- precompiles/deposit/error.go | 2 +- precompiles/deposit/setup_test.go | 38 +-- precompiles/deposit/types.go | 17 +- precompiles/reward/reward_test.go | 44 ++-- precompiles/reward/setup_test.go | 39 +-- precompiles/reward/utils_test.go | 231 ----------------- precompiles/slash/setup_test.go | 39 +-- precompiles/slash/slash_test.go | 44 ++-- precompiles/slash/utils_test.go | 231 ----------------- precompiles/withdraw/setup_test.go | 39 +-- precompiles/withdraw/utils_test.go | 232 ------------------ precompiles/withdraw/withdraw.sol | 2 +- .../withdraw/withdraw_integrate_test.go | 10 +- precompiles/withdraw/withdraw_test.go | 44 ++-- testutil/abci.go | 26 +- testutil/ante.go | 2 +- testutil/contract.go | 16 +- testutil/fund.go | 6 +- testutil/integration.go | 12 +- testutil/network/network.go | 4 +- testutil/network/network_test.go | 4 +- testutil/staking-rewards.go | 10 +- testutil/tx/cosmos.go | 12 +- testutil/tx/eip712.go | 16 +- testutil/tx/eth.go | 14 +- .../utils_test.go => testutil/utils.go | 184 ++++++++------ utils/utils.go | 6 +- utils/utils_test.go | 24 +- x/delegation/client/cli/query.go | 2 +- x/delegation/keeper/delegation_op_test.go | 92 +++---- x/delegation/keeper/operator_info_test.go | 8 +- x/delegation/keeper/setup_test.go | 24 +- x/delegation/keeper/utils_test.go | 44 ---- x/deposit/keeper/deposit_test.go | 16 +- x/deposit/keeper/params_test.go | 6 +- x/deposit/keeper/setup_test.go | 23 +- x/deposit/keeper/utils_test.go | 36 --- x/evm/types/params.go | 30 ++- x/native_token/module.go | 6 +- x/native_token/types/keys.go | 4 +- x/restaking_assets_manage/client/cli/query.go | 4 +- .../keeper/client_chain_and_asset_test.go | 14 +- .../keeper/setup_test.go | 23 +- .../keeper/staker_asset_test.go | 54 ++-- .../keeper/utils_test.go | 36 --- x/restaking_assets_manage/types/general.go | 2 +- x/reward/keeper/claim_reward_test.go | 12 +- x/reward/keeper/params_test.go | 6 +- x/reward/keeper/setup_test.go | 23 +- x/reward/keeper/utils_test.go | 34 --- x/slash/keeper/execute_slash_test.go | 22 +- x/slash/keeper/params_test.go | 6 +- x/slash/keeper/setup_test.go | 23 +- x/slash/keeper/utils_test.go | 34 --- x/withdraw/client/cli/query.go | 1 - x/withdraw/client/cli/tx.go | 1 + x/withdraw/keeper/claim_withdraw_test.go | 22 +- x/withdraw/keeper/setup_test.go | 24 +- x/withdraw/keeper/utils_test.go | 34 --- x/withdraw/module.go | 10 +- 69 files changed, 681 insertions(+), 1854 deletions(-) delete mode 100644 precompiles/delegation/utils_test.go delete mode 100644 precompiles/reward/utils_test.go delete mode 100644 precompiles/slash/utils_test.go delete mode 100644 precompiles/withdraw/utils_test.go rename precompiles/deposit/utils_test.go => testutil/utils.go (53%) delete mode 100644 x/delegation/keeper/utils_test.go delete mode 100644 x/deposit/keeper/utils_test.go delete mode 100644 x/restaking_assets_manage/keeper/utils_test.go delete mode 100644 x/reward/keeper/utils_test.go delete mode 100644 x/slash/keeper/utils_test.go delete mode 100644 x/withdraw/keeper/utils_test.go diff --git a/app/ethtest_helper.go b/app/ethtest_helper.go index b0700ddf1..3c2599230 100644 --- a/app/ethtest_helper.go +++ b/app/ethtest_helper.go @@ -109,7 +109,7 @@ func NewTestGenesisState(codec codec.Codec) simapp.GenesisState { Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), } - genesisState := NewDefaultGenesisState() + genesisState := NewDefaultGenesisState(codec) return genesisStateWithValSet(codec, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) } diff --git a/app/export.go b/app/export.go index 5cd4a8156..ed9e501c1 100644 --- a/app/export.go +++ b/app/export.go @@ -4,22 +4,74 @@ import ( "encoding/json" "fmt" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "cosmossdk.io/simapp" + + "github.com/ExocoreNetwork/exocore/utils" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + claimstypes "github.com/evmos/evmos/v14/x/claims/types" + evmtypes "github.com/evmos/evmos/v14/x/evm/types" + inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" "github.com/evmos/evmos/v14/encoding" ) // NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState() simapp.GenesisState { +func NewDefaultGenesisState(cdc codec.Codec) simapp.GenesisState { encCfg := encoding.MakeConfig(ModuleBasics) - return ModuleBasics.DefaultGenesis(encCfg.Codec) + defaultGenesis := ModuleBasics.DefaultGenesis(encCfg.Codec) + + // staking module + stakingGenesis := stakingtypes.GenesisState{} + rawGenesis := defaultGenesis[stakingtypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &stakingGenesis) + stakingGenesis.Params.BondDenom = utils.BaseDenom + defaultGenesis[stakingtypes.ModuleName] = cdc.MustMarshalJSON(&stakingGenesis) + + // crisis module + crisisGenesis := crisistypes.GenesisState{} + rawGenesis = defaultGenesis[crisistypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &crisisGenesis) + crisisGenesis.ConstantFee.Denom = utils.BaseDenom + defaultGenesis[crisistypes.ModuleName] = cdc.MustMarshalJSON(&crisisGenesis) + + // gov module + govGenesis := govtypesv1.GenesisState{} + rawGenesis = defaultGenesis[govtypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &govGenesis) + govGenesis.Params.MinDeposit[0].Denom = utils.BaseDenom + defaultGenesis[govtypes.ModuleName] = cdc.MustMarshalJSON(&govGenesis) + + // evm module + evmGenesis := evmtypes.GenesisState{} + rawGenesis = defaultGenesis[evmtypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &evmGenesis) + evmGenesis.Params.EvmDenom = utils.BaseDenom + defaultGenesis[evmtypes.ModuleName] = cdc.MustMarshalJSON(&evmGenesis) + + // inflation module + inflationGenesis := inflationtypes.GenesisState{} + rawGenesis = defaultGenesis[inflationtypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &inflationGenesis) + inflationGenesis.Params.MintDenom = utils.BaseDenom + defaultGenesis[inflationtypes.ModuleName] = cdc.MustMarshalJSON(&inflationGenesis) + + // claims module + claimsGenesis := claimstypes.GenesisState{} + rawGenesis = defaultGenesis[claimstypes.ModuleName] + cdc.MustUnmarshalJSON(rawGenesis, &claimsGenesis) + claimsGenesis.Params.ClaimsDenom = utils.BaseDenom + defaultGenesis[claimstypes.ModuleName] = cdc.MustMarshalJSON(&claimsGenesis) + + return defaultGenesis } // ExportAppStateAndValidators exports the state of the application for a genesis diff --git a/app/test_helpers.go b/app/test_helpers.go index 4af278b71..5fca3c7be 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -27,8 +27,8 @@ import ( "github.com/evmos/evmos/v14/encoding" feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types" - "github.com/evmos/evmos/v14/cmd/config" - "github.com/evmos/evmos/v14/utils" + "github.com/ExocoreNetwork/exocore/cmd/config" + "github.com/ExocoreNetwork/exocore/utils" ) func init() { @@ -106,7 +106,7 @@ func Setup( ) if !isCheckTx { // init chain must be called to stop deliverState from being nil - genesisState := NewDefaultGenesisState() + genesisState := NewDefaultGenesisState(app.appCodec) genesisState = GenesisStateWithValSet(app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) // Verify feeMarket genesis @@ -218,6 +218,6 @@ func SetupTestingApp(chainID string, isPrintLog bool) func() (ibctesting.Testing simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome), baseapp.SetChainID(chainID), ) - return app, NewDefaultGenesisState() + return app, NewDefaultGenesisState(app.appCodec) } } diff --git a/go.mod b/go.mod index 79d900dff..be0eb43af 100644 --- a/go.mod +++ b/go.mod @@ -215,12 +215,14 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // use Cosmos-SDK fork to enable Ledger functionality github.com/cosmos/cosmos-sdk => github.com/evmos/cosmos-sdk v0.47.4-evmos.2 + //github.com/cosmos/cosmos-sdk => ../cosmos-sdk //fix cosmos-sdk error github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.10 // use Evmos geth fork github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2 // use exocore fork of evmos github.com/evmos/evmos/v14 => github.com/ExocoreNetwork/evmos/v14 v14.1.1-0.20240205024453-5e8090e42ef4 + //github.com/evmos/evmos/v14 => ../ExocoreNetwork/evmos // Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb diff --git a/precompiles/delegation/delegation_test.go b/precompiles/delegation/delegation_test.go index cd869a26a..7d6931b33 100644 --- a/precompiles/delegation/delegation_test.go +++ b/precompiles/delegation/delegation_test.go @@ -1,7 +1,6 @@ package delegation_test import ( - "fmt" "math/big" "strings" @@ -24,7 +23,7 @@ import ( evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) -func (s *PrecompileTestSuite) TestIsTransaction() { +func (s *DelegationPrecompileSuite) TestIsTransaction() { testCases := []struct { name string method string @@ -63,12 +62,12 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { } // TestRun tests DelegateToThroughClientChain method through calling Run function. -func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { +func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { // deposit params for test exoCoreLzAppAddress := "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD" exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") - opAccAddr := "evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl" + opAccAddr := "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr" clientChainLzID := 101 lzNonce := 0 delegationAmount := big.NewInt(50) @@ -84,7 +83,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { AssetsAddress: usdtAddress, OpAmount: depositAmount, } - err := s.app.DepositKeeper.Deposit(s.ctx, params) + err := s.App.DepositKeeper.Deposit(s.Ctx, params) s.Require().NoError(err) } registerOperator := func() { @@ -94,27 +93,27 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { EarningsAddr: opAccAddr, }, } - _, err := s.app.DelegationKeeper.RegisterOperator(s.ctx, registerReq) + _, err := s.App.DelegationKeeper.RegisterOperator(s.Ctx, registerReq) s.NoError(err) } commonMalleate := func() (common.Address, []byte) { // prepare the call input for delegation test - valAddr, err := sdk.ValAddressFromBech32(s.validators[0].OperatorAddress) + valAddr, err := sdk.ValAddressFromBech32(s.Validators[0].OperatorAddress) s.Require().NoError(err) - val, _ := s.app.StakingKeeper.GetValidator(s.ctx, valAddr) + val, _ := s.App.StakingKeeper.GetValidator(s.Ctx, valAddr) coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(1e18))) - s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) + s.App.DistrKeeper.AllocateTokensToValidator(s.Ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( delegation.MethodDelegateToThroughClientChain, uint16(clientChainLzID), uint64(lzNonce), assetAddr, - paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), + paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength), []byte(opAccAddr), delegationAmount, ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[delegation.MethodDelegateToThroughClientChain].Outputs.Pack(true) s.Require().NoError(err) @@ -143,7 +142,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { ExoCoreLzAppAddress: exoCoreLzAppAddress, ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -155,10 +154,10 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { name: "fail - delegateToThroughClientChain transaction will fail because the delegated operator hasn't been registered", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -170,10 +169,10 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { name: "fail - delegateToThroughClientChain transaction will fail because the delegated asset hasn't been deposited", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) registerOperator() return commonMalleate() @@ -186,13 +185,13 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { name: "fail - delegateToThroughClientChain transaction will fail because the delegation amount is bigger than the canWithdraw amount", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) registerOperator() - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(smallDepositAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(smallDepositAmount)) return commonMalleate() }, readOnly: false, @@ -203,13 +202,13 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { name: "pass - delegateToThroughClientChain transaction", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) registerOperator() - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) return commonMalleate() }, returnBytes: successRet, @@ -224,7 +223,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -235,7 +234,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -247,28 +246,28 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + s.StateDB = statedb.New(s.Ctx, s.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.Ctx.HeaderHash().Bytes()))) // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) @@ -290,11 +289,11 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { } // TestRun tests DelegateToThroughClientChain method through calling Run function. -func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { +func (s *DelegationPrecompileSuite) TestRunUnDelegateFromThroughClientChain() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") - operatorAddr := "evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl" + operatorAddr := "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr" clientChainLzID := 101 lzNonce := uint64(0) delegationAmount := big.NewInt(50) @@ -309,7 +308,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { AssetsAddress: usdtAddress, OpAmount: depositAmount, } - err := s.app.DepositKeeper.Deposit(s.ctx, params) + err := s.App.DepositKeeper.Deposit(s.Ctx, params) s.Require().NoError(err) } @@ -326,7 +325,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { opAccAddr, err := sdk.AccAddressFromBech32(operatorAddr) s.Require().NoError(err) delegateToParams.OperatorAddress = opAccAddr - err = s.app.DelegationKeeper.DelegateTo(s.ctx, delegateToParams) + err = s.App.DelegationKeeper.DelegateTo(s.Ctx, delegateToParams) s.Require().NoError(err) } registerOperator := func() { @@ -336,27 +335,27 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { EarningsAddr: operatorAddr, }, } - _, err := s.app.DelegationKeeper.RegisterOperator(s.ctx, registerReq) + _, err := s.App.DelegationKeeper.RegisterOperator(s.Ctx, registerReq) s.NoError(err) } commonMalleate := func() (common.Address, []byte) { // prepare the call input for delegation test - valAddr, err := sdk.ValAddressFromBech32(s.validators[0].OperatorAddress) + valAddr, err := sdk.ValAddressFromBech32(s.Validators[0].OperatorAddress) s.Require().NoError(err) - val, _ := s.app.StakingKeeper.GetValidator(s.ctx, valAddr) + val, _ := s.App.StakingKeeper.GetValidator(s.Ctx, valAddr) coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(1e18))) - s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) + s.App.DistrKeeper.AllocateTokensToValidator(s.Ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( delegation.MethodUndelegateFromThroughClientChain, uint16(clientChainLzID), lzNonce+1, assetAddr, - paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), + paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength), []byte(operatorAddr), delegationAmount, ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[delegation.MethodUndelegateFromThroughClientChain].Outputs.Pack(true) s.Require().NoError(err) @@ -373,14 +372,14 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { name: "pass - undelegateFromThroughClientChain transaction", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) registerOperator() - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) - delegateAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(delegationAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) + delegateAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(delegationAmount)) return commonMalleate() }, returnBytes: successRet, @@ -394,7 +393,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -405,7 +404,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -417,30 +416,29 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // set txHash for delegation module - fmt.Println("the txHash is:", msgEthereumTx.Hash) - s.ctx = s.ctx.WithValue(delegation.CtxKeyTxHash, common.HexToHash(msgEthereumTx.Hash)) + s.Ctx = s.Ctx.WithValue(delegation.CtxKeyTxHash, common.HexToHash(msgEthereumTx.Hash)) // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + s.StateDB = statedb.New(s.Ctx, s.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.Ctx.HeaderHash().Bytes()))) // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) diff --git a/precompiles/delegation/setup_test.go b/precompiles/delegation/setup_test.go index 885171420..b5bec0e9b 100644 --- a/precompiles/delegation/setup_test.go +++ b/precompiles/delegation/setup_test.go @@ -1,50 +1,26 @@ package delegation_test import ( - "testing" - "github.com/ExocoreNetwork/exocore/precompiles/delegation" - - "github.com/evmos/evmos/v14/x/evm/statedb" + "github.com/ExocoreNetwork/exocore/testutil" + "testing" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - evmosapp "github.com/ExocoreNetwork/exocore/app" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" "github.com/stretchr/testify/suite" ) -var s *PrecompileTestSuite - -type PrecompileTestSuite struct { - suite.Suite +var s *DelegationPrecompileSuite - ctx sdk.Context - app *evmosapp.ExocoreApp - address common.Address - validators []stakingtypes.Validator - valSet *tmtypes.ValidatorSet - ethSigner ethtypes.Signer - privKey cryptotypes.PrivKey - signer keyring.Signer - bondDenom string +type DelegationPrecompileSuite struct { + testutil.BaseTestSuite precompile *delegation.Precompile - stateDB *statedb.StateDB - - queryClientEVM evmtypes.QueryClient } func TestPrecompileTestSuite(t *testing.T) { - s = new(PrecompileTestSuite) + s = new(DelegationPrecompileSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -52,6 +28,9 @@ func TestPrecompileTestSuite(t *testing.T) { RunSpecs(t, "Distribution Precompile Suite") } -func (s *PrecompileTestSuite) SetupTest() { +func (s *DelegationPrecompileSuite) SetupTest() { s.DoSetupTest() + precompile, err := delegation.NewPrecompile(s.App.StakingAssetsManageKeeper, s.App.DelegationKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile } diff --git a/precompiles/delegation/utils_test.go b/precompiles/delegation/utils_test.go deleted file mode 100644 index f3130d62c..000000000 --- a/precompiles/delegation/utils_test.go +++ /dev/null @@ -1,197 +0,0 @@ -package delegation_test - -import ( - "encoding/json" - "time" - - "github.com/ExocoreNetwork/exocore/precompiles/delegation" - "github.com/ExocoreNetwork/exocore/testutil" - testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" - - evmosapp "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/tmhash" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - cmn "github.com/evmos/evmos/v14/precompiles/common" - evmostypes "github.com/evmos/evmos/v14/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" - inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" -) - -// SetupWithGenesisValSet initializes a new EvmosApp with a validator set and genesis accounts -// that also act as delegators. For simplicity, each validator is bonded with a delegation -// of one consensus engine unit (10^6) in the default token of the simapp from first genesis -// account. A Nop logger is set in SimApp. -func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { - appI, genesisState := evmosapp.SetupTestingApp(cmn.DefaultChainID, false)() - app, ok := appI.(*evmosapp.ExocoreApp) - s.Require().True(ok) - - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.TokensFromConsensusPower(1, evmostypes.PowerReduction) - - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - s.Require().NoError(err) - pkAny, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - } - s.validators = validators - - // set validators and delegations - stakingParams := stakingtypes.DefaultParams() - // set bond demon to be aevmos - stakingParams.BondDenom = utils.BaseDenom - stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - - totalBondAmt := bondAmt.Add(bondAmt) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens and delegated tokens to total supply - totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(utils.BaseDenom, totalBondAmt))...) - } - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(utils.BaseDenom, totalBondAmt)}, - }) - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) - - // init chain will set the validator set and initialize the genesis accounts - app.InitChain( - abci.RequestInitChain{ - ChainId: cmn.DefaultChainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: evmosapp.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - app.Commit() - - // instantiate new header - header := testutil.NewHeader( - 2, - time.Now().UTC(), - cmn.DefaultChainID, - sdk.ConsAddress(validators[0].GetOperator()), - tmhash.Sum([]byte("app")), - tmhash.Sum([]byte("validators")), - ) - - app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // create Context - s.ctx = app.BaseApp.NewContext(false, header) - s.app = app -} - -func (s *PrecompileTestSuite) DoSetupTest() { - // generate validator private/public key - privVal := mock.NewPV() - pubKey, err := privVal.GetPubKey() - s.Require().NoError(err) - - privVal2 := mock.NewPV() - pubKey2, err := privVal2.GetPubKey() - s.Require().NoError(err) - - // create validator set with two validators - validator := tmtypes.NewValidator(pubKey, 1) - validator2 := tmtypes.NewValidator(pubKey2, 2) - s.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) - signers := make(map[string]tmtypes.PrivValidator) - signers[pubKey.Address().String()] = privVal - signers[pubKey2.Address().String()] = privVal2 - - // generate genesis account - addr, priv := testutiltx.NewAddrKey() - s.privKey = priv - s.address = addr - s.signer = testutiltx.NewSigner(priv) - - baseAcc := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - - acc := &evmostypes.EthAccount{ - BaseAccount: baseAcc, - CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), - } - - amount := sdk.TokensFromConsensusPower(5, evmostypes.PowerReduction) - - balance := banktypes.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, amount)), - } - - s.SetupWithGenesisValSet(s.valSet, []authtypes.GenesisAccount{acc}, balance) - - // bond denom - stakingParams := s.app.StakingKeeper.GetParams(s.ctx) - stakingParams.BondDenom = utils.BaseDenom - s.bondDenom = stakingParams.BondDenom - err = s.app.StakingKeeper.SetParams(s.ctx, stakingParams) - s.Require().NoError(err) - - s.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) - - precompile, err := delegation.NewPrecompile(s.app.StakingAssetsManageKeeper, s.app.DelegationKeeper, s.app.AuthzKeeper) - s.Require().NoError(err) - s.precompile = precompile - - coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) - inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) - distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) - err = s.app.BankKeeper.MintCoins(s.ctx, inflationtypes.ModuleName, coins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) - s.Require().NoError(err) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(s.ctx, s.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelperEvm, s.app.EvmKeeper) - s.queryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) -} diff --git a/precompiles/deposit/deposit_integrate_test.go b/precompiles/deposit/deposit_integrate_test.go index da95dee29..99ca68f2a 100644 --- a/precompiles/deposit/deposit_integrate_test.go +++ b/precompiles/deposit/deposit_integrate_test.go @@ -26,7 +26,7 @@ var ( passCheck testutil.LogCheckArgs ) -func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { +func (s *DepositPrecompileSuite) TestCallDepositToFromEOA() { // deposit params for test exoCoreLzAppAddress := "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD" exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" @@ -36,7 +36,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) clientChainLzID := 101 - stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) + stakerAddr := paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress method := "depositTo" @@ -47,7 +47,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { defaultCallArgs = contracts.CallArgs{ ContractAddr: s.precompile.Address(), ContractABI: s.precompile.ABI, - PrivKey: s.privKey, + PrivKey: s.PrivKey, } defaultLogCheck = testutil.LogCheckArgs{ @@ -57,7 +57,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { } prepareFunc := func(params *types3.Params, method string) contracts.CallArgs { - err := s.app.DepositKeeper.SetParams(s.ctx, params) + err := s.App.DepositKeeper.SetParams(s.Ctx, params) s.Require().NoError(err) defaultDepositArgs := defaultCallArgs.WithMethodName(method) return defaultDepositArgs.WithArgs( @@ -70,20 +70,20 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { // test caller error beforeEach() setDepositToArgs := prepareFunc(&depositParams, method) - _, _, err := contracts.CallContractAndCheckLogs(s.ctx, s.app, setDepositToArgs, passCheck) + _, _, err := contracts.CallContractAndCheckLogs(s.Ctx, s.App, setDepositToArgs, passCheck) s.Require().ErrorContains(err, strings.Split(deposit.ErrContractCaller, ",")[0]) // test success beforeEach() - depositParams.ExoCoreLzAppAddress = s.address.String() + depositParams.ExoCoreLzAppAddress = s.Address.String() setDepositToArgs = prepareFunc(&depositParams, method) - _, ethRes, err := contracts.CallContractAndCheckLogs(s.ctx, s.app, setDepositToArgs, passCheck) + _, ethRes, err := contracts.CallContractAndCheckLogs(s.Ctx, s.App, setDepositToArgs, passCheck) successRet, err := s.precompile.Methods[deposit.MethodDepositTo].Outputs.Pack(true, opAmount) s.Require().NoError(err) s.Require().Equal(successRet, ethRes.Ret) } -func (s *PrecompileTestSuite) TestCallDepositToFromContract() { +func (s *DepositPrecompileSuite) TestCallDepositToFromContract() { // deposit params for test exoCoreLzAppAddress := "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD" exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" @@ -93,7 +93,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) clientChainLzID := 101 - stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) + stakerAddr := paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -107,8 +107,9 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { s.Require().NoError(err) // NextBlock the smart contract s.NextBlock() + // check contract was correctly deployed - cAcc := s.app.EvmKeeper.GetAccount(s.ctx, contractAddr) + cAcc := s.App.EvmKeeper.GetAccount(s.Ctx, contractAddr) s.Require().NotNil(cAcc) s.Require().True(cAcc.IsContract()) @@ -118,7 +119,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { defaultCallArgs = contracts.CallArgs{ ContractAddr: contractAddr, ContractABI: contracts.DepositCallerContract.ABI, - PrivKey: s.privKey, + PrivKey: s.PrivKey, } // default log check arguments @@ -127,7 +128,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { } prepareFunc := func(params *types3.Params, method string) contracts.CallArgs { - err := s.app.DepositKeeper.SetParams(s.ctx, params) + err := s.App.DepositKeeper.SetParams(s.Ctx, params) s.Require().NoError(err) defaultDepositArgs := defaultCallArgs.WithMethodName(method) return defaultDepositArgs.WithArgs( @@ -141,9 +142,9 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { beforeEach() depositParams.ExoCoreLzAppAddress = contractAddr.String() setDepositToArgs := prepareFunc(&depositParams, "testDepositTo") - _, _, err = contracts.CallContractAndCheckLogs(s.ctx, s.app, setDepositToArgs, passCheck) + _, _, err = contracts.CallContractAndCheckLogs(s.Ctx, s.App, setDepositToArgs, passCheck) s.Require().NoError(err) - //todo: need to find why the ethRet is nil when called by contract + // todo: need to find why the ethRet is nil when called by contract /* successRet, err := contracts.DepositCallerContract.ABI.Methods["testDepositTo"].Outputs.Pack(true, opAmount) s.Require().NoError(err) s.Require().Equal(successRet, ethRes.Ret)*/ @@ -153,7 +154,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { setDepositToArgs = prepareFunc(&depositParams, "testCallDepositToAndEmitEvent") // todo: need to check why can't get the ethereum log // eventCheck := passCheck.WithExpEvents("callDepositToResult") - _, _, err = contracts.CallContractAndCheckLogs(s.ctx, s.app, setDepositToArgs, passCheck) + _, _, err = contracts.CallContractAndCheckLogs(s.Ctx, s.App, setDepositToArgs, passCheck) s.Require().NoError(err) /* successRet, err = contracts.DepositCallerContract.ABI.Methods["testCallDepositToAndEmitEvent"].Outputs.Pack(true, opAmount) s.Require().NoError(err) @@ -165,7 +166,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { setDepositToArgs = prepareFunc(&depositParams, "testCallDepositToWithTryCatch") // eventCheck = passCheck.WithExpEvents("ErrorOccurred") // todo: need to check the ethereum log - _, _, err = contracts.CallContractAndCheckLogs(s.ctx, s.app, setDepositToArgs, passCheck) + _, _, err = contracts.CallContractAndCheckLogs(s.Ctx, s.App, setDepositToArgs, passCheck) s.Require().NoError(err) /* successRet, err = contracts.DepositCallerContract.ABI.Methods["testCallDepositToWithTryCatch"].Outputs.Pack(false, big.NewInt(0)) s.Require().NoError(err) diff --git a/precompiles/deposit/deposit_test.go b/precompiles/deposit/deposit_test.go index a2d33e405..afc4f3227 100644 --- a/precompiles/deposit/deposit_test.go +++ b/precompiles/deposit/deposit_test.go @@ -16,7 +16,7 @@ import ( evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) -func (s *PrecompileTestSuite) TestIsTransaction() { +func (s *DepositPrecompileSuite) TestIsTransaction() { testCases := []struct { name string method string @@ -50,22 +50,22 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { } // TestRunDepositTo tests DepositTo method through calling Run function.. -func (s *PrecompileTestSuite) TestRunDepositTo() { +func (s *DepositPrecompileSuite) TestRunDepositTo() { // deposit params for test exoCoreLzAppAddress := "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD" exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) usdcAddress := paddingClientChainAddress(common.FromHex("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), types.GeneralClientChainAddrLength) clientChainLzID := 101 - stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) + stakerAddr := paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress commonMalleate := func() (common.Address, []byte) { - valAddr, err := sdk.ValAddressFromBech32(s.validators[0].OperatorAddress) + valAddr, err := sdk.ValAddressFromBech32(s.Validators[0].OperatorAddress) s.Require().NoError(err) - val, _ := s.app.StakingKeeper.GetValidator(s.ctx, valAddr) + val, _ := s.App.StakingKeeper.GetValidator(s.Ctx, valAddr) coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(1e18))) - s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) + s.App.DistrKeeper.AllocateTokensToValidator(s.Ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( deposit.MethodDepositTo, uint16(clientChainLzID), @@ -74,7 +74,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { opAmount, ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[deposit.MethodDepositTo].Outputs.Pack(true, opAmount) s.Require().NoError(err) @@ -103,7 +103,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { ExoCoreLzAppAddress: exoCoreLzAppAddress, ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -115,10 +115,10 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { name: "fail - depositTo transaction will fail because the staked asset hasn't been registered", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) assetAddr = usdcAddress return commonMalleate() @@ -131,11 +131,11 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { name: "pass - depositTo transaction", malleate: func() (common.Address, []byte) { depositModuleParam := &types3.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } assetAddr = usdtAddress - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -151,7 +151,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -162,7 +162,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -174,26 +174,26 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) diff --git a/precompiles/deposit/error.go b/precompiles/deposit/error.go index 268df762a..3bce6ea7e 100644 --- a/precompiles/deposit/error.go +++ b/precompiles/deposit/error.go @@ -1,7 +1,7 @@ package deposit const ( - ErrContractInputParaOrType = "the contract input parameter type or value error,arg index:%d, type is:%s,value:%v" + ErrContractInputParaOrType = "the contract input parameter type or value error,arg index:%d, expected type is:%s,value:%v" ErrContractCaller = "the caller doesn't have the permission to call this function,caller:%s,need:%s" ErrInputClientChainAddrLength = "the length of input client chain addr doesn't match,input:%d,need:%d" ) diff --git a/precompiles/deposit/setup_test.go b/precompiles/deposit/setup_test.go index 7c0783634..a489fe03d 100644 --- a/precompiles/deposit/setup_test.go +++ b/precompiles/deposit/setup_test.go @@ -1,50 +1,27 @@ package deposit_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" "github.com/ExocoreNetwork/exocore/precompiles/deposit" - "github.com/evmos/evmos/v14/x/evm/statedb" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - evmosapp "github.com/ExocoreNetwork/exocore/app" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" "github.com/stretchr/testify/suite" ) -var s *PrecompileTestSuite - -type PrecompileTestSuite struct { - suite.Suite +var s *DepositPrecompileSuite - ctx sdk.Context - app *evmosapp.ExocoreApp - address common.Address - validators []stakingtypes.Validator - valSet *tmtypes.ValidatorSet - ethSigner ethtypes.Signer - privKey cryptotypes.PrivKey - signer keyring.Signer - bondDenom string +type DepositPrecompileSuite struct { + testutil.BaseTestSuite precompile *deposit.Precompile - stateDB *statedb.StateDB - - queryClientEVM evmtypes.QueryClient } func TestPrecompileTestSuite(t *testing.T) { - s = new(PrecompileTestSuite) + s = new(DepositPrecompileSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -52,6 +29,9 @@ func TestPrecompileTestSuite(t *testing.T) { RunSpecs(t, "Distribution Precompile Suite") } -func (s *PrecompileTestSuite) SetupTest() { +func (s *DepositPrecompileSuite) SetupTest() { s.DoSetupTest() + precompile, err := deposit.NewPrecompile(s.App.StakingAssetsManageKeeper, s.App.DepositKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile } diff --git a/precompiles/deposit/types.go b/precompiles/deposit/types.go index dddc870f9..140677bfd 100644 --- a/precompiles/deposit/types.go +++ b/precompiles/deposit/types.go @@ -1,25 +1,24 @@ package deposit import ( - "fmt" "math/big" - "reflect" sdkmath "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/x/deposit/keeper" "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" sdk "github.com/cosmos/cosmos-sdk/types" cmn "github.com/evmos/evmos/v14/precompiles/common" + "golang.org/x/xerrors" ) func (p Precompile) GetDepositToParamsFromInputs(ctx sdk.Context, args []interface{}) (*keeper.DepositParams, error) { if len(args) != 4 { - return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, 4, len(args)) + return nil, xerrors.Errorf(cmn.ErrInvalidNumberOfArgs, 4, len(args)) } depositParams := &keeper.DepositParams{} clientChainLzID, ok := args[0].(uint16) if !ok { - return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) + return nil, xerrors.Errorf(ErrContractInputParaOrType, 0, "uint16", clientChainLzID) } depositParams.ClientChainLzID = uint64(clientChainLzID) @@ -32,25 +31,25 @@ func (p Precompile) GetDepositToParamsFromInputs(ctx sdk.Context, args []interfa // the length of client chain address inputted by caller is 32, so we need to check the length and remove the padding according to the actual length. assetAddr, ok := args[1].([]byte) if !ok || assetAddr == nil { - return nil, fmt.Errorf(ErrContractInputParaOrType, 1, reflect.TypeOf(args[0]), assetAddr) + return nil, xerrors.Errorf(ErrContractInputParaOrType, 1, "[]byte", assetAddr) } if len(assetAddr) != types.GeneralAssetsAddrLength { - return nil, fmt.Errorf(ErrInputClientChainAddrLength, len(assetAddr), types.GeneralClientChainAddrLength) + return nil, xerrors.Errorf(ErrInputClientChainAddrLength, len(assetAddr), types.GeneralClientChainAddrLength) } depositParams.AssetsAddress = assetAddr[:clientChainAddrLength] stakerAddr, ok := args[2].([]byte) if !ok || stakerAddr == nil { - return nil, fmt.Errorf(ErrContractInputParaOrType, 2, reflect.TypeOf(args[0]), stakerAddr) + return nil, xerrors.Errorf(ErrContractInputParaOrType, 2, "[]byte", stakerAddr) } if len(stakerAddr) != types.GeneralClientChainAddrLength { - return nil, fmt.Errorf(ErrInputClientChainAddrLength, len(assetAddr), types.GeneralClientChainAddrLength) + return nil, xerrors.Errorf(ErrInputClientChainAddrLength, len(assetAddr), types.GeneralClientChainAddrLength) } depositParams.StakerAddress = stakerAddr[:clientChainAddrLength] opAmount, ok := args[3].(*big.Int) if !ok || opAmount == nil || opAmount.Cmp(big.NewInt(0)) == 0 { - return nil, fmt.Errorf(ErrContractInputParaOrType, 3, reflect.TypeOf(args[0]), opAmount) + return nil, xerrors.Errorf(ErrContractInputParaOrType, 3, "*big.Int", opAmount) } depositParams.OpAmount = sdkmath.NewIntFromBigInt(opAmount) diff --git a/precompiles/reward/reward_test.go b/precompiles/reward/reward_test.go index 3306dba68..ccc2f0483 100644 --- a/precompiles/reward/reward_test.go +++ b/precompiles/reward/reward_test.go @@ -17,7 +17,7 @@ import ( evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) -func (s *PrecompileTestSuite) TestIsTransaction() { +func (s *RewardPrecompileTestSuite) TestIsTransaction() { testCases := []struct { name string method string @@ -51,7 +51,7 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { } // TestRun tests the precompiled Run method reward. -func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { +func (s *RewardPrecompileTestSuite) TestRunRewardThroughClientChain() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") @@ -68,7 +68,7 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { AssetsAddress: usdtAddress, OpAmount: depositAmount, } - err := s.app.DepositKeeper.Deposit(s.ctx, params) + err := s.App.DepositKeeper.Deposit(s.Ctx, params) s.Require().NoError(err) } @@ -78,11 +78,11 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { reward.MethodReward, uint16(clientChainLzID), assetAddr, - paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), + paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength), withdrawAmount, ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[reward.MethodReward].Outputs.Pack(true, new(big.Int).Add(depositAmount, withdrawAmount)) s.Require().NoError(err) @@ -98,17 +98,17 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { name: "pass - reward via pre-compiles", malleate: func() (common.Address, []byte) { depositModuleParam := &depositParams.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) rewardModuleParam := &rewardParams.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err = s.app.RewardKeeper.SetParams(s.ctx, rewardModuleParam) + err = s.App.RewardKeeper.SetParams(s.Ctx, rewardModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -123,7 +123,7 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -134,7 +134,7 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -146,27 +146,27 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + s.StateDB = statedb.New(s.Ctx, s.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.Ctx.HeaderHash().Bytes()))) // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) diff --git a/precompiles/reward/setup_test.go b/precompiles/reward/setup_test.go index e8db9fdbb..9b444815e 100644 --- a/precompiles/reward/setup_test.go +++ b/precompiles/reward/setup_test.go @@ -1,50 +1,26 @@ package reward_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" "github.com/ExocoreNetwork/exocore/precompiles/reward" - "github.com/evmos/evmos/v14/x/evm/statedb" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - evmosapp "github.com/ExocoreNetwork/exocore/app" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" "github.com/stretchr/testify/suite" ) -var s *PrecompileTestSuite - -type PrecompileTestSuite struct { - suite.Suite - - ctx sdk.Context - app *evmosapp.ExocoreApp - address common.Address - validators []stakingtypes.Validator - valSet *tmtypes.ValidatorSet - ethSigner ethtypes.Signer - privKey cryptotypes.PrivKey - signer keyring.Signer - bondDenom string +var s *RewardPrecompileTestSuite +type RewardPrecompileTestSuite struct { + testutil.BaseTestSuite precompile *reward.Precompile - stateDB *statedb.StateDB - - queryClientEVM evmtypes.QueryClient } func TestPrecompileTestSuite(t *testing.T) { - s = new(PrecompileTestSuite) + s = new(RewardPrecompileTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -52,6 +28,9 @@ func TestPrecompileTestSuite(t *testing.T) { RunSpecs(t, "Reward Precompile Suite") } -func (s *PrecompileTestSuite) SetupTest() { +func (s *RewardPrecompileTestSuite) SetupTest() { s.DoSetupTest() + precompile, err := reward.NewPrecompile(s.App.StakingAssetsManageKeeper, s.App.RewardKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile } diff --git a/precompiles/reward/utils_test.go b/precompiles/reward/utils_test.go deleted file mode 100644 index 61a8dc469..000000000 --- a/precompiles/reward/utils_test.go +++ /dev/null @@ -1,231 +0,0 @@ -package reward_test - -import ( - "encoding/json" - "time" - - evmosapp "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/precompiles/reward" - "github.com/ExocoreNetwork/exocore/utils" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/tmhash" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - cmn "github.com/evmos/evmos/v14/precompiles/common" - "github.com/evmos/evmos/v14/precompiles/testutil/contracts" - "github.com/evmos/evmos/v14/precompiles/vesting/testdata" - evmosutil "github.com/evmos/evmos/v14/testutil" - evmosutiltx "github.com/evmos/evmos/v14/testutil/tx" - evmostypes "github.com/evmos/evmos/v14/types" - "github.com/evmos/evmos/v14/x/evm/statedb" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" - inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" -) - -// SetupWithGenesisValSet initializes a new EvmosApp with a validator set and genesis accounts -// that also act as delegators. For simplicity, each validator is bonded with a delegation -// of one consensus engine unit (10^6) in the default token of the simapp from first genesis -// account. A Nop logger is set in SimApp. -func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { - appI, genesisState := evmosapp.SetupTestingApp(cmn.DefaultChainID, false)() - app, ok := appI.(*evmosapp.ExocoreApp) - s.Require().True(ok) - - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.TokensFromConsensusPower(1, evmostypes.PowerReduction) - - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - s.Require().NoError(err) - pkAny, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - } - s.validators = validators - - // set validators and delegations - stakingParams := stakingtypes.DefaultParams() - // set bond demon to be aevmos - stakingParams.BondDenom = utils.BaseDenom - stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - - totalBondAmt := bondAmt.Add(bondAmt) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens and delegated tokens to total supply - totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(utils.BaseDenom, totalBondAmt))...) - } - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(utils.BaseDenom, totalBondAmt)}, - }) - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) - - // init chain will set the validator set and initialize the genesis accounts - app.InitChain( - abci.RequestInitChain{ - ChainId: cmn.DefaultChainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: evmosapp.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - app.Commit() - - // instantiate new header - header := evmosutil.NewHeader( - 2, - time.Now().UTC(), - cmn.DefaultChainID, - sdk.ConsAddress(validators[0].GetOperator()), - tmhash.Sum([]byte("app")), - tmhash.Sum([]byte("validators")), - ) - - app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // create Context - s.ctx = app.BaseApp.NewContext(false, header) - s.app = app -} - -func (s *PrecompileTestSuite) DoSetupTest() { - // generate validator private/public key - privVal := mock.NewPV() - pubKey, err := privVal.GetPubKey() - s.Require().NoError(err) - - privVal2 := mock.NewPV() - pubKey2, err := privVal2.GetPubKey() - s.Require().NoError(err) - - // create validator set with two validators - validator := tmtypes.NewValidator(pubKey, 1) - validator2 := tmtypes.NewValidator(pubKey2, 2) - s.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) - signers := make(map[string]tmtypes.PrivValidator) - signers[pubKey.Address().String()] = privVal - signers[pubKey2.Address().String()] = privVal2 - - // generate genesis account - addr, priv := evmosutiltx.NewAddrKey() - s.privKey = priv - s.address = addr - s.signer = evmosutiltx.NewSigner(priv) - - baseAcc := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - - acc := &evmostypes.EthAccount{ - BaseAccount: baseAcc, - CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), - } - - amount := sdk.TokensFromConsensusPower(5, evmostypes.PowerReduction) - - balance := banktypes.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, amount)), - } - - s.SetupWithGenesisValSet(s.valSet, []authtypes.GenesisAccount{acc}, balance) - - // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) - - // bond denom - stakingParams := s.app.StakingKeeper.GetParams(s.ctx) - stakingParams.BondDenom = utils.BaseDenom - s.bondDenom = stakingParams.BondDenom - err = s.app.StakingKeeper.SetParams(s.ctx, stakingParams) - s.Require().NoError(err) - - s.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) - - precompile, err := reward.NewPrecompile(s.app.StakingAssetsManageKeeper, s.app.RewardKeeper, s.app.AuthzKeeper) - s.Require().NoError(err) - s.precompile = precompile - - coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) - inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) - distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) - err = s.app.BankKeeper.MintCoins(s.ctx, inflationtypes.ModuleName, coins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) - s.Require().NoError(err) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(s.ctx, s.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelperEvm, s.app.EvmKeeper) - s.queryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) -} - -// CallType is a struct that represents the type of call to be made to -// precompile - either direct or through a smart contract. -type CallType struct { - // name is the name of the call type - name string - // directCall is true if the call is to be made directly to precompile - directCall bool -} - -// BuildCallArgs builds the call arguments for the integration test suite -// depending on the type of interaction. -func (s *PrecompileTestSuite) BuildCallArgs( - callType CallType, - contractAddr common.Address, -) contracts.CallArgs { - callArgs := contracts.CallArgs{ - PrivKey: s.privKey, - } - if callType.directCall { - callArgs.ContractABI = s.precompile.ABI - callArgs.ContractAddr = s.precompile.Address() - } else { - callArgs.ContractAddr = contractAddr - callArgs.ContractABI = testdata.VestingCallerContract.ABI - } - - return callArgs -} diff --git a/precompiles/slash/setup_test.go b/precompiles/slash/setup_test.go index bd7eaf1b3..dcae7c8ee 100644 --- a/precompiles/slash/setup_test.go +++ b/precompiles/slash/setup_test.go @@ -1,50 +1,26 @@ package slash_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" "github.com/ExocoreNetwork/exocore/precompiles/slash" - "github.com/evmos/evmos/v14/x/evm/statedb" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - evmosapp "github.com/ExocoreNetwork/exocore/app" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" "github.com/stretchr/testify/suite" ) -var s *PrecompileTestSuite - -type PrecompileTestSuite struct { - suite.Suite - - ctx sdk.Context - app *evmosapp.ExocoreApp - address common.Address - validators []stakingtypes.Validator - valSet *tmtypes.ValidatorSet - ethSigner ethtypes.Signer - privKey cryptotypes.PrivKey - signer keyring.Signer - bondDenom string +var s *SlashPrecompileTestSuite +type SlashPrecompileTestSuite struct { + testutil.BaseTestSuite precompile *slash.Precompile - stateDB *statedb.StateDB - - queryClientEVM evmtypes.QueryClient } func TestPrecompileTestSuite(t *testing.T) { - s = new(PrecompileTestSuite) + s = new(SlashPrecompileTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -52,6 +28,9 @@ func TestPrecompileTestSuite(t *testing.T) { RunSpecs(t, "Slash Precompile Suite") } -func (s *PrecompileTestSuite) SetupTest() { +func (s *SlashPrecompileTestSuite) SetupTest() { s.DoSetupTest() + precompile, err := slash.NewPrecompile(s.App.StakingAssetsManageKeeper, s.App.ExoSlashKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile } diff --git a/precompiles/slash/slash_test.go b/precompiles/slash/slash_test.go index 6d653dab6..2538a6a70 100644 --- a/precompiles/slash/slash_test.go +++ b/precompiles/slash/slash_test.go @@ -17,7 +17,7 @@ import ( evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) -func (s *PrecompileTestSuite) TestIsTransaction() { +func (s *SlashPrecompileTestSuite) TestIsTransaction() { testCases := []struct { name string method string @@ -51,7 +51,7 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { } // TestRun tests the precompiles Run method submitSlash. -func (s *PrecompileTestSuite) TestRunSlash() { +func (s *SlashPrecompileTestSuite) TestRunSlash() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") @@ -68,7 +68,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { AssetsAddress: usdtAddress, OpAmount: depositAmount, } - err := s.app.DepositKeeper.Deposit(s.ctx, params) + err := s.App.DepositKeeper.Deposit(s.Ctx, params) s.Require().NoError(err) } @@ -78,7 +78,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { slash.MethodSlash, uint16(clientChainLzID), assetAddr, - paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), + paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength), slashAmount, common.FromHex("0x2E756b8faBeA234b9900767b69D6387400CDC396"), common.FromHex("0xceb69f6342ece283b2f5c9088ff249b5d0ae66ea"), @@ -86,7 +86,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { "slash", ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[slash.MethodSlash].Outputs.Pack(true) s.Require().NoError(err) @@ -102,17 +102,17 @@ func (s *PrecompileTestSuite) TestRunSlash() { name: "pass - slash via pre-compiles", malleate: func() (common.Address, []byte) { depositModuleParam := &depositParams.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) slashModuleParam := &slashParams.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err = s.app.ExoSlashKeeper.SetParams(s.ctx, slashModuleParam) + err = s.App.ExoSlashKeeper.SetParams(s.Ctx, slashModuleParam) s.Require().NoError(err) return commonMalleate() }, @@ -127,7 +127,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -138,7 +138,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -150,27 +150,27 @@ func (s *PrecompileTestSuite) TestRunSlash() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + s.StateDB = statedb.New(s.Ctx, s.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.Ctx.HeaderHash().Bytes()))) // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) diff --git a/precompiles/slash/utils_test.go b/precompiles/slash/utils_test.go deleted file mode 100644 index 47ba515ab..000000000 --- a/precompiles/slash/utils_test.go +++ /dev/null @@ -1,231 +0,0 @@ -package slash_test - -import ( - "encoding/json" - "time" - - evmosapp "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/precompiles/slash" - "github.com/ExocoreNetwork/exocore/utils" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/tmhash" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - cmn "github.com/evmos/evmos/v14/precompiles/common" - "github.com/evmos/evmos/v14/precompiles/testutil/contracts" - "github.com/evmos/evmos/v14/precompiles/vesting/testdata" - evmosutil "github.com/evmos/evmos/v14/testutil" - evmosutiltx "github.com/evmos/evmos/v14/testutil/tx" - evmostypes "github.com/evmos/evmos/v14/types" - "github.com/evmos/evmos/v14/x/evm/statedb" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" - inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" -) - -// SetupWithGenesisValSet initializes a new EvmosApp with a validator set and genesis accounts -// that also act as delegators. For simplicity, each validator is bonded with a delegation -// of one consensus engine unit (10^6) in the default token of the simapp from first genesis -// account. A Nop logger is set in SimApp. -func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { - appI, genesisState := evmosapp.SetupTestingApp(cmn.DefaultChainID, false)() - app, ok := appI.(*evmosapp.ExocoreApp) - s.Require().True(ok) - - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.TokensFromConsensusPower(1, evmostypes.PowerReduction) - - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - s.Require().NoError(err) - pkAny, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - } - s.validators = validators - - // set validators and delegations - stakingParams := stakingtypes.DefaultParams() - // set bond demon to be aevmos - stakingParams.BondDenom = utils.BaseDenom - stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - - totalBondAmt := bondAmt.Add(bondAmt) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens and delegated tokens to total supply - totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(utils.BaseDenom, totalBondAmt))...) - } - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(utils.BaseDenom, totalBondAmt)}, - }) - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) - - // init chain will set the validator set and initialize the genesis accounts - app.InitChain( - abci.RequestInitChain{ - ChainId: cmn.DefaultChainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: evmosapp.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - app.Commit() - - // instantiate new header - header := evmosutil.NewHeader( - 2, - time.Now().UTC(), - cmn.DefaultChainID, - sdk.ConsAddress(validators[0].GetOperator()), - tmhash.Sum([]byte("app")), - tmhash.Sum([]byte("validators")), - ) - - app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // create Context - s.ctx = app.BaseApp.NewContext(false, header) - s.app = app -} - -func (s *PrecompileTestSuite) DoSetupTest() { - // generate validator private/public key - privVal := mock.NewPV() - pubKey, err := privVal.GetPubKey() - s.Require().NoError(err) - - privVal2 := mock.NewPV() - pubKey2, err := privVal2.GetPubKey() - s.Require().NoError(err) - - // create validator set with two validators - validator := tmtypes.NewValidator(pubKey, 1) - validator2 := tmtypes.NewValidator(pubKey2, 2) - s.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) - signers := make(map[string]tmtypes.PrivValidator) - signers[pubKey.Address().String()] = privVal - signers[pubKey2.Address().String()] = privVal2 - - // generate genesis account - addr, priv := evmosutiltx.NewAddrKey() - s.privKey = priv - s.address = addr - s.signer = evmosutiltx.NewSigner(priv) - - baseAcc := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - - acc := &evmostypes.EthAccount{ - BaseAccount: baseAcc, - CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), - } - - amount := sdk.TokensFromConsensusPower(5, evmostypes.PowerReduction) - - balance := banktypes.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, amount)), - } - - s.SetupWithGenesisValSet(s.valSet, []authtypes.GenesisAccount{acc}, balance) - - // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) - - // bond denom - stakingParams := s.app.StakingKeeper.GetParams(s.ctx) - stakingParams.BondDenom = utils.BaseDenom - s.bondDenom = stakingParams.BondDenom - err = s.app.StakingKeeper.SetParams(s.ctx, stakingParams) - s.Require().NoError(err) - - s.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) - - precompile, err := slash.NewPrecompile(s.app.StakingAssetsManageKeeper, s.app.ExoSlashKeeper, s.app.AuthzKeeper) - s.Require().NoError(err) - s.precompile = precompile - - coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) - inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) - distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) - err = s.app.BankKeeper.MintCoins(s.ctx, inflationtypes.ModuleName, coins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) - s.Require().NoError(err) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(s.ctx, s.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelperEvm, s.app.EvmKeeper) - s.queryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) -} - -// CallType is a struct that represents the type of call to be made to -// precompile - either direct or through a smart contract. -type CallType struct { - // name is the name of the call type - name string - // directCall is true if the call is to be made directly to precompile - directCall bool -} - -// BuildCallArgs builds the call arguments for the integration test suite -// depending on the type of interaction. -func (s *PrecompileTestSuite) BuildCallArgs( - callType CallType, - contractAddr common.Address, -) contracts.CallArgs { - callArgs := contracts.CallArgs{ - PrivKey: s.privKey, - } - if callType.directCall { - callArgs.ContractABI = s.precompile.ABI - callArgs.ContractAddr = s.precompile.Address() - } else { - callArgs.ContractAddr = contractAddr - callArgs.ContractABI = testdata.VestingCallerContract.ABI - } - - return callArgs -} diff --git a/precompiles/withdraw/setup_test.go b/precompiles/withdraw/setup_test.go index 7465b97d7..259b6c0b5 100644 --- a/precompiles/withdraw/setup_test.go +++ b/precompiles/withdraw/setup_test.go @@ -1,50 +1,26 @@ package withdraw_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" "github.com/ExocoreNetwork/exocore/precompiles/withdraw" - "github.com/evmos/evmos/v14/x/evm/statedb" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - evmosapp "github.com/ExocoreNetwork/exocore/app" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" "github.com/stretchr/testify/suite" ) -var s *PrecompileTestSuite - -type PrecompileTestSuite struct { - suite.Suite - - ctx sdk.Context - app *evmosapp.ExocoreApp - address common.Address - validators []stakingtypes.Validator - valSet *tmtypes.ValidatorSet - ethSigner ethtypes.Signer - privKey cryptotypes.PrivKey - signer keyring.Signer - bondDenom string +var s *WithdrawPrecompileTestSuite +type WithdrawPrecompileTestSuite struct { + testutil.BaseTestSuite precompile *withdraw.Precompile - stateDB *statedb.StateDB - - queryClientEVM evmtypes.QueryClient } func TestPrecompileTestSuite(t *testing.T) { - s = new(PrecompileTestSuite) + s = new(WithdrawPrecompileTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -52,6 +28,9 @@ func TestPrecompileTestSuite(t *testing.T) { RunSpecs(t, "Withdraw Precompile Suite") } -func (s *PrecompileTestSuite) SetupTest() { +func (s *WithdrawPrecompileTestSuite) SetupTest() { s.DoSetupTest() + precompile, err := withdraw.NewPrecompile(s.App.StakingAssetsManageKeeper, s.App.WithdrawKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile } diff --git a/precompiles/withdraw/utils_test.go b/precompiles/withdraw/utils_test.go deleted file mode 100644 index 2ce50f587..000000000 --- a/precompiles/withdraw/utils_test.go +++ /dev/null @@ -1,232 +0,0 @@ -package withdraw_test - -import ( - "encoding/json" - "time" - - evmosapp "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/precompiles/withdraw" - testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" - "github.com/ExocoreNetwork/exocore/utils" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/tmhash" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - cmn "github.com/evmos/evmos/v14/precompiles/common" - "github.com/evmos/evmos/v14/precompiles/testutil/contracts" - "github.com/evmos/evmos/v14/precompiles/vesting/testdata" - evmosutil "github.com/evmos/evmos/v14/testutil" - evmosutiltx "github.com/evmos/evmos/v14/testutil/tx" - evmostypes "github.com/evmos/evmos/v14/types" - "github.com/evmos/evmos/v14/x/evm/statedb" - evmtypes "github.com/evmos/evmos/v14/x/evm/types" - inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" -) - -// SetupWithGenesisValSet initializes a new EvmosApp with a validator set and genesis accounts -// that also act as delegators. For simplicity, each validator is bonded with a delegation -// of one consensus engine unit (10^6) in the default token of the simapp from first genesis -// account. A Nop logger is set in SimApp. -func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { - appI, genesisState := evmosapp.SetupTestingApp(cmn.DefaultChainID, false)() - app, ok := appI.(*evmosapp.ExocoreApp) - s.Require().True(ok) - - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.TokensFromConsensusPower(1, evmostypes.PowerReduction) - - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - s.Require().NoError(err) - pkAny, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - } - s.validators = validators - - // set validators and delegations - stakingParams := stakingtypes.DefaultParams() - // set bond demon to be aevmos - stakingParams.BondDenom = utils.BaseDenom - stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - - totalBondAmt := bondAmt.Add(bondAmt) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens and delegated tokens to total supply - totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(utils.BaseDenom, totalBondAmt))...) - } - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(utils.BaseDenom, totalBondAmt)}, - }) - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) - - // init chain will set the validator set and initialize the genesis accounts - app.InitChain( - abci.RequestInitChain{ - ChainId: cmn.DefaultChainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: evmosapp.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - app.Commit() - - // instantiate new header - header := evmosutil.NewHeader( - 2, - time.Now().UTC(), - cmn.DefaultChainID, - sdk.ConsAddress(validators[0].GetOperator()), - tmhash.Sum([]byte("app")), - tmhash.Sum([]byte("validators")), - ) - - app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // create Context - s.ctx = app.BaseApp.NewContext(false, header) - s.app = app -} - -func (s *PrecompileTestSuite) DoSetupTest() { - // generate validator private/public key - privVal := mock.NewPV() - pubKey, err := privVal.GetPubKey() - s.Require().NoError(err) - - privVal2 := mock.NewPV() - pubKey2, err := privVal2.GetPubKey() - s.Require().NoError(err) - - // create validator set with two validators - validator := tmtypes.NewValidator(pubKey, 1) - validator2 := tmtypes.NewValidator(pubKey2, 2) - s.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) - signers := make(map[string]tmtypes.PrivValidator) - signers[pubKey.Address().String()] = privVal - signers[pubKey2.Address().String()] = privVal2 - - // generate genesis account - addr, priv := testutiltx.NewAddrKey() - s.privKey = priv - s.address = addr - s.signer = evmosutiltx.NewSigner(priv) - - baseAcc := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - - acc := &evmostypes.EthAccount{ - BaseAccount: baseAcc, - CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), - } - - amount := sdk.TokensFromConsensusPower(5, evmostypes.PowerReduction) - - balance := banktypes.Balance{ - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, amount)), - } - - s.SetupWithGenesisValSet(s.valSet, []authtypes.GenesisAccount{acc}, balance) - - // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) - - // bond denom - stakingParams := s.app.StakingKeeper.GetParams(s.ctx) - stakingParams.BondDenom = utils.BaseDenom - s.bondDenom = stakingParams.BondDenom - err = s.app.StakingKeeper.SetParams(s.ctx, stakingParams) - s.Require().NoError(err) - - s.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) - - precompile, err := withdraw.NewPrecompile(s.app.StakingAssetsManageKeeper, s.app.WithdrawKeeper, s.app.AuthzKeeper) - s.Require().NoError(err) - s.precompile = precompile - - coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) - inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) - distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) - err = s.app.BankKeeper.MintCoins(s.ctx, inflationtypes.ModuleName, coins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) - s.Require().NoError(err) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(s.ctx, s.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelperEvm, s.app.EvmKeeper) - s.queryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) -} - -// CallType is a struct that represents the type of call to be made to -// precompile - either direct or through a smart contract. -type CallType struct { - // name is the name of the call type - name string - // directCall is true if the call is to be made directly to precompile - directCall bool -} - -// BuildCallArgs builds the call arguments for the integration test suite -// depending on the type of interaction. -func (s *PrecompileTestSuite) BuildCallArgs( - callType CallType, - contractAddr common.Address, -) contracts.CallArgs { - callArgs := contracts.CallArgs{ - PrivKey: s.privKey, - } - if callType.directCall { - callArgs.ContractABI = s.precompile.ABI - callArgs.ContractAddr = s.precompile.Address() - } else { - callArgs.ContractAddr = contractAddr - callArgs.ContractABI = testdata.VestingCallerContract.ABI - } - - return callArgs -} diff --git a/precompiles/withdraw/withdraw.sol b/precompiles/withdraw/withdraw.sol index afd90b908..79e6c25b5 100644 --- a/precompiles/withdraw/withdraw.sol +++ b/precompiles/withdraw/withdraw.sol @@ -16,7 +16,7 @@ interface IWithdraw { /// TRANSACTIONS /// @dev withdraw To the staker, that will change the state in withdraw module /// Note that this address cannot be a module account. -/// @param clientChainLzID The lzId of client chain +/// @param clientChainLzID The LzID of client chain /// @param assetsAddress The client chain asset Address /// @param withdrawAddress The withdraw address /// @param opAmount The withdraw amount diff --git a/precompiles/withdraw/withdraw_integrate_test.go b/precompiles/withdraw/withdraw_integrate_test.go index a9566ab19..239c9d0f9 100644 --- a/precompiles/withdraw/withdraw_integrate_test.go +++ b/precompiles/withdraw/withdraw_integrate_test.go @@ -26,7 +26,7 @@ var ( passCheck testutil.LogCheckArgs ) -func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { +func (s *WithdrawPrecompileTestSuite) TestCallWithdrawFromEOA() { // withdraw params for test exoCoreLzAppAddress := "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD" exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" @@ -36,7 +36,7 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) clientChainLzID := 101 - stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) + stakerAddr := paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress method := "withdrawPrinciple" @@ -47,7 +47,7 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { defaultCallArgs = contracts.CallArgs{ ContractAddr: s.precompile.Address(), ContractABI: s.precompile.ABI, - PrivKey: s.privKey, + PrivKey: s.PrivKey, } defaultLogCheck = testutil.LogCheckArgs{ @@ -57,7 +57,7 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { } prepareFunc := func(params *deposittype.Params, method string) contracts.CallArgs { - err := s.app.DepositKeeper.SetParams(s.ctx, params) + err := s.App.DepositKeeper.SetParams(s.Ctx, params) s.Require().NoError(err) defaultWithdrawArgs := defaultCallArgs.WithMethodName(method) return defaultWithdrawArgs.WithArgs( @@ -69,6 +69,6 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { beforeEach() setWithdrawArgs := prepareFunc(¶ms, method) - _, _, err := contracts.CallContractAndCheckLogs(s.ctx, s.app, setWithdrawArgs, passCheck) + _, _, err := contracts.CallContractAndCheckLogs(s.Ctx, s.App, setWithdrawArgs, passCheck) s.Require().ErrorContains(err, strings.Split(withdraw.ErrContractCaller, ",")[0]) } diff --git a/precompiles/withdraw/withdraw_test.go b/precompiles/withdraw/withdraw_test.go index 0ac0e40c9..38545e324 100644 --- a/precompiles/withdraw/withdraw_test.go +++ b/precompiles/withdraw/withdraw_test.go @@ -16,7 +16,7 @@ import ( evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) -func (s *PrecompileTestSuite) TestIsTransaction() { +func (s *WithdrawPrecompileTestSuite) TestIsTransaction() { testCases := []struct { name string method string @@ -49,10 +49,10 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { return input } -func (s *PrecompileTestSuite) TestRequiredGas() { +func (s *WithdrawPrecompileTestSuite) TestRequiredGas() { clientChainLzID := 101 usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) - withdrawAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) + withdrawAddr := paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -92,7 +92,7 @@ func (s *PrecompileTestSuite) TestRequiredGas() { } // TestRun tests the precompiled Run method withdraw. -func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { +func (s *WithdrawPrecompileTestSuite) TestRunWithdrawThroughClientChain() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") @@ -109,7 +109,7 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { AssetsAddress: usdtAddress, OpAmount: depositAmount, } - err := s.app.DepositKeeper.Deposit(s.ctx, params) + err := s.App.DepositKeeper.Deposit(s.Ctx, params) s.Require().NoError(err) } @@ -119,11 +119,11 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { withdraw.MethodWithdraw, uint16(clientChainLzID), assetAddr, - paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), + paddingClientChainAddress(s.Address.Bytes(), types.GeneralClientChainAddrLength), withdrawAmount, ) s.Require().NoError(err, "failed to pack input") - return s.address, input + return s.Address, input } successRet, err := s.precompile.Methods[withdraw.MethodWithdraw].Outputs.Pack(true, new(big.Int).Sub(depositAmount, withdrawAmount)) s.Require().NoError(err) @@ -139,12 +139,12 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { name: "pass - withdraw via pre-compiles", malleate: func() (common.Address, []byte) { depositModuleParam := &depositparams.Params{ - ExoCoreLzAppAddress: s.address.String(), + ExoCoreLzAppAddress: s.Address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } - err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) + err := s.App.DepositKeeper.SetParams(s.Ctx, depositModuleParam) s.Require().NoError(err) - depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) + depositAsset(s.Address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) return commonMalleate() }, returnBytes: successRet, @@ -158,7 +158,7 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { // setup basic test suite s.SetupTest() - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) // malleate testcase caller, input := tc.malleate() @@ -169,7 +169,7 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { contractAddr := contract.Address() // Build and sign Ethereum transaction txArgs := evmtypes.EvmTxArgs{ - ChainID: s.app.EvmKeeper.ChainID(), + ChainID: s.App.EvmKeeper.ChainID(), Nonce: 0, To: &contractAddr, Amount: nil, @@ -181,27 +181,27 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { } msgEthereumTx := evmtypes.NewTx(&txArgs) - msgEthereumTx.From = s.address.String() - err := msgEthereumTx.Sign(s.ethSigner, s.signer) + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) s.Require().NoError(err, "failed to sign Ethereum message") // Instantiate config - proposerAddress := s.ctx.BlockHeader().ProposerAddress - cfg, err := s.app.EvmKeeper.EVMConfig(s.ctx, proposerAddress, s.app.EvmKeeper.ChainID()) + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) s.Require().NoError(err, "failed to instantiate EVM config") - msg, err := msgEthereumTx.AsMessage(s.ethSigner, baseFee) + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) s.Require().NoError(err, "failed to instantiate Ethereum message") // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + s.StateDB = statedb.New(s.Ctx, s.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.Ctx.HeaderHash().Bytes()))) // Instantiate EVM - evm := s.app.EvmKeeper.NewEVM( - s.ctx, msg, cfg, nil, s.stateDB, + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, ) - params := s.app.EvmKeeper.GetParams(s.ctx) + params := s.App.EvmKeeper.GetParams(s.Ctx) activePrecompiles := params.GetActivePrecompilesAddrs() - precompileMap := s.app.EvmKeeper.Precompiles(activePrecompiles...) + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) s.Require().NoError(err, "invalid precompiles", activePrecompiles) evm.WithPrecompiles(precompileMap, activePrecompiles) diff --git a/testutil/abci.go b/testutil/abci.go index 304468daa..51061fd20 100644 --- a/testutil/abci.go +++ b/testutil/abci.go @@ -57,7 +57,7 @@ func CommitAndCreateNewCtx(ctx sdk.Context, app *app.ExocoreApp, t time.Duration // DeliverTx delivers a cosmos tx for a given set of msgs func DeliverTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv cryptotypes.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg, @@ -65,7 +65,7 @@ func DeliverTx( txConfig := encoding.MakeConfig(app.ModuleBasics).TxConfig tx, err := tx.PrepareCosmosTx( ctx, - appEvmos, + appExocore, tx.CosmosTxArgs{ TxCfg: txConfig, Priv: priv, @@ -78,7 +78,7 @@ func DeliverTx( if err != nil { return abci.ResponseDeliverTx{}, err } - return BroadcastTxBytes(appEvmos, txConfig.TxEncoder(), tx) + return BroadcastTxBytes(appExocore, txConfig.TxEncoder(), tx) } // DeliverEthTx generates and broadcasts a Cosmos Tx populated with MsgEthereumTx messages. @@ -112,18 +112,18 @@ func DeliverEthTx( // otherwise, it will assume the messages have already been signed. It does not check if the Eth tx is // successful or not. func DeliverEthTxWithoutCheck( - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv cryptotypes.PrivKey, msgs ...sdk.Msg, ) (abci.ResponseDeliverTx, error) { txConfig := encoding.MakeConfig(app.ModuleBasics).TxConfig - tx, err := tx.PrepareEthTx(txConfig, appEvmos, priv, msgs...) + tx, err := tx.PrepareEthTx(txConfig, appExocore, priv, msgs...) if err != nil { return abci.ResponseDeliverTx{}, err } - res, err := BroadcastTxBytes(appEvmos, txConfig.TxEncoder(), tx) + res, err := BroadcastTxBytes(appExocore, txConfig.TxEncoder(), tx) if err != nil { return abci.ResponseDeliverTx{}, err } @@ -134,7 +134,7 @@ func DeliverEthTxWithoutCheck( // CheckTx checks a cosmos tx for a given set of msgs func CheckTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv cryptotypes.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg, @@ -143,7 +143,7 @@ func CheckTx( tx, err := tx.PrepareCosmosTx( ctx, - appEvmos, + appExocore, tx.CosmosTxArgs{ TxCfg: txConfig, Priv: priv, @@ -156,25 +156,25 @@ func CheckTx( if err != nil { return abci.ResponseCheckTx{}, err } - return checkTxBytes(appEvmos, txConfig.TxEncoder(), tx) + return checkTxBytes(appExocore, txConfig.TxEncoder(), tx) } // CheckEthTx checks a Ethereum tx for a given set of msgs func CheckEthTx( - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv cryptotypes.PrivKey, msgs ...sdk.Msg, ) (abci.ResponseCheckTx, error) { txConfig := encoding.MakeConfig(app.ModuleBasics).TxConfig - tx, err := tx.PrepareEthTx(txConfig, appEvmos, priv, msgs...) + tx, err := tx.PrepareEthTx(txConfig, appExocore, priv, msgs...) if err != nil { return abci.ResponseCheckTx{}, err } - return checkTxBytes(appEvmos, txConfig.TxEncoder(), tx) + return checkTxBytes(appExocore, txConfig.TxEncoder(), tx) } -// BroadcastTxBytes encodes a transaction and calls DeliverTx on the app. +// BroadcastTxBytes encodes a transaction and calls DeliverTx on the App. func BroadcastTxBytes(app *app.ExocoreApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci.ResponseDeliverTx, error) { // bz are bytes to be broadcasted over the network bz, err := txEncoder(tx) diff --git a/testutil/ante.go b/testutil/ante.go index 22032f884..f9fdfa990 100644 --- a/testutil/ante.go +++ b/testutil/ante.go @@ -10,7 +10,7 @@ import ( // the next function in the AnteHandler chain. // // It can be used in unit tests when calling a decorator's AnteHandle method, e.g. -// `dec.AnteHandle(ctx, tx, false, NextFn)` +// `dec.AnteHandle(Ctx, tx, false, NextFn)` func NextFn(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { return ctx, nil } diff --git a/testutil/contract.go b/testutil/contract.go index 27ac88ba6..8ea51b668 100644 --- a/testutil/contract.go +++ b/testutil/contract.go @@ -23,7 +23,7 @@ import ( // ContractArgs are the params used for calling a smart contract. type ContractArgs struct { - // Addr is the address of the contract to call. + // Addr is the Address of the contract to call. Addr common.Address // ABI is the ABI of the contract to call. ABI abi.ABI @@ -39,7 +39,7 @@ type ContractCallArgs struct { Contract ContractArgs // Nonce is the nonce to use for the transaction. Nonce *big.Int - // Amount is the aevmos amount to send in the transaction. + // Amount is the aexo amount to send in the transaction. Amount *big.Int // GasLimit to use for the transaction GasLimit uint64 @@ -51,15 +51,15 @@ type ContractCallArgs struct { // compiled contract data and constructor arguments func DeployContract( ctx sdk.Context, - evmosApp *app.ExocoreApp, + exocoreApp *app.ExocoreApp, priv cryptotypes.PrivKey, queryClientEvm evm.QueryClient, contract evm.CompiledContract, constructorArgs ...interface{}, ) (common.Address, error) { - chainID := evmosApp.EvmKeeper.ChainID() + chainID := exocoreApp.EvmKeeper.ChainID() from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := evmosApp.EvmKeeper.GetNonce(ctx, from) + nonce := exocoreApp.EvmKeeper.GetNonce(ctx, from) ctorArgs, err := contract.ABI.Pack("", constructorArgs...) if err != nil { @@ -76,19 +76,19 @@ func DeployContract( ChainID: chainID, Nonce: nonce, GasLimit: gas, - GasFeeCap: evmosApp.FeeMarketKeeper.GetBaseFee(ctx), + GasFeeCap: exocoreApp.FeeMarketKeeper.GetBaseFee(ctx), GasTipCap: big.NewInt(1), Input: data, Accesses: ðtypes.AccessList{}, }) msgEthereumTx.From = from.String() - res, err := DeliverEthTx(evmosApp, priv, msgEthereumTx) + res, err := DeliverEthTx(exocoreApp, priv, msgEthereumTx) if err != nil { return common.Address{}, err } - if _, err := CheckEthTxResponse(res, evmosApp.AppCodec()); err != nil { + if _, err := CheckEthTxResponse(res, exocoreApp.AppCodec()); err != nil { return common.Address{}, err } diff --git a/testutil/fund.go b/testutil/fund.go index dfc19878e..459bcde83 100644 --- a/testutil/fund.go +++ b/testutil/fund.go @@ -1,14 +1,14 @@ package testutil import ( + "github.com/ExocoreNetwork/exocore/utils" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - "github.com/evmos/evmos/v14/utils" inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" ) // FundAccount is a utility function that funds an account by minting and -// sending the coins to the address. +// sending the coins to the Address. func FundAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, amounts sdk.Coins) error { if err := bankKeeper.MintCoins(ctx, inflationtypes.ModuleName, amounts); err != nil { return err @@ -27,7 +27,7 @@ func FundAccountWithBaseDenom(ctx sdk.Context, bankKeeper bankkeeper.Keeper, add } // FundModuleAccount is a utility function that funds a module account by -// minting and sending the coins to the address. +// minting and sending the coins to the Address. func FundModuleAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, recipientMod string, amounts sdk.Coins) error { if err := bankKeeper.MintCoins(ctx, inflationtypes.ModuleName, amounts); err != nil { return err diff --git a/testutil/integration.go b/testutil/integration.go index e795a1d13..dfaa91a96 100644 --- a/testutil/integration.go +++ b/testutil/integration.go @@ -18,7 +18,7 @@ import ( // event. func SubmitProposal( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, pk *ethsecp256k1.PrivKey, content govv1beta1.Content, eventNum int, @@ -31,7 +31,7 @@ func SubmitProposal( if err != nil { return id, err } - res, err := DeliverTx(ctx, appEvmos, pk, nil, msg) + res, err := DeliverTx(ctx, appExocore, pk, nil, msg) if err != nil { return id, err } @@ -47,7 +47,7 @@ func SubmitProposal( // Delegate delivers a delegate tx func Delegate( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv *ethsecp256k1.PrivKey, delegateAmount sdk.Coin, validator stakingtypes.Validator, @@ -60,13 +60,13 @@ func Delegate( } delegateMsg := stakingtypes.NewMsgDelegate(accountAddress, val, delegateAmount) - return DeliverTx(ctx, appEvmos, priv, nil, delegateMsg) + return DeliverTx(ctx, appExocore, priv, nil, delegateMsg) } // Vote delivers a vote tx with the VoteOption "yes" func Vote( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv *ethsecp256k1.PrivKey, proposalID uint64, voteOption govv1beta1.VoteOption, @@ -74,5 +74,5 @@ func Vote( accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) voteMsg := govv1beta1.NewMsgVote(accountAddress, proposalID, voteOption) - return DeliverTx(ctx, appEvmos, priv, nil, voteMsg) + return DeliverTx(ctx, appExocore, priv, nil, voteMsg) } diff --git a/testutil/network/network.go b/testutil/network/network.go index 85593918e..513e044d1 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -99,7 +99,7 @@ type Config struct { // testing requirements. func DefaultConfig() Config { encCfg := encoding.MakeConfig(app.ModuleBasics) - chainID := fmt.Sprintf("evmos_%d-1", tmrand.Int63n(9999999999999)+1) + chainID := fmt.Sprintf("exocore_%d-1", tmrand.Int63n(9999999999999)+1) return Config{ Codec: encCfg.Codec, TxConfig: encCfg.TxConfig, @@ -111,7 +111,7 @@ func DefaultConfig() Config { TimeoutCommit: 3 * time.Second, ChainID: chainID, NumValidators: 4, - BondDenom: "aevmos", + BondDenom: "aexo", MinGasPrices: fmt.Sprintf("0.000006%s", evmostypes.AttoEvmos), AccountTokens: sdk.TokensFromConsensusPower(1000000000000000000, evmostypes.PowerReduction), StakingTokens: sdk.TokensFromConsensusPower(500000000000000000, evmostypes.PowerReduction), diff --git a/testutil/network/network_test.go b/testutil/network/network_test.go index 2844a9cc6..e412fef33 100644 --- a/testutil/network/network_test.go +++ b/testutil/network/network_test.go @@ -14,7 +14,7 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/evmos/evmos/v14/server/config" - evmosnetwork "github.com/ExocoreNetwork/exocore/testutil/network" + exocorenetwork "github.com/ExocoreNetwork/exocore/testutil/network" ) type IntegrationTestSuite struct { @@ -27,7 +27,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") var err error - cfg := evmosnetwork.DefaultConfig() + cfg := exocorenetwork.DefaultConfig() cfg.JSONRPCAddress = config.DefaultJSONRPCAddress cfg.NumValidators = 1 diff --git a/testutil/staking-rewards.go b/testutil/staking-rewards.go index 070ad7554..ac6cabefa 100644 --- a/testutil/staking-rewards.go +++ b/testutil/staking-rewards.go @@ -7,6 +7,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/app" testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" + "github.com/ExocoreNetwork/exocore/utils" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,7 +17,6 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" teststaking "github.com/cosmos/cosmos-sdk/x/staking/testutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/evmos/evmos/v14/utils" "github.com/stretchr/testify/require" ) @@ -44,7 +44,7 @@ func CreateValidator(ctx sdk.Context, t *testing.T, pubKey cryptotypes.PubKey, s // such that the given amount of tokens is outstanding as a staking reward for the account. // // The setup is done in the following way: -// - Fund the account with the given address with the given balance. +// - Fund the account with the given Address with the given balance. // - If the given balance is zero, the account will be created with zero balance. // // For every reward defined in the rewards argument, the following steps are executed: @@ -54,7 +54,7 @@ func CreateValidator(ctx sdk.Context, t *testing.T, pubKey cryptotypes.PubKey, s // The function returns the updated context along with a potential error. func PrepareAccountsForDelegationRewards(t *testing.T, ctx sdk.Context, app *app.ExocoreApp, addr sdk.AccAddress, balance sdkmath.Int, rewards ...sdkmath.Int) (sdk.Context, error) { // Calculate the necessary amount of tokens to fund the account in order for the desired residual balance to - // be left after creating validators and delegating to them. + // be left after creating Validators and delegating to them. totalRewards := sdk.ZeroInt() for _, reward := range rewards { totalRewards = totalRewards.Add(reward) @@ -112,7 +112,7 @@ func PrepareAccountsForDelegationRewards(t *testing.T, ctx sdk.Context, app *app stakingHelper.Denom = utils.BaseDenom valAddr := sdk.ValAddress(addr2.Bytes()) - // self-delegate the same amount of tokens as the delegate address also stakes + // self-delegate the same amount of tokens as the delegate Address also stakes // this ensures, that the delegation rewards are 50% of the total rewards stakingHelper.CreateValidator(valAddr, privKey.PubKey(), reward, true) stakingHelper.Delegate(addr, valAddr, reward) @@ -131,7 +131,7 @@ func PrepareAccountsForDelegationRewards(t *testing.T, ctx sdk.Context, app *app } // GetTotalDelegationRewards returns the total delegation rewards that are currently -// outstanding for the given address. +// outstanding for the given Address. func GetTotalDelegationRewards(ctx sdk.Context, distributionKeeper distributionkeeper.Keeper, addr sdk.AccAddress) (sdk.DecCoins, error) { querier := distributionkeeper.NewQuerier(distributionKeeper) resp, err := querier.DelegationTotalRewards( diff --git a/testutil/tx/cosmos.go b/testutil/tx/cosmos.go index ee9dee3c3..9051dd01b 100644 --- a/testutil/tx/cosmos.go +++ b/testutil/tx/cosmos.go @@ -12,7 +12,7 @@ import ( authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/ExocoreNetwork/exocore/app" - "github.com/evmos/evmos/v14/utils" + "github.com/ExocoreNetwork/exocore/utils" ) var ( @@ -44,7 +44,7 @@ type CosmosTxArgs struct { // It returns the signed transaction and an error func PrepareCosmosTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, args CosmosTxArgs, ) (authsigning.Tx, error) { txBuilder := args.TxCfg.NewTxBuilder() @@ -67,7 +67,7 @@ func PrepareCosmosTx( return signCosmosTx( ctx, - appEvmos, + appExocore, args, txBuilder, ) @@ -77,12 +77,12 @@ func PrepareCosmosTx( // the provided private key func signCosmosTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, args CosmosTxArgs, txBuilder client.TxBuilder, ) (authsigning.Tx, error) { addr := sdk.AccAddress(args.Priv.PubKey().Address().Bytes()) - seq, err := appEvmos.AccountKeeper.GetSequence(ctx, addr) + seq, err := appExocore.AccountKeeper.GetSequence(ctx, addr) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func signCosmosTx( } // Second round: all signer infos are set, so each signer can sign. - accNumber := appEvmos.AccountKeeper.GetAccount(ctx, addr).GetAccountNumber() + accNumber := appExocore.AccountKeeper.GetAccount(ctx, addr).GetAccountNumber() signerData := authsigning.SignerData{ ChainID: args.ChainID, AccountNumber: accNumber, diff --git a/testutil/tx/eip712.go b/testutil/tx/eip712.go index 65a6a37b3..e845453c3 100644 --- a/testutil/tx/eip712.go +++ b/testutil/tx/eip712.go @@ -50,12 +50,12 @@ type legacyWeb3ExtensionArgs struct { // It returns the signed transaction and an error func CreateEIP712CosmosTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, args EIP712TxArgs, ) (sdk.Tx, error) { builder, err := PrepareEIP712CosmosTx( ctx, - appEvmos, + appExocore, args, ) return builder.GetTx(), err @@ -66,7 +66,7 @@ func CreateEIP712CosmosTx( // It returns the tx builder with the signed transaction and an error func PrepareEIP712CosmosTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, args EIP712TxArgs, ) (client.TxBuilder, error) { txArgs := args.CosmosTxArgs @@ -78,9 +78,9 @@ func PrepareEIP712CosmosTx( chainIDNum := pc.Uint64() from := sdk.AccAddress(txArgs.Priv.PubKey().Address().Bytes()) - accNumber := appEvmos.AccountKeeper.GetAccount(ctx, from).GetAccountNumber() + accNumber := appExocore.AccountKeeper.GetAccount(ctx, from).GetAccountNumber() - nonce, err := appEvmos.AccountKeeper.GetSequence(ctx, from) + nonce, err := appExocore.AccountKeeper.GetSequence(ctx, from) if err != nil { return nil, err } @@ -117,7 +117,7 @@ func PrepareEIP712CosmosTx( return signCosmosEIP712Tx( ctx, - appEvmos, + appExocore, args, builder, chainIDNum, @@ -129,7 +129,7 @@ func PrepareEIP712CosmosTx( // the provided private key and the typed data func signCosmosEIP712Tx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, args EIP712TxArgs, builder authtx.ExtensionOptionsTxBuilder, chainID uint64, @@ -138,7 +138,7 @@ func signCosmosEIP712Tx( priv := args.CosmosTxArgs.Priv from := sdk.AccAddress(priv.PubKey().Address().Bytes()) - nonce, err := appEvmos.AccountKeeper.GetSequence(ctx, from) + nonce, err := appExocore.AccountKeeper.GetSequence(ctx, from) if err != nil { return nil, err } diff --git a/testutil/tx/eth.go b/testutil/tx/eth.go index 0bf8afb5f..84aec52c2 100644 --- a/testutil/tx/eth.go +++ b/testutil/tx/eth.go @@ -26,13 +26,13 @@ import ( // It returns the signed transaction and an error func PrepareEthTx( txCfg client.TxConfig, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, priv cryptotypes.PrivKey, msgs ...sdk.Msg, ) (authsigning.Tx, error) { txBuilder := txCfg.NewTxBuilder() - signer := ethtypes.LatestSignerForChainID(appEvmos.EvmKeeper.ChainID()) + signer := ethtypes.LatestSignerForChainID(appExocore.EvmKeeper.ChainID()) txFee := sdk.Coins{} txGasLimit := uint64(0) @@ -89,7 +89,7 @@ func PrepareEthTx( // Should this not be the case, just pass in zero. func CreateEthTx( ctx sdk.Context, - appEvmos *app.ExocoreApp, + appExocore *app.ExocoreApp, privKey cryptotypes.PrivKey, from sdk.AccAddress, dest sdk.AccAddress, @@ -98,17 +98,17 @@ func CreateEthTx( ) (*evmtypes.MsgEthereumTx, error) { toAddr := common.BytesToAddress(dest.Bytes()) fromAddr := common.BytesToAddress(from.Bytes()) - chainID := appEvmos.EvmKeeper.ChainID() + chainID := appExocore.EvmKeeper.ChainID() // When we send multiple Ethereum Tx's in one Cosmos Tx, we need to increment the nonce for each one. - nonce := appEvmos.EvmKeeper.GetNonce(ctx, fromAddr) + uint64(nonceIncrement) + nonce := appExocore.EvmKeeper.GetNonce(ctx, fromAddr) + uint64(nonceIncrement) evmTxParams := &evmtypes.EvmTxArgs{ ChainID: chainID, Nonce: nonce, To: &toAddr, Amount: amount, GasLimit: 100000, - GasFeeCap: appEvmos.FeeMarketKeeper.GetBaseFee(ctx), + GasFeeCap: appExocore.FeeMarketKeeper.GetBaseFee(ctx), GasTipCap: big.NewInt(1), Accesses: ðtypes.AccessList{}, } @@ -117,7 +117,7 @@ func CreateEthTx( // If we are creating multiple eth Tx's with different senders, we need to sign here rather than later. if privKey != nil { - signer := ethtypes.LatestSignerForChainID(appEvmos.EvmKeeper.ChainID()) + signer := ethtypes.LatestSignerForChainID(appExocore.EvmKeeper.ChainID()) err := msgEthereumTx.Sign(signer, NewSigner(privKey)) if err != nil { return nil, err diff --git a/precompiles/deposit/utils_test.go b/testutil/utils.go similarity index 53% rename from precompiles/deposit/utils_test.go rename to testutil/utils.go index 31af57c34..d7a973841 100644 --- a/precompiles/deposit/utils_test.go +++ b/testutil/utils.go @@ -1,44 +1,80 @@ -package deposit_test +package testutil import ( "encoding/json" "time" - "github.com/ExocoreNetwork/exocore/precompiles/deposit" - "github.com/ExocoreNetwork/exocore/testutil" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/evmos/evmos/v14/testutil" + "github.com/stretchr/testify/suite" + "golang.org/x/exp/rand" + testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" - evmosapp "github.com/ExocoreNetwork/exocore/app" + exocoreapp "github.com/ExocoreNetwork/exocore/app" "github.com/ExocoreNetwork/exocore/utils" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/tmhash" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - cmn "github.com/evmos/evmos/v14/precompiles/common" evmostypes "github.com/evmos/evmos/v14/types" "github.com/evmos/evmos/v14/x/evm/statedb" evmtypes "github.com/evmos/evmos/v14/x/evm/types" - inflationtypes "github.com/evmos/evmos/v14/x/inflation/types" ) +type BaseTestSuite struct { + suite.Suite + + Ctx sdk.Context + App *exocoreapp.ExocoreApp + Address common.Address + AccAddress sdk.AccAddress + + Validators []stakingtypes.Validator + ValSet *tmtypes.ValidatorSet + EthSigner ethtypes.Signer + PrivKey cryptotypes.PrivKey + Signer keyring.Signer + BondDenom string + StateDB *statedb.StateDB + QueryClientEVM evmtypes.QueryClient + + // needed by test + /* operatorAddr sdk.AccAddress + avsAddr string + assetID string + stakerID string + assetAddr common.Address + assetDecimal uint32 + clientChainLzID uint64 + depositAmount sdkmath.Int + delegationAmount sdkmath.Int + updatedAmountForOptIn sdkmath.Int*/ +} + +func (suite *BaseTestSuite) SetupTest() { + suite.DoSetupTest() +} + // SetupWithGenesisValSet initializes a new EvmosApp with a validator set and genesis accounts // that also act as delegators. For simplicity, each validator is bonded with a delegation // of one consensus engine unit (10^6) in the default token of the simapp from first genesis // account. A Nop logger is set in SimApp. -func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { - appI, genesisState := evmosapp.SetupTestingApp(cmn.DefaultChainID, false)() - app, ok := appI.(*evmosapp.ExocoreApp) - s.Require().True(ok) +func (suite *BaseTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) { + appI, genesisState := exocoreapp.SetupTestingApp(utils.DefaultChainID, false)() + app, ok := appI.(*exocoreapp.ExocoreApp) + suite.Require().True(ok) // set genesis accounts authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) @@ -51,9 +87,9 @@ func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSe for _, val := range valSet.Validators { pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - s.Require().NoError(err) + suite.Require().NoError(err) pkAny, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) + suite.Require().NoError(err) validator := stakingtypes.Validator{ OperatorAddress: sdk.ValAddress(val.Address).String(), ConsensusPubkey: pkAny, @@ -70,9 +106,9 @@ func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSe validators = append(validators, validator) delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) } - s.validators = validators + suite.Validators = validators - // set validators and delegations + // set Validators and delegations stakingParams := stakingtypes.DefaultParams() // set bond demon to be aevmos stakingParams.BondDenom = utils.BaseDenom @@ -97,14 +133,14 @@ func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSe genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) + suite.Require().NoError(err) // init chain will set the validator set and initialize the genesis accounts app.InitChain( abci.RequestInitChain{ - ChainId: cmn.DefaultChainID, + ChainId: utils.DefaultChainID, Validators: []abci.ValidatorUpdate{}, - ConsensusParams: evmosapp.DefaultConsensusParams, + ConsensusParams: exocoreapp.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) @@ -114,107 +150,109 @@ func (s *PrecompileTestSuite) SetupWithGenesisValSet(valSet *tmtypes.ValidatorSe header := testutil.NewHeader( 2, time.Now().UTC(), - cmn.DefaultChainID, + utils.DefaultChainID, sdk.ConsAddress(validators[0].GetOperator()), - tmhash.Sum([]byte("app")), - tmhash.Sum([]byte("validators")), + tmhash.Sum([]byte("App")), + tmhash.Sum([]byte("Validators")), ) app.BeginBlock(abci.RequestBeginBlock{ Header: header, }) - // create Context - s.ctx = app.BaseApp.NewContext(false, header) - s.app = app + // need to create UncachedContext when retrieving historical state + suite.Ctx = app.BaseApp.NewUncachedContext(false, header) + suite.App = app } -func (s *PrecompileTestSuite) DoSetupTest() { +func (suite *BaseTestSuite) DoSetupTest() { // generate validator private/public key privVal := mock.NewPV() pubKey, err := privVal.GetPubKey() - s.Require().NoError(err) + suite.Require().NoError(err) privVal2 := mock.NewPV() pubKey2, err := privVal2.GetPubKey() - s.Require().NoError(err) + suite.Require().NoError(err) - // create validator set with two validators + // create validator set with two Validators validator := tmtypes.NewValidator(pubKey, 1) validator2 := tmtypes.NewValidator(pubKey2, 2) - s.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) + suite.ValSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator, validator2}) signers := make(map[string]tmtypes.PrivValidator) signers[pubKey.Address().String()] = privVal signers[pubKey2.Address().String()] = privVal2 + // create AccAddress for test + pubBz := make([]byte, ed25519.PubKeySize) + pub := &ed25519.PubKey{Key: pubBz} + _, err = rand.Read(pub.Key) + suite.Require().NoError(err) + suite.AccAddress = sdk.AccAddress(pub.Address()) + // generate genesis account addr, priv := testutiltx.NewAddrKey() - s.privKey = priv - s.address = addr - s.signer = testutiltx.NewSigner(priv) - + suite.PrivKey = priv + suite.Address = addr + suite.Signer = testutiltx.NewSigner(priv) baseAcc := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - acc := &evmostypes.EthAccount{ BaseAccount: baseAcc, CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), } - + // set amount for genesis account amount := sdk.TokensFromConsensusPower(5, evmostypes.PowerReduction) - balance := banktypes.Balance{ Address: acc.GetAddress().String(), Coins: sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, amount)), } - s.SetupWithGenesisValSet(s.valSet, []authtypes.GenesisAccount{acc}, balance) + // Initialize an ExocoreApp for test + suite.SetupWithGenesisValSet(suite.ValSet, []authtypes.GenesisAccount{acc}, balance) // Create StateDB - s.stateDB = statedb.New(s.ctx, s.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(s.ctx.HeaderHash().Bytes()))) + suite.StateDB = statedb.New(suite.Ctx, suite.App.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.Ctx.HeaderHash().Bytes()))) // bond denom - stakingParams := s.app.StakingKeeper.GetParams(s.ctx) - stakingParams.BondDenom = utils.BaseDenom - s.bondDenom = stakingParams.BondDenom - err = s.app.StakingKeeper.SetParams(s.ctx, stakingParams) - s.Require().NoError(err) - - s.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) - - precompile, err := deposit.NewPrecompile(s.app.StakingAssetsManageKeeper, s.app.DepositKeeper, s.app.AuthzKeeper) - s.Require().NoError(err) - s.precompile = precompile - - coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) - inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) - distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) - err = s.app.BankKeeper.MintCoins(s.ctx, inflationtypes.ModuleName, coins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToModule(s.ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) - s.Require().NoError(err) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(s.ctx, s.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelperEvm, s.app.EvmKeeper) - s.queryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) + /* stakingParams := suite.App.StakingKeeper.GetParams(suite.Ctx) + stakingParams.BondDenom = utils.BaseDenom + suite.BondDenom = stakingParams.BondDenom + err = suite.App.StakingKeeper.SetParams(suite.Ctx, stakingParams) + suite.Require().NoError(err)*/ + + suite.BondDenom = utils.BaseDenom + suite.EthSigner = ethtypes.LatestSignerForChainID(suite.App.EvmKeeper.ChainID()) + + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelperEvm, suite.App.EvmKeeper) + suite.QueryClientEVM = evmtypes.NewQueryClient(queryHelperEvm) + + /* coins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(5000000000000000000))) + inflCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(2000000000000000000))) + distrCoins := sdk.NewCoins(sdk.NewCoin(utils.BaseDenom, sdk.NewInt(3000000000000000000))) + err = suite.App.BankKeeper.MintCoins(suite.Ctx, inflationtypes.ModuleName, coins) + suite.Require().NoError(err) + err = suite.App.BankKeeper.SendCoinsFromModuleToModule(suite.Ctx, inflationtypes.ModuleName, authtypes.FeeCollectorName, inflCoins) + suite.Require().NoError(err) + err = suite.App.BankKeeper.SendCoinsFromModuleToModule(suite.Ctx, inflationtypes.ModuleName, distrtypes.ModuleName, distrCoins) + suite.Require().NoError(err)*/ } // DeployContract deploys a contract that calls the deposit precompile's methods for testing purposes. -func (s *PrecompileTestSuite) DeployContract(contract evmtypes.CompiledContract) (addr common.Address, err error) { - addr, err = testutil.DeployContract( - s.ctx, - s.app, - s.privKey, - s.queryClientEVM, +func (suite *BaseTestSuite) DeployContract(contract evmtypes.CompiledContract) (addr common.Address, err error) { + addr, err = DeployContract( + suite.Ctx, + suite.App, + suite.PrivKey, + suite.QueryClientEVM, contract, ) return } // NextBlock commits the current block and sets up the next block. -func (s *PrecompileTestSuite) NextBlock() { +func (suite *BaseTestSuite) NextBlock() { var err error - s.ctx, err = testutil.CommitAndCreateNewCtx(s.ctx, s.app, time.Second, s.valSet) - s.Require().NoError(err) + suite.Ctx, err = CommitAndCreateNewCtx(suite.Ctx, suite.App, time.Second, suite.ValSet) + suite.Require().NoError(err) } diff --git a/utils/utils.go b/utils/utils.go index 121c91017..cbbc672ec 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -20,6 +20,8 @@ const ( // TestnetChainID defines the Evmos EIP155 chain ID for testnet // TODO: the testnet chainid is still under consideration and need to be finalized later TestnetChainID = "exocoretestnet_233" + // DefaultChainID is the standard chain id used for testing purposes + DefaultChainID = MainnetChainID + "-1" // BaseDenom defines the Evmos mainnet denomination BaseDenom = "aexo" ) @@ -62,11 +64,11 @@ func IsSupportedKey(pubkey cryptotypes.PubKey) bool { } } -// GetEvmosAddressFromBech32 returns the sdk.Account address of given address, +// GetExocoreAddressFromBech32 returns the sdk.Account address of given address, // while also changing bech32 human readable prefix (HRP) to the value set on // the global sdk.Config (eg: `evmos`). // The function fails if the provided bech32 address is invalid. -func GetEvmosAddressFromBech32(address string) (sdk.AccAddress, error) { +func GetExocoreAddressFromBech32(address string) (sdk.AccAddress, error) { bech32Prefix := strings.SplitN(address, "1", 2)[0] if bech32Prefix == address { return nil, errorsmod.Wrapf(errortypes.ErrInvalidAddress, "invalid bech32 address: %s", address) diff --git a/utils/utils_test.go b/utils/utils_test.go index f3e547835..5240ce5a0 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -17,7 +17,7 @@ import ( func init() { cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount("evmos", "evmospub") + cfg.SetBech32PrefixForAccount("exo", "exopub") } func TestIsSupportedKeys(t *testing.T) { @@ -73,7 +73,7 @@ func TestIsSupportedKeys(t *testing.T) { } } -func TestGetEvmosAddressFromBech32(t *testing.T) { +func TestGetExocoreAddressFromBech32(t *testing.T) { testCases := []struct { name string address string @@ -88,38 +88,38 @@ func TestGetEvmosAddressFromBech32(t *testing.T) { }, { "invalid bech32 address", - "evmos", + "exocore", "", true, }, { "invalid address bytes", - "evmos1123", + "exocore1123", "", true, }, { - "evmos address", - "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", - "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", + "exocore address", + "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", + "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", false, }, { "cosmos address", "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc", - "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", + "exo1qql8ag4cluz6r4dz28p3w00dnc9w8ueu83talg", false, }, { "osmosis address", "osmo1qql8ag4cluz6r4dz28p3w00dnc9w8ueuhnecd2", - "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", + "exo1qql8ag4cluz6r4dz28p3w00dnc9w8ueu83talg", false, }, } for _, tc := range testCases { - addr, err := GetEvmosAddressFromBech32(tc.address) + addr, err := GetExocoreAddressFromBech32(tc.address) if tc.expError { require.Error(t, err, tc.name) } else { @@ -129,7 +129,7 @@ func TestGetEvmosAddressFromBech32(t *testing.T) { } } -func TestEvmosCoinDenom(t *testing.T) { +func TestExocoreCoinDenom(t *testing.T) { testCases := []struct { name string denom string @@ -137,7 +137,7 @@ func TestEvmosCoinDenom(t *testing.T) { }{ { "valid denom - native coin", - "aevmos", + "aexo", false, }, { diff --git a/x/delegation/client/cli/query.go b/x/delegation/client/cli/query.go index 6cc258196..ead51495b 100644 --- a/x/delegation/client/cli/query.go +++ b/x/delegation/client/cli/query.go @@ -34,7 +34,7 @@ func GetQueryCmd() *cobra.Command { // QuerySingleDelegationInfo queries the single delegation info func QuerySingleDelegationInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "QuerySingleDelegationInfo clientChainId stakerAddr assetAddr operatorAddr", + Use: "QuerySingleDelegationInfo clientChainID stakerAddr assetAddr operatorAddr", Short: "Get single delegation info", Long: "Get single delegation info", Args: cobra.ExactArgs(4), diff --git a/x/delegation/keeper/delegation_op_test.go b/x/delegation/keeper/delegation_op_test.go index 3cf6f8d07..33ed6d3e0 100644 --- a/x/delegation/keeper/delegation_op_test.go +++ b/x/delegation/keeper/delegation_op_test.go @@ -11,33 +11,33 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (suite *KeeperTestSuite) TestDelegateTo() { +func (suite *DelegationTestSuite) TestDelegateTo() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ ClientChainLzID: clientChainLzID, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } depositEvent.AssetsAddress = usdtAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, depositEvent) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, depositEvent) suite.NoError(err) - opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") + opAccAddr, err := sdk.AccAddressFromBech32("exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr") suite.NoError(err) delegationParams := &keeper2.DelegationOrUndelegationParams{ ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(50), LzNonce: 0, TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), } - err = suite.app.DelegationKeeper.DelegateTo(suite.ctx, delegationParams) + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, delegationParams) suite.EqualError(err, delegationtype.ErrOperatorNotExist.Error()) registerReq := &delegationtype.RegisterOperatorReq{ @@ -46,15 +46,15 @@ func (suite *KeeperTestSuite) TestDelegateTo() { EarningsAddr: opAccAddr.String(), }, } - _, err = suite.app.DelegationKeeper.RegisterOperator(suite.ctx, registerReq) + _, err = suite.App.DelegationKeeper.RegisterOperator(suite.Ctx, registerReq) suite.NoError(err) - err = suite.app.DelegationKeeper.DelegateTo(suite.ctx, delegationParams) + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, delegationParams) suite.NoError(err) // check delegation states stakerID, assetID := types.GetStakeIDAndAssetID(delegationParams.ClientChainLzID, delegationParams.StakerAddress, delegationParams.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + restakerState, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestDelegateTo() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) + operatorState, err := suite.App.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.Ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: delegationParams.OpAmount, @@ -70,40 +70,40 @@ func (suite *KeeperTestSuite) TestDelegateTo() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) + specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: delegationParams.OpAmount, WaitUndelegationAmount: sdkmath.NewInt(0), }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) + totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(delegationParams.OpAmount, totalDelegationAmount) } -func (suite *KeeperTestSuite) TestUndelegateFrom() { +func (suite *DelegationTestSuite) TestUndelegateFrom() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ ClientChainLzID: clientChainLzID, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } depositEvent.AssetsAddress = usdtAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, depositEvent) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, depositEvent) suite.NoError(err) - opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") + opAccAddr, err := sdk.AccAddressFromBech32("exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr") suite.NoError(err) delegationEvent := &keeper2.DelegationOrUndelegationParams{ ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(50), LzNonce: 0, TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), @@ -114,20 +114,20 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { EarningsAddr: opAccAddr.String(), }, } - _, err = suite.app.DelegationKeeper.RegisterOperator(suite.ctx, registerReq) + _, err = suite.App.DelegationKeeper.RegisterOperator(suite.Ctx, registerReq) suite.NoError(err) - err = suite.app.DelegationKeeper.DelegateTo(suite.ctx, delegationEvent) + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, delegationEvent) suite.NoError(err) // test Undelegation delegationEvent.LzNonce = 1 - err = suite.app.DelegationKeeper.UndelegateFrom(suite.ctx, delegationEvent) + err = suite.App.DelegationKeeper.UndelegateFrom(suite.Ctx, delegationEvent) suite.NoError(err) // check state stakerID, assetID := types.GetStakeIDAndAssetID(delegationEvent.ClientChainLzID, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + restakerState, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -135,7 +135,7 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { WaitUndelegationAmountOrWantChangeValue: delegationEvent.OpAmount, }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) + operatorState, err := suite.App.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.Ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: delegationEvent.OpAmount, @@ -143,18 +143,18 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { WaitUndelegationAmountOrWantChangeValue: delegationEvent.OpAmount, }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) + specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: sdkmath.NewInt(0), WaitUndelegationAmount: delegationEvent.OpAmount, }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) + totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(delegationEvent.OpAmount, totalDelegationAmount) - records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerID, assetID, keeper2.PendingRecords) + records, err := suite.App.DelegationKeeper.GetStakerUndelegationRecords(suite.Ctx, stakerID, assetID, keeper2.PendingRecords) suite.NoError(err) suite.Equal(1, len(records)) UndelegationRecord := &delegationtype.UndelegationRecord{ @@ -163,7 +163,7 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { OperatorAddr: delegationEvent.OperatorAddress.String(), TxHash: delegationEvent.TxHash.String(), IsPending: true, - BlockNumber: uint64(suite.ctx.BlockHeight()), + BlockNumber: uint64(suite.Ctx.BlockHeight()), LzTxNonce: delegationEvent.LzNonce, Amount: delegationEvent.OpAmount, ActualCompletedAmount: sdkmath.NewInt(0), @@ -171,35 +171,35 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { UndelegationRecord.CompleteBlockNumber = UndelegationRecord.BlockNumber + delegationtype.CanUndelegationDelayHeight suite.Equal(UndelegationRecord, records[0]) - suite.ctx.Logger().Info("the complete block number is:", "height", UndelegationRecord.CompleteBlockNumber) - waitUndelegationRecords, err := suite.app.DelegationKeeper.GetWaitCompleteUndelegationRecords(suite.ctx, UndelegationRecord.CompleteBlockNumber) + suite.Ctx.Logger().Info("the complete block number is:", "height", UndelegationRecord.CompleteBlockNumber) + waitUndelegationRecords, err := suite.App.DelegationKeeper.GetWaitCompleteUndelegationRecords(suite.Ctx, UndelegationRecord.CompleteBlockNumber) suite.NoError(err) suite.Equal(1, len(waitUndelegationRecords)) suite.Equal(UndelegationRecord, waitUndelegationRecords[0]) } -func (suite *KeeperTestSuite) TestCompleteUndelegation() { +func (suite *DelegationTestSuite) TestCompleteUndelegation() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ ClientChainLzID: clientChainLzID, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } depositEvent.AssetsAddress = usdtAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, depositEvent) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, depositEvent) suite.NoError(err) - opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") + opAccAddr, err := sdk.AccAddressFromBech32("exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr") suite.NoError(err) delegationEvent := &keeper2.DelegationOrUndelegationParams{ ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(50), LzNonce: 0, TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), @@ -210,26 +210,26 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { EarningsAddr: opAccAddr.String(), }, } - _, err = suite.app.DelegationKeeper.RegisterOperator(suite.ctx, registerReq) + _, err = suite.App.DelegationKeeper.RegisterOperator(suite.Ctx, registerReq) suite.NoError(err) - err = suite.app.DelegationKeeper.DelegateTo(suite.ctx, delegationEvent) + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, delegationEvent) suite.NoError(err) delegationEvent.LzNonce = 1 - err = suite.app.DelegationKeeper.UndelegateFrom(suite.ctx, delegationEvent) + err = suite.App.DelegationKeeper.UndelegateFrom(suite.Ctx, delegationEvent) suite.NoError(err) - UndelegateHeight := suite.ctx.BlockHeight() - suite.ctx.Logger().Info("the ctx block height is:", "height", UndelegateHeight) + UndelegateHeight := suite.Ctx.BlockHeight() + suite.Ctx.Logger().Info("the ctx block height is:", "height", UndelegateHeight) // test complete Undelegation completeBlockNumber := UndelegateHeight + int64(delegationtype.CanUndelegationDelayHeight) - suite.ctx = suite.ctx.WithBlockHeight(completeBlockNumber) - suite.app.DelegationKeeper.EndBlock(suite.ctx, abci.RequestEndBlock{}) + suite.Ctx = suite.Ctx.WithBlockHeight(completeBlockNumber) + suite.App.DelegationKeeper.EndBlock(suite.Ctx, abci.RequestEndBlock{}) // check state stakerID, assetID := types.GetStakeIDAndAssetID(delegationEvent.ClientChainLzID, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + restakerState, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -237,7 +237,7 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) + operatorState, err := suite.App.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.Ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: sdkmath.NewInt(0), @@ -245,18 +245,18 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) + specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: sdkmath.NewInt(0), WaitUndelegationAmount: sdkmath.NewInt(0), }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) + totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(0), totalDelegationAmount) - records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerID, assetID, keeper2.CompletedRecords) + records, err := suite.App.DelegationKeeper.GetStakerUndelegationRecords(suite.Ctx, stakerID, assetID, keeper2.CompletedRecords) suite.NoError(err) suite.Equal(1, len(records)) UndelegationRecord := &delegationtype.UndelegationRecord{ @@ -273,7 +273,7 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { } suite.Equal(UndelegationRecord, records[0]) - waitUndelegationRecords, err := suite.app.DelegationKeeper.GetWaitCompleteUndelegationRecords(suite.ctx, UndelegationRecord.CompleteBlockNumber) + waitUndelegationRecords, err := suite.App.DelegationKeeper.GetWaitCompleteUndelegationRecords(suite.Ctx, UndelegationRecord.CompleteBlockNumber) suite.NoError(err) suite.Equal(1, len(waitUndelegationRecords)) suite.Equal(UndelegationRecord, waitUndelegationRecords[0]) diff --git a/x/delegation/keeper/operator_info_test.go b/x/delegation/keeper/operator_info_test.go index aec84310d..d0b3b1df6 100644 --- a/x/delegation/keeper/operator_info_test.go +++ b/x/delegation/keeper/operator_info_test.go @@ -2,9 +2,9 @@ package keeper_test import delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" -func (suite *KeeperTestSuite) TestOperatorInfo() { +func (suite *DelegationTestSuite) TestOperatorInfo() { info := &delegationtype.OperatorInfo{ - EarningsAddr: suite.accAddress.String(), + EarningsAddr: suite.AccAddress.String(), ApproveAddr: "", OperatorMetaInfo: "test operator", ClientChainEarningsAddr: &delegationtype.ClientChainEarningAddrList{ @@ -13,10 +13,10 @@ func (suite *KeeperTestSuite) TestOperatorInfo() { }, }, } - err := suite.app.DelegationKeeper.SetOperatorInfo(suite.ctx, suite.accAddress.String(), info) + err := suite.App.DelegationKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) suite.NoError(err) - getOperatorInfo, err := suite.app.DelegationKeeper.GetOperatorInfo(suite.ctx, suite.accAddress.String()) + getOperatorInfo, err := suite.App.DelegationKeeper.GetOperatorInfo(suite.Ctx, suite.AccAddress.String()) suite.NoError(err) suite.Equal(*info, *getOperatorInfo) } diff --git a/x/delegation/keeper/setup_test.go b/x/delegation/keeper/setup_test.go index ce52efbcb..c139e4874 100644 --- a/x/delegation/keeper/setup_test.go +++ b/x/delegation/keeper/setup_test.go @@ -1,33 +1,23 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - signer keyring.Signer - accAddress sdk.AccAddress +type DelegationTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *DelegationTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(DelegationTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -35,6 +25,6 @@ func TestKeeperTestSuite(t *testing.T) { RunSpecs(t, "Keeper Suite") } -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *DelegationTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/delegation/keeper/utils_test.go b/x/delegation/keeper/utils_test.go deleted file mode 100644 index 8abc9db4a..000000000 --- a/x/delegation/keeper/utils_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types" - "github.com/stretchr/testify/require" - "golang.org/x/exp/rand" -) - -// Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // accAddress - pubBz := make([]byte, ed25519.PubKeySize) - pub := &ed25519.PubKey{Key: pubBz} - rand.Read(pub.Key) - suite.accAddress = sdk.AccAddress(pub.Address()) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState(), chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/deposit/keeper/deposit_test.go b/x/deposit/keeper/deposit_test.go index 46f9e51d0..41c87e024 100644 --- a/x/deposit/keeper/deposit_test.go +++ b/x/deposit/keeper/deposit_test.go @@ -8,33 +8,33 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (suite *KeeperTestSuite) TestDeposit() { +func (suite *DepositTestSuite) TestDeposit() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") params := &keeper.DepositParams{ ClientChainLzID: 101, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } // test the case that the deposit asset hasn't registered params.AssetsAddress = usdcAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, params) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, params) suite.ErrorContains(err, deposittype.ErrDepositAssetNotExist.Error()) - assets, err := suite.app.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.ctx) + assets, err := suite.App.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.Ctx) suite.NoError(err) - suite.app.Logger().Info("the assets is:", "assets", assets) + suite.App.Logger().Info("the assets is:", "assets", assets) // test the normal case params.AssetsAddress = usdtAddress[:] - err = suite.app.DepositKeeper.Deposit(suite.ctx, params) + err = suite.App.DepositKeeper.Deposit(suite.Ctx, params) suite.NoError(err) // check state after deposit stakerID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: params.OpAmount, @@ -42,7 +42,7 @@ func (suite *KeeperTestSuite) TestDeposit() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) + assetInfo, err := suite.App.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.Ctx, assetID) suite.NoError(err) suite.Equal(params.OpAmount, assetInfo.StakingTotalAmount) } diff --git a/x/deposit/keeper/params_test.go b/x/deposit/keeper/params_test.go index f40415fff..016486003 100644 --- a/x/deposit/keeper/params_test.go +++ b/x/deposit/keeper/params_test.go @@ -4,15 +4,15 @@ import ( deposittype "github.com/ExocoreNetwork/exocore/x/deposit/types" ) -func (suite *KeeperTestSuite) TestParams() { +func (suite *DepositTestSuite) TestParams() { params := &deposittype.Params{ ExoCoreLzAppAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", ExoCoreLzAppEventTopic: "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec", } - err := suite.app.DepositKeeper.SetParams(suite.ctx, params) + err := suite.App.DepositKeeper.SetParams(suite.Ctx, params) suite.NoError(err) - getParams, err := suite.app.DepositKeeper.GetParams(suite.ctx) + getParams, err := suite.App.DepositKeeper.GetParams(suite.Ctx) suite.NoError(err) suite.Equal(*params, *getParams) } diff --git a/x/deposit/keeper/setup_test.go b/x/deposit/keeper/setup_test.go index 13bd11a79..c6b43ccc3 100644 --- a/x/deposit/keeper/setup_test.go +++ b/x/deposit/keeper/setup_test.go @@ -1,32 +1,23 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - signer keyring.Signer +type DepositTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *DepositTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(DepositTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -34,6 +25,6 @@ func TestKeeperTestSuite(t *testing.T) { RunSpecs(t, "Keeper Suite") } -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *DepositTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/deposit/keeper/utils_test.go b/x/deposit/keeper/utils_test.go deleted file mode 100644 index 8116e8070..000000000 --- a/x/deposit/keeper/utils_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types" - "github.com/stretchr/testify/require" -) - -// Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState(), chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/evm/types/params.go b/x/evm/types/params.go index d0419b159..0dcacfceb 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -1,22 +1,26 @@ package types import ( - utils "github.com/ExocoreNetwork/exocore/utils" + "github.com/ExocoreNetwork/exocore/utils" evmtype "github.com/evmos/evmos/v14/x/evm/types" ) // ExocoreAvailableEVMExtensions defines the default active precompiles -var ExocoreAvailableEVMExtensions = []string{ - "0x0000000000000000000000000000000000000800", // Staking precompile - "0x0000000000000000000000000000000000000801", // Distribution precompile - "0x0000000000000000000000000000000000000802", // ICS20 transfer precompile - "0x0000000000000000000000000000000000000803", // Vesting precompile - "0x0000000000000000000000000000000000000804", // deposit precompile - "0x0000000000000000000000000000000000000805", // delegation precompile - "0x0000000000000000000000000000000000000806", // reward precompile - "0x0000000000000000000000000000000000000807", // slash precompile - "0x0000000000000000000000000000000000000808", // withdraw precompile -} +var ( + // DefaultEVMDenom defines the default EVM denomination on Exocore + DefaultEVMDenom = utils.BaseDenom + ExocoreAvailableEVMExtensions = []string{ + "0x0000000000000000000000000000000000000800", // Staking precompile + "0x0000000000000000000000000000000000000801", // Distribution precompile + "0x0000000000000000000000000000000000000802", // ICS20 transfer precompile + "0x0000000000000000000000000000000000000803", // Vesting precompile + "0x0000000000000000000000000000000000000804", // deposit precompile + "0x0000000000000000000000000000000000000805", // delegation precompile + "0x0000000000000000000000000000000000000806", // reward precompile + "0x0000000000000000000000000000000000000807", // slash precompile + "0x0000000000000000000000000000000000000808", // withdraw precompile + } +) // ExocoreEvmDefaultParams returns default evm parameters // ExtraEIPs is empty to prevent overriding the latest hard fork instruction set @@ -24,7 +28,7 @@ var ExocoreAvailableEVMExtensions = []string{ // from the EVM configuration. func ExocoreEvmDefaultParams() evmtype.Params { return evmtype.Params{ - EvmDenom: utils.BaseDenom, + EvmDenom: DefaultEVMDenom, EnableCreate: evmtype.DefaultEnableCreate, EnableCall: evmtype.DefaultEnableCall, ChainConfig: evmtype.DefaultChainConfig(), diff --git a/x/native_token/module.go b/x/native_token/module.go index 4ad59d5b4..08a16273a 100644 --- a/x/native_token/module.go +++ b/x/native_token/module.go @@ -85,9 +85,9 @@ type IDeposit interface { PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error // SetReStakerExoCoreAddr handle the SetReStakerExoCoreAddr txs from msg service - SetReStakerExoCoreAddr(ctx context.Context, reStakerId string) (err error) - GetReStakerExoCoreAddr(reStakerId string) (addr sdk.Address, err error) + SetReStakerExoCoreAddr(ctx context.Context, reStakerID string) (err error) + GetReStakerExoCoreAddr(reStakerID string) (addr sdk.Address, err error) // Deposit internal func for PostTxProcessing - Deposit(reStakerId string, assetsInfo map[string]math.Uint) error + Deposit(reStakerID string, assetsInfo map[string]math.Uint) error } diff --git a/x/native_token/types/keys.go b/x/native_token/types/keys.go index 5835491f9..bcc3947a5 100644 --- a/x/native_token/types/keys.go +++ b/x/native_token/types/keys.go @@ -28,6 +28,6 @@ const ( prefixReStakerExocoreAddr = iota + 1 ) -// KeyPrefixReStakerExoCoreAddr reStakerId = clientChainAddr+'_'+ExoCoreChainIndex -// KeyPrefixReStakerExoCoreAddr key-value: reStakerId->exoCoreAddr +// KeyPrefixReStakerExoCoreAddr reStakerID = clientChainAddr+'_'+ExoCoreChainIndex +// KeyPrefixReStakerExoCoreAddr key-value: reStakerID->exoCoreAddr var KeyPrefixReStakerExoCoreAddr = []byte{prefixReStakerExocoreAddr} diff --git a/x/restaking_assets_manage/client/cli/query.go b/x/restaking_assets_manage/client/cli/query.go index cce124677..a3d0e1a0f 100644 --- a/x/restaking_assets_manage/client/cli/query.go +++ b/x/restaking_assets_manage/client/cli/query.go @@ -190,7 +190,7 @@ func QueStakerAssetInfos() *cobra.Command { // QueStakerSpecifiedAssetAmount queries staker specified asset info func QueStakerSpecifiedAssetAmount() *cobra.Command { cmd := &cobra.Command{ - Use: "QueStakerSpecifiedAssetAmount clientChainId stakerAddr assetAddr", + Use: "QueStakerSpecifiedAssetAmount clientChainID stakerAddr assetAddr", Short: "Get staker specified asset state", Long: "Get staker specified asset state", Args: cobra.ExactArgs(3), @@ -254,7 +254,7 @@ func QueOperatorAssetInfos() *cobra.Command { // QueOperatorSpecifiedAssetAmount queries specified operator asset info func QueOperatorSpecifiedAssetAmount() *cobra.Command { cmd := &cobra.Command{ - Use: "QueOperatorSpecifiedAssetAmount operatorAddr clientChainId assetAddr", + Use: "QueOperatorSpecifiedAssetAmount operatorAddr clientChainID assetAddr", Short: "Get operator specified asset state", Long: "Get operator specified asset state", Args: cobra.ExactArgs(3), diff --git a/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go b/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go index a776ee0a4..83e1b2e30 100644 --- a/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go +++ b/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go @@ -5,29 +5,29 @@ import ( "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" ) -func (suite *KeeperTestSuite) TestGenesisClientChainAndAssetInfo() { +func (suite *StakingAssetsTestSuite) TestGenesisClientChainAndAssetInfo() { defaultGensisState := restaking_assets_manage.DefaultGenesisState() // test the client chains getting - clientChains, err := suite.app.StakingAssetsManageKeeper.GetAllClientChainInfo(suite.ctx) + clientChains, err := suite.App.StakingAssetsManageKeeper.GetAllClientChainInfo(suite.Ctx) suite.NoError(err) - suite.ctx.Logger().Info("the clientChains is:", "info", clientChains) + suite.Ctx.Logger().Info("the clientChains is:", "info", clientChains) for _, clientChain := range defaultGensisState.DefaultSupportedClientChains { info, ok := clientChains[clientChain.LayerZeroChainID] suite.True(ok) suite.Equal(info, clientChain) } - chainInfo, err := suite.app.StakingAssetsManageKeeper.GetClientChainInfoByIndex(suite.ctx, 101) + chainInfo, err := suite.App.StakingAssetsManageKeeper.GetClientChainInfoByIndex(suite.Ctx, 101) suite.NoError(err) suite.Equal(clientChains[101], chainInfo) // test the client chain assets getting - assets, err := suite.app.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.ctx) + assets, err := suite.App.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.Ctx) suite.NoError(err) for _, asset := range defaultGensisState.DefaultSupportedClientChainTokens { _, assetID := types.GetStakeIDAndAssetIDFromStr(asset.LayerZeroChainID, "", asset.Address) - suite.ctx.Logger().Info("the asset id is:", "assetID", assetID) + suite.Ctx.Logger().Info("the asset id is:", "assetID", assetID) info, ok := assets[assetID] suite.True(ok) suite.Equal(asset, info.AssetBasicInfo) @@ -35,7 +35,7 @@ func (suite *KeeperTestSuite) TestGenesisClientChainAndAssetInfo() { usdtAsset := defaultGensisState.DefaultSupportedClientChainTokens[0] _, assetID := types.GetStakeIDAndAssetIDFromStr(usdtAsset.LayerZeroChainID, "", usdtAsset.Address) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) + assetInfo, err := suite.App.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.Ctx, assetID) suite.NoError(err) suite.Equal(usdtAsset, assetInfo.AssetBasicInfo) } diff --git a/x/restaking_assets_manage/keeper/setup_test.go b/x/restaking_assets_manage/keeper/setup_test.go index 13bd11a79..21d80f32f 100644 --- a/x/restaking_assets_manage/keeper/setup_test.go +++ b/x/restaking_assets_manage/keeper/setup_test.go @@ -1,32 +1,23 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - signer keyring.Signer +type StakingAssetsTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *StakingAssetsTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(StakingAssetsTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -34,6 +25,6 @@ func TestKeeperTestSuite(t *testing.T) { RunSpecs(t, "Keeper Suite") } -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *StakingAssetsTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/restaking_assets_manage/keeper/staker_asset_test.go b/x/restaking_assets_manage/keeper/staker_asset_test.go index 9d8232c32..563166d72 100644 --- a/x/restaking_assets_manage/keeper/staker_asset_test.go +++ b/x/restaking_assets_manage/keeper/staker_asset_test.go @@ -8,20 +8,20 @@ import ( restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" ) -func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { - stakerID := fmt.Sprintf("%s_%s", suite.address, "0") - ethUniAssetId := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") +func (suite *StakingAssetsTestSuite) TestUpdateStakerAssetsState() { + stakerID := fmt.Sprintf("%s_%s", suite.Address, "0") + ethUniAssetID := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") ethUniInitialChangeValue := restakingtype.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: math.NewInt(1000), CanWithdrawAmountOrWantChangeValue: math.NewInt(1000), } // test the initial storage of statker assets state - err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err := suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().NoError(err) // test that the retrieved value is correct - getInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) + getInfo, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUniAssetID) suite.Require().NoError(err) suite.Require().True(ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue.Equal(getInfo.TotalDepositAmountOrWantChangeValue)) suite.Require().True(ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue.Equal(getInfo.CanWithdrawAmountOrWantChangeValue)) @@ -29,16 +29,16 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { // test ErrInputUpdateStateIsZero /* ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(0) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(0) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) - suite.Require().Error(err, types2.ErrInputUpdateStateIsZero)*/ + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) + suite.Require().Error(err, restakingtype.ErrInputUpdateStateIsZero)*/ // test valid increase of staker asset state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) + getInfo, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUniAssetID) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1500))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1500))) @@ -46,9 +46,9 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { // test valid decrease of staker asset state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) + getInfo, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUniAssetID) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) @@ -56,40 +56,40 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { // test the decreased amount is bigger than original state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-2000) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().Error(err, restakingtype.ErrSubAmountIsMoreThanOrigin) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) + getInfo, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUniAssetID) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-2000) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().Error(err, restakingtype.ErrSubAmountIsMoreThanOrigin) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) + getInfo, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUniAssetID) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) // test the storage of multiple assets state - ethUsdtAssetId := fmt.Sprintf("%s_%s", "0xdac17f958d2ee523a2206206994597c13d831ec7", "101") + ethUsdtAssetID := fmt.Sprintf("%s_%s", "0xdac17f958d2ee523a2206206994597c13d831ec7", "101") ethUsdtInitialChangeValue := restakingtype.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: math.NewInt(2000), CanWithdrawAmountOrWantChangeValue: math.NewInt(2000), } - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUsdtAssetId, ethUsdtInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUsdtAssetID, ethUsdtInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUsdtAssetId) + getInfo, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, ethUsdtAssetID) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(2000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(2000))) } -func (suite *KeeperTestSuite) TestGetStakerAssetInfos() { - stakerID := fmt.Sprintf("%s_%s", suite.address, "0") - ethUniAssetId := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") - ethUsdtAssetId := fmt.Sprintf("%s_%s", "0xdac17f958d2ee523a2206206994597c13d831ec7", "101") +func (suite *StakingAssetsTestSuite) TestGetStakerAssetInfos() { + stakerID := fmt.Sprintf("%s_%s", suite.Address, "0") + ethUniAssetID := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") + ethUsdtAssetID := fmt.Sprintf("%s_%s", "0xdac17f958d2ee523a2206206994597c13d831ec7", "101") ethUniInitialChangeValue := restakingtype.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: math.NewInt(1000), CanWithdrawAmountOrWantChangeValue: math.NewInt(1000), @@ -98,20 +98,20 @@ func (suite *KeeperTestSuite) TestGetStakerAssetInfos() { TotalDepositAmountOrWantChangeValue: math.NewInt(2000), CanWithdrawAmountOrWantChangeValue: math.NewInt(2000), } - err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) + err := suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUniAssetID, ethUniInitialChangeValue) suite.Require().NoError(err) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUsdtAssetId, ethUsdtInitialChangeValue) + err = suite.App.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.Ctx, stakerID, ethUsdtAssetID, ethUsdtInitialChangeValue) suite.Require().NoError(err) // test get all assets state of staker - assetsInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerAssetInfos(suite.ctx, stakerID) + assetsInfo, err := suite.App.StakingAssetsManageKeeper.GetStakerAssetInfos(suite.Ctx, stakerID) suite.Require().NoError(err) - uniState, isExist := assetsInfo[ethUniAssetId] + uniState, isExist := assetsInfo[ethUniAssetID] suite.Require().True(isExist) suite.Require().True(uniState.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(uniState.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) - usdtState, isExist := assetsInfo[ethUsdtAssetId] + usdtState, isExist := assetsInfo[ethUsdtAssetID] suite.Require().True(isExist) suite.Require().True(usdtState.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(2000))) suite.Require().True(usdtState.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(2000))) diff --git a/x/restaking_assets_manage/keeper/utils_test.go b/x/restaking_assets_manage/keeper/utils_test.go deleted file mode 100644 index 8116e8070..000000000 --- a/x/restaking_assets_manage/keeper/utils_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types" - "github.com/stretchr/testify/require" -) - -// Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState(), chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/restaking_assets_manage/types/general.go b/x/restaking_assets_manage/types/general.go index 75f92a609..1d2e39dd2 100644 --- a/x/restaking_assets_manage/types/general.go +++ b/x/restaking_assets_manage/types/general.go @@ -15,7 +15,7 @@ const ( ClientChainLzIDIndexInTopics = 0 LzNonceIndexInTopics = 2 - ExoCoreOperatorAddrLength = 44 + ExoCoreOperatorAddrLength = 42 ) type GeneralAssetsAddr [32]byte diff --git a/x/reward/keeper/claim_reward_test.go b/x/reward/keeper/claim_reward_test.go index d2caf5818..c2bda596b 100644 --- a/x/reward/keeper/claim_reward_test.go +++ b/x/reward/keeper/claim_reward_test.go @@ -8,29 +8,29 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { +func (suite *RewardTestSuite) TestClaimWithdrawRequest() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.RewardParams{ ClientChainLzID: 101, Action: types.WithDrawReward, - WithdrawRewardAddress: suite.address[:], + WithdrawRewardAddress: suite.Address[:], OpAmount: sdkmath.NewInt(10), } // test the case that the deposit asset hasn't registered event.AssetsAddress = usdcAddress[:] - err := suite.app.RewardKeeper.RewardForWithdraw(suite.ctx, event) + err := suite.App.RewardKeeper.RewardForWithdraw(suite.Ctx, event) suite.ErrorContains(err, rewardtype.ErrRewardAssetNotExist.Error()) // test the normal case event.AssetsAddress = usdtAddress[:] - err = suite.app.RewardKeeper.RewardForWithdraw(suite.ctx, event) + err = suite.App.RewardKeeper.RewardForWithdraw(suite.Ctx, event) suite.NoError(err) // check state after reward stakerID, assetID := types.GetStakeIDAndAssetID(event.ClientChainLzID, event.WithdrawRewardAddress, event.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) + assetInfo, err := suite.App.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.Ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/reward/keeper/params_test.go b/x/reward/keeper/params_test.go index 5de13d449..3dfa1fd9e 100644 --- a/x/reward/keeper/params_test.go +++ b/x/reward/keeper/params_test.go @@ -4,15 +4,15 @@ import ( rewardtype "github.com/ExocoreNetwork/exocore/x/reward/types" ) -func (suite *KeeperTestSuite) TestParams() { +func (suite *RewardTestSuite) TestParams() { params := &rewardtype.Params{ ExoCoreLzAppAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", ExoCoreLzAppEventTopic: "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec", } - err := suite.app.RewardKeeper.SetParams(suite.ctx, params) + err := suite.App.RewardKeeper.SetParams(suite.Ctx, params) suite.NoError(err) - getParams, err := suite.app.RewardKeeper.GetParams(suite.ctx) + getParams, err := suite.App.RewardKeeper.GetParams(suite.Ctx) suite.NoError(err) suite.Equal(*params, *getParams) } diff --git a/x/reward/keeper/setup_test.go b/x/reward/keeper/setup_test.go index f8d0365c3..1927a5b17 100644 --- a/x/reward/keeper/setup_test.go +++ b/x/reward/keeper/setup_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" //nolint:revive // dot imports are fine for Ginkgo @@ -8,27 +9,17 @@ import ( //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/gomega" - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - - signer keyring.Signer +type RewardTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *RewardTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(RewardTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -37,6 +28,6 @@ func TestKeeperTestSuite(t *testing.T) { } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *RewardTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/reward/keeper/utils_test.go b/x/reward/keeper/utils_test.go deleted file mode 100644 index 8dcb23033..000000000 --- a/x/reward/keeper/utils_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - "github.com/stretchr/testify/require" -) - -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, nil, chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/slash/keeper/execute_slash_test.go b/x/slash/keeper/execute_slash_test.go index 0986a2ac7..a222f02b0 100644 --- a/x/slash/keeper/execute_slash_test.go +++ b/x/slash/keeper/execute_slash_test.go @@ -9,39 +9,39 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (suite *KeeperTestSuite) TestSlash() { +func (suite *SlashTestSuite) TestSlash() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.SlashParams{ ClientChainLzID: 101, Action: types.Slash, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(90), } depositEvent := &depositKeeper.DepositParams{ ClientChainLzID: 101, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } // deposit firstly depositEvent.AssetsAddress = usdtAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, depositEvent) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, depositEvent) suite.NoError(err) // test the case that the slash hasn't registered event.AssetsAddress = usdcAddress[:] - err = suite.app.ExoSlashKeeper.Slash(suite.ctx, event) + err = suite.App.ExoSlashKeeper.Slash(suite.Ctx, event) suite.ErrorContains(err, slashtype.ErrSlashAssetNotExist.Error()) - assets, err := suite.app.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.ctx) + assets, err := suite.App.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.Ctx) suite.NoError(err) - suite.app.Logger().Info("the assets is:", "assets", assets) + suite.App.Logger().Info("the assets is:", "assets", assets) stakerID, assetID := types.GetStakeIDAndAssetID(depositEvent.ClientChainLzID, depositEvent.StakerAddress, depositEvent.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -51,12 +51,12 @@ func (suite *KeeperTestSuite) TestSlash() { // test the normal case event.AssetsAddress = usdtAddress[:] - err = suite.app.ExoSlashKeeper.Slash(suite.ctx, event) + err = suite.App.ExoSlashKeeper.Slash(suite.Ctx, event) suite.NoError(err) // check state after slash stakerID, assetID = types.GetStakeIDAndAssetID(event.ClientChainLzID, event.StakerAddress, event.AssetsAddress) - info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestSlash() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) + assetInfo, err := suite.App.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.Ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/slash/keeper/params_test.go b/x/slash/keeper/params_test.go index c89f832aa..4d4342717 100644 --- a/x/slash/keeper/params_test.go +++ b/x/slash/keeper/params_test.go @@ -4,15 +4,15 @@ import ( slashtype "github.com/ExocoreNetwork/exocore/x/slash/types" ) -func (suite *KeeperTestSuite) TestParams() { +func (suite *SlashTestSuite) TestParams() { params := &slashtype.Params{ ExoCoreLzAppAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", ExoCoreLzAppEventTopic: "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec", } - err := suite.app.ExoSlashKeeper.SetParams(suite.ctx, params) + err := suite.App.ExoSlashKeeper.SetParams(suite.Ctx, params) suite.NoError(err) - getParams, err := suite.app.ExoSlashKeeper.GetParams(suite.ctx) + getParams, err := suite.App.ExoSlashKeeper.GetParams(suite.Ctx) suite.NoError(err) suite.Equal(*params, *getParams) } diff --git a/x/slash/keeper/setup_test.go b/x/slash/keeper/setup_test.go index f8d0365c3..cf45470b0 100644 --- a/x/slash/keeper/setup_test.go +++ b/x/slash/keeper/setup_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" //nolint:revive // dot imports are fine for Ginkgo @@ -8,27 +9,17 @@ import ( //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/gomega" - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - - signer keyring.Signer +type SlashTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *SlashTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(SlashTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -37,6 +28,6 @@ func TestKeeperTestSuite(t *testing.T) { } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *SlashTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/slash/keeper/utils_test.go b/x/slash/keeper/utils_test.go deleted file mode 100644 index 8dcb23033..000000000 --- a/x/slash/keeper/utils_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - "github.com/stretchr/testify/require" -) - -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, nil, chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/withdraw/client/cli/query.go b/x/withdraw/client/cli/query.go index 229a8827e..523254dd8 100644 --- a/x/withdraw/client/cli/query.go +++ b/x/withdraw/client/cli/query.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - // "strings" "github.com/spf13/cobra" diff --git a/x/withdraw/client/cli/tx.go b/x/withdraw/client/cli/tx.go index cca9df077..ac1e77b6a 100644 --- a/x/withdraw/client/cli/tx.go +++ b/x/withdraw/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "github.com/ExocoreNetwork/exocore/x/withdraw/types" "github.com/spf13/cobra" diff --git a/x/withdraw/keeper/claim_withdraw_test.go b/x/withdraw/keeper/claim_withdraw_test.go index d1457d887..f40e3a31c 100644 --- a/x/withdraw/keeper/claim_withdraw_test.go +++ b/x/withdraw/keeper/claim_withdraw_test.go @@ -9,39 +9,39 @@ import ( "github.com/ethereum/go-ethereum/common" ) -func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { +func (suite *WithdrawTestSuite) TestClaimWithdrawRequest() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.WithdrawParams{ ClientChainLzID: 101, Action: types.WithdrawPrinciple, - WithdrawAddress: suite.address[:], + WithdrawAddress: suite.Address[:], OpAmount: sdkmath.NewInt(90), } depositEvent := &depositKeeper.DepositParams{ ClientChainLzID: 101, Action: types.Deposit, - StakerAddress: suite.address[:], + StakerAddress: suite.Address[:], OpAmount: sdkmath.NewInt(100), } // deposit firstly depositEvent.AssetsAddress = usdtAddress[:] - err := suite.app.DepositKeeper.Deposit(suite.ctx, depositEvent) + err := suite.App.DepositKeeper.Deposit(suite.Ctx, depositEvent) suite.NoError(err) // test the case that the withdraw asset hasn't registered event.AssetsAddress = usdcAddress[:] - err = suite.app.WithdrawKeeper.Withdraw(suite.ctx, event) + err = suite.App.WithdrawKeeper.Withdraw(suite.Ctx, event) suite.ErrorContains(err, withdrawtype.ErrWithdrawAssetNotExist.Error()) - assets, err := suite.app.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.ctx) + assets, err := suite.App.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.Ctx) suite.NoError(err) - suite.app.Logger().Info("the assets is:", "assets", assets) + suite.App.Logger().Info("the assets is:", "assets", assets) stakerID, assetID := types.GetStakeIDAndAssetID(depositEvent.ClientChainLzID, depositEvent.StakerAddress, depositEvent.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err := suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -50,12 +50,12 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { }, *info) // test the normal case event.AssetsAddress = usdtAddress[:] - err = suite.app.WithdrawKeeper.Withdraw(suite.ctx, event) + err = suite.App.WithdrawKeeper.Withdraw(suite.Ctx, event) suite.NoError(err) // check state after withdraw stakerID, assetID = types.GetStakeIDAndAssetID(event.ClientChainLzID, event.WithdrawAddress, event.AssetsAddress) - info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) + info, err = suite.App.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.Ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) + assetInfo, err := suite.App.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.Ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/withdraw/keeper/setup_test.go b/x/withdraw/keeper/setup_test.go index f8d0365c3..9dd0c641a 100644 --- a/x/withdraw/keeper/setup_test.go +++ b/x/withdraw/keeper/setup_test.go @@ -1,34 +1,24 @@ package keeper_test import ( + "github.com/ExocoreNetwork/exocore/testutil" "testing" //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/ginkgo/v2" //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/gomega" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.ExocoreApp - address common.Address - - signer keyring.Signer +type WithdrawTestSuite struct { + testutil.BaseTestSuite } -var s *KeeperTestSuite +var s *WithdrawTestSuite func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) + s = new(WithdrawTestSuite) suite.Run(t, s) // Run Ginkgo integration tests @@ -37,6 +27,6 @@ func TestKeeperTestSuite(t *testing.T) { } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func (suite *WithdrawTestSuite) SetupTest() { + suite.DoSetupTest() } diff --git a/x/withdraw/keeper/utils_test.go b/x/withdraw/keeper/utils_test.go deleted file mode 100644 index 8dcb23033..000000000 --- a/x/withdraw/keeper/utils_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package keeper_test - -import ( - "time" - - "github.com/ExocoreNetwork/exocore/app" - "github.com/ExocoreNetwork/exocore/utils" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" - "github.com/evmos/evmos/v14/crypto/ethsecp256k1" - "github.com/evmos/evmos/v14/testutil" - utiltx "github.com/evmos/evmos/v14/testutil/tx" - "github.com/stretchr/testify/require" -) - -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = utiltx.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - chainID := utils.TestnetChainID + "-1" - suite.app = app.Setup(false, nil, chainID, false) - header := testutil.NewHeader( - 1, time.Now().UTC(), chainID, consAddress, nil, nil, - ) - suite.ctx = suite.app.BaseApp.NewContext(false, header) -} diff --git a/x/withdraw/module.go b/x/withdraw/module.go index 0a0b3c92e..5b28f8ba2 100644 --- a/x/withdraw/module.go +++ b/x/withdraw/module.go @@ -45,13 +45,13 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {} +func (a AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} +func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module func (a AppModuleBasic) GetTxCmd() *cobra.Command { @@ -85,9 +85,9 @@ func NewAppModule( } // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { +func (am AppModule) RegisterServices(_ module.Configurator) { // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - //types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + // types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) From f3df5ef2b43c3081d446af7ebe02c2bd0f826c70 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:59:15 +0530 Subject: [PATCH 38/41] feat(dogfood): asset ids, oracle usage (#11) * feat(dogfood): add asset_ids param * feat(dogfood): move to average pricing * fix(dogfood): relint, add epoch id for avg * chore(dogfood): golangci-lint * chore(dogfood): lint gosec again * fix(dogfood): use correct string for pubkey * fix(dogfood): ++ the undelegation hold count The line was accidentally deleted. --- proto/exocore/dogfood/v1/dogfood.proto | 54 +- proto/exocore/dogfood/v1/params.proto | 5 + x/dogfood/keeper/abci.go | 124 ++- x/dogfood/keeper/genesis.go | 22 +- x/dogfood/keeper/impl_delegation_hooks.go | 104 +-- x/dogfood/keeper/impl_epochs_hooks.go | 12 +- x/dogfood/keeper/impl_operator_hooks.go | 119 +-- x/dogfood/keeper/keeper.go | 41 +- x/dogfood/keeper/params.go | 14 +- x/dogfood/keeper/pending.go | 30 - x/dogfood/keeper/queue.go | 45 -- x/dogfood/keeper/unbonding.go | 11 +- x/dogfood/keeper/validators.go | 73 +- x/dogfood/module.go | 4 +- x/dogfood/types/dogfood.pb.go | 899 ++++++++-------------- x/dogfood/types/expected_keepers.go | 10 + x/dogfood/types/keys.go | 17 + x/dogfood/types/params.go | 65 +- x/dogfood/types/params.pb.go | 99 ++- 19 files changed, 728 insertions(+), 1020 deletions(-) delete mode 100644 x/dogfood/keeper/queue.go diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index 8f5ad37f5..28f16e9e5 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -8,7 +8,6 @@ import "google/protobuf/timestamp.proto"; import "cosmos/staking/v1beta1/staking.proto"; import "cosmos_proto/cosmos.proto"; -import "tendermint/crypto/keys.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; @@ -27,52 +26,6 @@ message ExocoreValidator { ]; } -// OperationType is used to indicate the type of operation that is being -// cached by the module to create the updated validator set. -enum OperationType { - option (gogoproto.goproto_enum_prefix) = false; - // KeyOpUnspecified is used to indicate that the operation type is not specified. - // This should never be used. - OPERATION_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "KeyOpUnspecified" ]; - // KeyAddition is used to indicate that the operation is a key addition. - OPERATION_TYPE_ADDITION_OR_UPDATE = 1 [ (gogoproto.enumvalue_customname) = "KeyAdditionOrUpdate" ]; - // KeyRemoval is used to indicate that the operation is a key removal. Typically - // this is done due to key replacement mechanism and not directly. - OPERATION_TYPE_REMOVAL = 2 [ (gogoproto.enumvalue_customname) = "KeyRemoval" ]; -} - -// QueueResultType is used to indicate the result of the queue operation. -enum QueueResultType { - option (gogoproto.goproto_enum_prefix) = false; - // QueueResultUnspecified is used to indicate that the queue result type is not specified. - QUEUE_RESULT_TYPE_UNSPECIFIED = 0 [ (gogoproto.enumvalue_customname) = "QueueResultUnspecified" ]; - // QueueResultSuccess is used to indicate that the queue operation was successful. - QUEUE_RESULT_TYPE_SUCCESS = 1 [ (gogoproto.enumvalue_customname) = "QueueResultSuccess" ]; - // QueueResultExists is used to indicate that the queue operation failed because the - // operation already exists in the queue. - QUEUE_RESULT_TYPE_EXISTS = 2 [ (gogoproto.enumvalue_customname) = "QueueResultExists" ]; - // QueueResultRemoved is used to indicate that the queue operation resulted in an existing - // operation being removed from the queue. - QUEUE_RESULT_TYPE_REMOVED = 3 [ (gogoproto.enumvalue_customname) = "QueueResultRemoved" ]; -} - -// Operation is used to indicate the operation that is being cached by the module -// to create the updated validator set. -message Operation { - // OperationType is the type of the operation (addition / removal). - OperationType operation_type = 1; - // OperatorAddress is the sdk.AccAddress of the operator. - bytes operator_address = 2; - // PubKey is the public key for which the operation is being applied. - tendermint.crypto.PublicKey pub_key = 3 [(gogoproto.nullable) = false]; -} - -// Operations is a collection of Operation. -message Operations { - // list is the list of operations. - repeated Operation list = 1 [(gogoproto.nullable) = false]; -} - // AccountAddresses represents a list of account addresses. It is used to store the list of // operator addresses whose operations are maturing at an epoch. message AccountAddresses { @@ -110,4 +63,11 @@ message HeaderSubset { bytes next_validators_hash = 2; // state after txs from the previous block bytes app_hash = 3; +} + +// KeyPowerMapping is a mapping of the consensus public key (as a string) +// to the power of the key. +message KeyPowerMapping { + // list is the actual mapping of the consensus public key to the power. + map list = 1; } \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/params.proto b/proto/exocore/dogfood/v1/params.proto index 4d3f94a8d..790908699 100644 --- a/proto/exocore/dogfood/v1/params.proto +++ b/proto/exocore/dogfood/v1/params.proto @@ -20,4 +20,9 @@ message Params { uint32 max_validators = 3; // HistoricalEntries is the number of historical entries to persist. uint32 historical_entries = 4; + // AssetIDs is the ids of the assets which will be accepted by the module. + // It must be within the list of assets supported by the restaking module. + // The typical format of these IDs is + // lower(assetAddress) + _ + hex(clientChainLzID) + repeated string asset_ids = 5 [(gogoproto.customname) = "AssetIDs"]; } diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go index a9641c68d..040aabdf5 100644 --- a/x/dogfood/keeper/abci.go +++ b/x/dogfood/keeper/abci.go @@ -1,12 +1,21 @@ package keeper import ( - "github.com/ExocoreNetwork/exocore/x/dogfood/types" + "sort" + abci "github.com/cometbft/cometbft/abci/types" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" ) func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { + id, _ := k.getValidatorSetID(ctx, ctx.BlockHeight()) + if !k.IsEpochEnd(ctx) { + // save the same id for the next block height. + k.setValidatorSetID(ctx, ctx.BlockHeight()+1, id) + return []abci.ValidatorUpdate{} + } + defer k.ClearEpochEnd(ctx) // start with clearing the hold on the undelegations. undelegations := k.GetPendingUndelegations(ctx) for _, undelegation := range undelegations.GetList() { @@ -30,40 +39,95 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { } k.ClearPendingConsensusAddrs(ctx) // finally, perform the actual operations of vote power changes. - operations := k.GetPendingOperations(ctx) - id, _ := k.getValidatorSetID(ctx, ctx.BlockHeight()) - if len(operations.GetList()) == 0 { - // there is no validator set change, so we just increment the block height - // and retain the same val set id mapping. - k.setValidatorSetID(ctx, ctx.BlockHeight()+1, id) + // 1. find all operator keys for the chain. + // 2. find last stored operator keys + their powers. + // 3. find newest vote power for the operator keys, and sort them. + // 4. loop through #1 and see if anything has changed. + // if it hasn't, do nothing for that operator key. + // if it has, queue an update. + prev := k.getKeyPowerMapping(ctx).List + res := make([]abci.ValidatorUpdate, 0, len(prev)) + operators, keys := k.operatorKeeper.GetActiveOperatorsForChainId(ctx, ctx.ChainID()) + powers, err := k.restakingKeeper.GetAvgDelegatedValue( + ctx, operators, k.GetAssetIDs(ctx), k.GetEpochIdentifier(ctx), + ) + if err != nil { return []abci.ValidatorUpdate{} } - res := make([]abci.ValidatorUpdate, 0, len(operations.GetList())) - for _, operation := range operations.GetList() { - switch operation.OperationType { - case types.KeyAdditionOrUpdate: - power, err := k.restakingKeeper.GetOperatorAssetValue( - ctx, operation.OperatorAddress, - ) - if err != nil { - // this should never happen, but if it does, we just skip the operation. - continue - } - res = append(res, abci.ValidatorUpdate{ - PubKey: operation.PubKey, - Power: power, - }) - case types.KeyRemoval: - res = append(res, abci.ValidatorUpdate{ - PubKey: operation.PubKey, - Power: 0, - }) - case types.KeyOpUnspecified: - // this should never happen, but if it does, we just skip the operation. + operators, keys, powers = sortByPower(operators, keys, powers) + maxVals := k.GetMaxValidators(ctx) + for i := range operators { + // #nosec G701 // ok if 64-bit. + if i >= int(maxVals) { + // we have reached the maximum number of validators. + break + } + power := powers[i] + if power < 1 { + // we have reached the bottom of the rung. + break + } + // find the previous power. + key := keys[i] + keyString := string(k.cdc.MustMarshal(&key)) + prevPower, found := prev[keyString] + if found && prevPower == power { + delete(prev, keyString) continue } + // either the key was not in the previous set, + // or the power has changed. + res = append(res, abci.ValidatorUpdate{ + PubKey: key, + // note that this is the final power and not the change in power. + Power: power, + }) + } + // the remaining keys in prev have lost their power. + // gosec does not like `for key := range prev` while others do not like + // `for key, _ := range prev` + // #nosec G705 + for key := range prev { + bz := []byte(key) // undo string operation + var keyObj tmprotocrypto.PublicKey + k.cdc.MustUnmarshal(bz, &keyObj) // undo marshal operation + res = append(res, abci.ValidatorUpdate{ + PubKey: keyObj, + Power: 0, + }) } // call via wrapper function so that validator info is stored. // the id is incremented by 1 for the next block. - return k.ApplyValidatorChanges(ctx, res, id+1, false) + return k.ApplyValidatorChanges(ctx, res, id+1) +} + +// sortByPower sorts operators, their pubkeys, and their powers by the powers. +// the sorting is descending, so the highest power is first. +func sortByPower( + operatorAddrs []sdk.AccAddress, + pubKeys []tmprotocrypto.PublicKey, + powers []int64, +) ([]sdk.AccAddress, []tmprotocrypto.PublicKey, []int64) { + // Create a slice of indices + indices := make([]int, len(powers)) + for i := range indices { + indices[i] = i + } + + // Sort the indices slice based on the powers slice + sort.SliceStable(indices, func(i, j int) bool { + return powers[indices[i]] > powers[indices[j]] + }) + + // Reorder all slices using the sorted indices + sortedOperatorAddrs := make([]sdk.AccAddress, len(operatorAddrs)) + sortedPubKeys := make([]tmprotocrypto.PublicKey, len(pubKeys)) + sortedPowers := make([]int64, len(powers)) + for i, idx := range indices { + sortedOperatorAddrs[i] = operatorAddrs[idx] + sortedPubKeys[i] = pubKeys[idx] + sortedPowers[i] = powers[idx] + } + + return sortedOperatorAddrs, sortedPubKeys, sortedPowers } diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index e0544924d..76e3758a9 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -1,6 +1,8 @@ package keeper import ( + "fmt" + "github.com/ExocoreNetwork/exocore/x/dogfood/types" abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,13 +23,29 @@ func (k Keeper) InitGenesis( // is not running. it means that the genesis file is malformed. panic("epoch info not found") } - return k.ApplyValidatorChanges(ctx, genState.ValSet, types.InitialValidatorSetID, true) + // apply the same logic to the staking assets. + for _, assetID := range genState.Params.AssetIDs { + if !k.restakingKeeper.IsStakingAsset(ctx, assetID) { + panic(fmt.Errorf("staking asset %s not found", assetID)) + } + } + // genState must not be malformed. + // #nosec G701 // ok if 64-bit. + if len(genState.ValSet) > int(k.GetMaxValidators(ctx)) { + panic(fmt.Errorf( + "cannot have more than %d validators in the genesis state", + k.GetMaxValidators(ctx), + )) + } + return k.ApplyValidatorChanges( + ctx, genState.ValSet, types.InitialValidatorSetID, + ) } // ExportGenesis returns the module's exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetDogfoodParams(ctx) - + // TODO(mm) return genesis } diff --git a/x/dogfood/keeper/impl_delegation_hooks.go b/x/dogfood/keeper/impl_delegation_hooks.go index e32442853..adbdc021e 100644 --- a/x/dogfood/keeper/impl_delegation_hooks.go +++ b/x/dogfood/keeper/impl_delegation_hooks.go @@ -22,100 +22,34 @@ func (k *Keeper) DelegationHooks() DelegationHooksWrapper { // AfterDelegation is called after a delegation is made. func (wrapper DelegationHooksWrapper) AfterDelegation( - ctx sdk.Context, operator sdk.AccAddress, + sdk.Context, sdk.AccAddress, ) { - found, pubKey, err := wrapper.keeper.operatorKeeper.GetOperatorConsKeyForChainId( - ctx, operator, ctx.ChainID(), - ) - if err != nil { - // the operator keeper can offer two errors: not an operator and not a chain. - // both of these should not happen here because the dogfooding genesis will - // register the chain, and the operator must be known to the delegation module - // when it calls this hook. - panic(err) - } - if found { - if !wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( - ctx, operator, ctx.ChainID(), - ) { - // only queue the operation if operator is still opted into the chain. - res := wrapper.keeper.QueueOperation( - ctx, operator, pubKey, types.KeyAdditionOrUpdate, - ) - switch res { - case types.QueueResultExists: - // nothing to do because the operation is in the queue already. - case types.QueueResultRemoved: - // a KeyRemoval was in the queue which has now been cleared from the queue. - // the KeyRemoval can only be in the queue if the operator is opting out from - // the chain, or has replaced their key. if it is the former, it means that - // there is some inconsistency. if it is the latter, it means that the operator - // module just reported the old key in `GetOperatorConsKeyForChainId`, which - // should not happen. - panic("unexpected removal of operation from queue") - case types.QueueResultSuccess: - // best case, nothing to do. - case types.QueueResultUnspecified: - panic("unspecified queue result") - } - } - } + // we do nothing here, since the vote power for all operators is calculated + // in the end separately. even if we knew the amount of the delegation, the + // average exchange rate for the epoch is unknown. } // AfterUndelegationStarted is called after an undelegation is started. func (wrapper DelegationHooksWrapper) AfterUndelegationStarted( ctx sdk.Context, operator sdk.AccAddress, recordKey []byte, ) { - found, pubKey, err := wrapper.keeper.operatorKeeper.GetOperatorConsKeyForChainId( + var unbondingCompletionEpoch int64 + if wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( ctx, operator, ctx.ChainID(), - ) - if err != nil { - panic(err) - } - if found { - // note that this is still key addition or update because undelegation does not remove - // the operator from the list. it only decreases their vote power. - if !wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( - ctx, operator, ctx.ChainID(), - ) { - // only queue the operation if operator is still opted into the chain. - res := wrapper.keeper.QueueOperation( - ctx, operator, pubKey, types.KeyAdditionOrUpdate, - ) - switch res { - case types.QueueResultExists: - // nothing to do - case types.QueueResultRemoved: - // KeyRemoval + KeyAdditionOrUpdate => Removed - // KeyRemoval can happen - // 1. if the operator is opting out from the chain,which is inconsistent. - // 2. if the operator is replacing their old key, which should not be returned - // by `GetOperatorConsKeyForChainId`. - panic("unexpected removal of operation from queue") - case types.QueueResultSuccess: - // best case, nothing to do. - case types.QueueResultUnspecified: - panic("unspecified queue result") - } - } - // now handle the unbonding timeline. - wrapper.keeper.delegationKeeper.IncrementUndelegationHoldCount(ctx, recordKey) - // mark for unbonding release. - // note that we aren't supporting redelegation yet, so this undelegated amount will be - // held until the end of the unbonding period or the operator opt out period, whichever - // is first. - var unbondingCompletionEpoch int64 - if wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainId( - ctx, operator, ctx.ChainID(), - ) { - unbondingCompletionEpoch = wrapper.keeper.GetOperatorOptOutFinishEpoch( - ctx, operator, - ) - } else { - unbondingCompletionEpoch = wrapper.keeper.GetUnbondingCompletionEpoch(ctx) - } - wrapper.keeper.AppendUndelegationToMature(ctx, unbondingCompletionEpoch, recordKey) + ) { + // if the operator is opting out, we need to use the finish epoch of the opt out. + unbondingCompletionEpoch = wrapper.keeper.GetOperatorOptOutFinishEpoch(ctx, operator) + // even if the operator opts back in, the undelegated vote power does not reappear + // in the picture. slashable events between undelegation and opt in cannot occur + // because the operator is not in the validator set. + } else { + // otherwise, we use the default unbonding completion epoch. + unbondingCompletionEpoch = wrapper.keeper.GetUnbondingCompletionEpoch(ctx) + // if the operator opts out after this, the undelegation will mature before the opt out. + // so this is not a concern. } + wrapper.keeper.AppendUndelegationToMature(ctx, unbondingCompletionEpoch, recordKey) + wrapper.keeper.delegationKeeper.IncrementUndelegationHoldCount(ctx, recordKey) } // AfterUndelegationCompleted is called after an undelegation is completed. diff --git a/x/dogfood/keeper/impl_epochs_hooks.go b/x/dogfood/keeper/impl_epochs_hooks.go index c17314a89..c3bed17db 100644 --- a/x/dogfood/keeper/impl_epochs_hooks.go +++ b/x/dogfood/keeper/impl_epochs_hooks.go @@ -22,7 +22,7 @@ func (k *Keeper) EpochsHooks() EpochsHooksWrapper { return EpochsHooksWrapper{k} } -// AfterEpochEnd is called after an epoch ends. +// AfterEpochEnd is called after an epoch ends. It is called during the BeginBlock function. func (wrapper EpochsHooksWrapper) AfterEpochEnd( ctx sdk.Context, identifier string, epoch int64, ) { @@ -32,17 +32,19 @@ func (wrapper EpochsHooksWrapper) AfterEpochEnd( // note that this hook is called during BeginBlock, and the "pending" operations will be // applied within this block. however, for clarity, it is highlighted that unbonding // takes N epochs + 1 block to complete. - operations := wrapper.keeper.GetQueuedOperations(ctx) - wrapper.keeper.SetPendingOperations(ctx, types.Operations{List: operations}) - wrapper.keeper.ClearQueuedOperations(ctx) + wrapper.keeper.MarkEpochEnd(ctx) + // find the opt outs that mature when this epoch ends, and move them to pending. optOuts := wrapper.keeper.GetOptOutsToFinish(ctx, epoch) wrapper.keeper.SetPendingOptOuts(ctx, types.AccountAddresses{List: optOuts}) wrapper.keeper.ClearOptOutsToFinish(ctx, epoch) + // next, find the consensus addresses that are to be pruned, and move them to pending. consAddresses := wrapper.keeper.GetConsensusAddrsToPrune(ctx, epoch) wrapper.keeper.SetPendingConsensusAddrs( ctx, types.ConsensusAddresses{List: consAddresses}, ) wrapper.keeper.ClearConsensusAddrsToPrune(ctx, epoch) + // finally, find the undelegations that mature when this epoch ends, and move them to + // pending. undelegations := wrapper.keeper.GetUndelegationsToMature(ctx, epoch) wrapper.keeper.SetPendingUndelegations( ctx, types.UndelegationRecordKeys{ @@ -56,5 +58,5 @@ func (wrapper EpochsHooksWrapper) AfterEpochEnd( func (wrapper EpochsHooksWrapper) BeforeEpochStart( sdk.Context, string, int64, ) { - // nothing to do + // no-op } diff --git a/x/dogfood/keeper/impl_operator_hooks.go b/x/dogfood/keeper/impl_operator_hooks.go index 3599d6565..5e0d027bb 100644 --- a/x/dogfood/keeper/impl_operator_hooks.go +++ b/x/dogfood/keeper/impl_operator_hooks.go @@ -21,127 +21,36 @@ func (k *Keeper) OperatorHooks() OperatorHooksWrapper { return OperatorHooksWrapper{k} } -// Hooks assumptions: Assuming I is opt-in, O is opt-out and R is key replacement, these are all -// possible within the same epoch, for a fresh operator. -// I O -// I R -// I R O -// This is not possible for a fresh operator to do: -// I O R -// R I O -// R I -// For an operator that is already opted in, the list looks like follows: -// R O -// O I (reversing the decision to opt out) -// O I R -// R O I -// The impossible list looks like: -// O R -// O R I -// Replacing the key with the same key is not possible, so it is not covered. -// The assumption is that these are enforced (allowed/denied) by the operator module. - -// Cases for a fresh operator: -// I + O => KeyAdditionOrUpdate + KeyRemoval => Success + Removed => covered. -// I + R => KeyAdditionOrUpdate (old) + KeyAdditionOrUpdate (new) + KeyRemoval (old) => -// Success + Success + Removed + => not considered unbonding of the old key since it -// was not yet effective => covered. -// I + R + O => KeyAdditionOrUpdate (old) + KeyAdditionOrUpdate (new) + KeyRemoval (old) + -// KeyRemoval (new) => -// Success (old) + Success (new) + Removed (old) + Removed (new) => covered - -// Cases for an operator that has already opted in: -// R + O => KeyAdditionOrUpdate (new) + KeyRemoval (old) + KeyRemoval (new) => -// Success (new) + Success (old) + Removed (new) => -// unbonding data made (old) => covered. -// O + I -// O + I case 1 => KeyRemoval (old) + KeyAdditionOrUpdate (new) => Success (old) + Success (new) -// => unbonding data made (old) => covered. -// O + I case 2 => KeyRemoval (old) + KeyAdditionOrUpdate (old) => Success (old) + Removed (old) -// => unbonding data made (old) and then cleared => covered. -// O + I + R -// O + I + R case 1 => KeyRemoval (old) + KeyAdditionOrUpdate (old) + KeyRemoval (old) + -// KeyAdditionOrUpdate (new) => Success (old) + Removed (old) + Success (old) + -// Success (new) => unbonding data old made + cleared + made => covered. -// O + I + R case 2 => -// AfterOperatorOptOut(old) => Success => unbonding data made for old -// AfterOperatorOptIn(new) => Success => no data changed -// AfterOperatorKeyReplacement(new, new2) => -// new2 operation KeyAdditionOrUpdate => Success => no data changed -// new operation KeyRemoval => Removed => no data changed -// => covered -// R + O + I => KeyAdditionOrUpdate (new) + KeyRemoval (old) + KeyRemoval (new) + -// KeyAdditionOrUpdate (X) -// Success + Success (=> unbonding data for old) + Removed (=> no data) + -// case 1 => X == new => Success => no change => covered -// case 2 => X == old => Removed => unbonding data for old removed => covered. -// case 3 => X == abc => Success => no change and unbonding data for old is not removed => -// covered. - // AfterOperatorOptIn is the implementation of the operator hooks. func (h OperatorHooksWrapper) AfterOperatorOptIn( - ctx sdk.Context, addr sdk.AccAddress, - chainID string, pubKey tmprotocrypto.PublicKey, + ctx sdk.Context, addr sdk.AccAddress, chainID string, key tmprotocrypto.PublicKey, ) { - if strings.Compare(ctx.ChainID(), chainID) == 0 { - // res == Removed, it means operator has opted back in - // res == Success, there is no additional information to store - // res == Exists, there is nothing to do - if res := h.keeper.QueueOperation( - ctx, addr, pubKey, types.KeyAdditionOrUpdate, - ); res == types.QueueResultRemoved { - // the old operation was key removal, which is now removed from the queue. - // so all of the changes that were associated with it need to be undone. - h.keeper.ClearUnbondingInformation(ctx, addr, pubKey) - } + // an operator opting in does not meaningfully affect this module, since + // this information will be fetched at the end of the epoch + // and the operator's vote power will be calculated then. + // however, we will still clear the unbonding information, if it exists. + if strings.Compare(chainID, ctx.ChainID()) == 0 { + h.keeper.ClearUnbondingInformation(ctx, addr, key) } } // AfterOperatorKeyReplacement is the implementation of the operator hooks. func (h OperatorHooksWrapper) AfterOperatorKeyReplacement( - ctx sdk.Context, addr sdk.AccAddress, - newKey tmprotocrypto.PublicKey, oldKey tmprotocrypto.PublicKey, - chainID string, + ctx sdk.Context, operator sdk.AccAddress, oldKey tmprotocrypto.PublicKey, + newKey tmprotocrypto.PublicKey, chainID string, ) { if strings.Compare(chainID, ctx.ChainID()) == 0 { - // remove the old key - // res == Removed, it means operator had added this key and is now removing it. - // no additional information to clear. - // res == Success, the old key should be pruned from the operator module. - // res == Exists, there is nothing to do. - if res := h.keeper.QueueOperation( - ctx, addr, oldKey, types.KeyRemoval, - ); res == types.QueueResultSuccess { - // the old key can be marked for pruning - h.keeper.SetUnbondingInformation(ctx, addr, oldKey, false) - } - // add the new key - // res == Removed, it means operator has added their original key again - // res == Success, there is no additional information to store - // res == Exists, there is no nothing to do - if res := h.keeper.QueueOperation( - ctx, addr, newKey, types.KeyAdditionOrUpdate, - ); res == types.QueueResultRemoved { - // see AfterOperatorOptIn for explanation - h.keeper.ClearUnbondingInformation(ctx, addr, newKey) - } + // a key replacement means that the old key needs to be pruned upon maturity. + h.keeper.SetUnbondingInformation(ctx, operator, oldKey, false) + h.keeper.ClearUnbondingInformation(ctx, operator, newKey) } } // AfterOperatorOptOutInitiated is the implementation of the operator hooks. func (h OperatorHooksWrapper) AfterOperatorOptOutInitiated( - ctx sdk.Context, addr sdk.AccAddress, - chainID string, pubKey tmprotocrypto.PublicKey, + ctx sdk.Context, operator sdk.AccAddress, chainID string, key tmprotocrypto.PublicKey, ) { if strings.Compare(chainID, ctx.ChainID()) == 0 { - // res == Removed means operator had opted in and is now opting out. nothing to do if - // it is within the same epoch. - // res == Success, set up pruning deadline and opt out completion deadline - // res == Exists, there is nothing to do (should never happen) - if res := h.keeper.QueueOperation( - ctx, addr, pubKey, types.KeyRemoval, - ); res == types.QueueResultSuccess { - h.keeper.SetUnbondingInformation(ctx, addr, pubKey, true) - } + h.keeper.SetUnbondingInformation(ctx, operator, key, true) } } diff --git a/x/dogfood/keeper/keeper.go b/x/dogfood/keeper/keeper.go index e85f961d0..a0ba33e63 100644 --- a/x/dogfood/keeper/keeper.go +++ b/x/dogfood/keeper/keeper.go @@ -81,37 +81,26 @@ func (k Keeper) Hooks() types.DogfoodHooks { return k.dogfoodHooks } -// GetQueuedKeyOperations returns the list of operations that are queued for execution at the -// end of the current epoch. -func (k Keeper) GetQueuedOperations( - ctx sdk.Context, -) []types.Operation { +// MarkEpochEnd marks the end of the epoch. It is called within the BeginBlocker to inform +// the module to apply the validator updates at the end of this block. +func (k Keeper) MarkEpochEnd(ctx sdk.Context) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.QueuedOperationsKey()) - if bz == nil { - return []types.Operation{} - } - var operations types.Operations - if err := operations.Unmarshal(bz); err != nil { - // TODO(mm): any failure to unmarshal is treated as no operations or panic? - return []types.Operation{} - } - return operations.GetList() + key := types.EpochEndKey() + store.Set(key, []byte{1}) } -// ClearQueuedOperations clears the operations to be executed at the end of the epoch. -func (k Keeper) ClearQueuedOperations(ctx sdk.Context) { +// IsEpochEnd returns true if the epoch ended in the beginning of this block, or the end of the +// previous block. +func (k Keeper) IsEpochEnd(ctx sdk.Context) bool { store := ctx.KVStore(k.storeKey) - store.Delete(types.QueuedOperationsKey()) + key := types.EpochEndKey() + return store.Has(key) } -// setQueuedOperations is a private, internal function used to update the current queue of -// operations to be executed at the end of the epoch with the supplied value. -func (k Keeper) setQueuedOperations(ctx sdk.Context, operations types.Operations) { +// ClearEpochEnd clears the epoch end marker. It is called after the epoch end operations are +// applied. +func (k Keeper) ClearEpochEnd(ctx sdk.Context) { store := ctx.KVStore(k.storeKey) - bz, err := operations.Marshal() - if err != nil { - panic(err) - } - store.Set(types.QueuedOperationsKey(), bz) + key := types.EpochEndKey() + store.Delete(key) } diff --git a/x/dogfood/keeper/params.go b/x/dogfood/keeper/params.go index f2bb7af60..782f57921 100644 --- a/x/dogfood/keeper/params.go +++ b/x/dogfood/keeper/params.go @@ -3,6 +3,7 @@ package keeper import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // GetEpochsUntilUnbonded returns the number of epochs after which an unbonding that is made @@ -25,7 +26,7 @@ func (k Keeper) GetEpochIdentifier(ctx sdk.Context) string { // the chain. It is a parameter of the dogfood module. func (k Keeper) GetMaxValidators(ctx sdk.Context) uint32 { var maxValidators uint32 - k.paramstore.Get(ctx, types.KeyMaxValidators, &maxValidators) + k.paramstore.Get(ctx, stakingtypes.KeyMaxValidators, &maxValidators) return maxValidators } @@ -33,10 +34,18 @@ func (k Keeper) GetMaxValidators(ctx sdk.Context) uint32 { // entries are used by the IBC module. The return value is a parameter of the dogfood module. func (k Keeper) GetHistoricalEntries(ctx sdk.Context) uint32 { var historicalEntries uint32 - k.paramstore.Get(ctx, types.KeyHistoricalEntries, &historicalEntries) + k.paramstore.Get(ctx, stakingtypes.KeyHistoricalEntries, &historicalEntries) return historicalEntries } +// GetAssetIDs returns the asset IDs that are accepted by the dogfood module. It is a parameter +// of the dogfood module. +func (k Keeper) GetAssetIDs(ctx sdk.Context) []string { + var assetIDs []string + k.paramstore.Get(ctx, types.KeyAssetIDs, &assetIDs) + return assetIDs +} + // SetParams sets the params for the dogfood module. func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.SetParamSet(ctx, ¶ms) @@ -52,5 +61,6 @@ func (k Keeper) GetDogfoodParams(ctx sdk.Context) (params types.Params) { k.GetEpochIdentifier(ctx), k.GetMaxValidators(ctx), k.GetHistoricalEntries(ctx), + k.GetAssetIDs(ctx), ) } diff --git a/x/dogfood/keeper/pending.go b/x/dogfood/keeper/pending.go index 9bf05ae17..e3cf92288 100644 --- a/x/dogfood/keeper/pending.go +++ b/x/dogfood/keeper/pending.go @@ -5,36 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// SetPendingOperations sets the pending operations to be applied at the end of the block. -func (k Keeper) SetPendingOperations(ctx sdk.Context, operations types.Operations) { - store := ctx.KVStore(k.storeKey) - bz, err := operations.Marshal() - if err != nil { - panic(err) - } - store.Set(types.PendingOperationsKey(), bz) -} - -// GetPendingOperations returns the pending operations to be applied at the end of the block. -func (k Keeper) GetPendingOperations(ctx sdk.Context) types.Operations { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingOperationsKey()) - if bz == nil { - return types.Operations{} - } - var operations types.Operations - if err := operations.Unmarshal(bz); err != nil { - return types.Operations{} - } - return operations -} - -// ClearPendingOperations clears the pending operations to be applied at the end of the block. -func (k Keeper) ClearPendingOperations(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingOperationsKey()) -} - // SetPendingOptOuts sets the pending opt-outs to be applied at the end of the block. func (k Keeper) SetPendingOptOuts(ctx sdk.Context, addrs types.AccountAddresses) { store := ctx.KVStore(k.storeKey) diff --git a/x/dogfood/keeper/queue.go b/x/dogfood/keeper/queue.go deleted file mode 100644 index 07cedfb32..000000000 --- a/x/dogfood/keeper/queue.go +++ /dev/null @@ -1,45 +0,0 @@ -package keeper - -import ( - "github.com/ExocoreNetwork/exocore/x/dogfood/types" - tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// QueueOperation adds an operation to the consensus public key queue. If a similar operation -// already exists, the queue is not modified and QueueResultExists is returned. If a reverse -// operation already exists (removal + addition, or addition + removal), the old operation is -// dropped from the queue and QueueResultRemoved is returned. In the case that the operation is -// added to the queue, QueueResultSuccess is returned. -func (k Keeper) QueueOperation( - ctx sdk.Context, addr sdk.AccAddress, - key tmprotocrypto.PublicKey, operationType types.OperationType, -) types.QueueResultType { - if operationType == types.KeyOpUnspecified { - // should never happen - panic("invalid operation type") - } - currentQueue := k.GetQueuedOperations(ctx) - indexToDelete := len(currentQueue) - for i, operation := range currentQueue { - if operation.PubKey.Equal(key) { - if operation.OperationType == operationType { - return types.QueueResultExists - } - // reverse operation exists, remove it - indexToDelete = i - break - } - } - ret := types.QueueResultSuccess - if indexToDelete > len(currentQueue) { - currentQueue = append(currentQueue[:indexToDelete], currentQueue[indexToDelete+1:]...) - ret = types.QueueResultRemoved - } else { - operation := types.Operation{OperationType: operationType, OperatorAddress: addr, PubKey: key} - currentQueue = append(currentQueue, operation) - } - operations := types.Operations{List: currentQueue} - k.setQueuedOperations(ctx, operations) - return ret -} diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index 4070c87dc..4092acc8c 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -17,7 +17,7 @@ func (k Keeper) ClearUnbondingInformation( k.RemoveOptOutToFinish(ctx, optOutEpoch, addr) consAddress, err := types.TMCryptoPublicKeyToConsAddr(pubKey) if err != nil { - panic(err) + return } k.DeleteConsensusAddrToPrune(ctx, optOutEpoch, consAddress) } @@ -27,13 +27,13 @@ func (k Keeper) SetUnbondingInformation( ctx sdk.Context, addr sdk.AccAddress, pubKey tmprotocrypto.PublicKey, isOptingOut bool, ) { unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) - k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) if isOptingOut { + k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) } consAddress, err := types.TMCryptoPublicKeyToConsAddr(pubKey) if err != nil { - panic(err) + return } k.AppendConsensusAddrToPrune(ctx, unbondingCompletionEpoch, consAddress) } @@ -44,12 +44,9 @@ func (k Keeper) GetUnbondingCompletionEpoch( ctx sdk.Context, ) int64 { unbondingEpochs := k.GetEpochsUntilUnbonded(ctx) - epochInfo, found := k.epochsKeeper.GetEpochInfo( + epochInfo, _ := k.epochsKeeper.GetEpochInfo( ctx, k.GetEpochIdentifier(ctx), ) - if !found { - panic("current epoch not found") - } // if i execute the transaction at epoch 5, the vote power change // goes into effect at the beginning of epoch 6. the information // should be held for 7 epochs, so it should be deleted at the diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index 13336a37f..df67cb234 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -30,11 +30,11 @@ func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration { // ApplyValidatorChanges returns the validator set as is. However, it also // stores the validators that are added or those that are removed, and updates -// the power for the existing validators. It also allows any hooks registered +// the stored power for the existing validators. It also allows any hooks registered // on the keeper to be executed. Lastly, it stores the validator set against the // provided validator set id. func (k Keeper) ApplyValidatorChanges( - ctx sdk.Context, changes []abci.ValidatorUpdate, valSetID uint64, genesis bool, + ctx sdk.Context, changes []abci.ValidatorUpdate, valSetID uint64, ) []abci.ValidatorUpdate { ret := []abci.ValidatorUpdate{} for _, change := range changes { @@ -42,16 +42,20 @@ func (k Keeper) ApplyValidatorChanges( pubkey, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()) if err != nil { // An error here would indicate that this change is invalid. - // In no situation it should happen, however, if it does, + // The change is received either from the genesis file, or from + // other parts of the module. + // In no situation it should happen; however, if it does, // we do not panic. Simply skip the change. continue } + // the address is just derived from the public key and + // has no correlation with the operator address on Exocore. addr := pubkey.Address() val, found := k.GetValidator(ctx, addr) - switch found { case true: - // update or delete an existing validator + // update or delete an existing validator. + // assumption: power can not be negative. if change.Power < 1 { k.DeleteValidator(ctx, addr) } else { @@ -60,12 +64,12 @@ func (k Keeper) ApplyValidatorChanges( } case false: if change.Power > 0 { - // create a new validator - the address is just derived from the public key and - // has no correlation with the operator address on Exocore + // create a new validator. ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) if err != nil { continue } + // guard for errors within the AfterValidatorBonded hook. cc, writeFunc := ctx.CacheContext() k.SetValidator(cc, ocVal) err = k.Hooks().AfterValidatorBonded(cc, sdk.ConsAddress(addr), nil) @@ -84,7 +88,7 @@ func (k Keeper) ApplyValidatorChanges( ret = append(ret, change) } - // store the validator set against the provided validator set id + // store the updated validator set against the provided validator set id lastVals := types.Validators{} for _, v := range k.GetAllExocoreValidators(ctx) { // we stored the validators above, so this will never fail. @@ -97,16 +101,15 @@ func (k Keeper) ApplyValidatorChanges( val.Status = stakingtypes.Bonded // Compute tokens from voting power val.Tokens = sdk.TokensFromConsensusPower(v.Power, sdk.DefaultPowerReduction) - lastVals.List = append(lastVals.GetList(), val) + lastVals.List = append(lastVals.List, val) } k.setValidatorSet(ctx, valSetID, &lastVals) - if !genesis { - // the val set change is effective as of the next block, so height + 1. - k.setValidatorSetID(ctx, ctx.BlockHeight()+1, valSetID) - } else { - // the val set change is effective immediately. - k.setValidatorSetID(ctx, ctx.BlockHeight(), valSetID) - } + // this validator set is effective as of the next block, so use height + 1. + // this statement is true for genesis as well, since ctx.BlockHeight() is + // reported as 0 during InitGenesis. + k.setValidatorSetID(ctx, ctx.BlockHeight()+1, valSetID) + // store this to compare against, in the next round. + k.saveKeyPowerMapping(ctx, ret) return ret } @@ -227,8 +230,8 @@ func (k Keeper) deleteValidatorSet(ctx sdk.Context, id uint64) { // event. Otherwise, it is constant. The header, however, will change at every block. Since // the Cosmos SDK does not allow for the retrieval of a past block header, we store the header // ourselves in this function. The validator set is stored when it changes at the end of an -// epoch or at a slashing event in the corresponding functions. It is called within the EndBlock -// of the module, so it is kept public. +// epoch or at a slashing event in the corresponding functions. The function is called within +// the EndBlock of the module, so it is kept public. func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { // Get the number of historical entries to persist, as the number of block heights. // #nosec G701 // uint32 fits into int64 always. @@ -253,9 +256,16 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { break } } + // even if numHistoricalEntries is 0, this will work because it is called after the + // validatorSetID for height + 1 is stored. + // on the opposite side of things, if numHistoricalEntries is too large, currentID + // will be 0, and the loop will not run. currentID, _ := k.getValidatorSetID(ctx, ctx.BlockHeight()-numHistoricalEntries+1, ) + // lastDeletedID will be the lowest deleted id since we are working backwards + // from the latest height to the oldest height. this, and upto but not including + // currentID, are the ids to delete. for i := lastDeletedID; i < currentID; i++ { k.deleteValidatorSet(ctx, i) } @@ -269,7 +279,7 @@ func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { k.storeBlockHeader(ctx) // we have stored: - // before TrackHistoricalInfo: ValidatorSetID for height, and the validator set. + // outside of TrackHistoricalInfo: ValidatorSetID for height, and the validator set. // within TrackHistoricalInfo: the header. // this is enough information to answer the GetHistoricalInfo query. } @@ -373,3 +383,28 @@ func (k Keeper) storeBlockHeader(ctx sdk.Context) { value := k.cdc.MustMarshal(&header) store.Set(key, value) } + +// saveKeyPowerMapping stores a mapping from the key string to the power. +func (k Keeper) saveKeyPowerMapping(ctx sdk.Context, updates []abci.ValidatorUpdate) { + store := ctx.KVStore(k.storeKey) + m := make(map[string]int64, len(updates)) + for _, update := range updates { + // do not use the stringer interface here so that it can be deserialized. + key := update.PubKey // prevent implicit memory aliasing. + m[string(k.cdc.MustMarshal(&key))] = update.Power + } + bz := k.cdc.MustMarshal(&types.KeyPowerMapping{List: m}) + store.Set(types.KeyPowerMappingKey(), bz) +} + +// getKeyPowerMapping gets the most recently stored mapping from the key string to the power. +func (k Keeper) getKeyPowerMapping(ctx sdk.Context) types.KeyPowerMapping { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyPowerMappingKey()) + if bz == nil { + return types.KeyPowerMapping{} + } + var updates types.KeyPowerMapping + k.cdc.MustUnmarshal(bz, &updates) + return updates +} diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 44483fd37..1f0b36e58 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -163,5 +163,7 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock contains the logic that is automatically triggered at the end of each block func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return am.keeper.EndBlock(ctx) + ret := am.keeper.EndBlock(ctx) + am.keeper.TrackHistoricalInfo(ctx) + return ret } diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 876f5c4c1..56424d7ad 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -31,79 +30,6 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// OperationType is used to indicate the type of operation that is being -// cached by the module to create the updated validator set. -type OperationType int32 - -const ( - // KeyOpUnspecified is used to indicate that the operation type is not specified. - // This should never be used. - KeyOpUnspecified OperationType = 0 - // KeyAddition is used to indicate that the operation is a key addition. - KeyAdditionOrUpdate OperationType = 1 - // KeyRemoval is used to indicate that the operation is a key removal. Typically - // this is done due to key replacement mechanism and not directly. - KeyRemoval OperationType = 2 -) - -var OperationType_name = map[int32]string{ - 0: "OPERATION_TYPE_UNSPECIFIED", - 1: "OPERATION_TYPE_ADDITION_OR_UPDATE", - 2: "OPERATION_TYPE_REMOVAL", -} - -var OperationType_value = map[string]int32{ - "OPERATION_TYPE_UNSPECIFIED": 0, - "OPERATION_TYPE_ADDITION_OR_UPDATE": 1, - "OPERATION_TYPE_REMOVAL": 2, -} - -func (x OperationType) String() string { - return proto.EnumName(OperationType_name, int32(x)) -} - -func (OperationType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{0} -} - -// QueueResultType is used to indicate the result of the queue operation. -type QueueResultType int32 - -const ( - // QueueResultUnspecified is used to indicate that the queue result type is not specified. - QueueResultUnspecified QueueResultType = 0 - // QueueResultSuccess is used to indicate that the queue operation was successful. - QueueResultSuccess QueueResultType = 1 - // QueueResultExists is used to indicate that the queue operation failed because the - // operation already exists in the queue. - QueueResultExists QueueResultType = 2 - // QueueResultRemoved is used to indicate that the queue operation resulted in an existing - // operation being removed from the queue. - QueueResultRemoved QueueResultType = 3 -) - -var QueueResultType_name = map[int32]string{ - 0: "QUEUE_RESULT_TYPE_UNSPECIFIED", - 1: "QUEUE_RESULT_TYPE_SUCCESS", - 2: "QUEUE_RESULT_TYPE_EXISTS", - 3: "QUEUE_RESULT_TYPE_REMOVED", -} - -var QueueResultType_value = map[string]int32{ - "QUEUE_RESULT_TYPE_UNSPECIFIED": 0, - "QUEUE_RESULT_TYPE_SUCCESS": 1, - "QUEUE_RESULT_TYPE_EXISTS": 2, - "QUEUE_RESULT_TYPE_REMOVED": 3, -} - -func (x QueueResultType) String() string { - return proto.EnumName(QueueResultType_name, int32(x)) -} - -func (QueueResultType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{1} -} - // ExocoreValidator is a validator that is part of the Exocore network. It is // used to validate and sign blocks and transactions. type ExocoreValidator struct { @@ -170,117 +96,6 @@ func (m *ExocoreValidator) GetPubkey() *types.Any { return nil } -// Operation is used to indicate the operation that is being cached by the module -// to create the updated validator set. -type Operation struct { - // OperationType is the type of the operation (addition / removal). - OperationType OperationType `protobuf:"varint,1,opt,name=operation_type,json=operationType,proto3,enum=exocore.dogfood.v1.OperationType" json:"operation_type,omitempty"` - // OperatorAddress is the sdk.AccAddress of the operator. - OperatorAddress []byte `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` - // PubKey is the public key for which the operation is being applied. - PubKey crypto.PublicKey `protobuf:"bytes,3,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` -} - -func (m *Operation) Reset() { *m = Operation{} } -func (m *Operation) String() string { return proto.CompactTextString(m) } -func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{1} -} -func (m *Operation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Operation.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 *Operation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operation.Merge(m, src) -} -func (m *Operation) XXX_Size() int { - return m.Size() -} -func (m *Operation) XXX_DiscardUnknown() { - xxx_messageInfo_Operation.DiscardUnknown(m) -} - -var xxx_messageInfo_Operation proto.InternalMessageInfo - -func (m *Operation) GetOperationType() OperationType { - if m != nil { - return m.OperationType - } - return KeyOpUnspecified -} - -func (m *Operation) GetOperatorAddress() []byte { - if m != nil { - return m.OperatorAddress - } - return nil -} - -func (m *Operation) GetPubKey() crypto.PublicKey { - if m != nil { - return m.PubKey - } - return crypto.PublicKey{} -} - -// Operations is a collection of Operation. -type Operations struct { - // list is the list of operations. - List []Operation `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` -} - -func (m *Operations) Reset() { *m = Operations{} } -func (m *Operations) String() string { return proto.CompactTextString(m) } -func (*Operations) ProtoMessage() {} -func (*Operations) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{2} -} -func (m *Operations) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Operations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Operations.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 *Operations) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operations.Merge(m, src) -} -func (m *Operations) XXX_Size() int { - return m.Size() -} -func (m *Operations) XXX_DiscardUnknown() { - xxx_messageInfo_Operations.DiscardUnknown(m) -} - -var xxx_messageInfo_Operations proto.InternalMessageInfo - -func (m *Operations) GetList() []Operation { - if m != nil { - return m.List - } - return nil -} - // AccountAddresses represents a list of account addresses. It is used to store the list of // operator addresses whose operations are maturing at an epoch. type AccountAddresses struct { @@ -292,7 +107,7 @@ func (m *AccountAddresses) Reset() { *m = AccountAddresses{} } func (m *AccountAddresses) String() string { return proto.CompactTextString(m) } func (*AccountAddresses) ProtoMessage() {} func (*AccountAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{3} + return fileDescriptor_071b9989c501c3f2, []int{1} } func (m *AccountAddresses) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -339,7 +154,7 @@ func (m *ConsensusAddresses) Reset() { *m = ConsensusAddresses{} } func (m *ConsensusAddresses) String() string { return proto.CompactTextString(m) } func (*ConsensusAddresses) ProtoMessage() {} func (*ConsensusAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{4} + return fileDescriptor_071b9989c501c3f2, []int{2} } func (m *ConsensusAddresses) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,7 +201,7 @@ func (m *UndelegationRecordKeys) Reset() { *m = UndelegationRecordKeys{} func (m *UndelegationRecordKeys) String() string { return proto.CompactTextString(m) } func (*UndelegationRecordKeys) ProtoMessage() {} func (*UndelegationRecordKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{5} + return fileDescriptor_071b9989c501c3f2, []int{3} } func (m *UndelegationRecordKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -432,7 +247,7 @@ func (m *Validators) Reset() { *m = Validators{} } func (m *Validators) String() string { return proto.CompactTextString(m) } func (*Validators) ProtoMessage() {} func (*Validators) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{6} + return fileDescriptor_071b9989c501c3f2, []int{4} } func (m *Validators) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -484,7 +299,7 @@ func (m *HeaderSubset) Reset() { *m = HeaderSubset{} } func (m *HeaderSubset) String() string { return proto.CompactTextString(m) } func (*HeaderSubset) ProtoMessage() {} func (*HeaderSubset) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{7} + return fileDescriptor_071b9989c501c3f2, []int{5} } func (m *HeaderSubset) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -534,77 +349,104 @@ func (m *HeaderSubset) GetAppHash() []byte { return nil } +// KeyPowerMapping is a mapping of the consensus public key (as a string) +// to the power of the key. +type KeyPowerMapping struct { + // list is the actual mapping of the consensus public key to the power. + List map[string]int64 `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` +} + +func (m *KeyPowerMapping) Reset() { *m = KeyPowerMapping{} } +func (m *KeyPowerMapping) String() string { return proto.CompactTextString(m) } +func (*KeyPowerMapping) ProtoMessage() {} +func (*KeyPowerMapping) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{6} +} +func (m *KeyPowerMapping) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyPowerMapping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyPowerMapping.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 *KeyPowerMapping) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyPowerMapping.Merge(m, src) +} +func (m *KeyPowerMapping) XXX_Size() int { + return m.Size() +} +func (m *KeyPowerMapping) XXX_DiscardUnknown() { + xxx_messageInfo_KeyPowerMapping.DiscardUnknown(m) +} + +var xxx_messageInfo_KeyPowerMapping proto.InternalMessageInfo + +func (m *KeyPowerMapping) GetList() map[string]int64 { + if m != nil { + return m.List + } + return nil +} + func init() { - proto.RegisterEnum("exocore.dogfood.v1.OperationType", OperationType_name, OperationType_value) - proto.RegisterEnum("exocore.dogfood.v1.QueueResultType", QueueResultType_name, QueueResultType_value) proto.RegisterType((*ExocoreValidator)(nil), "exocore.dogfood.v1.ExocoreValidator") - proto.RegisterType((*Operation)(nil), "exocore.dogfood.v1.Operation") - proto.RegisterType((*Operations)(nil), "exocore.dogfood.v1.Operations") proto.RegisterType((*AccountAddresses)(nil), "exocore.dogfood.v1.AccountAddresses") proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") proto.RegisterType((*UndelegationRecordKeys)(nil), "exocore.dogfood.v1.UndelegationRecordKeys") proto.RegisterType((*Validators)(nil), "exocore.dogfood.v1.Validators") proto.RegisterType((*HeaderSubset)(nil), "exocore.dogfood.v1.HeaderSubset") + proto.RegisterType((*KeyPowerMapping)(nil), "exocore.dogfood.v1.KeyPowerMapping") + proto.RegisterMapType((map[string]int64)(nil), "exocore.dogfood.v1.KeyPowerMapping.ListEntry") } func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0x8e, 0x9b, 0xb2, 0xbb, 0x4c, 0xbb, 0x5d, 0x33, 0x84, 0x6e, 0x6a, 0xed, 0xa6, 0x6e, 0x84, - 0x50, 0xa8, 0xc0, 0x26, 0x2d, 0x08, 0x04, 0x02, 0x29, 0x6d, 0x8c, 0x1a, 0x65, 0x69, 0xb2, 0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 0x8b, 0xe5, 0xa5, 0x5e, 0xa9, 0x76, 0x70, 0x33, - 0xed, 0x07, 0xdd, 0x97, 0x17, 0x35, 0xe1, 0xd5, 0x45, 0x4d, 0xf8, 0xe7, 0xa2, 0x26, 0xbc, 0xb8, - 0xac, 0x95, 0x5e, 0x5d, 0xd6, 0x4a, 0x7f, 0x5d, 0xd6, 0x4a, 0x3f, 0x36, 0x47, 0x1e, 0x3b, 0x8d, - 0x86, 0x8a, 0x43, 0x26, 0x2a, 0x9f, 0x74, 0xc7, 0xc0, 0x9e, 0x93, 0xf0, 0x4c, 0xcd, 0x47, 0xfc, - 0xf9, 0x62, 0xc8, 0x27, 0xb3, 0x84, 0x0e, 0xef, 0xa4, 0x9e, 0xdb, 0xff, 0x3f, 0x00, 0x00, 0xff, - 0xff, 0x99, 0xab, 0xaa, 0x75, 0x04, 0x06, 0x00, 0x00, + // 575 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xce, 0x36, 0xfd, 0xf5, 0xd7, 0x6e, 0x23, 0x11, 0xad, 0x22, 0x48, 0x73, 0x70, 0x82, 0x85, + 0x50, 0x0e, 0x74, 0x4d, 0xd2, 0x03, 0x55, 0x39, 0x25, 0xa8, 0x52, 0x51, 0x00, 0x55, 0xe6, 0xcf, + 0x81, 0x4b, 0xb4, 0xb6, 0xa7, 0x8e, 0x15, 0xc7, 0xbb, 0xf2, 0xae, 0xd3, 0xf8, 0x21, 0x90, 0x7a, + 0xe1, 0x11, 0x78, 0x03, 0x1e, 0xa2, 0xe2, 0xd4, 0x23, 0xa7, 0x82, 0x92, 0x37, 0xe0, 0x09, 0x90, + 0xbd, 0x76, 0x80, 0x16, 0x71, 0x9b, 0xd9, 0xef, 0x9b, 0xd9, 0x6f, 0xe7, 0x9b, 0xc5, 0x1d, 0x58, + 0x70, 0x97, 0xc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 0x4b, + 0x4d, 0x6f, 0x94, 0xd0, 0x17, 0x81, 0x54, 0xc7, 0x91, 0x8a, 0x53, 0xfd, 0xdc, 0xd6, 0x13, 0xbc, + 0xb3, 0x3e, 0x22, 0x75, 0x5c, 0xcd, 0xd6, 0x24, 0x7b, 0xe9, 0x8e, 0x9d, 0x85, 0xd9, 0x46, 0xcd, + 0x59, 0x98, 0x40, 0xb9, 0x51, 0x79, 0x72, 0xb4, 0x71, 0x88, 0x86, 0xa3, 0xcb, 0xa5, 0x81, 0xae, + 0x96, 0x06, 0xfa, 0xbe, 0x34, 0xd0, 0xc5, 0xca, 0xa8, 0x5c, 0xad, 0x8c, 0xca, 0xd7, 0x95, 0x51, + 0x79, 0xdf, 0xf3, 0x03, 0x35, 0x49, 0x1c, 0xea, 0xf2, 0x99, 0x55, 0x2c, 0xef, 0x2b, 0x50, 0xe7, + 0x3c, 0x9e, 0x5a, 0xe5, 0xbf, 0x5c, 0xac, 0x7f, 0xa6, 0x4a, 0x05, 0x48, 0x67, 0x2b, 0x9f, 0xe6, + 0xc1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x8d, 0x64, 0x24, 0xb9, 0x03, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -654,88 +496,6 @@ func (m *ExocoreValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Operation) 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 *Operation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Operation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDogfood(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintDogfood(dAtA, i, uint64(len(m.OperatorAddress))) - i-- - dAtA[i] = 0x12 - } - if m.OperationType != 0 { - i = encodeVarintDogfood(dAtA, i, uint64(m.OperationType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Operations) 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 *Operations) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Operations) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.List) > 0 { - for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDogfood(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *AccountAddresses) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -903,17 +663,57 @@ func (m *HeaderSubset) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err3 != nil { - return 0, err3 + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err2 != nil { + return 0, err2 } - i -= n3 - i = encodeVarintDogfood(dAtA, i, uint64(n3)) + i -= n2 + i = encodeVarintDogfood(dAtA, i, uint64(n2)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } +func (m *KeyPowerMapping) 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 *KeyPowerMapping) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyPowerMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.List) > 0 { + for k := range m.List { + v := m.List[k] + baseI := i + i = encodeVarintDogfood(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintDogfood(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintDogfood(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintDogfood(dAtA []byte, offset int, v uint64) int { offset -= sovDogfood(v) base := offset @@ -945,39 +745,6 @@ func (m *ExocoreValidator) Size() (n int) { return n } -func (m *Operation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OperationType != 0 { - n += 1 + sovDogfood(uint64(m.OperationType)) - } - l = len(m.OperatorAddress) - if l > 0 { - n += 1 + l + sovDogfood(uint64(l)) - } - l = m.PubKey.Size() - n += 1 + l + sovDogfood(uint64(l)) - return n -} - -func (m *Operations) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.List) > 0 { - for _, e := range m.List { - l = e.Size() - n += 1 + l + sovDogfood(uint64(l)) - } - } - return n -} - func (m *AccountAddresses) Size() (n int) { if m == nil { return 0 @@ -1057,6 +824,23 @@ func (m *HeaderSubset) Size() (n int) { return n } +func (m *KeyPowerMapping) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for k, v := range m.List { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovDogfood(uint64(len(k))) + 1 + sovDogfood(uint64(v)) + n += mapEntrySize + 1 + sovDogfood(uint64(mapEntrySize)) + } + } + return n +} + func sovDogfood(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1202,7 +986,7 @@ func (m *ExocoreValidator) Unmarshal(dAtA []byte) error { } return nil } -func (m *Operation) Unmarshal(dAtA []byte) error { +func (m *AccountAddresses) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1225,34 +1009,15 @@ func (m *Operation) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Operation: wiretype end group for non-group") + return fmt.Errorf("proto: AccountAddresses: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Operation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AccountAddresses: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperationType", wireType) - } - m.OperationType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDogfood - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OperationType |= OperationType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1279,43 +1044,8 @@ func (m *Operation) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = append(m.OperatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.OperatorAddress == nil { - m.OperatorAddress = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDogfood - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDogfood - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDogfood - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1338,7 +1068,7 @@ func (m *Operation) Unmarshal(dAtA []byte) error { } return nil } -func (m *Operations) Unmarshal(dAtA []byte) error { +func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1361,17 +1091,17 @@ func (m *Operations) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Operations: wiretype end group for non-group") + return fmt.Errorf("proto: ConsensusAddresses: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Operations: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsensusAddresses: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -1381,25 +1111,23 @@ func (m *Operations) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, Operation{}) - if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1422,7 +1150,7 @@ func (m *Operations) Unmarshal(dAtA []byte) error { } return nil } -func (m *AccountAddresses) Unmarshal(dAtA []byte) error { +func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1445,10 +1173,10 @@ func (m *AccountAddresses) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AccountAddresses: wiretype end group for non-group") + return fmt.Errorf("proto: UndelegationRecordKeys: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AccountAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1504,7 +1232,7 @@ func (m *AccountAddresses) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { +func (m *Validators) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1527,17 +1255,17 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsensusAddresses: wiretype end group for non-group") + return fmt.Errorf("proto: Validators: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsensusAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Validators: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -1547,23 +1275,25 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, make([]byte, postIndex-iNdEx)) - copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) + m.List = append(m.List, types1.Validator{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1586,7 +1316,7 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { } return nil } -func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { +func (m *HeaderSubset) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1609,17 +1339,17 @@ func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UndelegationRecordKeys: wiretype end group for non-group") + return fmt.Errorf("proto: HeaderSubset: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HeaderSubset: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -1629,79 +1359,64 @@ func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, make([]byte, postIndex-iNdEx)) - copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipDogfood(dAtA[iNdEx:]) - if err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDogfood + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Validators) 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 ErrIntOverflowDogfood + if byteLen < 0 { + return ErrInvalidLengthDogfood } - if iNdEx >= l { + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDogfood + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...) + if m.NextValidatorsHash == nil { + m.NextValidatorsHash = []byte{} } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Validators: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Validators: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -1711,24 +1426,24 @@ func (m *Validators) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, types1.Validator{}) - if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} } iNdEx = postIndex default: @@ -1752,7 +1467,7 @@ func (m *Validators) Unmarshal(dAtA []byte) error { } return nil } -func (m *HeaderSubset) Unmarshal(dAtA []byte) error { +func (m *KeyPowerMapping) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1775,15 +1490,15 @@ func (m *HeaderSubset) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: HeaderSubset: wiretype end group for non-group") + return fmt.Errorf("proto: KeyPowerMapping: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: HeaderSubset: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: KeyPowerMapping: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1810,77 +1525,89 @@ func (m *HeaderSubset) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDogfood - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDogfood - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDogfood - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...) - if m.NextValidatorsHash == nil { - m.NextValidatorsHash = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDogfood - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + if m.List == nil { + m.List = make(map[string]int64) + } + var mapkey string + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthDogfood + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthDogfood + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDogfood + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skipDogfood(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDogfood + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - if byteLen < 0 { - return ErrInvalidLengthDogfood - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDogfood - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) - if m.AppHash == nil { - m.AppHash = []byte{} - } + m.List[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 06ca74df4..6c6862d9f 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -55,6 +55,12 @@ type OperatorKeeper interface { ) (bool, sdk.AccAddress) IsOperatorJailedForChainId(sdk.Context, sdk.AccAddress, string) bool Jail(sdk.Context, sdk.ConsAddress, string) + // GetActiveOperatorsForChainId should return a list of operators and their public keys. + // These operators should not be in the process of opting our, and should not be jailed + // whether permanently or temporarily. + GetActiveOperatorsForChainId( + sdk.Context, string, + ) ([]sdk.AccAddress, []tmprotocrypto.PublicKey) } // DelegationKeeper represents the expected keeper interface for the delegation module. @@ -72,6 +78,10 @@ type EpochsHooks interface { // RestakingKeeper represents the expected keeper interface for the restaking module. type RestakingKeeper interface { GetOperatorAssetValue(sdk.Context, sdk.AccAddress) (int64, error) + IsStakingAsset(sdk.Context, string) bool + GetAvgDelegatedValue( + sdk.Context, []sdk.AccAddress, []string, string, + ) ([]int64, error) } // SlashingKeeper represents the expected keeper interface for the (exo-)slashing module. diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 1303fb4d0..849b5ec54 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -53,6 +53,7 @@ const ( // PendingUndelegationsByte is the byte used to store the list of undelegations that will // mature at the end of the current block. PendingUndelegationsByte + // ValidatorSetBytePrefix is the prefix for the historical validator set store. ValidatorSetBytePrefix @@ -61,6 +62,12 @@ const ( // HeaderBytePrefix is the prefix for the header store. HeaderBytePrefix + + // EpochEndByte is the byte key for the epoch end store. + EpochEndByte + + // KeyPowerMappingByte is the byte key for the consensus key to vote power mapping store. + KeyPowerMappingByte ) // ExocoreValidatorKey returns the key for the validator store. @@ -169,6 +176,16 @@ func PendingUndelegationsKey() []byte { return []byte{PendingUndelegationsByte} } +// EpochEndKey returns the key for the epoch end store. +func EpochEndKey() []byte { + return []byte{EpochEndByte} +} + +// KeyPowerMappingKey returns the key for the consensus key to vote power mapping store. +func KeyPowerMappingKey() []byte { + return []byte{KeyPowerMappingByte} +} + // SafeInt64ToUint64 is a wrapper function to convert an int64 // to a uint64. It returns (0, false) if the conversion is not possible. // This is safe as long as the int64 is non-negative. diff --git a/x/dogfood/types/params.go b/x/dogfood/types/params.go index f1b272b56..a07d14f3e 100644 --- a/x/dogfood/types/params.go +++ b/x/dogfood/types/params.go @@ -2,12 +2,14 @@ package types import ( "fmt" + "strings" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common/hexutil" "gopkg.in/yaml.v2" - epochTypes "github.com/evmos/evmos/v14/x/epochs/types" + epochtypes "github.com/evmos/evmos/v14/x/epochs/types" ) var _ paramtypes.ParamSet = (*Params)(nil) @@ -20,21 +22,24 @@ const ( DefaultEpochsUntilUnbonded = 7 // DefaultEpochIdentifier is the epoch identifier which is used, by default, to identify the // epoch. Note that the options include week, day or hour. - DefaultEpochIdentifier = epochTypes.HourEpochID - // DefaultMaxValidators is the default maximum number of bonded validators. + DefaultEpochIdentifier = epochtypes.HourEpochID + // DefaultMaxValidators is the default maximum number of bonded validators. It is defined as + // a copy here so that we can use a value other than that in x/staking, if necessary. DefaultMaxValidators = stakingtypes.DefaultMaxValidators // DefaultHistorical entries is the number of entries of historical staking data to persist. - // Apps that don't use IBC can ignore this value by not adding the staking module to the - // application module manager's SetOrderBeginBlockers. + // It is defined as a copy here so that we can use a value other than that in x/staking, if + // necessary. DefaultHistoricalEntries = stakingtypes.DefaultHistoricalEntries + // DefaultAssetIDs is the default asset IDs accepted by the dogfood module. If multiple + // asset IDs are to be supported by default, separate them with a pipe character. + DefaultAssetIDs = "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65" ) // Reflection based keys for params subspace. var ( KeyEpochsUntilUnbonded = []byte("EpochsUntilUnbonded") KeyEpochIdentifier = []byte("EpochIdentifier") - KeyMaxValidators = []byte("MaxValidators") - KeyHistoricalEntries = []byte("HistoricalEntries") + KeyAssetIDs = []byte("AssetIDs") ) // ParamKeyTable returns a key table with the necessary registered params. @@ -48,12 +53,14 @@ func NewParams( epochIdentifier string, maxValidators uint32, historicalEntries uint32, + assetIDs []string, ) Params { return Params{ EpochsUntilUnbonded: epochsUntilUnbonded, EpochIdentifier: epochIdentifier, MaxValidators: maxValidators, HistoricalEntries: historicalEntries, + AssetIDs: assetIDs, } } @@ -64,6 +71,7 @@ func DefaultParams() Params { DefaultEpochIdentifier, DefaultMaxValidators, DefaultHistoricalEntries, + strings.Split(DefaultAssetIDs, "|"), ) } @@ -78,18 +86,23 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair( KeyEpochIdentifier, &p.EpochIdentifier, - epochTypes.ValidateEpochIdentifierInterface, + epochtypes.ValidateEpochIdentifierInterface, ), paramtypes.NewParamSetPair( - KeyMaxValidators, + stakingtypes.KeyMaxValidators, &p.MaxValidators, ValidatePositiveUint32, ), paramtypes.NewParamSetPair( - KeyHistoricalEntries, + stakingtypes.KeyHistoricalEntries, &p.HistoricalEntries, ValidatePositiveUint32, ), + paramtypes.NewParamSetPair( + KeyAssetIDs, + &p.AssetIDs, + ValidateAssetIDs, + ), } } @@ -98,7 +111,7 @@ func (p Params) Validate() error { if err := ValidatePositiveUint32(p.EpochsUntilUnbonded); err != nil { return fmt.Errorf("epochs until unbonded: %w", err) } - if err := epochTypes.ValidateEpochIdentifierInterface(p.EpochIdentifier); err != nil { + if err := epochtypes.ValidateEpochIdentifierInterface(p.EpochIdentifier); err != nil { return fmt.Errorf("epoch identifier: %w", err) } if err := ValidatePositiveUint32(p.MaxValidators); err != nil { @@ -129,3 +142,33 @@ func (p Params) String() string { } return string(out) } + +// ValidateAssetIDs checks whether the supplied value is a valid asset ID. +func ValidateAssetIDs(i interface{}) error { + var val []string + if val, ok := i.([]string); !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } else if len(val) == 0 { + return fmt.Errorf("invalid parameter value: %v", val) + } + for _, assetID := range val { + if !strings.Contains(assetID, "_") { + return fmt.Errorf("invalid parameter value (missing underscore): %v", val) + } + split := strings.Split(assetID, "_") + if len(split) != 2 { + return fmt.Errorf( + "invalid parameter value (unexpected number of underscores): %v", val, + ) + } + if len(split[0]) == 0 || len(split[1]) == 0 { + return fmt.Errorf("invalid parameter value (empty parts): %v", val) + } + // i cannot validate the address because it may be on a client chain and i have + // no idea what format or length it may have. i can only validate the chain ID. + if _, err := hexutil.DecodeUint64(split[1]); err != nil { + return fmt.Errorf("invalid parameter value (not a number): %v", split[1]) + } + } + return nil +} diff --git a/x/dogfood/types/params.pb.go b/x/dogfood/types/params.pb.go index 1b35e818a..a59e27d9e 100644 --- a/x/dogfood/types/params.pb.go +++ b/x/dogfood/types/params.pb.go @@ -36,6 +36,11 @@ type Params struct { MaxValidators uint32 `protobuf:"varint,3,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty"` // HistoricalEntries is the number of historical entries to persist. HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` + // AssetIDs is the ids of the assets which will be accepted by the module. + // It must be within the list of assets supported by the restaking module. + // The typical format of these IDs is + // lower(assetAddress) + _ + hex(clientChainLzID) + AssetIDs []string `protobuf:"bytes,5,rep,name=asset_ids,json=assetIds,proto3" json:"asset_ids,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -98,6 +103,13 @@ func (m *Params) GetHistoricalEntries() uint32 { return 0 } +func (m *Params) GetAssetIDs() []string { + if m != nil { + return m.AssetIDs + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "exocore.dogfood.v1.Params") } @@ -105,25 +117,27 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/params.proto", fileDescriptor_e8747fb70c97d97f) } var fileDescriptor_e8747fb70c97d97f = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0x3f, 0x4b, 0xc3, 0x40, - 0x18, 0x87, 0x73, 0x5a, 0x0a, 0x1e, 0xd4, 0x3f, 0xa7, 0x42, 0x70, 0xb8, 0x16, 0x41, 0xa8, 0x83, - 0x39, 0xaa, 0x9b, 0xa3, 0xd0, 0x41, 0x04, 0x91, 0x42, 0x1d, 0x5c, 0xc2, 0x35, 0x77, 0x4d, 0x0f, - 0x9b, 0xbc, 0xe1, 0xee, 0x1a, 0xe3, 0xb7, 0x70, 0x74, 0xf4, 0xbb, 0xb8, 0x38, 0x76, 0x74, 0x94, - 0xe4, 0x8b, 0x48, 0x2f, 0x31, 0x6e, 0xc7, 0xef, 0x79, 0xee, 0x1d, 0x1e, 0xdc, 0x97, 0x05, 0x44, - 0xa0, 0x25, 0x13, 0x10, 0xcf, 0x01, 0x04, 0xcb, 0x47, 0x2c, 0xe3, 0x9a, 0x27, 0x26, 0xc8, 0x34, - 0x58, 0x20, 0xa4, 0x11, 0x82, 0x46, 0x08, 0xf2, 0xd1, 0xc9, 0x51, 0x0c, 0x31, 0x38, 0xcc, 0x36, - 0xaf, 0xda, 0x3c, 0xfd, 0x44, 0xb8, 0xfb, 0xe0, 0xbe, 0x92, 0x4b, 0x7c, 0x2c, 0x33, 0x88, 0x16, - 0x26, 0x5c, 0xa5, 0x56, 0x2d, 0xc3, 0x55, 0x3a, 0x83, 0x54, 0x48, 0xe1, 0xa3, 0x01, 0x1a, 0xf6, - 0x26, 0x87, 0x35, 0x9c, 0x6e, 0xd8, 0xb4, 0x41, 0xe4, 0x1c, 0xef, 0xbb, 0x39, 0x54, 0x42, 0xa6, - 0x56, 0xcd, 0x95, 0xd4, 0xfe, 0xd6, 0x00, 0x0d, 0x77, 0x26, 0x7b, 0x6e, 0xbf, 0x6d, 0x67, 0x72, - 0x86, 0x77, 0x13, 0x5e, 0x84, 0x39, 0x5f, 0x2a, 0xc1, 0x2d, 0x68, 0xe3, 0x6f, 0xbb, 0xbb, 0xbd, - 0x84, 0x17, 0x8f, 0xed, 0x48, 0x2e, 0x30, 0x59, 0x28, 0x63, 0x41, 0xab, 0x88, 0x2f, 0x43, 0x99, - 0x5a, 0xad, 0xa4, 0xf1, 0x3b, 0x4e, 0x3d, 0xf8, 0x27, 0xe3, 0x1a, 0x5c, 0x77, 0xde, 0x3f, 0xfa, - 0xde, 0xcd, 0xdd, 0x57, 0x49, 0xd1, 0xba, 0xa4, 0xe8, 0xa7, 0xa4, 0xe8, 0xad, 0xa2, 0xde, 0xba, - 0xa2, 0xde, 0x77, 0x45, 0xbd, 0xa7, 0x51, 0xac, 0xec, 0x62, 0x35, 0x0b, 0x22, 0x48, 0xd8, 0xb8, - 0x8e, 0x72, 0x2f, 0xed, 0x0b, 0xe8, 0x67, 0xf6, 0x17, 0xb1, 0x68, 0x33, 0xda, 0xd7, 0x4c, 0x9a, - 0x59, 0xd7, 0x95, 0xb9, 0xfa, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x52, 0x3e, 0xbb, 0xe0, 0x66, 0x01, + // 322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0x3f, 0x4f, 0x02, 0x31, + 0x18, 0x87, 0xaf, 0x82, 0x04, 0x1a, 0xf1, 0x4f, 0xd5, 0xe4, 0xe2, 0x70, 0x10, 0x13, 0x13, 0x18, + 0xbc, 0x0b, 0xba, 0xb9, 0x49, 0x64, 0x20, 0x26, 0xc6, 0x90, 0xe0, 0xe0, 0xd2, 0x94, 0x6b, 0x39, + 0x1a, 0xb9, 0x7b, 0x2f, 0x6d, 0xc1, 0xf3, 0x5b, 0x38, 0x3a, 0xfa, 0x71, 0x1c, 0x19, 0x9d, 0x8c, + 0x39, 0x76, 0x3f,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x7d, 0xae, 0xaf, 0xca, 0x6f, 0xef, 0x0d, 0xa7, + 0x7b, 0xfb, 0x91, 0x7b, 0x68, 0x91, 0x7b, 0xe8, 0x3b, 0xf7, 0xd0, 0xeb, 0xd2, 0x73, 0x16, 0x4b, + 0xcf, 0xf9, 0x5c, 0x7a, 0xce, 0x63, 0x27, 0x92, 0x66, 0x32, 0x1b, 0xf9, 0x21, 0xc4, 0x41, 0xaf, + 0xe8, 0x77, 0x27, 0xcc, 0x33, 0xa8, 0xa7, 0xe0, 0xaf, 0x77, 0xb6, 0x29, 0x6e, 0x5e, 0x52, 0xa1, + 0x47, 0x15, 0x1b, 0xf1, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x8d, 0x3f, 0x7c, 0x91, 0x01, 0x00, 0x00, } @@ -147,6 +161,15 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AssetIDs) > 0 { + for iNdEx := len(m.AssetIDs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AssetIDs[iNdEx]) + copy(dAtA[i:], m.AssetIDs[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.AssetIDs[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } if m.HistoricalEntries != 0 { i = encodeVarintParams(dAtA, i, uint64(m.HistoricalEntries)) i-- @@ -202,6 +225,12 @@ func (m *Params) Size() (n int) { if m.HistoricalEntries != 0 { n += 1 + sovParams(uint64(m.HistoricalEntries)) } + if len(m.AssetIDs) > 0 { + for _, s := range m.AssetIDs { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } return n } @@ -329,6 +358,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AssetIDs = append(m.AssetIDs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 3ded4acd934bb4cff476f3c4d2ecee8b5cb2f7d3 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:19:59 +0530 Subject: [PATCH 39/41] chore(lint): fix super linter (again) (#14) * chore(lint): satisfy gitleaks If a variable name contains the word KEY, gitleaks does not like it and flags it as a potential secret. I have changed the name of the variable in these files from KEYALGO to ALGO since it is not a secret but rather the algorithm of the key generation. That silences gitleaks. * chore(lint): placate YAML linter added a blank line at the end of `.golangci.yml` * chore(lint): activate Docker / IAAS linter * chore(lint): placate shellcheck * chore(lint): placate markdownlint * chore(lint): placate markdownlint from `lint.yml` The previous commit worked on the markdownlint from the super-linter. * build: use test keyring in localnet The OS keyring may not always be available. * chore(lint): merge docker RUN statements It can potentially reduce the number of layers in the image, making it smaller and more efficient to build and pull. * fix(localnet): remove seed URL upon init * chore(lint): some lint suggestions for Dockerfile Note that this file is used from the root of the project via `make localnet-build`, which is why the paths work. * chore(lint): apply shfmt * chore(lint): add docker healthcheck and user * chore(build): update release go version to 1.21 * chore(ci): add permissions to workflows * chore(ci): skip generated files * chore(ci): placate yaml linter * chore(ci): use correct argument name for checkov * chore(ci): add top level permissions to codeql * chore(ci): add json super linter to match develop * chore(ci): disable JSON super linter * chore(lint): trigger lint workflows with comment * chore(deps): upgrade protobuf to 1.33.0 CVE-2024-24786 / GO-2024-2611 is fixed with this upgrade. Even though this package is fundamental to our system, the changes between 1.31.0 and 1.33.0 are minor. * Revert "chore(deps): upgrade protobuf to 1.33.0" This reverts commit c09f9864441e9aaf64ad2d31bb568eb71bf6eb35. * chore(deps): update protobuf A vulnerability has been fixed in v1.33.0 of google.golang.org/protobuf and we must update the associated github.com/golang/protobuf as well. * chore(ci): coverage badge comment on PR * chore(build): exclude testutil from coverage * chore(ci): add test coverage commenting workflow * chore(ci): use step output instead of env * chore(ci): add commit hash in test comment * chore(ci): remove deprecated output The test workflow will not fully run right now because it runs on `pull_request_target` which must be merged into the base branch first. --- .checkov.yaml | 3 + .github/workflows/ante-benchmark.yml | 3 + .github/workflows/build.yml | 3 + .github/workflows/codeql-analysis.yml | 5 ++ .github/workflows/consensuswarn.yml | 5 ++ .github/workflows/e2e-test-release.yml | 4 ++ .github/workflows/e2e-test.yml | 4 ++ .github/workflows/goreleaser.yml | 4 ++ .github/workflows/labeler.yml | 4 ++ .github/workflows/markdown-links.yml | 11 ++- .github/workflows/proto.yml | 3 + .github/workflows/security.yml | 5 ++ .github/workflows/semgrep.yml | 2 + .github/workflows/slither.yml | 4 ++ .github/workflows/solhint.yml | 5 +- .github/workflows/solidity-test.yml | 3 + .github/workflows/stale.yml | 4 ++ .github/workflows/super-linter.yml | 8 ++- .github/workflows/test.yml | 39 ++++++++--- .gitignore | 1 - .golangci.yml | 2 +- CONTRIBUTING.md | 85 ++++++++++++------------ Dockerfile | 9 ++- Makefile | 10 +-- README.md | 17 ++++- SECURITY.md | 5 +- go.mod | 4 +- go.sum | 4 ++ init.bat | 4 +- local_node.sh | 12 ++-- networks/init-node.sh | 77 ++++++++++----------- networks/local/exocore/Dockerfile | 22 ++++-- networks/local/exocore/wrapper.sh | 11 +-- precompiles/testutil/contracts/readme.md | 7 +- scripts/start-docker.sh | 25 +++---- x/dogfood/module.go | 2 +- x/todo.md | 34 +++++----- 37 files changed, 288 insertions(+), 162 deletions(-) create mode 100644 .checkov.yaml diff --git a/.checkov.yaml b/.checkov.yaml new file mode 100644 index 000000000..72c539fa6 --- /dev/null +++ b/.checkov.yaml @@ -0,0 +1,3 @@ +skip-path: + # auto generated + - client/docs diff --git a/.github/workflows/ante-benchmark.yml b/.github/workflows/ante-benchmark.yml index 2d55b6dd5..590b0349c 100644 --- a/.github/workflows/ante-benchmark.yml +++ b/.github/workflows/ante-benchmark.yml @@ -1,5 +1,8 @@ name: AnteHandler Benchmark Tests +permissions: + contents: read + on: push: branches: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c636203a5..d5e7b9557 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0485a8127..af03a72b2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,6 +11,11 @@ # name: "CodeQL" +permissions: + actions: read + contents: read + security-events: write + on: push: branches: [develop, main, master] diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml index 7662e31d5..82e8919a6 100644 --- a/.github/workflows/consensuswarn.yml +++ b/.github/workflows/consensuswarn.yml @@ -7,9 +7,14 @@ on: - edited - synchronize +permissions: + contents: read + pull-requests: write + jobs: main: permissions: + contents: read pull-requests: write # For reading the PR and posting comment runs-on: ubuntu-latest steps: diff --git a/.github/workflows/e2e-test-release.yml b/.github/workflows/e2e-test-release.yml index 95fd08b67..ca78d773f 100644 --- a/.github/workflows/e2e-test-release.yml +++ b/.github/workflows/e2e-test-release.yml @@ -1,4 +1,8 @@ name: E2E Test Release + +permissions: + contents: read + on: pull_request: branches: diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index bdd06f6dc..b15c50b93 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -1,4 +1,8 @@ name: E2E Test + +permissions: + contents: read + on: pull_request: branches: diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 9fc7c3002..a014b645b 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -1,5 +1,9 @@ name: goreleaser +permissions: + # github releases + contents: write + on: push: tags: diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f54447304..13424e232 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,5 +1,9 @@ name: "Pull Request Labeler" +permissions: + contents: read + pull-requests: write + on: pull_request_target: diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml index f276610e8..87d094918 100644 --- a/.github/workflows/markdown-links.yml +++ b/.github/workflows/markdown-links.yml @@ -1,5 +1,9 @@ name: Check Markdown links -on: + +permissions: + contents: read + +on: pull_request: paths: - '**.md' @@ -10,6 +14,9 @@ on: - master paths: - '**.md' + # runs every monday at 9 am + schedule: + - cron: "0 9 * * 1" jobs: markdown-link-check: @@ -18,7 +25,5 @@ jobs: - uses: actions/checkout@v4 - uses: gaurav-nelson/github-action-markdown-link-check@master with: - check-modified-files-only: "yes" - use-quiet-mode: "yes" base-branch: "main" config-file: "mlc_config.json" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index d450c6f3a..de4cfd9d5 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -6,6 +6,9 @@ on: paths: - "proto/**" +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 54ceec5c7..8ceef65bc 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -7,9 +7,14 @@ on: - main - master +permissions: + contents: read + security-events: write + jobs: Gosec: permissions: + contents: read security-events: write runs-on: ubuntu-latest diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index c54ae1743..4531ca4ca 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -1,4 +1,6 @@ name: Semgrep +permissions: + contents: read on: # Scan changed files in PRs, block on new issues only (existing issues ignored) pull_request: {} diff --git a/.github/workflows/slither.yml b/.github/workflows/slither.yml index 23826ddb6..3c30f4003 100644 --- a/.github/workflows/slither.yml +++ b/.github/workflows/slither.yml @@ -8,6 +8,10 @@ on: - main - master +permissions: + contents: read + security-events: write + jobs: analyze: # disabled for now, since we don't have any Solidity files. diff --git a/.github/workflows/solhint.yml b/.github/workflows/solhint.yml index a6038bda2..0da93dd36 100644 --- a/.github/workflows/solhint.yml +++ b/.github/workflows/solhint.yml @@ -1,10 +1,13 @@ name: Solhint -# This workflow is only run when a .sol file has been changed +# This workflow is only run when a file in the contracts folder changes. on: pull_request: paths: - "contracts/**" +permissions: + contents: read + jobs: solhint: name: runner / solhint diff --git a/.github/workflows/solidity-test.yml b/.github/workflows/solidity-test.yml index 950733176..74e83d6e5 100644 --- a/.github/workflows/solidity-test.yml +++ b/.github/workflows/solidity-test.yml @@ -7,6 +7,9 @@ on: - master - release/** +permissions: + contents: read + jobs: test-solidity: # disabled for now, since we don't have any Solidity files. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 95a200548..02a1abc10 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -3,6 +3,10 @@ on: schedule: - cron: "0 0 * * *" +permissions: + issues: write + pull-requests: write + jobs: stale: runs-on: ubuntu-latest diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index b13c9fd4e..97be283aa 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -7,6 +7,9 @@ --- name: Lint Code Base +permissions: + contents: read + on: push: branches: ["develop", "main", "master"] @@ -33,9 +36,10 @@ jobs: VALIDATE_NATURAL_LANGUAGE: false VALIDATE_OPENAPI: false VALIDATE_JSCPD: false + # The JSON files in the repo are generated (abis or swagger) + # or are linting files. So this can be safely disabled. + VALIDATE_JSON: false # separate workflow VALIDATE_GO: false VALIDATE_GO_MODULES: false - # TODO: enable docker coverage later - VALIDATE_CHECKOV: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a81cadb22..9d669e41d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: Tests on: - pull_request: + # for write permission, use pull_request_target and not pull_request. + pull_request_target: push: branches: - develop @@ -8,6 +9,10 @@ on: - master - release/** +permissions: + contents: write + pull-requests: write + # Automatically cancel run if another commit to the same ref is detected. concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -29,14 +34,32 @@ jobs: **/**.go go.mod go.sum - - name: Test and Create Coverage Report + - name: Test and create coverage report run: | make test-unit-cover if: env.GIT_DIFF - - uses: codecov/codecov-action@v3 - # disabled for now, since we don't have any codecov - if: ${{ false }} + - name: Check if test coverage is above threshold + id: output-coverage + uses: vladopajic/go-test-coverage@v2 + with: + profile: cover.out + local-prefix: github.com/ExocoreNetwork/exocore + # TODO: increase this threshold with time to 80 + threshold-total: 10 + if: env.GIT_DIFF + - name: Find comment + id: find-comment + uses: peter-evans/find-comment@v2 + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + if: env.GIT_DIFF && github.event_name == 'pull_request' + - name: Comment coverage on PR + uses: peter-evans/create-or-update-comment@v3 with: - file: ./coverage.txt - fail_ci_if_error: true - # if: env.GIT_DIFF + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + body: | + Coverage as of ${{ github.sha }}: ${{ steps.output-coverage.outputs.total-coverage }}% + edit-mode: append + if: env.GIT_DIFF && github.event_name == 'pull_request' diff --git a/.gitignore b/.gitignore index 30be6a326..f7cb1b900 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,6 @@ localnet-setup .testnets # Testing -coverage.txt *.out sim_log_file tests/**/tmp/* diff --git a/.golangci.yml b/.golangci.yml index e58b0924c..95fe2bac9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -67,4 +67,4 @@ issues: # however, other linters have not yet caught up. - text: 'leading space' linters: - - nolintlint \ No newline at end of file + - nolintlint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92634ecc4..4841563d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,25 +1,23 @@ # Exocore Contributor Guidelines - - [Exocore Contributor Guidelines](#exocore-contributor-guidelines) - - [General Procedure](#general-procedure) - - [Architecture Decision Records (ADR)](#architecture-decision-records-adr) - - [Forking](#forking) - - [Dependencies](#dependencies) - - [Protobuf](#protobuf) - - [Development Procedure](#development-procedure) - - [Testing](#testing) - - [Updating Documentation](#updating-documentation) - - [Branching Model and Release](#branching-model-and-release) - - [Commit messages](#commit-messages) - - [PR Targeting](#pr-targeting) - - [Pull Requests](#pull-requests) - - [Process for reviewing PRs](#process-for-reviewing-prs) - - [Pull Merge Procedure](#pull-merge-procedure) - - [Release Procedure](#release-procedure) - - -## General Procedure + - [General Procedure](#general-procedure) + - [Architecture Decision Records (ADR)](#architecture-decision-records-adr) + - [Forking](#forking) + - [Dependencies](#dependencies) + - [Protobuf](#protobuf) + - [Development Procedure](#development-procedure) + - [Testing](#testing) + - [Updating Documentation](#updating-documentation) + - [Branching Model and Release](#branching-model-and-release) + - [Commit messages](#commit-messages) + - [PR Targeting](#pr-targeting) + - [Pull Requests](#pull-requests) + - [Process for reviewing PRs](#process-for-reviewing-prs) + - [Pull Merge Procedure](#pull-merge-procedure) + - [Release Procedure](#release-procedure) + +## General Procedure Thank you for considering making contributions to Exocore and related repositories! @@ -31,8 +29,8 @@ To ensure a smooth workflow for all contributors, the following general procedure for contributing has been established: 1. Either [open](https://github.com/ExocoreNetwork/exocore/issues/new/choose) - or [find](https://github.com/ExocoreNetwork/exocore/issues) an issue you have identified and would like to contribute to - resolving. + or [find](https://github.com/ExocoreNetwork/exocore/issues) an issue you have identified and would like to contribute + to resolving. 2. Participate in thoughtful discussion on that issue. 3. If you would like to contribute: 1. If the issue is a proposal, ensure that the proposal has been accepted by the Exocore team. @@ -68,8 +66,7 @@ For more complex problems/features, if a PR is opened before an adequate design discussion has taken place in a GitHub issue, that PR runs a high likelihood of being rejected. - -## Architecture Decision Records (ADR) +## Architecture Decision Records (ADR) When proposing an architecture decision for Exocore, please create an ADR @@ -79,7 +76,7 @@ before any party begins coding the proposed implementation. If you would like to see some examples of how these are written refer to [Tendermint ADRs](https://github.com/tendermint/tendermint/tree/master/docs/architecture). -## Forking +## Forking Please note that Go requires code to live under absolute paths, which complicates forking. While my fork lives at `https://github.com/ExocoreNetwork/exocore`, @@ -92,12 +89,12 @@ For instance, to create a fork and work on a branch of it, you would: 1. Create the fork on github, using the fork button. 2. Go to the original repo checked out locally. (i.e. `$GOPATH/src/github.com/ExocoreNetwork/exocore`) 3. `git remote rename origin upstream` -4. `git remote add origin git@github.com:tharsis/Exocore.git` +4. `git remote add origin git@github.com:$USERNAME/Exocore.git` Now `origin` refers to my fork and `upstream` refers to the Exocore version. So I can `git push -u origin master` to update my fork, and make pull requests to Exocore from there. -Of course, replace `tharsis` with your git handle. +Of course, replace `$USERNAME` with your git handle. To pull in updates from the origin repo, run: @@ -129,7 +126,7 @@ More about rebase [here](https://git-scm.com/docs/git-rebase) and Please **NO DOT** make Pull Requests from `development`. -## Dependencies +## Dependencies We use [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependency versions. @@ -139,7 +136,7 @@ with their dependencies, so we can get away with telling people they can just `g Since some dependencies are not under our control, a third party may break our build, in which case we can fall back on `go mod tidy -v`. -## Protobuf +## Protobuf We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/cosmos/protobuf) to generate code for use in Exocore. @@ -172,7 +169,7 @@ For example, in vscode your `.vscode/settings.json` should look like: } ``` -## Development Procedure +## Development Procedure 1. The latest state of development is on `development`. 2. `development` must never @@ -182,17 +179,17 @@ For example, in vscode your `.vscode/settings.json` should look like: using `git remote add origin`). 5. Before submitting a pull request, begin `git rebase` on top of `development`. -## Testing +## Testing Exocore uses [GitHub Actions](https://github.com/features/actions) for automated testing. -## Updating Documentation +## Updating Documentation If you open a PR on the Exocore repo, it is mandatory to update the relevant documentation in `/docs`. Please refer to the docs subdirectory and make changes accordingly. Prior to approval, the Code owners/approvers may request some updates to specific docs. -## Branching Model and Release +## Branching Model and Release User-facing repos should adhere to the [trunk based development branching model](https://trunkbaseddevelopment.com/). @@ -200,7 +197,7 @@ Libraries need not follow the model strictly, but would be wise to. Exocore utilizes [semantic versioning](https://semver.org/). -### Commit messages +### Commit messages Commit messages should be written in a short, descriptive manner and be prefixed with tags for the change type and scope (if possible) @@ -209,7 +206,7 @@ according to the [semantic commit](https://gist.github.com/joshbuchea/6f47e86d25 For example, a new change to the `bank` module might have the following message: `feat(bank): add balance query cli command` -### PR Targeting +### PR Targeting Ensure that you base and target your PR on the `development` branch. @@ -217,13 +214,13 @@ All feature additions should be targeted against `development`. Bug fixes for an outstanding release candidate should be targeted against the release candidate branch. -### Pull Requests +### Pull Requests To accommodate the review process, we suggest that PRs are categorically broken up. Ideally each PR addresses only a single issue. Additionally, as much as possible code refactoring and cleanup should be submitted as separate PRs from bug fixes/feature-additions. -### Process for reviewing PRs +### Process for reviewing PRs All PRs require two Reviews before merge. When reviewing PRs, please use the following review explanations: @@ -233,21 +230,21 @@ All PRs require two Reviews before merge. When reviewing PRs, please use the fol documentation/spec is updated in the right places, you have pulled down and tested the code locally. In addition: - * You must think through whether any added code could be partially combined (DRYed) with existing code. - * You must think through any potential security issues or incentive-compatibility flaws introduced by the changes. - * Naming convention must be consistent with the rest of the codebase. - * Code must live in a reasonable location, considering dependency structures + - You must think through whether any added code could be partially combined (DRYed) with existing code. + - You must think through any potential security issues or incentive-compatibility flaws introduced by the changes. + - Naming convention must be consistent with the rest of the codebase. + - Code must live in a reasonable location, considering dependency structures (e.g. not importing testing modules in production code, or including example code modules in production code). - * If you approve of the PR, you are responsible for fixing any of the issues mentioned here. + - If you approve of the PR, you are responsible for fixing any of the issues mentioned here. 3. If you are only making "surface level" reviews, submit any notes as `Comments` without adding a review. -### Pull Merge Procedure +### Pull Merge Procedure 1. Ensure pull branch is rebased on `development`. 2. Run `make test` to ensure that all tests pass. 3. Squash merge pull request. -### Release Procedure +### Release Procedure 1. Start on `development`. 2. Create the release candidate branch `rc/v*` (going forward known as `RC`) @@ -265,5 +262,5 @@ All PRs require two Reviews before merge. When reviewing PRs, please use the fol 8. Tag the release (use `git tag -a`) and create a release in Github. 9. Delete the `RC` branches. -**Note**: tharsis’s Exocore team currently cuts releases on a need to have basis. +**Note**: The Exocore team currently cuts releases on a need to have basis. We will announce a more standardized release schedule as we near production readiness. diff --git a/Dockerfile b/Dockerfile index 7ce5d7ca7..7a6fab470 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# This is the published docker image for exocore. + FROM golang:1.21.0-alpine3.18 AS build-env WORKDIR /go/src/github.com/ExocoreNetwork/exocore @@ -12,9 +14,7 @@ RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \ COPY . . -RUN make build - -RUN go install github.com/MinseokOh/toml-cli@latest +RUN make build && go install github.com/MinseokOh/toml-cli@latest FROM alpine:3.18 @@ -32,4 +32,7 @@ WORKDIR /home/exocore EXPOSE 26656 26657 1317 9090 8545 8546 +# Every 30s, allow 3 retries before failing, timeout after 30s. +HEALTHCHECK --interval=30s --timeout=30s --retries=3 CMD curl -f http://localhost:26657/health || exit 1 + CMD ["exocored"] diff --git a/Makefile b/Makefile index ac25228fc..5fa3aa0ce 100644 --- a/Makefile +++ b/Makefile @@ -297,7 +297,9 @@ test: test-unit test-all: test-unit test-race # For unit tests we don't want to execute the upgrade tests in tests/e2e but # we want to include all unit tests in the subfolders (tests/e2e/*) -PACKAGES_UNIT=$(shell go list ./... | grep -v '/tests/e2e$$') +# We also want to exclude the testutil folder because it contains only +# helper functions for the tests. +PACKAGES_UNIT=$(shell go list ./... | grep -v '/tests/e2e$$' | grep -v 'testutil') TEST_PACKAGES=./... TEST_TARGETS := test-unit test-unit-cover test-race @@ -311,7 +313,7 @@ test-race: ARGS=-race test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION) $(TEST_TARGETS): run-tests -test-unit-cover: ARGS=-timeout=15m -coverprofile=coverage.txt -covermode=atomic +test-unit-cover: ARGS=-timeout=15m -coverprofile=cover.out -covermode=atomic test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT) test-e2e: @@ -479,7 +481,7 @@ localnet-build: # Generate multi node configuration files and initialize configurations # TODO: exocore testnet chainid is still under consideration and need to be finalized later localnet-init: localnet-stop - exocored testnet init-files --chain-id exocoretestnet_233-1 --v 4 -o $(CURDIR)/build/.testnets --starting-ip-address 192.168.10.2 --keyring-backend=os && \ + exocored testnet init-files --chain-id exocoretestnet_233-1 --v 4 -o $(CURDIR)/build/.testnets --starting-ip-address 192.168.10.2 --keyring-backend=test && \ ./networks/init-node.sh # Start a 4-node testnet locally @@ -522,7 +524,7 @@ localnet-show-logstream: ############################################################################### PACKAGE_NAME:=github.com/ExocoreNetwork/exocore -GOLANG_CROSS_VERSION = v1.20 +GOLANG_CROSS_VERSION = v1.21 GOPATH ?= '$(HOME)/go' release-dry-run: docker run \ diff --git a/README.md b/README.md index 0bf8301c0..16fe69a49 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,38 @@ # exocore -Exocore is an omnichain restaking protocol that combines the crypto-economic security from multiple blockchain networks and tokens, and extends it to any off-chain system. The protocol is designed with a modular architecture, incorporating Tendermint-based Byzantine Fault Tolerant (BFT) consensus mechanism, Zero-Knowledge (ZK) light-client bridging, and a fully EVM-compatible execution environment. This design enables smooth interactions for restakers and seamless integration for developers. Additionally, we introduce novel concepts, such as Union Restaking, where off-chain services can form a union to extend the crypto-economic security of their own tokens to each other. By pooling crypto-economic security and extending it to off-chain systems, Exocore powers an open market for decentralized trust. +Exocore is an omnichain restaking protocol that combines the crypto-economic security from multiple blockchain networks +and tokens, and extends it to any off-chain system. The protocol is designed with a modular architecture, incorporating +Tendermint-based Byzantine Fault Tolerant (BFT) consensus mechanism, Zero-Knowledge (ZK) light-client bridging, and a +fully EVM-compatible execution environment. This design enables smooth interactions for restakers and seamless +integration for developers. Additionally, we introduce novel concepts, such as Union Restaking, where off-chain services +can form a union to extend the crypto-economic security of their own tokens to each other. By pooling crypto-economic +security and extending it to off-chain systems, Exocore powers an open market for decentralized trust. ## Documentation To learn how Exocore works from a high-level perspective, see the [Exocore Whitepaper](https://t.co/A4y4YcOuEC) ## Creating docker images + 1. Once the dependencies are installed, execute `make localnet-init`, this will generate the cluster configuration file. 2. Run the following command to create the docker image: + ```bash make localnet-build # Check if images build done docker images ``` + 3. Launch the chain node: + ```bash make localnet-start # Check if containers are all up docker ps ``` + ## Interacting with a local node -With a node running, the exocored binary can be used to interact with the node. Run `./bin/exocored --help` to get information about the available commands. \ No newline at end of file + +With a node running, the exocored binary can be used to interact with the node. Run `./bin/exocored --help` to +get information about the available commands. diff --git a/SECURITY.md b/SECURITY.md index 33badb3e3..522c14e34 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,8 +1,11 @@ # Security + TODO: add our security policy ## Guidelines + TODO: add our security policy ## Disclosure Process -TODO: add our security policy \ No newline at end of file + +TODO: add our security policy diff --git a/go.mod b/go.mod index be0eb43af..6c12c8c97 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.2.1-0.20230829085526-4d114bd09096 github.com/ethereum/go-ethereum v1.11.5 github.com/evmos/evmos/v14 v14.0.0-rc4 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/onsi/ginkgo/v2 v2.11.0 @@ -201,7 +201,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index d33d5c4a7..70be3e69c 100644 --- a/go.sum +++ b/go.sum @@ -951,6 +951,8 @@ github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -2255,6 +2257,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/init.bat b/init.bat index cbff3bd6d..ab2916e4d 100644 --- a/init.bat +++ b/init.bat @@ -13,7 +13,7 @@ set KEY="dev0" set CHAINID="exocoretestnet_233-1" set MONIKER="localtestnet" set KEYRING="test" -set KEYALGO="eth_secp256k1" +set ALGO="eth_secp256k1" set LOGLEVEL="info" # to trace evm #TRACE="--trace" @@ -34,7 +34,7 @@ del /s /q %HOME% exocored config keyring-backend %KEYRING% exocored config chain-id %CHAINID% -exocored keys add %KEY% --keyring-backend %KEYRING% --algo %KEYALGO% +exocored keys add %KEY% --keyring-backend %KEYRING% --algo %ALGO% rem Set moniker and chain-id for exocore (Moniker can be anything, chain-id must be an integer) exocored init %MONIKER% --chain-id %CHAINID% diff --git a/local_node.sh b/local_node.sh index 7b3848b75..5c6036d4e 100755 --- a/local_node.sh +++ b/local_node.sh @@ -10,7 +10,7 @@ MONIKER="localtestnet" # otherwise your balance will be wiped quickly # The keyring test does not require private key to steal tokens from you KEYRING="test" -KEYALGO="eth_secp256k1" +ALGO="eth_secp256k1" LOGLEVEL="info" # Set dedicated home directory for the exocored instance HOMEDIR="$HOME/.tmp-exocored" @@ -56,7 +56,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then # If keys exist they should be deleted for KEY in "${KEYS[@]}"; do - exocored keys add "$KEY" --keyring-backend $KEYRING --algo $KEYALGO --home "$HOMEDIR" + exocored keys add "$KEY" --keyring-backend $KEYRING --algo $ALGO --home "$HOMEDIR" done # Set moniker and chain-id for Evmos (Moniker can be anything, chain-id must be an integer) @@ -144,10 +144,10 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then sed -i.bak 's/pruning-keep-recent = "0"/pruning-keep-recent = "2"/g' "$APP_TOML" sed -i.bak 's/pruning-interval = "0"/pruning-interval = "10"/g' "$APP_TOML" - # make sure the localhost IP is 0.0.0.0 - sed -i.bak 's/localhost/0.0.0.0/g' "$CONFIG" - sed -i.bak 's/localhost/0.0.0.0/g' "$APP_TOML" - sed -i.bak 's/127.0.0.1/0.0.0.0/g' "$APP_TOML" + # make sure the localhost IP is 0.0.0.0 + sed -i.bak 's/localhost/0.0.0.0/g' "$CONFIG" + sed -i.bak 's/localhost/0.0.0.0/g' "$APP_TOML" + sed -i.bak 's/127.0.0.1/0.0.0.0/g' "$APP_TOML" # Allocate genesis accounts (cosmos formatted addresses) for KEY in "${KEYS[@]}"; do diff --git a/networks/init-node.sh b/networks/init-node.sh index 4008cd260..376c604bb 100755 --- a/networks/init-node.sh +++ b/networks/init-node.sh @@ -3,46 +3,49 @@ current_dir="$PWD" CHAINDIR="$current_dir/build/.testnets" for node in {0..3}; do - NODE_DIR="$CHAINDIR/node$node" - GENESIS="$NODE_DIR/exocored/config/genesis.json" - TMP_GENESIS="$NODE_DIR/exocored/config/tmp_genesis.json" - APP_TOML="$NODE_DIR/exocored/config/app.toml" - CONFIG_TOML="$NODE_DIR/exocored/config/config.toml" - # If TMP_GENESIS directory does not exist, create it - TMP_GENESIS_DIR=$(dirname "$TMP_GENESIS") - if [ ! -d "$TMP_GENESIS_DIR" ]; then - mkdir -p "$TMP_GENESIS_DIR" - fi - # used to exit on first error (any non-zero exit code) - set -e + NODE_DIR="$CHAINDIR/node$node" + GENESIS="$NODE_DIR/exocored/config/genesis.json" + TMP_GENESIS="$NODE_DIR/exocored/config/tmp_genesis.json" + APP_TOML="$NODE_DIR/exocored/config/app.toml" + CONFIG_TOML="$NODE_DIR/exocored/config/config.toml" + # If TMP_GENESIS directory does not exist, create it + TMP_GENESIS_DIR=$(dirname "$TMP_GENESIS") + if [ ! -d "$TMP_GENESIS_DIR" ]; then + mkdir -p "$TMP_GENESIS_DIR" + fi + # used to exit on first error (any non-zero exit code) + set -e - # Update total supply with claim values - # Bc is required to add this big numbers - # total_supply=$(bc <<< "$amount_to_claim+$validators_supply") - #total_supply=20000000000000000000000 - #jq -r --arg total_supply "$total_supply" '.app_state.bank.supply[0].amount=$total_supply' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - # Set gas limit in genesis - jq '.consensus_params["block"]["max_gas"]="1000000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - # Set claims start time - current_date=$(date -u +"%Y-%m-%dT%TZ") - jq -r --arg current_date "$current_date" '.app_state["claims"]["params"]["airdrop_start_time"]=$current_date' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - # make sure the localhost IP is 0.0.0.0 - sed -i.bak 's/localhost/0.0.0.0/g' "$CONFIG_TOML" - sed -i.bak 's/localhost/0.0.0.0/g' "$APP_TOML" - sed -i.bak 's/127.0.0.1/0.0.0.0/g' "$APP_TOML" + # Update total supply with claim values + # Bc is required to add this big numbers + # total_supply=$(bc <<< "$amount_to_claim+$validators_supply") + #total_supply=20000000000000000000000 + #jq -r --arg total_supply "$total_supply" '.app_state.bank.supply[0].amount=$total_supply' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + # Set gas limit in genesis + jq '.consensus_params["block"]["max_gas"]="1000000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + # Set claims start time + current_date=$(date -u +"%Y-%m-%dT%TZ") + jq -r --arg current_date "$current_date" '.app_state["claims"]["params"]["airdrop_start_time"]=$current_date' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + # make sure the localhost IP is 0.0.0.0 + sed -i.bak 's/localhost/0.0.0.0/g' "$CONFIG_TOML" + sed -i.bak 's/localhost/0.0.0.0/g' "$APP_TOML" + sed -i.bak 's/127.0.0.1/0.0.0.0/g' "$APP_TOML" - # enable prometheus metrics - sed -i.bak 's/prometheus = false/prometheus = true/' "$CONFIG_TOML" - sed -i.bak 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML" - sed -i.bak 's/enabled = false/enabled = true/g' "$APP_TOML" + # enable prometheus metrics + sed -i.bak 's/prometheus = false/prometheus = true/' "$CONFIG_TOML" + sed -i.bak 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML" + sed -i.bak 's/enabled = false/enabled = true/g' "$APP_TOML" - # use timeout_commit 1s to make test faster - sed -i.bak 's/timeout_commit = "3s"/timeout_commit = "1s"/g' "$CONFIG_TOML" + # use timeout_commit 1s to make test faster + sed -i.bak 's/timeout_commit = "3s"/timeout_commit = "1s"/g' "$CONFIG_TOML" - # Enable the APIs for the tests to be successful - sed -i.bak 's/enable = false/enable = true/g' "$APP_TOML" - sed -i.bak 's/swagger = false/swagger = true/g' "$APP_TOML" - sed -i.bak 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' "$APP_TOML" + # Enable the APIs for the tests to be successful + sed -i.bak 's/enable = false/enable = true/g' "$APP_TOML" + sed -i.bak 's/swagger = false/swagger = true/g' "$APP_TOML" + sed -i.bak 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' "$APP_TOML" - echo "Modified configurations for node$node" + # remove seeds + sed -i.bak 's/seeds = "[^"]*"/seeds = ""/' "$CONFIG_TOML" + + echo "Modified configurations for node$node" done diff --git a/networks/local/exocore/Dockerfile b/networks/local/exocore/Dockerfile index 3edba177c..90c83368b 100644 --- a/networks/local/exocore/Dockerfile +++ b/networks/local/exocore/Dockerfile @@ -1,7 +1,7 @@ -FROM golang:1.21-alpine AS build -RUN apk add build-base linux-headers git +FROM golang:1.21.0-alpine3.18 AS build +RUN apk add --no-cache build-base=0.5-r3 linux-headers=6.3-r0 git=2.40.1-r0 # Set working directory for the build -WORKDIR work +WORKDIR /go/work # Add source files COPY . ./ # build exocore @@ -9,16 +9,24 @@ COPY . ./ RUN LEDGER_ENABLED=false make build ##################################### -FROM alpine AS run -RUN apk add bash curl jq +FROM alpine:3.18 AS run +RUN apk add --no-cache bash=5.2.15-r5 curl=8.5.0-r0 jq=1.6-r4 \ + && addgroup -g 1000 exocore \ + && adduser -S -h /home/exocore -D exocore -u 1000 -G exocore EXPOSE 26656 26657 1317 9090 8545 8546 # TODO: exocore testnet chainid is still under consideration and need to be finalized later -CMD ["start", "--log_format", "plain","--chain-id","exocoretestnet_233-1", "--metrics", "--json-rpc.api", "eth,txpool,personal,net,debug,web3", "--api.enable", "--json-rpc.enable", "true"] +CMD ["start", "--log_format", "plain", "--chain-id", "exocoretestnet_233-1", "--metrics", "--json-rpc.api", "eth,txpool,personal,net,debug,web3", "--api.enable", "--json-rpc.enable", "true", "--minimum-gas-prices", "0.0001aexocore"] +# by default, a SIGKILL is sent after 10 seconds. We need to override this to allow graceful shutdown. STOPSIGNAL SIGTERM VOLUME /exocore WORKDIR /exocore -COPY networks/local/exocore/wrapper.sh /usr/bin/wrapper.sh +COPY ./networks/local/exocore/wrapper.sh /usr/bin/wrapper.sh COPY --from=build /go/work/build/exocored /exocore +# Use the created non-root user +USER exocoreuser + +HEALTHCHECK --interval=30s --timeout=30s --retries=3 CMD curl -f http://localhost:26657/health || exit 1 + ENTRYPOINT ["/usr/bin/wrapper.sh"] \ No newline at end of file diff --git a/networks/local/exocore/wrapper.sh b/networks/local/exocore/wrapper.sh index 902805826..cb53eb02c 100755 --- a/networks/local/exocore/wrapper.sh +++ b/networks/local/exocore/wrapper.sh @@ -1,5 +1,6 @@ #!/usr/bin/env sh -set -euo pipefail +# shellcheck disable=SC3040 +(set -o pipefail 2>/dev/null) && set -o pipefail set -x BINARY=/exocore/${BINARY:-exocored} @@ -14,13 +15,13 @@ fi export EHOME="/data/node${ID}/exocored" export APP_TOML="$EHOME/config/app.toml" export CLIENT_TOML="$EHOME/config/client.toml" -APP_TOML_TMP="$EHOME/config/tmp_app.toml" -CLIENT_TOML_TMP="$EHOME/config/tmp_client.toml" +#APP_TOML_TMP="$EHOME/config/tmp_app.toml" +#CLIENT_TOML_TMP="$EHOME/config/tmp_client.toml" #cat $APP_TOML | tomlq '.api["enable"]=true' --toml-output > $APP_TOML_TMP && mv $APP_TOML_TMP $APP_TOML #sed -i.bak 's/chain-id =.*/chain-id = "evmos_9000-8808"/g' "${CLIENT_TOML_TMP}" if [ -d "$(dirname "${EHOME}"/"${LOG}")" ]; then - "${BINARY}" --home "${EHOME}" "$@" | tee "${EHOME}/${LOG}" + "${BINARY}" --home "${EHOME}" "$@" | tee "${EHOME}/${LOG}" else - "${BINARY}" --home "${EHOME}" "$@" + "${BINARY}" --home "${EHOME}" "$@" fi diff --git a/precompiles/testutil/contracts/readme.md b/precompiles/testutil/contracts/readme.md index 65b9d8874..1ba4a3709 100644 --- a/precompiles/testutil/contracts/readme.md +++ b/precompiles/testutil/contracts/readme.md @@ -1,8 +1,9 @@ # how to write a test to call the precompile contract from a contract + ## cmd to generate abi and bin `solc --base-path ./ --include-path ./../.. --evm-version paris --bin --abi ./DepositCaller.sol -o . --overwrite` -First you need to create a file named DepositCaller.json and add the generated bin and abi to the created json file.Then you can write some tests to call the Deposit precompile contract from contract account. You can refer to the file deposit_integrate_test.go to get how to write the test codes. - - +First you need to create a file named DepositCaller.json and add the generated bin and abi to the created json file.Then +you can write some tests to call the Deposit precompile contract from contract account. You can refer to the file +`deposit_integrate_test.go` to get how to write the test codes. diff --git a/scripts/start-docker.sh b/scripts/start-docker.sh index b48000690..d944cb87f 100755 --- a/scripts/start-docker.sh +++ b/scripts/start-docker.sh @@ -7,24 +7,25 @@ MONIKER="mymoniker" DATA_DIR=$(mktemp -d -t exocore-datadir.XXXXX) echo "create and add new keys" -./exocored keys add $KEY --home $DATA_DIR --no-backup --chain-id $CHAINID --algo "eth_secp256k1" --keyring-backend test -echo "init exocore with moniker=$MONIKER and chain-id=$CHAINID" -./exocored init $MONIKER --chain-id $CHAINID --home $DATA_DIR +./exocored keys add "${KEY}" --home "${DATA_DIR}" --no-backup --chain-id "${CHAINID}" --algo "eth_secp256k1" --keyring-backend test +echo "init exocore with moniker=\"${MONIKER}\" and chain-id=\"${CHAINID}\"" +./exocored init "${MONIKER}" --chain-id "${CHAINID}" --home "${DATA_DIR}" echo "prepare genesis: Allocate genesis accounts" ./exocored add-genesis-account \ -"$(./exocored keys show $KEY -a --home $DATA_DIR --keyring-backend test)" 1000000000000000000aevmos,1000000000000000000stake \ ---home $DATA_DIR --keyring-backend test + "$(./exocored keys show "${KEY}" -a --home "${DATA_DIR}" --keyring-backend test)" 1000000000000000000aevmos,1000000000000000000stake \ + --home "${DATA_DIR}" --keyring-backend test echo "prepare genesis: Sign genesis transaction" -./exocored gentx $KEY 1000000000000000000stake --keyring-backend test --home $DATA_DIR --keyring-backend test --chain-id $CHAINID +./exocored gentx "${KEY}" 1000000000000000000stake --keyring-backend test --home "${DATA_DIR}" --keyring-backend test --chain-id "${CHAINID}" echo "prepare genesis: Collect genesis tx" -./exocored collect-gentxs --home $DATA_DIR +./exocored collect-gentxs --home "${DATA_DIR}" echo "prepare genesis: Run validate-genesis to ensure everything worked and that the genesis file is setup correctly" -./exocored validate-genesis --home $DATA_DIR +./exocored validate-genesis --home "${DATA_DIR}" -echo "starting exocore node $i in background ..." +echo "starting exocore node in background ..." ./exocored start --pruning=nothing --rpc.unsafe \ ---keyring-backend test --home $DATA_DIR \ ->$DATA_DIR/node.log 2>&1 & disown + --keyring-backend test --home "${DATA_DIR}" \ + >"${DATA_DIR}"/node.log 2>&1 & +disown echo "started exocore node" -tail -f /dev/null \ No newline at end of file +tail -f /dev/null diff --git a/x/dogfood/module.go b/x/dogfood/module.go index 1f0b36e58..5cc548046 100644 --- a/x/dogfood/module.go +++ b/x/dogfood/module.go @@ -108,7 +108,7 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // modules need to implement type AppModule struct { AppModuleBasic - + // keeper of the module receives the cdc codec separately. keeper keeper.Keeper } diff --git a/x/todo.md b/x/todo.md index dc3254fc0..e26721607 100644 --- a/x/todo.md +++ b/x/todo.md @@ -2,38 +2,38 @@ ## common -* use evm tx as the only entry for any exocore operation -* implement the invariant logic for every module to keep the state security -* setting module parameter needs to be done through governance proposal -* pay attention to each module's state when the EVM transaction fails. -* consider which operations require depositing some exocore tokens to maintain security +- use evm tx as the only entry for any exocore operation +- implement the invariant logic for every module to keep the state security +- setting module parameter needs to be done through governance proposal +- pay attention to each module's state when the EVM transaction fails. +- consider which operations require depositing some exocore tokens to maintain security ## deposit ## delegation -* delegateTo and undelegateFrom might also need to be implemented using exocore as entry -* Need to check the input parameters and deposit some exocore token when register to an operator -* the operator can only be registered once -* delegateTo might require the approval of operator to grant the operator permission for selecting a staking user +- delegateTo and undelegateFrom might also need to be implemented using exocore as entry +- Need to check the input parameters and deposit some exocore token when register to an operator +- the operator can only be registered once +- delegateTo might require the approval of operator to grant the operator permission for selecting a staking user ## restaking_assets_manage -* implement the registration of client chain and assets through the governance proposal instead of setting in the genesis +- implement the registration of client chain and assets through the governance proposal instead of setting in the genesis ## withdraw ## reward -* consider storing the reward state in its own module state + +- consider storing the reward state in its own module state ## exoslash -* record the slash states of all operators -* provide the function to deploy slash condition for AVS -* provide the function to approve the slash condition deployed by the AVS(to be decided) -* provide the function to submit slash proof +- record the slash states of all operators +- provide the function to deploy slash condition for AVS +- provide the function to approve the slash condition deployed by the AVS(to be decided) +- provide the function to submit slash proof ## AVS opted-in -* record the operator opted-in information - +- record the operator opted-in information From bdb2207958580c6258b050bb4b081c559274f565 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 14 Mar 2024 12:25:47 +0530 Subject: [PATCH 40/41] fix(ci): semgrep, cov-comment, buf-break-no-fail (#15) * chore(lint): security options in docker compose * chore(lint): unlock mutex in testutil * chore(lint): limit value of uint using strconv * fix(lint): check out old code correctly for diff In the event of a pull_request_target action, the checkout action by default does not check out the PR but the base repository. This change explicitly sets it up to check out the PR's head branch. * Revert "fix(lint): check out old code correctly" This reverts commit 4f24ba223548593149602c2bb8842c38fab2dd13. * chore(lint): split test coverage commenter See comment on test.yml for explanation. * chore(ci): trigger go based CIs delete superfluous comment * fix(lint): add empty line at end of yaml file * chore(lint): fix the test-comment workflow - shell check the script - add top level permissions * Revert "chore(lint): unlock mutex in testutil" This reverts commit a6cdb02745b6afe7d7c60277895921e5654d9631. It is said that the unlocking of the mutex might deviate from the original purpose of the function. Instead, we are electing to ignore the testutil folder, which will be sent in the next commit. * chore(ci): ignore testutil for semgrep * chore(ci): do not fail if breaking proto changes * chore(ci): trigger buf-breaking-action check This commit will be reverted before merge of the PR. * chore(ci): add comment if buf reports change * fix(ci): only overwrite prev coverage comment * fix(ci)(proto): +comment read/write permission * fix(ci): add comment rw permission to job * fix(ci): update job name in test-comment * fix(ci): give `proto.yml` all rw permissions * fix(ci): split buf-breaking and its comment As before, the `pull_request` event does not have enough permissions to make a comment and the `pull_request_target` cannot safely check out the PR. Hence, we split the commenting process into 2 parts: - Run the buf breaking action and do not fail the workflow even if it errors - In a separate workflow, consume the artifact produced by the previous workflow and comment (or append to an existing comment) its contents. Note that the *-comment.yml workflows are being commented blindly at the moment because it is not possible to run them until they exist on the branch. * fix(ci): if condition shouldn't be always true * Revert "chore(ci): trigger go based CIs" This reverts commit 62b3744cc65d994d28c0c9ef69c06e0d4239bb8e. * Revert "chore(ci): trigger buf-breaking-action... check." This reverts commit 88566fdfb4ed74935374c4062b950f35beaf8e4b. --- .github/workflows/proto-comment.yml | 81 ++++++++++++++++++++++ .github/workflows/proto.yml | 20 +++++- .github/workflows/test-comment.yml | 71 +++++++++++++++++++ .github/workflows/test.yml | 35 +++++----- .semgrepignore | 1 + docker-compose.yml | 12 ++-- x/restaking_assets_manage/client/cli/tx.go | 4 +- 7 files changed, 200 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/proto-comment.yml create mode 100644 .github/workflows/test-comment.yml diff --git a/.github/workflows/proto-comment.yml b/.github/workflows/proto-comment.yml new file mode 100644 index 000000000..596243c10 --- /dev/null +++ b/.github/workflows/proto-comment.yml @@ -0,0 +1,81 @@ +name: Comment protobuf breaking action outcome on the pull request + +permissions: + # for finding and downloading artifacts. + actions: read + # for commenting on pull requests. + pull-requests: write + # the content of the repo is irrelevant to this workflow. + contents: none + +on: + workflow_run: + workflows: ["Protobuf"] + types: + - completed + +jobs: + download-artifact-and-comment: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.conclusion == 'success' + steps: + - name: 'Download artifact' + uses: actions/github-script@v7.0.1 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.find((artifact) => { + return artifact.name == "result"; + }); + if (!matchArtifact) { + var core = require('@actions/core'); + core.setFailed('Artifact "result" not found.'); + return; + } + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/result.zip', Buffer.from(download.data)); + - run: unzip result.zip -d result + - name: Read PR number and outcome + run: | + pr_number=$(cat "result/pr_number.txt") + outcome=$(cat "result/outcome.txt") + echo "PR_NUMBER=${pr_number}" >> "$GITHUB_ENV" + echo "OUTCOME=${outcome}" >> "$GITHUB_ENV" + - name: Find comment + id: find-comment + uses: peter-evans/find-comment@v2 + with: + issue-number: ${{ env.PR_NUMBER }} + comment-author: 'github-actions[bot]' + body-includes: buf breaking change + - name: Comment status of break-check in the case of failure + if: ${{ env.OUTCOME == 'failure' }} + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ env.PR_NUMBER }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + body: | + ${{ github.sha }} (${{ github.event.workflow_run.updated_at }}) has a buf breaking change. + View the workflow run: [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) + edit-mode: append + - name: Comment status of break-check in the case of success + if: env.OUTCOME == 'success' && steps.find-comment.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ env.PR_NUMBER }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + body: | + ${{ github.sha }} (${{ github.event.workflow_run.updated_at }}) has no buf breaking changes. + View the workflow run: [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) + edit-mode: append diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index de4cfd9d5..3bfafc585 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -7,7 +7,13 @@ on: - "proto/**" permissions: - contents: read + # for uploading artifacts + contents: write + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build: @@ -42,6 +48,7 @@ jobs: - uses: actions/checkout@v4 - uses: bufbuild/buf-setup-action@v1.26.1 - uses: bufbuild/buf-breaking-action@v1 + id: break-check with: input: "proto" # previously, this ran on ref=HEAD~1, which is incorrect as it can @@ -49,3 +56,14 @@ jobs: # on a PR, so it must compare the HEAD of the base branch against # the PR branch. against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},subdir=proto" + # do not fail the build if there are breaking changes + continue-on-error: true + - name: Make buf breaking changes outcome as txt file + run: | + mkdir -p ./result/ + echo "${{ steps.break-check.outcome }}" > ./result/outcome.txt + echo "${{ github.event.pull_request.number }}" > ./result/pr_number.txt + - uses: actions/upload-artifact@v2 + with: + name: result + path: ./result/ diff --git a/.github/workflows/test-comment.yml b/.github/workflows/test-comment.yml new file mode 100644 index 000000000..9fc63ddca --- /dev/null +++ b/.github/workflows/test-comment.yml @@ -0,0 +1,71 @@ +# This workflow runs after test.yml and comments the test coverage on the pull request. +name: Comment test coverage on the pull request + +permissions: + # for finding and downloading artifacts. + actions: read + # for commenting on pull requests. + pull-requests: write + # the content of the repo is irrelevant to this workflow. + contents: none + +on: + workflow_run: + workflows: ["Tests"] + types: + - completed + +jobs: + download-artifact-and-comment: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + steps: + - name: Download artifact + uses: actions/github-script@v7.0.1 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.find((artifact) => { + return artifact.name == "result" + }); + if (!matchArtifact) { + var core = require('@actions/core'); + core.setFailed('Artifact "result" not found.'); + return; + } + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/result.zip', Buffer.from(download.data)); + - run: unzip result.zip -d result + - name: Read PR number and coverage + run: | + pr_number=$(cat "result/pr_number.txt") + coverage=$(cat "result/coverage.txt") + echo "PR_NUMBER=${pr_number}" >> "$GITHUB_ENV" + echo "COVERAGE=${coverage}" >> "$GITHUB_ENV" + - name: Find comment + id: find-comment + uses: peter-evans/find-comment@v2 + with: + issue-number: ${{ env.PR_NUMBER }} + comment-author: 'github-actions[bot]' + body-includes: Coverage as of + - name: Comment coverage on PR + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ env.PR_NUMBER }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + body: | + Coverage as of ${{ github.sha }}: ${{ env.COVERAGE }}% + edit-mode: append diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d669e41d..4221bb8a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,13 @@ +# This workflow runs on every push and pull request to the repository. +# It then calculates the unit test coverage and checks if it's above a certain threshold. +# this information is passed on to another workflow as artifacts for commenting on the PR. +# This is because the `pull_request` event does not have the commenting permissions. +# We could switch to `pull_request_target` which does have them, however, it +# opens a security hole. See: +# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ name: Tests on: - # for write permission, use pull_request_target and not pull_request. - pull_request_target: + pull_request: push: branches: - develop @@ -10,8 +16,9 @@ on: - release/** permissions: + # for uploading artifacts contents: write - pull-requests: write + pull-requests: read # Automatically cancel run if another commit to the same ref is detected. concurrency: @@ -30,7 +37,6 @@ jobs: - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | - **/**.sol **/**.go go.mod go.sum @@ -47,19 +53,14 @@ jobs: # TODO: increase this threshold with time to 80 threshold-total: 10 if: env.GIT_DIFF - - name: Find comment - id: find-comment - uses: peter-evans/find-comment@v2 - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' + - name: Generate artifact for PR + run: | + mkdir -p ./result/ + echo "${{ steps.output-coverage.outputs.total-coverage }}" > ./result/coverage.txt + echo "${{ github.event.pull_request.number }}" > ./result/pr_number.txt if: env.GIT_DIFF && github.event_name == 'pull_request' - - name: Comment coverage on PR - uses: peter-evans/create-or-update-comment@v3 + - uses: actions/upload-artifact@v2 with: - issue-number: ${{ github.event.pull_request.number }} - comment-id: ${{ steps.find-comment.outputs.comment-id }} - body: | - Coverage as of ${{ github.sha }}: ${{ steps.output-coverage.outputs.total-coverage }}% - edit-mode: append + name: result + path: ./result/ if: env.GIT_DIFF && github.event_name == 'pull_request' diff --git a/.semgrepignore b/.semgrepignore index 2fd10b138..9f5d214e5 100644 --- a/.semgrepignore +++ b/.semgrepignore @@ -19,6 +19,7 @@ vendor/ # Common test paths test/ tests/ +testutil/ *_test.go *.pb.gw.go *.pb.go diff --git a/docker-compose.yml b/docker-compose.yml index c039a41d9..967a5d2f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: exocorenode0: container_name: exocorenode0 image: "exocore/node" + read_only: true environment: - DEBUG=1 - ID=0 @@ -11,7 +12,7 @@ services: cap_add: - SYS_PTRACE security_opt: - - seccomp:unconfined + - no-new-privileges:true ports: - "26656-26657:26656-26657" - "1317:1317" @@ -28,6 +29,7 @@ services: exocorenode1: container_name: exocorenode1 image: "exocore/node" + read_only: true environment: - DEBUG=0 - ID=1 @@ -35,7 +37,7 @@ services: cap_add: - SYS_PTRACE security_opt: - - seccomp:unconfined + - no-new-privileges:true ports: - "26666-26667:26656-26657" - "1318:1317" @@ -52,6 +54,7 @@ services: exocorenode2: container_name: exocorenode2 image: "exocore/node" + read_only: true environment: - DEBUG=0 - ID=2 @@ -59,7 +62,7 @@ services: cap_add: - SYS_PTRACE security_opt: - - seccomp:unconfined + - no-new-privileges:true ports: - "26676-26677:26656-26657" - "1319:1317" @@ -76,6 +79,7 @@ services: exocorenode3: container_name: exocorenode3 image: "exocore/node" + read_only: true environment: - DEBUG=0 - ID=3 @@ -83,7 +87,7 @@ services: cap_add: - SYS_PTRACE security_opt: - - seccomp:unconfined + - no-new-privileges:true ports: - "26686-26687:26656-26657" - "1320:1317" diff --git a/x/restaking_assets_manage/client/cli/tx.go b/x/restaking_assets_manage/client/cli/tx.go index 7b55345a0..bfd11b538 100644 --- a/x/restaking_assets_manage/client/cli/tx.go +++ b/x/restaking_assets_manage/client/cli/tx.go @@ -56,7 +56,7 @@ func RegisterClientChain() *cobra.Command { if err != nil { return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[2])) } - addressLength, err := strconv.ParseUint(args[3], 10, 64) + addressLength, err := strconv.ParseUint(args[3], 10, 32) if err != nil { return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[3])) } @@ -105,7 +105,7 @@ func RegisterAsset() *cobra.Command { if err != nil { return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[5])) } - decimal, err := strconv.ParseUint(args[6], 10, 64) + decimal, err := strconv.ParseUint(args[6], 10, 32) if err != nil { return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[6])) } From c646504624c92541df683b498a155a6a70ce33c7 Mon Sep 17 00:00:00 2001 From: leonz789 Date: Wed, 20 Mar 2024 16:31:01 +0800 Subject: [PATCH 41/41] refactor: remove unused ginkgo --- x/delegation/keeper/setup_test.go | 7 +------ x/deposit/keeper/setup_test.go | 8 +------- x/restaking_assets_manage/keeper/setup_test.go | 7 +------ x/reward/keeper/setup_test.go | 9 +-------- x/slash/keeper/setup_test.go | 10 +--------- x/withdraw/keeper/setup_test.go | 11 ++--------- 6 files changed, 7 insertions(+), 45 deletions(-) diff --git a/x/delegation/keeper/setup_test.go b/x/delegation/keeper/setup_test.go index c139e4874..5548d2306 100644 --- a/x/delegation/keeper/setup_test.go +++ b/x/delegation/keeper/setup_test.go @@ -1,11 +1,9 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" "github.com/stretchr/testify/suite" ) @@ -20,9 +18,6 @@ func TestKeeperTestSuite(t *testing.T) { s = new(DelegationTestSuite) suite.Run(t, s) - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } func (suite *DelegationTestSuite) SetupTest() { diff --git a/x/deposit/keeper/setup_test.go b/x/deposit/keeper/setup_test.go index c6b43ccc3..cc891fe42 100644 --- a/x/deposit/keeper/setup_test.go +++ b/x/deposit/keeper/setup_test.go @@ -1,11 +1,9 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" "github.com/stretchr/testify/suite" ) @@ -19,10 +17,6 @@ var s *DepositTestSuite func TestKeeperTestSuite(t *testing.T) { s = new(DepositTestSuite) suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } func (suite *DepositTestSuite) SetupTest() { diff --git a/x/restaking_assets_manage/keeper/setup_test.go b/x/restaking_assets_manage/keeper/setup_test.go index 21d80f32f..1bcb40b43 100644 --- a/x/restaking_assets_manage/keeper/setup_test.go +++ b/x/restaking_assets_manage/keeper/setup_test.go @@ -1,11 +1,9 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" "github.com/stretchr/testify/suite" ) @@ -20,9 +18,6 @@ func TestKeeperTestSuite(t *testing.T) { s = new(StakingAssetsTestSuite) suite.Run(t, s) - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } func (suite *StakingAssetsTestSuite) SetupTest() { diff --git a/x/reward/keeper/setup_test.go b/x/reward/keeper/setup_test.go index 1927a5b17..df09bc953 100644 --- a/x/reward/keeper/setup_test.go +++ b/x/reward/keeper/setup_test.go @@ -1,13 +1,9 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/ginkgo/v2" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" "github.com/stretchr/testify/suite" ) @@ -22,9 +18,6 @@ func TestKeeperTestSuite(t *testing.T) { s = new(RewardTestSuite) suite.Run(t, s) - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. diff --git a/x/slash/keeper/setup_test.go b/x/slash/keeper/setup_test.go index cf45470b0..9cad0a10a 100644 --- a/x/slash/keeper/setup_test.go +++ b/x/slash/keeper/setup_test.go @@ -1,13 +1,9 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/ginkgo/v2" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" "github.com/stretchr/testify/suite" ) @@ -21,10 +17,6 @@ var s *SlashTestSuite func TestKeeperTestSuite(t *testing.T) { s = new(SlashTestSuite) suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. diff --git a/x/withdraw/keeper/setup_test.go b/x/withdraw/keeper/setup_test.go index 9dd0c641a..fe9eb12e1 100644 --- a/x/withdraw/keeper/setup_test.go +++ b/x/withdraw/keeper/setup_test.go @@ -1,13 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/ginkgo/v2" - //nolint:revive // dot imports are fine for Ginkgo - . "github.com/onsi/gomega" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/stretchr/testify/suite" ) @@ -20,10 +17,6 @@ var s *WithdrawTestSuite func TestKeeperTestSuite(t *testing.T) { s = new(WithdrawTestSuite) suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") } // SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`.