diff --git a/proto/secret/cron/genesis.proto b/proto/secret/cron/genesis.proto deleted file mode 100644 index 9a570c257..000000000 --- a/proto/secret/cron/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package neutron.cron; - -import "gogoproto/gogo.proto"; -import "neutron/cron/params.proto"; -import "neutron/cron/schedule.proto"; -// this line is used by starport scaffolding # genesis/proto/import - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types"; - -// Defines the cron module's genesis state. -message GenesisState { - repeated Schedule scheduleList = 2 [(gogoproto.nullable) = false]; - Params params = 1 [(gogoproto.nullable) = false]; - // this line is used by starport scaffolding # genesis/proto/state -} diff --git a/proto/secret/cron/params.proto b/proto/secret/cron/params.proto deleted file mode 100644 index 0018d73ed..000000000 --- a/proto/secret/cron/params.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package neutron.cron; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types"; - -// Defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - // Security address that can remove schedules - string security_address = 1; - // Limit of schedules executed in one block - uint64 limit = 2; -} diff --git a/proto/secret/cron/query.proto b/proto/secret/cron/query.proto deleted file mode 100644 index c75045c1e..000000000 --- a/proto/secret/cron/query.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; -package neutron.cron; - -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "neutron/cron/params.proto"; -import "neutron/cron/schedule.proto"; -// this line is used by starport scaffolding # 1 - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types"; - -// Defines the gRPC querier service. -service Query { - // Queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/neutron/cron/params"; - } - - // Queries a Schedule by name. - rpc Schedule(QueryGetScheduleRequest) returns (QueryGetScheduleResponse) { - option (google.api.http).get = "/neutron/cron/schedule/{name}"; - } - - // Queries a list of Schedule items. - rpc Schedules(QuerySchedulesRequest) returns (QuerySchedulesResponse) { - option (google.api.http).get = "/neutron/cron/schedule"; - } - - // this line is used by starport scaffolding # 2 -} - -// The request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// The response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -// The request type for the Query/Schedule RPC method. -message QueryGetScheduleRequest { - string name = 1; -} - -// The response type for the Query/Params RPC method. -message QueryGetScheduleResponse { - Schedule schedule = 1 [(gogoproto.nullable) = false]; -} - -// The request type for the Query/Schedules RPC method. -message QuerySchedulesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// The response type for the Query/Params RPC method. -message QuerySchedulesResponse { - repeated Schedule schedules = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// this line is used by starport scaffolding # 3 diff --git a/proto/secret/cron/schedule.proto b/proto/secret/cron/schedule.proto deleted file mode 100644 index 7cfa2caa6..000000000 --- a/proto/secret/cron/schedule.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; -package neutron.cron; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types"; - -// Defines when messages will be executed in the block -enum ExecutionStage { - // Execution at the end of the block - EXECUTION_STAGE_END_BLOCKER = 0; - // Execution at the beginning of the block - EXECUTION_STAGE_BEGIN_BLOCKER = 1; -} - -// Defines the schedule for execution -message Schedule { - // Name of schedule - string name = 1; - // Period in blocks - uint64 period = 2; - // Msgs that will be executed every certain number of blocks, specified in the `period` field - repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false]; - // Last execution's block height - uint64 last_execute_height = 4; - // Stage when messages will be executed - ExecutionStage execution_stage = 5; -} - -// Defines the contract and the message to pass -message MsgExecuteContract { - // The address of the smart contract - string contract = 1; - // JSON encoded message to be passed to the contract - string msg = 2; -} - -// Defines the number of current schedules -message ScheduleCount { - // The number of current schedules - int32 count = 1; -} diff --git a/proto/secret/cron/tx.proto b/proto/secret/cron/tx.proto deleted file mode 100644 index be869cdd8..000000000 --- a/proto/secret/cron/tx.proto +++ /dev/null @@ -1,86 +0,0 @@ -syntax = "proto3"; -package neutron.cron; - -import "amino/amino.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "neutron/cron/params.proto"; -import "neutron/cron/schedule.proto"; - -// this line is used by starport scaffolding # proto/tx/import - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types"; - -// Defines the Msg service. -service Msg { - option (cosmos.msg.v1.service) = true; - - // Adds new schedule. - rpc AddSchedule(MsgAddSchedule) returns (MsgAddScheduleResponse); - // Removes schedule. - rpc RemoveSchedule(MsgRemoveSchedule) returns (MsgRemoveScheduleResponse); - // Updates the module parameters. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - // this line is used by starport scaffolding # proto/tx/rpc -} - -// The MsgAddSchedule request type. -message MsgAddSchedule { - option (amino.name) = "cron/MsgAddSchedule"; - option (cosmos.msg.v1.signer) = "authority"; - - // The address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Name of the schedule - string name = 2; - // Period in blocks - uint64 period = 3; - // Msgs that will be executed every certain number of blocks, specified in the `period` field - repeated MsgExecuteContract msgs = 4 [(gogoproto.nullable) = false]; - // Stage when messages will be executed - ExecutionStage execution_stage = 5; -} - -// Defines the response structure for executing a MsgAddSchedule message. -message MsgAddScheduleResponse {} - -// The MsgRemoveSchedule request type. -message MsgRemoveSchedule { - option (amino.name) = "cron/MsgRemoveSchedule"; - option (cosmos.msg.v1.signer) = "authority"; - - // The address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Name of the schedule - string name = 2; -} - -// Defines the response structure for executing a MsgRemoveSchedule message. -message MsgRemoveScheduleResponse {} - -// this line is used by starport scaffolding # proto/tx/message - -// The MsgUpdateParams request type. -// -// Since: 0.47 -message MsgUpdateParams { - option (amino.name) = "cron/MsgUpdateParams"; - option (cosmos.msg.v1.signer) = "authority"; - - // The address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // Defines the x/cron parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} - -// Defines the response structure for executing a MsgUpdateParams message. -// -// Since: 0.47 -message MsgUpdateParamsResponse {} diff --git a/proto/secret/cron/v1/schedule.proto b/proto/secret/cron/v1/schedule.proto deleted file mode 100644 index 3593f5058..000000000 --- a/proto/secret/cron/v1/schedule.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -package neutron.cron.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/neutron-org/neutron/v5/x/cron/types/v1"; - -// Defines the schedule for execution -message Schedule { - // Name of schedule - string name = 1; - // Period in blocks - uint64 period = 2; - // Msgs that will be executed every certain number of blocks, specified in the `period` field - repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false]; - // Last execution's block height - uint64 last_execute_height = 4; -} - -// Defines the contract and the message to pass -message MsgExecuteContract { - // The address of the smart contract - string contract = 1; - // JSON encoded message to be passed to the contract - string msg = 2; -} - -// Defines the number of current schedules -message ScheduleCount { - // The number of current schedules - int32 count = 1; -} diff --git a/x/cron/client/cli/query.go b/x/cron/client/cli/query.go deleted file mode 100644 index 0b8d433e1..000000000 --- a/x/cron/client/cli/query.go +++ /dev/null @@ -1,29 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(_ string) *cobra.Command { - // Group cron 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()) - cmd.AddCommand(CmdListSchedule()) - cmd.AddCommand(CmdShowSchedule()) - - return cmd -} diff --git a/x/cron/client/cli/query_params.go b/x/cron/client/cli/query_params.go deleted file mode 100644 index 0500a73ce..000000000 --- a/x/cron/client/cli/query_params.go +++ /dev/null @@ -1,35 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/neutron-org/neutron/v5/x/cron/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 := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/cron/client/cli/query_schedule.go b/x/cron/client/cli/query_schedule.go deleted file mode 100644 index 08142d832..000000000 --- a/x/cron/client/cli/query_schedule.go +++ /dev/null @@ -1,74 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func CmdListSchedule() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-schedule", - Short: "list all schedule", - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QuerySchedulesRequest{ - Pagination: pageReq, - } - - res, err := queryClient.Schedules(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowSchedule() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-schedule [name]", - Short: "shows a schedule", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - argName := args[0] - - params := &types.QueryGetScheduleRequest{ - Name: argName, - } - - res, err := queryClient.Schedule(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/cron/client/cli/query_schedule_test.go b/x/cron/client/cli/query_schedule_test.go deleted file mode 100644 index 27970dd18..000000000 --- a/x/cron/client/cli/query_schedule_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/neutron-org/neutron/v5/testutil/common/nullify" - "github.com/neutron-org/neutron/v5/testutil/cron/network" - "github.com/neutron-org/neutron/v5/x/cron/client/cli" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func networkWithScheduleObjects(t *testing.T, n int) (*network.Network, []types.Schedule) { - t.Helper() - cfg := network.DefaultConfig() - state := types.GenesisState{} - require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) - - for i := 0; i < n; i++ { - schedule := types.Schedule{ - Name: strconv.Itoa(i), - Period: 1000, - Msgs: []types.MsgExecuteContract{}, - LastExecuteHeight: uint64(0), - } - state.ScheduleList = append(state.ScheduleList, schedule) - } - state.Params = types.DefaultParams() - buf, err := cfg.Codec.MarshalJSON(&state) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), state.ScheduleList -} - -func TestShowSchedule(t *testing.T) { - net, objs := networkWithScheduleObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - for _, tc := range []struct { - desc string - name string - - args []string - err error - obj types.Schedule - }{ - { - desc: "found", - name: objs[0].Name, - - args: common, - obj: objs[0], - err: nil, - }, - { - desc: "not found", - name: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.name, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSchedule(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetScheduleResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Schedule) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Schedule), - ) - } - }) - } -} - -func TestListSchedule(t *testing.T) { - net, objs := networkWithScheduleObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) //nolint:gosec - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSchedule(), args) - require.NoError(t, err) - var resp types.QuerySchedulesResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Schedules), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Schedules), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) //nolint:gosec - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSchedule(), args) - require.NoError(t, err) - var resp types.QuerySchedulesResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Schedules), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Schedules), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSchedule(), args) - require.NoError(t, err) - var resp types.QuerySchedulesResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) //nolint:gosec - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Schedules), - ) - }) -} diff --git a/x/cron/client/cli/tx.go b/x/cron/client/cli/tx.go deleted file mode 100644 index 565daeb0d..000000000 --- a/x/cron/client/cli/tx.go +++ /dev/null @@ -1,24 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// 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/cron/genesis.go b/x/cron/genesis.go deleted file mode 100644 index 78b82c5ae..000000000 --- a/x/cron/genesis.go +++ /dev/null @@ -1,33 +0,0 @@ -package cron - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/neutron-org/neutron/v5/x/cron/keeper" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the schedules - for _, elem := range genState.ScheduleList { - err := k.AddSchedule(ctx, elem.Name, elem.Period, elem.Msgs, elem.ExecutionStage) - if err != nil { - panic(err) - } - } - // this line is used by starport scaffolding # genesis/module/init - err := k.SetParams(ctx, genState.Params) - if err != nil { - panic(err) - } -} - -// 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.ScheduleList = k.GetAllSchedules(ctx) - - return genesis -} diff --git a/x/cron/genesis_test.go b/x/cron/genesis_test.go deleted file mode 100644 index 9ec174bbe..000000000 --- a/x/cron/genesis_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package cron_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/testutil/common/nullify" - "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - "github.com/neutron-org/neutron/v5/x/cron" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func TestGenesis(t *testing.T) { - k, ctx := keeper.CronKeeper(t, nil, nil) - - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - ScheduleList: []types.Schedule{ - { - Name: "a", - Period: 5, - Msgs: nil, - LastExecuteHeight: uint64(ctx.BlockHeight()), //nolint:gosec - }, - }, - } - - cron.InitGenesis(ctx, *k, genesisState) - got := cron.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.Equal(t, genesisState.Params, got.Params) - require.ElementsMatch(t, genesisState.ScheduleList, got.ScheduleList) -} diff --git a/x/cron/keeper/grpc_query.go b/x/cron/keeper/grpc_query.go deleted file mode 100644 index 50017a573..000000000 --- a/x/cron/keeper/grpc_query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/cron/keeper/grpc_query_params.go b/x/cron/keeper/grpc_query_params.go deleted file mode 100644 index a646a7abb..000000000 --- a/x/cron/keeper/grpc_query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/cron/keeper/grpc_query_params_test.go b/x/cron/keeper/grpc_query_params_test.go deleted file mode 100644 index 64d1d4a13..000000000 --- a/x/cron/keeper/grpc_query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.CronKeeper(t, nil, nil) - params := types.DefaultParams() - err := keeper.SetParams(ctx, params) - require.NoError(t, err) - - response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/cron/keeper/grpc_query_schedule.go b/x/cron/keeper/grpc_query_schedule.go deleted file mode 100644 index 4b4d1d5ee..000000000 --- a/x/cron/keeper/grpc_query_schedule.go +++ /dev/null @@ -1,54 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func (k Keeper) Schedules(c context.Context, req *types.QuerySchedulesRequest) (*types.QuerySchedulesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var schedules []types.Schedule - ctx := sdk.UnwrapSDKContext(c) - - scheduleStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - - pageRes, err := query.Paginate(scheduleStore, req.Pagination, func(_, value []byte) error { - var schedule types.Schedule - k.cdc.MustUnmarshal(value, &schedule) - - schedules = append(schedules, schedule) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QuerySchedulesResponse{Schedules: schedules, Pagination: pageRes}, nil -} - -func (k Keeper) Schedule(c context.Context, req *types.QueryGetScheduleRequest) (*types.QueryGetScheduleResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetSchedule( - ctx, - req.Name, - ) - if !found { - return nil, status.Error(codes.NotFound, "schedule not found") - } - - return &types.QueryGetScheduleResponse{Schedule: *val}, nil -} diff --git a/x/cron/keeper/grpc_query_schedule_test.go b/x/cron/keeper/grpc_query_schedule_test.go deleted file mode 100644 index 86eaf179a..000000000 --- a/x/cron/keeper/grpc_query_schedule_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/neutron-org/neutron/v5/testutil/common/nullify" - testutil_keeper "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - cronkeeper "github.com/neutron-org/neutron/v5/x/cron/keeper" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestScheduleQuerySingle(t *testing.T) { - k, ctx := testutil_keeper.CronKeeper(t, nil, nil) - schedules := createNSchedule(t, ctx, k, 2) - - for _, tc := range []struct { - desc string - request *types.QueryGetScheduleRequest - response *types.QueryGetScheduleResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetScheduleRequest{ - Name: schedules[0].Name, - }, - response: &types.QueryGetScheduleResponse{Schedule: schedules[0]}, - }, - { - desc: "Second", - request: &types.QueryGetScheduleRequest{ - Name: schedules[1].Name, - }, - response: &types.QueryGetScheduleResponse{Schedule: schedules[1]}, - }, - { - desc: "KeyIsAbsent", - request: &types.QueryGetScheduleRequest{ - Name: "absent_key", - }, - err: status.Error(codes.NotFound, "schedule not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } { - t.Run(tc.desc, func(t *testing.T) { - response, err := k.Schedule(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestScheduleQueryPaginated(t *testing.T) { - k, ctx := testutil_keeper.CronKeeper(t, nil, nil) - schedules := createNSchedule(t, ctx, k, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QuerySchedulesRequest { - return &types.QuerySchedulesRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(schedules); i += step { - resp, err := k.Schedules(ctx, request(nil, uint64(i), uint64(step), false)) //nolint:gosec - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Schedules), step) - require.Subset(t, - nullify.Fill(schedules), - nullify.Fill(resp.Schedules), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(schedules); i += step { - resp, err := k.Schedules(ctx, request(next, 0, uint64(step), false)) //nolint:gosec - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Schedules), step) - require.Subset(t, - nullify.Fill(schedules), - nullify.Fill(resp.Schedules), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := k.Schedules(ctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(schedules), int(resp.Pagination.Total)) //nolint:gosec - require.ElementsMatch(t, - nullify.Fill(schedules), - nullify.Fill(resp.Schedules), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := k.Schedules(ctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} - -func createNSchedule(t *testing.T, ctx sdk.Context, k *cronkeeper.Keeper, n int32) []types.Schedule { - res := make([]types.Schedule, n) - - for idx, item := range res { - item.Name = strconv.Itoa(idx) - item.Period = 1000 - item.Msgs = nil - item.LastExecuteHeight = uint64(ctx.BlockHeight()) //nolint:gosec - item.ExecutionStage = types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER - - err := k.AddSchedule(ctx, item.Name, item.Period, item.Msgs, item.ExecutionStage) - require.NoError(t, err) - - res[idx] = item - } - - return res -} diff --git a/x/cron/keeper/keeper.go b/x/cron/keeper/keeper.go deleted file mode 100644 index 61fa71ac4..000000000 --- a/x/cron/keeper/keeper.go +++ /dev/null @@ -1,265 +0,0 @@ -package keeper - -import ( - "fmt" - "strconv" - "time" - - "cosmossdk.io/log" - "github.com/hashicorp/go-metrics" - - "github.com/cosmos/cosmos-sdk/telemetry" - - "cosmossdk.io/store/prefix" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -var ( - LabelExecuteReadySchedules = "execute_ready_schedules" - LabelScheduleCount = "schedule_count" - LabelScheduleExecutionsCount = "schedule_executions_count" - - MetricLabelSuccess = "success" - MetricLabelScheduleName = "schedule_name" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - accountKeeper types.AccountKeeper - WasmMsgServer types.WasmMsgServer - authority string - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - accountKeeper types.AccountKeeper, - authority string, -) *Keeper { - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - accountKeeper: accountKeeper, - authority: authority, - } -} - -func (k Keeper) GetAuthority() string { - return k.authority -} - -func (k *Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// ExecuteReadySchedules gets all schedules that are due for execution (with limit that is equal to Params.Limit) -// and executes messages in each one -func (k *Keeper) ExecuteReadySchedules(ctx sdk.Context, executionStage types.ExecutionStage) { - telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), LabelExecuteReadySchedules) - schedules := k.getSchedulesReadyForExecution(ctx, executionStage) - - for _, schedule := range schedules { - err := k.executeSchedule(ctx, schedule) - recordExecutedSchedule(err, schedule) - } -} - -// AddSchedule adds a new schedule to be executed every certain number of blocks, specified in the `period`. -// First schedule execution is supposed to be on `now + period` block. -func (k *Keeper) AddSchedule( - ctx sdk.Context, - name string, - period uint64, - msgs []types.MsgExecuteContract, - executionStage types.ExecutionStage, -) error { - if k.scheduleExists(ctx, name) { - return fmt.Errorf("schedule already exists with name=%v", name) - } - - schedule := types.Schedule{ - Name: name, - Period: period, - Msgs: msgs, - // let's execute newly added schedule on `now + period` block - LastExecuteHeight: uint64(ctx.BlockHeight()), //nolint:gosec - ExecutionStage: executionStage, - } - - k.storeSchedule(ctx, schedule) - k.changeTotalCount(ctx, 1) - - return nil -} - -// RemoveSchedule removes schedule with a given `name` -func (k *Keeper) RemoveSchedule(ctx sdk.Context, name string) { - if !k.scheduleExists(ctx, name) { - return - } - - k.changeTotalCount(ctx, -1) - k.removeSchedule(ctx, name) -} - -// GetSchedule returns schedule with a given `name` -func (k *Keeper) GetSchedule(ctx sdk.Context, name string) (*types.Schedule, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - bzSchedule := store.Get(types.GetScheduleKey(name)) - if bzSchedule == nil { - return nil, false - } - - var schedule types.Schedule - k.cdc.MustUnmarshal(bzSchedule, &schedule) - return &schedule, true -} - -// GetAllSchedules returns all schedules -func (k *Keeper) GetAllSchedules(ctx sdk.Context) []types.Schedule { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - - res := make([]types.Schedule, 0) - - iterator := storetypes.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var schedule types.Schedule - k.cdc.MustUnmarshal(iterator.Value(), &schedule) - res = append(res, schedule) - } - - return res -} - -func (k *Keeper) GetScheduleCount(ctx sdk.Context) int32 { - return k.getScheduleCount(ctx) -} - -func (k *Keeper) getSchedulesReadyForExecution(ctx sdk.Context, executionStage types.ExecutionStage) []types.Schedule { - params := k.GetParams(ctx) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - count := uint64(0) - - res := make([]types.Schedule, 0) - - iterator := storetypes.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var schedule types.Schedule - k.cdc.MustUnmarshal(iterator.Value(), &schedule) - - if k.intervalPassed(ctx, schedule) && schedule.ExecutionStage == executionStage { - res = append(res, schedule) - count++ - - if count >= params.Limit { - k.Logger(ctx).Info("limit of schedule executions per block reached") - return res - } - } - } - - return res -} - -// executeSchedule executes all msgs in a given schedule and changes LastExecuteHeight -// if at least one msg execution fails, rollback all messages -func (k *Keeper) executeSchedule(ctx sdk.Context, schedule types.Schedule) error { - // Even if contract execution returned an error, we still increase the height - // and execute it after this interval - schedule.LastExecuteHeight = uint64(ctx.BlockHeight()) //nolint:gosec - k.storeSchedule(ctx, schedule) - - cacheCtx, writeFn := ctx.CacheContext() - - for idx, msg := range schedule.Msgs { - executeMsg := wasmtypes.MsgExecuteContract{ - Sender: k.accountKeeper.GetModuleAddress(types.ModuleName).String(), - Contract: msg.Contract, - Msg: []byte(msg.Msg), - Funds: sdk.NewCoins(), - } - _, err := k.WasmMsgServer.ExecuteContract(cacheCtx, &executeMsg) - if err != nil { - ctx.Logger().Info("executeSchedule: failed to execute contract msg", - "schedule_name", schedule.Name, - "msg_idx", idx, - "msg_contract", msg.Contract, - "msg", msg.Msg, - "error", err, - ) - return err - } - } - - // only save state if all the messages in a schedule were executed successfully - writeFn() - return nil -} - -func (k *Keeper) storeSchedule(ctx sdk.Context, schedule types.Schedule) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - - bzSchedule := k.cdc.MustMarshal(&schedule) - store.Set(types.GetScheduleKey(schedule.Name), bzSchedule) -} - -func (k *Keeper) removeSchedule(ctx sdk.Context, name string) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - - store.Delete(types.GetScheduleKey(name)) -} - -func (k *Keeper) scheduleExists(ctx sdk.Context, name string) bool { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ScheduleKey) - return store.Has(types.GetScheduleKey(name)) -} - -func (k *Keeper) intervalPassed(ctx sdk.Context, schedule types.Schedule) bool { - return uint64(ctx.BlockHeight()) > (schedule.LastExecuteHeight + schedule.Period) //nolint:gosec -} - -func (k *Keeper) changeTotalCount(ctx sdk.Context, incrementAmount int32) { - store := ctx.KVStore(k.storeKey) - count := k.getScheduleCount(ctx) - newCount := types.ScheduleCount{Count: count + incrementAmount} - bzCount := k.cdc.MustMarshal(&newCount) - store.Set(types.ScheduleCountKey, bzCount) - - telemetry.ModuleSetGauge(types.ModuleName, float32(newCount.Count), LabelScheduleCount) -} - -func (k *Keeper) getScheduleCount(ctx sdk.Context) int32 { - store := ctx.KVStore(k.storeKey) - bzCount := store.Get(types.ScheduleCountKey) - if bzCount == nil { - return 0 - } - - var count types.ScheduleCount - k.cdc.MustUnmarshal(bzCount, &count) - return count.Count -} - -func recordExecutedSchedule(err error, schedule types.Schedule) { - telemetry.IncrCounterWithLabels([]string{LabelScheduleExecutionsCount}, 1, []metrics.Label{ - telemetry.NewLabel(telemetry.MetricLabelNameModule, types.ModuleName), - telemetry.NewLabel(MetricLabelSuccess, strconv.FormatBool(err == nil)), - telemetry.NewLabel(MetricLabelScheduleName, schedule.Name), - }) -} diff --git a/x/cron/keeper/keeper_test.go b/x/cron/keeper/keeper_test.go deleted file mode 100644 index 4882f7ae4..000000000 --- a/x/cron/keeper/keeper_test.go +++ /dev/null @@ -1,295 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - "github.com/stretchr/testify/assert" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/testutil" - testutil_keeper "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - mock_types "github.com/neutron-org/neutron/v5/testutil/mocks/cron/types" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// ExecuteReadySchedules: -// - calls msgServer.execute() on ready schedules -// - updates ready schedules lastExecuteHeight -// - does not update lastExecuteHeight of unready schedules -// - does not go over the limit -func TestKeeperExecuteReadySchedules(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - accountKeeper := mock_types.NewMockAccountKeeper(ctrl) - addr, err := sdk.AccAddressFromBech32(testutil.TestOwnerAddress) - require.NoError(t, err) - - wasmMsgServer := mock_types.NewMockWasmMsgServer(ctrl) - k, ctx := testutil_keeper.CronKeeper(t, wasmMsgServer, accountKeeper) - ctx = ctx.WithBlockHeight(0) - - err = k.SetParams(ctx, types.Params{ - SecurityAddress: testutil.TestOwnerAddress, - Limit: 2, - }) - require.NoError(t, err) - - schedules := []types.Schedule{ - { - Name: "1_unready1", - Period: 10, - Msgs: []types.MsgExecuteContract{ - { - Contract: "1_neutron", - Msg: "1_msg", - }, - }, - LastExecuteHeight: 4, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - { - Name: "2_ready1", - Period: 4, - Msgs: []types.MsgExecuteContract{ - { - Contract: "2_neutron", - Msg: "2_msg", - }, - }, - LastExecuteHeight: 0, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - { - Name: "3_ready2", - Period: 4, - Msgs: []types.MsgExecuteContract{ - { - Contract: "3_neutron", - Msg: "3_msg", - }, - }, - LastExecuteHeight: 0, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - { - Name: "4_unready2", - Period: 10, - Msgs: []types.MsgExecuteContract{}, - LastExecuteHeight: 4, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - { - Name: "5_ready3", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "5_neutron", - Msg: "5_msg", - }, - }, - LastExecuteHeight: 0, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - { - Name: "6_ready4", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "6_neutron", - Msg: "6_msg", - }, - }, - LastExecuteHeight: 0, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER, - }, - } - - for _, item := range schedules { - ctx = ctx.WithBlockHeight(int64(item.LastExecuteHeight)) //nolint:gosec - err := k.AddSchedule(ctx, item.Name, item.Period, item.Msgs, item.ExecutionStage) - require.NoError(t, err) - } - - count := k.GetScheduleCount(ctx) - require.Equal(t, count, int32(6)) - - ctx = ctx.WithBlockHeight(5) - - accountKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(addr).AnyTimes() - wasmMsgServer.EXPECT().ExecuteContract(gomock.Any(), &wasmtypes.MsgExecuteContract{ - Sender: testutil.TestOwnerAddress, - Contract: "2_neutron", - Msg: []byte("2_msg"), - Funds: sdk.NewCoins(), - }).Return(nil, fmt.Errorf("executeerror")) - wasmMsgServer.EXPECT().ExecuteContract(gomock.Any(), &wasmtypes.MsgExecuteContract{ - Sender: testutil.TestOwnerAddress, - Contract: "3_neutron", - Msg: []byte("3_msg"), - Funds: sdk.NewCoins(), - }).Return(&wasmtypes.MsgExecuteContractResponse{}, nil) - - k.ExecuteReadySchedules(ctx, types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - - unready1, _ := k.GetSchedule(ctx, "1_unready1") - ready1, _ := k.GetSchedule(ctx, "2_ready1") - ready2, _ := k.GetSchedule(ctx, "3_ready2") - unready2, _ := k.GetSchedule(ctx, "4_unready2") - ready3, _ := k.GetSchedule(ctx, "5_ready3") - ready4, _ := k.GetSchedule(ctx, "6_ready4") - - require.Equal(t, uint64(4), unready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready2.LastExecuteHeight) - require.Equal(t, uint64(4), unready2.LastExecuteHeight) - require.Equal(t, uint64(0), ready3.LastExecuteHeight) - require.Equal(t, uint64(0), ready4.LastExecuteHeight) - - // let's make another call at the next height - // Notice that now only one ready schedule left because we got limit of 2 at once - ctx = ctx.WithBlockHeight(6) - - wasmMsgServer.EXPECT().ExecuteContract(gomock.Any(), &wasmtypes.MsgExecuteContract{ - Sender: testutil.TestOwnerAddress, - Contract: "5_neutron", - Msg: []byte("5_msg"), - Funds: sdk.NewCoins(), - }).Return(&wasmtypes.MsgExecuteContractResponse{}, nil) - - k.ExecuteReadySchedules(ctx, types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - - unready1, _ = k.GetSchedule(ctx, "1_unready1") - ready1, _ = k.GetSchedule(ctx, "2_ready1") - ready2, _ = k.GetSchedule(ctx, "3_ready2") - unready2, _ = k.GetSchedule(ctx, "4_unready2") - ready3, _ = k.GetSchedule(ctx, "5_ready3") - ready4, _ = k.GetSchedule(ctx, "6_ready4") - - require.Equal(t, uint64(4), unready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready2.LastExecuteHeight) - require.Equal(t, uint64(4), unready2.LastExecuteHeight) - require.Equal(t, uint64(6), ready3.LastExecuteHeight) - require.Equal(t, uint64(0), ready4.LastExecuteHeight) - - ctx = ctx.WithBlockHeight(7) - - wasmMsgServer.EXPECT().ExecuteContract(gomock.Any(), &wasmtypes.MsgExecuteContract{ - Sender: testutil.TestOwnerAddress, - Contract: "6_neutron", - Msg: []byte("6_msg"), - Funds: sdk.NewCoins(), - }).Return(&wasmtypes.MsgExecuteContractResponse{}, nil) - - k.ExecuteReadySchedules(ctx, types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) - - unready1, _ = k.GetSchedule(ctx, "1_unready1") - ready1, _ = k.GetSchedule(ctx, "2_ready1") - ready2, _ = k.GetSchedule(ctx, "3_ready2") - unready2, _ = k.GetSchedule(ctx, "4_unready2") - ready3, _ = k.GetSchedule(ctx, "5_ready3") - ready4, _ = k.GetSchedule(ctx, "6_ready4") - - require.Equal(t, uint64(4), unready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready1.LastExecuteHeight) - require.Equal(t, uint64(5), ready2.LastExecuteHeight) - require.Equal(t, uint64(4), unready2.LastExecuteHeight) - require.Equal(t, uint64(6), ready3.LastExecuteHeight) - require.Equal(t, uint64(7), ready4.LastExecuteHeight) -} - -func TestAddSchedule(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - accountKeeper := mock_types.NewMockAccountKeeper(ctrl) - - wasmMsgServer := mock_types.NewMockWasmMsgServer(ctrl) - k, ctx := testutil_keeper.CronKeeper(t, wasmMsgServer, accountKeeper) - ctx = ctx.WithBlockHeight(0) - - err := k.SetParams(ctx, types.Params{ - SecurityAddress: testutil.TestOwnerAddress, - Limit: 2, - }) - require.NoError(t, err) - - // normal add schedule - err = k.AddSchedule(ctx, "a", 7, []types.MsgExecuteContract{ - { - Contract: "c", - Msg: "m", - }, - }, types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - require.NoError(t, err) - - err = k.AddSchedule(ctx, "b", 7, []types.MsgExecuteContract{ - { - Contract: "c", - Msg: "m", - }, - }, types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) - require.NoError(t, err) - - // second time with same name returns error - err = k.AddSchedule(ctx, "a", 5, []types.MsgExecuteContract{}, types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) - require.Error(t, err) - - scheduleA, found := k.GetSchedule(ctx, "a") - require.True(t, found) - require.Equal(t, scheduleA.Name, "a") - require.Equal(t, scheduleA.Period, uint64(7)) - require.Equal(t, scheduleA.Msgs, []types.MsgExecuteContract{ - {Contract: "c", Msg: "m"}, - }) - require.Equal(t, scheduleA.ExecutionStage, types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - - schedules := k.GetAllSchedules(ctx) - require.Len(t, schedules, 2) - require.Equal(t, schedules[0].ExecutionStage, types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - require.Equal(t, schedules[1].ExecutionStage, types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) - - // remove schedule works - k.RemoveSchedule(ctx, "a") - _, found = k.GetSchedule(ctx, "a") - assert.False(t, found) - - // does not panic even though we don't have it - k.RemoveSchedule(ctx, "a") -} - -func TestGetAllSchedules(t *testing.T) { - k, ctx := testutil_keeper.CronKeeper(t, nil, nil) - - err := k.SetParams(ctx, types.Params{ - SecurityAddress: testutil.TestOwnerAddress, - Limit: 2, - }) - require.NoError(t, err) - - expectedSchedules := make([]types.Schedule, 0, 3) - for i := range []int{1, 2, 3} { - s := types.Schedule{ - Name: strconv.Itoa(i), - Period: 5, - Msgs: nil, - LastExecuteHeight: uint64(ctx.BlockHeight()), //nolint:gosec - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER, - } - expectedSchedules = append(expectedSchedules, s) - err := k.AddSchedule(ctx, s.Name, s.Period, s.Msgs, s.ExecutionStage) - require.NoError(t, err) - } - - schedules := k.GetAllSchedules(ctx) - assert.Equal(t, 3, len(schedules)) - assert.ElementsMatch(t, schedules, expectedSchedules) - assert.Equal(t, int32(3), k.GetScheduleCount(ctx)) -} diff --git a/x/cron/keeper/migrations.go b/x/cron/keeper/migrations.go deleted file mode 100644 index b4c394bb1..000000000 --- a/x/cron/keeper/migrations.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - v2 "github.com/neutron-org/neutron/v5/x/cron/migrations/v2" -) - -// Migrator is a struct for handling in-place store migrations. -type Migrator struct { - keeper Keeper -} - -// NewMigrator returns a new Migrator. -func NewMigrator(keeper Keeper) Migrator { - return Migrator{keeper: keeper} -} - -// Migrate1to2 migrates from version 1 to 2. -func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v2.MigrateStore(ctx, m.keeper.cdc, m.keeper.storeKey) -} diff --git a/x/cron/keeper/msg_server.go b/x/cron/keeper/msg_server.go deleted file mode 100644 index ccb0bcbc4..000000000 --- a/x/cron/keeper/msg_server.go +++ /dev/null @@ -1,78 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -type msgServer struct { - keeper 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{} - -// AddSchedule adds new schedule -func (k msgServer) AddSchedule(goCtx context.Context, req *types.MsgAddSchedule) (*types.MsgAddScheduleResponse, error) { - if err := req.Validate(); err != nil { - return nil, errors.Wrap(err, "failed to validate MsgAddSchedule") - } - - authority := k.keeper.GetAuthority() - if authority != req.Authority { - return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.keeper.AddSchedule(ctx, req.Name, req.Period, req.Msgs, req.ExecutionStage); err != nil { - return nil, errors.Wrap(err, "failed to add schedule") - } - - return &types.MsgAddScheduleResponse{}, nil -} - -// RemoveSchedule removes schedule -func (k msgServer) RemoveSchedule(goCtx context.Context, req *types.MsgRemoveSchedule) (*types.MsgRemoveScheduleResponse, error) { - if err := req.Validate(); err != nil { - return nil, errors.Wrap(err, "failed to validate MsgRemoveSchedule") - } - - authority := k.keeper.GetAuthority() - if authority != req.Authority { - return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - k.keeper.RemoveSchedule(ctx, req.Name) - - return &types.MsgRemoveScheduleResponse{}, nil -} - -// UpdateParams updates the module parameters -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if err := req.Validate(); err != nil { - return nil, errors.Wrap(err, "failed to validate MsgUpdateParams") - } - - authority := k.keeper.GetAuthority() - if authority != req.Authority { - return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.keeper.SetParams(ctx, req.Params); err != nil { - return nil, err - } - - return &types.MsgUpdateParamsResponse{}, nil -} diff --git a/x/cron/keeper/msg_server_test.go b/x/cron/keeper/msg_server_test.go deleted file mode 100644 index 4c0a6e5d3..000000000 --- a/x/cron/keeper/msg_server_test.go +++ /dev/null @@ -1,221 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/testutil" - testkeeper "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - cronkeeper "github.com/neutron-org/neutron/v5/x/cron/keeper" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func TestMsgAddScheduleValidate(t *testing.T) { - k, ctx := testkeeper.CronKeeper(t, nil, nil) - msgServer := cronkeeper.NewMsgServerImpl(*k) - - tests := []struct { - name string - msg types.MsgAddSchedule - expectedErr string - }{ - { - "empty authority", - types.MsgAddSchedule{ - Authority: "", - Name: "name", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - "authority is invalid", - }, - { - "invalid authority", - types.MsgAddSchedule{ - Authority: "invalid authority", - Name: "name", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - "authority is invalid", - }, - { - "invalid name", - types.MsgAddSchedule{ - Authority: testutil.TestOwnerAddress, - Name: "", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - "name is invalid", - }, - { - "invalid period", - types.MsgAddSchedule{ - Authority: testutil.TestOwnerAddress, - Name: "name", - Period: 0, - Msgs: []types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - "period is invalid", - }, - { - "empty msgs", - types.MsgAddSchedule{ - Authority: testutil.TestOwnerAddress, - Name: "name", - Period: 3, - Msgs: []types.MsgExecuteContract{}, - ExecutionStage: types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER, - }, - "msgs should not be empty", - }, - { - "invalid execution stage", - types.MsgAddSchedule{ - Authority: testutil.TestOwnerAddress, - Name: "name", - Period: 3, - Msgs: []types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - ExecutionStage: 7, - }, - "execution stage is invalid", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - resp, err := msgServer.AddSchedule(ctx, &tt.msg) - require.ErrorContains(t, err, tt.expectedErr) - require.Nil(t, resp) - }) - } -} - -func TestMsgRemoveScheduleValidate(t *testing.T) { - k, ctx := testkeeper.CronKeeper(t, nil, nil) - msgServer := cronkeeper.NewMsgServerImpl(*k) - - tests := []struct { - name string - msg types.MsgRemoveSchedule - expectedErr string - }{ - { - "empty authority", - types.MsgRemoveSchedule{ - Authority: "", - Name: "name", - }, - "authority is invalid", - }, - { - "invalid authority", - types.MsgRemoveSchedule{ - Authority: "invalid authority", - Name: "name", - }, - "authority is invalid", - }, - { - "invalid name", - types.MsgRemoveSchedule{ - Authority: testutil.TestOwnerAddress, - Name: "", - }, - "name is invalid", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - resp, err := msgServer.RemoveSchedule(ctx, &tt.msg) - require.ErrorContains(t, err, tt.expectedErr) - require.Nil(t, resp) - }) - } -} - -func TestMsgUpdateParamsValidate(t *testing.T) { - k, ctx := testkeeper.CronKeeper(t, nil, nil) - msgServer := cronkeeper.NewMsgServerImpl(*k) - - tests := []struct { - name string - msg types.MsgUpdateParams - expectedErr string - }{ - { - "empty authority", - types.MsgUpdateParams{ - Authority: "", - }, - "authority is invalid", - }, - { - "invalid authority", - types.MsgUpdateParams{ - Authority: "invalid authority", - }, - "authority is invalid", - }, - { - "empty security_address", - types.MsgUpdateParams{ - Authority: testutil.TestOwnerAddress, - Params: types.Params{ - SecurityAddress: "", - }, - }, - "security_address is invalid", - }, - { - "invalid security_address", - types.MsgUpdateParams{ - Authority: testutil.TestOwnerAddress, - Params: types.Params{ - SecurityAddress: "invalid security_address", - }, - }, - "security_address is invalid", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - resp, err := msgServer.UpdateParams(ctx, &tt.msg) - require.ErrorContains(t, err, tt.expectedErr) - require.Nil(t, resp) - }) - } -} diff --git a/x/cron/keeper/params.go b/x/cron/keeper/params.go deleted file mode 100644 index 81b7321e4..000000000 --- a/x/cron/keeper/params.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKey) - if bz == nil { - return params - } - - k.cdc.MustUnmarshal(bz, ¶ms) - return params -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { - store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(¶ms) - if err != nil { - return err - } - - store.Set(types.ParamsKey, bz) - return nil -} diff --git a/x/cron/keeper/params_test.go b/x/cron/keeper/params_test.go deleted file mode 100644 index be0630f66..000000000 --- a/x/cron/keeper/params_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/neutron-org/neutron/v5/app/config" - - "github.com/neutron-org/neutron/v5/testutil" - - testkeeper "github.com/neutron-org/neutron/v5/testutil/cron/keeper" - - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func TestGetParams(t *testing.T) { - _ = config.GetDefaultConfig() - - k, ctx := testkeeper.CronKeeper(t, nil, nil) - params := types.Params{ - SecurityAddress: testutil.TestOwnerAddress, - Limit: 5, - } - - err := k.SetParams(ctx, params) - require.NoError(t, err) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/cron/migrations/v2/store.go b/x/cron/migrations/v2/store.go deleted file mode 100644 index dae71e591..000000000 --- a/x/cron/migrations/v2/store.go +++ /dev/null @@ -1,56 +0,0 @@ -package v2 - -import ( - "cosmossdk.io/errors" - "cosmossdk.io/store/prefix" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// MigrateStore performs in-place store migrations. -// The migration adds execution stage for schedules. -func MigrateStore(ctx sdk.Context, cdc codec.BinaryCodec, storeKey storetypes.StoreKey) error { - return migrateSchedules(ctx, cdc, storeKey) -} - -type migrationUpdate struct { - key []byte - val []byte -} - -func migrateSchedules(ctx sdk.Context, cdc codec.BinaryCodec, storeKey storetypes.StoreKey) error { - ctx.Logger().Info("Migrating cron Schedules...") - - store := prefix.NewStore(ctx.KVStore(storeKey), types.ScheduleKey) - iterator := storetypes.KVStorePrefixIterator(store, []byte{}) - schedulesToUpdate := make([]migrationUpdate, 0) - - for ; iterator.Valid(); iterator.Next() { - var schedule types.Schedule - cdc.MustUnmarshal(iterator.Value(), &schedule) - // Set execution in EndBlocker - schedule.ExecutionStage = types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER - - schedulesToUpdate = append(schedulesToUpdate, migrationUpdate{ - key: iterator.Key(), - val: cdc.MustMarshal(&schedule), - }) - } - - err := iterator.Close() - if err != nil { - return errors.Wrap(err, "iterator failed to close during migration") - } - - // Store the updated Schedules - for _, v := range schedulesToUpdate { - store.Set(v.key, v.val) - } - - ctx.Logger().Info("Finished migrating cron Schedules...") - - return nil -} diff --git a/x/cron/migrations/v2/store_test.go b/x/cron/migrations/v2/store_test.go deleted file mode 100644 index a1a3c4fef..000000000 --- a/x/cron/migrations/v2/store_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package v2_test - -import ( - "testing" - - "cosmossdk.io/store/prefix" - "github.com/stretchr/testify/suite" - - "github.com/neutron-org/neutron/v5/testutil" - v2 "github.com/neutron-org/neutron/v5/x/cron/migrations/v2" - "github.com/neutron-org/neutron/v5/x/cron/types" - v1types "github.com/neutron-org/neutron/v5/x/cron/types/v1" -) - -type V2CronMigrationTestSuite struct { - testutil.IBCConnectionTestSuite -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(V2CronMigrationTestSuite)) -} - -func (suite *V2CronMigrationTestSuite) TestScheduleUpgrade() { - var ( - app = suite.GetNeutronZoneApp(suite.ChainA) - storeKey = app.GetKey(types.StoreKey) - ctx = suite.ChainA.GetContext() - cdc = app.AppCodec() - ) - - schedule := v1types.Schedule{ - Name: "name", - Period: 3, - Msgs: []v1types.MsgExecuteContract{ - { - Contract: "contract", - Msg: "msg", - }, - }, - LastExecuteHeight: 1, - } - - store := prefix.NewStore(ctx.KVStore(storeKey), types.ScheduleKey) - bz := cdc.MustMarshal(&schedule) - store.Set(types.GetScheduleKey(schedule.Name), bz) - - // Run migration - suite.NoError(v2.MigrateStore(ctx, cdc, storeKey)) - - // Check Schedule has correct ExecutionStage - newSchedule, _ := app.CronKeeper.GetSchedule(ctx, schedule.Name) - suite.Equal(newSchedule.Name, schedule.Name) - suite.Equal(newSchedule.Period, schedule.Period) - for i, msg := range newSchedule.Msgs { - suite.Equal(msg.Contract, schedule.Msgs[i].Contract) - suite.Equal(msg.Msg, schedule.Msgs[i].Msg) - } - suite.Equal(newSchedule.LastExecuteHeight, schedule.LastExecuteHeight) - suite.Equal(newSchedule.ExecutionStage, types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) -} diff --git a/x/cron/module.go b/x/cron/module.go deleted file mode 100644 index e86ee8745..000000000 --- a/x/cron/module.go +++ /dev/null @@ -1,169 +0,0 @@ -package cron - -import ( - "context" - "encoding/json" - "fmt" - - "cosmossdk.io/core/appmodule" - - "github.com/gorilla/mux" - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/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" - - "github.com/neutron-org/neutron/v5/x/cron/client/cli" - "github.com/neutron-org/neutron/v5/x/cron/keeper" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -var ( - _ appmodule.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ appmodule.HasBeginBlocker = AppModule{} - _ appmodule.HasEndBlocker = AppModule{} -) - -// ---------------------------------------------------------------------------- -// 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, _ 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() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { -} - -// 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)) //nolint:errcheck -} - -// 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 -// ---------------------------------------------------------------------------- - -var _ appmodule.AppModule = AppModule{} - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - } -} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (am AppModule) IsOnePerModuleType() { // marker -} - -// IsAppModule implements the appmodule.AppModule interface. -func (am AppModule) IsAppModule() { // marker -} - -// Deprecated: use RegisterServices -func (AppModule) QuerierRoute() string { return types.RouterKey } - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(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 types.ConsensusVersion } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(ctx context.Context) error { - am.keeper.ExecuteReadySchedules(sdk.UnwrapSDKContext(ctx), types.ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER) - return nil -} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(ctx context.Context) error { - am.keeper.ExecuteReadySchedules(sdk.UnwrapSDKContext(ctx), types.ExecutionStage_EXECUTION_STAGE_END_BLOCKER) - return nil -} diff --git a/x/cron/module_simulation.go b/x/cron/module_simulation.go deleted file mode 100644 index 0ada92486..000000000 --- a/x/cron/module_simulation.go +++ /dev/null @@ -1,47 +0,0 @@ -package cron - -import ( - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/testutil/sims" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - cronsimulation "github.com/neutron-org/neutron/v5/x/cron/simulation" - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -// avoid unused import issue -var ( - _ = cronsimulation.FindAccount - _ = sims.StakePerAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace -) - -// GenerateGenesisState creates a randomized GenState of the module -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - cronGenesis := types.GenesisState{ - Params: types.DefaultParams(), - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&cronGenesis) -} - -// ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { - return nil -} - -// TODO -// RegisterStoreDecoder registers a decoder -func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - return operations -} diff --git a/x/cron/simulation/helpers.go b/x/cron/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/cron/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/cron/types/codec.go b/x/cron/types/codec.go deleted file mode 100644 index 6772e97b9..000000000 --- a/x/cron/types/codec.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.cron.MsgUpdateParams", nil) -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgUpdateParams{}, - &MsgAddSchedule{}, - &MsgRemoveSchedule{}, - ) - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/cron/types/constants.go b/x/cron/types/constants.go deleted file mode 100644 index 6bad94d03..000000000 --- a/x/cron/types/constants.go +++ /dev/null @@ -1,3 +0,0 @@ -package types - -const ConsensusVersion = 1 diff --git a/x/cron/types/errors.go b/x/cron/types/errors.go deleted file mode 100644 index 8bc535d7e..000000000 --- a/x/cron/types/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// DONTCOVER - -import ( - "cosmossdk.io/errors" -) - -// x/cron module sentinel errors -var ( - ErrSample = errors.Register(ModuleName, 1100, "sample error") -) diff --git a/x/cron/types/expected_keepers.go b/x/cron/types/expected_keepers.go deleted file mode 100644 index cbed63584..000000000 --- a/x/cron/types/expected_keepers.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -import ( - "context" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetModuleAddress(moduleName string) sdk.AccAddress - // Methods imported from account should be defined here -} - -type WasmMsgServer interface { - ExecuteContract(context.Context, *wasmtypes.MsgExecuteContract) (*wasmtypes.MsgExecuteContractResponse, error) - // Methods imported from account should be defined here -} diff --git a/x/cron/types/genesis.go b/x/cron/types/genesis.go deleted file mode 100644 index 4fad02046..000000000 --- a/x/cron/types/genesis.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -import "fmt" - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - ScheduleList: []Schedule{}, - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in schedule - scheduleIndexMap := make(map[string]struct{}) - - for _, elem := range gs.ScheduleList { - index := string(GetScheduleKey(elem.Name)) - if _, ok := scheduleIndexMap[index]; ok { - return fmt.Errorf("duplicated index for schedule") - } - scheduleIndexMap[index] = struct{}{} - } - - return gs.Params.Validate() -} diff --git a/x/cron/types/genesis.pb.go b/x/cron/types/genesis.pb.go deleted file mode 100644 index b3678689b..000000000 --- a/x/cron/types/genesis.pb.go +++ /dev/null @@ -1,385 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/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 - -// Defines the cron module's genesis state. -type GenesisState struct { - ScheduleList []Schedule `protobuf:"bytes,2,rep,name=scheduleList,proto3" json:"scheduleList"` - 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_7c41f2dea8ad83c2, []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) GetScheduleList() []Schedule { - if m != nil { - return m.ScheduleList - } - return nil -} - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "neutron.cron.GenesisState") -} - -func init() { proto.RegisterFile("neutron/cron/genesis.proto", fileDescriptor_7c41f2dea8ad83c2) } - -var fileDescriptor_7c41f2dea8ad83c2 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x4b, 0x2d, 0x2d, - 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0x06, 0x11, 0xe9, 0xa9, 0x79, 0xa9, 0xc5, 0x99, 0xc5, 0x7a, 0x05, - 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x50, 0x39, 0x3d, 0x90, 0x9c, 0x94, 0x48, 0x7a, 0x7e, 0x7a, - 0x3e, 0x58, 0x42, 0x1f, 0xc4, 0x82, 0xa8, 0x91, 0x92, 0x44, 0xd1, 0x5f, 0x90, 0x58, 0x94, 0x98, - 0x0b, 0xd5, 0x2e, 0x25, 0x8d, 0x22, 0x55, 0x9c, 0x9c, 0x91, 0x9a, 0x52, 0x9a, 0x93, 0x0a, 0x91, - 0x54, 0x6a, 0x61, 0xe4, 0xe2, 0x71, 0x87, 0xd8, 0x16, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc0, - 0xc5, 0x03, 0x53, 0xe2, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0x24, 0xa6, - 0x87, 0xec, 0x06, 0xbd, 0x60, 0xa8, 0x0a, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0x50, 0x74, - 0x08, 0x19, 0x71, 0xb1, 0x41, 0xec, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0x41, 0xd5, - 0x1b, 0x00, 0x96, 0x83, 0xea, 0x84, 0xaa, 0x74, 0xf2, 0x38, 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, 0xbd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, - 0xa8, 0x39, 0xba, 0xf9, 0x45, 0xe9, 0x30, 0xb6, 0x7e, 0x99, 0xa9, 0x7e, 0x05, 0xc4, 0x67, 0x25, - 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x7f, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, - 0x63, 0x56, 0x46, 0x51, 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 - if len(m.ScheduleList) > 0 { - for iNdEx := len(m.ScheduleList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ScheduleList[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 { - 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)) - if len(m.ScheduleList) > 0 { - for _, e := range m.ScheduleList { - l = e.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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScheduleList", 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.ScheduleList = append(m.ScheduleList, Schedule{}) - if err := m.ScheduleList[len(m.ScheduleList)-1].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/cron/types/genesis_test.go b/x/cron/types/genesis_test.go deleted file mode 100644 index 04d14471f..000000000 --- a/x/cron/types/genesis_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/neutron-org/neutron/v5/app/config" - - "github.com/stretchr/testify/require" - - "github.com/neutron-org/neutron/v5/x/cron/types" -) - -func TestGenesisState_Validate(t *testing.T) { - config.GetDefaultConfig() - - for _, tc := range []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - SecurityAddress: "neutron17dtl0mjt3t77kpuhg2edqzjpszulwhgzcdvagh", - Limit: 1, - }, - }, - valid: true, - }, - { - desc: "invalid genesis state - params are invalid", - genState: &types.GenesisState{ - Params: types.Params{ - SecurityAddress: "", - Limit: 0, - }, - }, - valid: false, - }, - } { - 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/cron/types/keys.go b/x/cron/types/keys.go deleted file mode 100644 index 95bb9a676..000000000 --- a/x/cron/types/keys.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "cron" - - // 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_cron" -) - -const ( - prefixScheduleKey = iota + 1 - prefixScheduleCountKey - prefixParamsKey -) - -var ( - ScheduleKey = []byte{prefixScheduleKey} - ScheduleCountKey = []byte{prefixScheduleCountKey} - ParamsKey = []byte{prefixParamsKey} -) - -func GetScheduleKey(name string) []byte { - return []byte(name) -} diff --git a/x/cron/types/params.go b/x/cron/types/params.go deleted file mode 100644 index 2ad7cf24c..000000000 --- a/x/cron/types/params.go +++ /dev/null @@ -1,106 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -var ( - KeySecurityAddress = []byte("SecurityAddress") - KeyLimit = []byte("Limit") - - DefaultSecurityAddress = "" - DefaultLimit = uint64(5) -) - -// 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(securityAddress string, limit uint64) Params { - return Params{ - SecurityAddress: securityAddress, - Limit: limit, - } -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams(DefaultSecurityAddress, DefaultLimit) -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair( - KeySecurityAddress, - &p.SecurityAddress, - validateAddress, - ), - paramtypes.NewParamSetPair( - KeyLimit, - &p.Limit, - validateLimit, - ), - } -} - -// Validate validates the set of params -func (p Params) Validate() error { - err := validateAddress(p.SecurityAddress) - if err != nil { - return fmt.Errorf("invalid security address: %w", err) - } - - err = validateLimit(p.Limit) - if err != nil { - return fmt.Errorf("invalid limit: %w", err) - } - - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -func validateAddress(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - // address might be explicitly empty in test environments - if len(v) == 0 { - return nil - } - - _, err := sdk.AccAddressFromBech32(v) - if err != nil { - return fmt.Errorf("invalid address: %w", err) - } - - return nil -} - -func validateLimit(i interface{}) error { - l, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if l == 0 { - return fmt.Errorf("limit cannot be zero") - } - - return nil -} diff --git a/x/cron/types/params.pb.go b/x/cron/types/params.pb.go deleted file mode 100644 index 6f0715acb..000000000 --- a/x/cron/types/params.pb.go +++ /dev/null @@ -1,355 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/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 - -// Defines the parameters for the module. -type Params struct { - // Security address that can remove schedules - SecurityAddress string `protobuf:"bytes,1,opt,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty"` - // Limit of schedules executed in one block - Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_efa4f5c14a68f6e5, []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) GetSecurityAddress() string { - if m != nil { - return m.SecurityAddress - } - return "" -} - -func (m *Params) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func init() { - proto.RegisterType((*Params)(nil), "neutron.cron.Params") -} - -func init() { proto.RegisterFile("neutron/cron/params.proto", fileDescriptor_efa4f5c14a68f6e5) } - -var fileDescriptor_efa4f5c14a68f6e5 = []byte{ - // 198 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x4b, 0x2d, 0x2d, - 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0x06, 0x11, 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x7a, 0x05, 0x45, - 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x50, 0x29, 0x3d, 0x90, 0x94, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, - 0x58, 0x42, 0x1f, 0xc4, 0x82, 0xa8, 0x51, 0xf2, 0xe7, 0x62, 0x0b, 0x00, 0xeb, 0x11, 0xd2, 0xe4, - 0x12, 0x28, 0x4e, 0x4d, 0x2e, 0x2d, 0xca, 0x2c, 0xa9, 0x8c, 0x4f, 0x4c, 0x49, 0x29, 0x4a, 0x2d, - 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0xe2, 0x87, 0x89, 0x3b, 0x42, 0x84, 0x85, 0x44, - 0xb8, 0x58, 0x73, 0x32, 0x73, 0x33, 0x4b, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, - 0x2b, 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0x3c, 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, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xea, - 0x32, 0xdd, 0xfc, 0xa2, 0x74, 0x18, 0x5b, 0xbf, 0xcc, 0x54, 0xbf, 0x02, 0xe2, 0x8b, 0x92, 0xca, - 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x0b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x43, 0x7c, - 0x1b, 0xae, 0xe2, 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 - if m.Limit != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x10 - } - if len(m.SecurityAddress) > 0 { - i -= len(m.SecurityAddress) - copy(dAtA[i:], m.SecurityAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.SecurityAddress))) - 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.SecurityAddress) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - if m.Limit != 0 { - n += 1 + sovParams(uint64(m.Limit)) - } - 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 SecurityAddress", 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.SecurityAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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/cron/types/query.pb.go b/x/cron/types/query.pb.go deleted file mode 100644 index 4d8b3eedb..000000000 --- a/x/cron/types/query.pb.go +++ /dev/null @@ -1,1391 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/query.proto - -package types - -import ( - context "context" - fmt "fmt" - query "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 - -// The 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_e02f33367c9498fe, []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 - -// The 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_e02f33367c9498fe, []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{} -} - -// The request type for the Query/Schedule RPC method. -type QueryGetScheduleRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (m *QueryGetScheduleRequest) Reset() { *m = QueryGetScheduleRequest{} } -func (m *QueryGetScheduleRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetScheduleRequest) ProtoMessage() {} -func (*QueryGetScheduleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e02f33367c9498fe, []int{2} -} -func (m *QueryGetScheduleRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetScheduleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetScheduleRequest.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 *QueryGetScheduleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetScheduleRequest.Merge(m, src) -} -func (m *QueryGetScheduleRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetScheduleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetScheduleRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetScheduleRequest proto.InternalMessageInfo - -func (m *QueryGetScheduleRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// The response type for the Query/Params RPC method. -type QueryGetScheduleResponse struct { - Schedule Schedule `protobuf:"bytes,1,opt,name=schedule,proto3" json:"schedule"` -} - -func (m *QueryGetScheduleResponse) Reset() { *m = QueryGetScheduleResponse{} } -func (m *QueryGetScheduleResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetScheduleResponse) ProtoMessage() {} -func (*QueryGetScheduleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e02f33367c9498fe, []int{3} -} -func (m *QueryGetScheduleResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetScheduleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetScheduleResponse.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 *QueryGetScheduleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetScheduleResponse.Merge(m, src) -} -func (m *QueryGetScheduleResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetScheduleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetScheduleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetScheduleResponse proto.InternalMessageInfo - -func (m *QueryGetScheduleResponse) GetSchedule() Schedule { - if m != nil { - return m.Schedule - } - return Schedule{} -} - -// The request type for the Query/Schedules RPC method. -type QuerySchedulesRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QuerySchedulesRequest) Reset() { *m = QuerySchedulesRequest{} } -func (m *QuerySchedulesRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySchedulesRequest) ProtoMessage() {} -func (*QuerySchedulesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e02f33367c9498fe, []int{4} -} -func (m *QuerySchedulesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySchedulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySchedulesRequest.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 *QuerySchedulesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchedulesRequest.Merge(m, src) -} -func (m *QuerySchedulesRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySchedulesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchedulesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySchedulesRequest proto.InternalMessageInfo - -func (m *QuerySchedulesRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// The response type for the Query/Params RPC method. -type QuerySchedulesResponse struct { - Schedules []Schedule `protobuf:"bytes,1,rep,name=schedules,proto3" json:"schedules"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QuerySchedulesResponse) Reset() { *m = QuerySchedulesResponse{} } -func (m *QuerySchedulesResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySchedulesResponse) ProtoMessage() {} -func (*QuerySchedulesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e02f33367c9498fe, []int{5} -} -func (m *QuerySchedulesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySchedulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySchedulesResponse.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 *QuerySchedulesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchedulesResponse.Merge(m, src) -} -func (m *QuerySchedulesResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySchedulesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchedulesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySchedulesResponse proto.InternalMessageInfo - -func (m *QuerySchedulesResponse) GetSchedules() []Schedule { - if m != nil { - return m.Schedules - } - return nil -} - -func (m *QuerySchedulesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "neutron.cron.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "neutron.cron.QueryParamsResponse") - proto.RegisterType((*QueryGetScheduleRequest)(nil), "neutron.cron.QueryGetScheduleRequest") - proto.RegisterType((*QueryGetScheduleResponse)(nil), "neutron.cron.QueryGetScheduleResponse") - proto.RegisterType((*QuerySchedulesRequest)(nil), "neutron.cron.QuerySchedulesRequest") - proto.RegisterType((*QuerySchedulesResponse)(nil), "neutron.cron.QuerySchedulesResponse") -} - -func init() { proto.RegisterFile("neutron/cron/query.proto", fileDescriptor_e02f33367c9498fe) } - -var fileDescriptor_e02f33367c9498fe = []byte{ - // 496 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0xb3, 0xb1, 0x86, 0xe6, 0xe9, 0xe9, 0x19, 0x63, 0x5c, 0xeb, 0xb6, 0xae, 0xb6, 0x8a, - 0xd0, 0x19, 0x1a, 0x11, 0xc4, 0x63, 0x0f, 0x56, 0x6f, 0x35, 0x7a, 0xf2, 0x22, 0x93, 0x38, 0x6c, - 0x83, 0xcd, 0xcc, 0x76, 0x67, 0x36, 0x58, 0x44, 0x10, 0xff, 0x02, 0xc1, 0xb3, 0xff, 0x4f, 0x8f, - 0x05, 0x2f, 0x9e, 0x44, 0x12, 0xef, 0xfe, 0x0b, 0x65, 0xe7, 0x47, 0x9a, 0x6d, 0x96, 0xe6, 0x12, - 0x86, 0x7d, 0xdf, 0xf7, 0xfd, 0x7e, 0x66, 0xde, 0x0b, 0x74, 0x04, 0xcf, 0x75, 0x26, 0x05, 0x1d, - 0x14, 0x3f, 0x47, 0x39, 0xcf, 0x8e, 0x49, 0x9a, 0x49, 0x2d, 0xf1, 0xba, 0xab, 0x90, 0xa2, 0x12, - 0x3e, 0x1e, 0x48, 0x35, 0x92, 0x8a, 0xf6, 0x99, 0xe2, 0x56, 0x46, 0xc7, 0x3b, 0x7d, 0xae, 0xd9, - 0x0e, 0x4d, 0x59, 0x32, 0x14, 0x4c, 0x0f, 0xa5, 0xb0, 0x9d, 0x61, 0x2b, 0x91, 0x89, 0x34, 0x47, - 0x5a, 0x9c, 0xdc, 0xd7, 0xb5, 0x44, 0xca, 0xe4, 0x90, 0x53, 0x96, 0x0e, 0x29, 0x13, 0x42, 0x6a, - 0xd3, 0xa2, 0x5c, 0xf5, 0x76, 0x89, 0x23, 0x65, 0x19, 0x1b, 0xf9, 0xd2, 0x9d, 0x52, 0x49, 0x0d, - 0x0e, 0xf8, 0x87, 0xfc, 0x90, 0xdb, 0x62, 0xdc, 0x02, 0x7c, 0x5d, 0xd0, 0xec, 0x9b, 0x8e, 0x1e, - 0x3f, 0xca, 0xb9, 0xd2, 0xf1, 0x2b, 0xb8, 0x51, 0xfa, 0xaa, 0x52, 0x29, 0x14, 0xc7, 0x2e, 0x34, - 0xac, 0x73, 0x27, 0xd8, 0x08, 0x1e, 0x5d, 0xeb, 0xb6, 0xc8, 0xfc, 0x1d, 0x89, 0x55, 0xef, 0xae, - 0x9c, 0xfc, 0x59, 0xaf, 0xf5, 0x9c, 0x32, 0xde, 0x86, 0x5b, 0xc6, 0x6a, 0x8f, 0xeb, 0x37, 0x2e, - 0xda, 0xa5, 0x20, 0xc2, 0x8a, 0x60, 0x23, 0x6e, 0xcc, 0x9a, 0x3d, 0x73, 0x8e, 0xdf, 0x42, 0x67, - 0x51, 0xee, 0xe2, 0x9f, 0xc1, 0xaa, 0xa7, 0x77, 0x00, 0xed, 0x32, 0x80, 0xef, 0x70, 0x08, 0x33, - 0x75, 0xfc, 0x1e, 0x6e, 0x1a, 0x57, 0x2f, 0xf0, 0x17, 0xc5, 0x17, 0x00, 0xe7, 0xcf, 0xef, 0x4c, - 0xb7, 0x88, 0x9d, 0x15, 0x29, 0x66, 0x45, 0xec, 0x48, 0xdd, 0xac, 0xc8, 0x3e, 0x4b, 0x3c, 0x7e, - 0x6f, 0xae, 0x33, 0xfe, 0x19, 0x40, 0xfb, 0x62, 0x82, 0xa3, 0x7e, 0x0e, 0x4d, 0xcf, 0x51, 0xbc, - 0xdb, 0x95, 0xa5, 0xd8, 0xe7, 0x72, 0xdc, 0x2b, 0xe1, 0xd5, 0x0d, 0xde, 0xc3, 0xa5, 0x78, 0x36, - 0x78, 0x9e, 0xaf, 0xfb, 0xbf, 0x0e, 0x57, 0x0d, 0x1f, 0x7e, 0x84, 0x86, 0x9d, 0x13, 0x6e, 0x94, - 0x29, 0x16, 0xd7, 0x20, 0xbc, 0x77, 0x89, 0xc2, 0x86, 0xc4, 0x6b, 0xdf, 0x7e, 0xfd, 0xfb, 0x51, - 0x6f, 0x63, 0x8b, 0x56, 0x2c, 0x20, 0x7e, 0x0d, 0x60, 0xd5, 0xdf, 0x0e, 0x37, 0x2b, 0xdc, 0x16, - 0xb7, 0x22, 0xdc, 0x5a, 0x26, 0x73, 0xc9, 0x9b, 0x26, 0x79, 0x1d, 0xef, 0xd2, 0xca, 0xfd, 0xa6, - 0x9f, 0x8b, 0x7d, 0xfa, 0x82, 0x63, 0x68, 0xce, 0x66, 0x82, 0xf7, 0x2b, 0xbc, 0x2f, 0xee, 0x44, - 0xf8, 0xe0, 0x72, 0x91, 0x8b, 0x8f, 0x4c, 0x7c, 0x07, 0xdb, 0xd5, 0xf1, 0xbb, 0x2f, 0x4f, 0x26, - 0x51, 0x70, 0x3a, 0x89, 0x82, 0xbf, 0x93, 0x28, 0xf8, 0x3e, 0x8d, 0x6a, 0xa7, 0xd3, 0xa8, 0xf6, - 0x7b, 0x1a, 0xd5, 0xde, 0x91, 0x64, 0xa8, 0x0f, 0xf2, 0x3e, 0x19, 0xc8, 0x91, 0xef, 0xdd, 0x96, - 0x59, 0x32, 0xf3, 0x19, 0x3f, 0xa5, 0x9f, 0xac, 0x99, 0x3e, 0x4e, 0xb9, 0xea, 0x37, 0xcc, 0x3f, - 0xf5, 0xc9, 0x59, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0x47, 0xef, 0x62, 0x6b, 0x04, 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 { - // Queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a Schedule by name. - Schedule(ctx context.Context, in *QueryGetScheduleRequest, opts ...grpc.CallOption) (*QueryGetScheduleResponse, error) - // Queries a list of Schedule items. - Schedules(ctx context.Context, in *QuerySchedulesRequest, opts ...grpc.CallOption) (*QuerySchedulesResponse, 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, "/neutron.cron.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Schedule(ctx context.Context, in *QueryGetScheduleRequest, opts ...grpc.CallOption) (*QueryGetScheduleResponse, error) { - out := new(QueryGetScheduleResponse) - err := c.cc.Invoke(ctx, "/neutron.cron.Query/Schedule", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Schedules(ctx context.Context, in *QuerySchedulesRequest, opts ...grpc.CallOption) (*QuerySchedulesResponse, error) { - out := new(QuerySchedulesResponse) - err := c.cc.Invoke(ctx, "/neutron.cron.Query/Schedules", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a Schedule by name. - Schedule(context.Context, *QueryGetScheduleRequest) (*QueryGetScheduleResponse, error) - // Queries a list of Schedule items. - Schedules(context.Context, *QuerySchedulesRequest) (*QuerySchedulesResponse, 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 (*UnimplementedQueryServer) Schedule(ctx context.Context, req *QueryGetScheduleRequest) (*QueryGetScheduleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Schedule not implemented") -} -func (*UnimplementedQueryServer) Schedules(ctx context.Context, req *QuerySchedulesRequest) (*QuerySchedulesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Schedules 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: "/neutron.cron.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Schedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetScheduleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Schedule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neutron.cron.Query/Schedule", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Schedule(ctx, req.(*QueryGetScheduleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Schedules_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySchedulesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Schedules(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neutron.cron.Query/Schedules", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Schedules(ctx, req.(*QuerySchedulesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "neutron.cron.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Schedule", - Handler: _Query_Schedule_Handler, - }, - { - MethodName: "Schedules", - Handler: _Query_Schedules_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "neutron/cron/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 (m *QueryGetScheduleRequest) 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 *QueryGetScheduleRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetScheduleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetScheduleResponse) 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 *QueryGetScheduleResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetScheduleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Schedule.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 (m *QuerySchedulesRequest) 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 *QuerySchedulesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySchedulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 (m *QuerySchedulesResponse) 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 *QuerySchedulesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySchedulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Schedules) > 0 { - for iNdEx := len(m.Schedules) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Schedules[iNdEx].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 (m *QueryGetScheduleRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetScheduleResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Schedule.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QuerySchedulesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QuerySchedulesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Schedules) > 0 { - for _, e := range m.Schedules { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.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 (m *QueryGetScheduleRequest) 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: QueryGetScheduleRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetScheduleRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryGetScheduleResponse) 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: QueryGetScheduleResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetScheduleResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schedule", 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.Schedule.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 (m *QuerySchedulesRequest) 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: QuerySchedulesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchedulesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.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 (m *QuerySchedulesResponse) 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: QuerySchedulesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchedulesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schedules", 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 - } - m.Schedules = append(m.Schedules, Schedule{}) - if err := m.Schedules[len(m.Schedules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.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/cron/types/query.pb.gw.go b/x/cron/types/query.pb.gw.go deleted file mode 100644 index a3ce24432..000000000 --- a/x/cron/types/query.pb.gw.go +++ /dev/null @@ -1,337 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: neutron/cron/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 - -} - -func request_Query_Schedule_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetScheduleRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := client.Schedule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Schedule_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetScheduleRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := server.Schedule(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_Schedules_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_Schedules_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchedulesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Schedules_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Schedules(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Schedules_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchedulesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Schedules_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Schedules(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()...) - - }) - - mux.Handle("GET", pattern_Query_Schedule_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_Schedule_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_Schedule_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Schedules_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_Schedules_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_Schedules_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()...) - - }) - - mux.Handle("GET", pattern_Query_Schedule_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_Schedule_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_Schedule_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Schedules_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_Schedules_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_Schedules_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{"neutron", "cron", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Schedule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"neutron", "cron", "schedule", "name"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Schedules_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"neutron", "cron", "schedule"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Schedule_0 = runtime.ForwardResponseMessage - - forward_Query_Schedules_0 = runtime.ForwardResponseMessage -) diff --git a/x/cron/types/schedule.pb.go b/x/cron/types/schedule.pb.go deleted file mode 100644 index 42fb227f7..000000000 --- a/x/cron/types/schedule.pb.go +++ /dev/null @@ -1,912 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/schedule.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 - -// Defines when messages will be executed in the block -type ExecutionStage int32 - -const ( - // Execution at the end of the block - ExecutionStage_EXECUTION_STAGE_END_BLOCKER ExecutionStage = 0 - // Execution at the beginning of the block - ExecutionStage_EXECUTION_STAGE_BEGIN_BLOCKER ExecutionStage = 1 -) - -var ExecutionStage_name = map[int32]string{ - 0: "EXECUTION_STAGE_END_BLOCKER", - 1: "EXECUTION_STAGE_BEGIN_BLOCKER", -} - -var ExecutionStage_value = map[string]int32{ - "EXECUTION_STAGE_END_BLOCKER": 0, - "EXECUTION_STAGE_BEGIN_BLOCKER": 1, -} - -func (x ExecutionStage) String() string { - return proto.EnumName(ExecutionStage_name, int32(x)) -} - -func (ExecutionStage) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_49ace1b59de613ef, []int{0} -} - -// Defines the schedule for execution -type Schedule struct { - // Name of schedule - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Period in blocks - Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` - // Msgs that will be executed every certain number of blocks, specified in the `period` field - Msgs []MsgExecuteContract `protobuf:"bytes,3,rep,name=msgs,proto3" json:"msgs"` - // Last execution's block height - LastExecuteHeight uint64 `protobuf:"varint,4,opt,name=last_execute_height,json=lastExecuteHeight,proto3" json:"last_execute_height,omitempty"` - // Stage when messages will be executed - ExecutionStage ExecutionStage `protobuf:"varint,5,opt,name=execution_stage,json=executionStage,proto3,enum=neutron.cron.ExecutionStage" json:"execution_stage,omitempty"` -} - -func (m *Schedule) Reset() { *m = Schedule{} } -func (m *Schedule) String() string { return proto.CompactTextString(m) } -func (*Schedule) ProtoMessage() {} -func (*Schedule) Descriptor() ([]byte, []int) { - return fileDescriptor_49ace1b59de613ef, []int{0} -} -func (m *Schedule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Schedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Schedule.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 *Schedule) XXX_Merge(src proto.Message) { - xxx_messageInfo_Schedule.Merge(m, src) -} -func (m *Schedule) XXX_Size() int { - return m.Size() -} -func (m *Schedule) XXX_DiscardUnknown() { - xxx_messageInfo_Schedule.DiscardUnknown(m) -} - -var xxx_messageInfo_Schedule proto.InternalMessageInfo - -func (m *Schedule) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Schedule) GetPeriod() uint64 { - if m != nil { - return m.Period - } - return 0 -} - -func (m *Schedule) GetMsgs() []MsgExecuteContract { - if m != nil { - return m.Msgs - } - return nil -} - -func (m *Schedule) GetLastExecuteHeight() uint64 { - if m != nil { - return m.LastExecuteHeight - } - return 0 -} - -func (m *Schedule) GetExecutionStage() ExecutionStage { - if m != nil { - return m.ExecutionStage - } - return ExecutionStage_EXECUTION_STAGE_END_BLOCKER -} - -// Defines the contract and the message to pass -type MsgExecuteContract struct { - // The address of the smart contract - Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` - // JSON encoded message to be passed to the contract - Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` -} - -func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } -func (m *MsgExecuteContract) String() string { return proto.CompactTextString(m) } -func (*MsgExecuteContract) ProtoMessage() {} -func (*MsgExecuteContract) Descriptor() ([]byte, []int) { - return fileDescriptor_49ace1b59de613ef, []int{1} -} -func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExecuteContract.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 *MsgExecuteContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExecuteContract.Merge(m, src) -} -func (m *MsgExecuteContract) XXX_Size() int { - return m.Size() -} -func (m *MsgExecuteContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo - -func (m *MsgExecuteContract) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -func (m *MsgExecuteContract) GetMsg() string { - if m != nil { - return m.Msg - } - return "" -} - -// Defines the number of current schedules -type ScheduleCount struct { - // The number of current schedules - Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` -} - -func (m *ScheduleCount) Reset() { *m = ScheduleCount{} } -func (m *ScheduleCount) String() string { return proto.CompactTextString(m) } -func (*ScheduleCount) ProtoMessage() {} -func (*ScheduleCount) Descriptor() ([]byte, []int) { - return fileDescriptor_49ace1b59de613ef, []int{2} -} -func (m *ScheduleCount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ScheduleCount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ScheduleCount.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 *ScheduleCount) XXX_Merge(src proto.Message) { - xxx_messageInfo_ScheduleCount.Merge(m, src) -} -func (m *ScheduleCount) XXX_Size() int { - return m.Size() -} -func (m *ScheduleCount) XXX_DiscardUnknown() { - xxx_messageInfo_ScheduleCount.DiscardUnknown(m) -} - -var xxx_messageInfo_ScheduleCount proto.InternalMessageInfo - -func (m *ScheduleCount) GetCount() int32 { - if m != nil { - return m.Count - } - return 0 -} - -func init() { - proto.RegisterEnum("neutron.cron.ExecutionStage", ExecutionStage_name, ExecutionStage_value) - proto.RegisterType((*Schedule)(nil), "neutron.cron.Schedule") - proto.RegisterType((*MsgExecuteContract)(nil), "neutron.cron.MsgExecuteContract") - proto.RegisterType((*ScheduleCount)(nil), "neutron.cron.ScheduleCount") -} - -func init() { proto.RegisterFile("neutron/cron/schedule.proto", fileDescriptor_49ace1b59de613ef) } - -var fileDescriptor_49ace1b59de613ef = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xc1, 0xaa, 0xd3, 0x40, - 0x18, 0x85, 0x33, 0x36, 0x2d, 0xed, 0xa8, 0xb5, 0x8e, 0x45, 0x42, 0xab, 0x69, 0x2c, 0x08, 0x41, - 0x30, 0x81, 0x8a, 0x1b, 0x77, 0x26, 0x0e, 0x6d, 0x51, 0x5b, 0x48, 0x2b, 0x88, 0x9b, 0x90, 0xa6, - 0xc3, 0x24, 0xd0, 0x64, 0x4a, 0x66, 0x22, 0xf5, 0x2d, 0x7c, 0xac, 0x2e, 0xbb, 0x74, 0x25, 0xd2, - 0xae, 0x7c, 0x8b, 0x4b, 0x26, 0x69, 0xb9, 0xbd, 0x77, 0x13, 0xce, 0xe1, 0x7c, 0x87, 0x7f, 0xe6, - 0xcf, 0xc0, 0x7e, 0x4a, 0x72, 0x91, 0xb1, 0xd4, 0x0e, 0x8b, 0x0f, 0x0f, 0x23, 0xb2, 0xce, 0x37, - 0xc4, 0xda, 0x66, 0x4c, 0x30, 0xf4, 0xa8, 0x0a, 0xad, 0x22, 0xec, 0x75, 0x29, 0xa3, 0x4c, 0x06, - 0x76, 0xa1, 0x4a, 0x66, 0xf8, 0x1f, 0xc0, 0xe6, 0xa2, 0xaa, 0x21, 0x04, 0xd5, 0x34, 0x48, 0x88, - 0x06, 0x0c, 0x60, 0xb6, 0x3c, 0xa9, 0xd1, 0x73, 0xd8, 0xd8, 0x92, 0x2c, 0x66, 0x6b, 0xed, 0x81, - 0x01, 0x4c, 0xd5, 0xab, 0x1c, 0xfa, 0x00, 0xd5, 0x84, 0x53, 0xae, 0xd5, 0x8c, 0x9a, 0xf9, 0x70, - 0x64, 0x58, 0xb7, 0x67, 0x59, 0x5f, 0x39, 0xc5, 0x3b, 0x12, 0xe6, 0x82, 0xb8, 0x2c, 0x15, 0x59, - 0x10, 0x0a, 0x47, 0xdd, 0xff, 0x1d, 0x28, 0x9e, 0xec, 0x20, 0x0b, 0x3e, 0xdb, 0x04, 0x5c, 0xf8, - 0xa4, 0x64, 0xfc, 0x88, 0xc4, 0x34, 0x12, 0x9a, 0x2a, 0x07, 0x3c, 0x2d, 0xa2, 0xaa, 0x3d, 0x91, - 0x01, 0xc2, 0xf0, 0x49, 0x89, 0xc6, 0x2c, 0xf5, 0xb9, 0x08, 0x28, 0xd1, 0xea, 0x06, 0x30, 0xdb, - 0xa3, 0x17, 0xd7, 0x63, 0xf1, 0x19, 0x5a, 0x14, 0x8c, 0xd7, 0x26, 0x57, 0x7e, 0xe8, 0x40, 0x74, - 0xff, 0x60, 0xa8, 0x07, 0x9b, 0x61, 0xa5, 0xab, 0x8b, 0x5f, 0x3c, 0xea, 0xc0, 0x5a, 0xc2, 0xa9, - 0xbc, 0x79, 0xcb, 0x2b, 0xe4, 0xf0, 0x35, 0x7c, 0x7c, 0x5e, 0x97, 0xcb, 0xf2, 0x54, 0xa0, 0x2e, - 0xac, 0x87, 0x85, 0x90, 0xdd, 0xba, 0x57, 0x9a, 0x37, 0x4b, 0xd8, 0xbe, 0x3e, 0x0c, 0x1a, 0xc0, - 0x3e, 0xfe, 0x8e, 0xdd, 0x6f, 0xcb, 0xe9, 0x7c, 0xe6, 0x2f, 0x96, 0x1f, 0xc7, 0xd8, 0xc7, 0xb3, - 0x4f, 0xbe, 0xf3, 0x65, 0xee, 0x7e, 0xc6, 0x5e, 0x47, 0x41, 0xaf, 0xe0, 0xcb, 0xbb, 0x80, 0x83, - 0xc7, 0xd3, 0xd9, 0x05, 0x01, 0xce, 0x64, 0x7f, 0xd4, 0xc1, 0xe1, 0xa8, 0x83, 0x7f, 0x47, 0x1d, - 0xfc, 0x3e, 0xe9, 0xca, 0xe1, 0xa4, 0x2b, 0x7f, 0x4e, 0xba, 0xf2, 0xc3, 0xa2, 0xb1, 0x88, 0xf2, - 0x95, 0x15, 0xb2, 0xc4, 0xae, 0x56, 0xf2, 0x96, 0x65, 0xf4, 0xac, 0xed, 0x9f, 0xef, 0xed, 0x5d, - 0xf9, 0x46, 0xc4, 0xaf, 0x2d, 0xe1, 0xab, 0x86, 0xfc, 0xfb, 0xef, 0x6e, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xee, 0xcd, 0x08, 0xb7, 0x40, 0x02, 0x00, 0x00, -} - -func (m *Schedule) 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 *Schedule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Schedule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExecutionStage != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.ExecutionStage)) - i-- - dAtA[i] = 0x28 - } - if m.LastExecuteHeight != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.LastExecuteHeight)) - i-- - dAtA[i] = 0x20 - } - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSchedule(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Period != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.Period)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgExecuteContract) 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 *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msg) > 0 { - i -= len(m.Msg) - copy(dAtA[i:], m.Msg) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Msg))) - i-- - dAtA[i] = 0x12 - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ScheduleCount) 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 *ScheduleCount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ScheduleCount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Count != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintSchedule(dAtA []byte, offset int, v uint64) int { - offset -= sovSchedule(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Schedule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - if m.Period != 0 { - n += 1 + sovSchedule(uint64(m.Period)) - } - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovSchedule(uint64(l)) - } - } - if m.LastExecuteHeight != 0 { - n += 1 + sovSchedule(uint64(m.LastExecuteHeight)) - } - if m.ExecutionStage != 0 { - n += 1 + sovSchedule(uint64(m.ExecutionStage)) - } - return n -} - -func (m *MsgExecuteContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - return n -} - -func (m *ScheduleCount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Count != 0 { - n += 1 + sovSchedule(uint64(m.Count)) - } - return n -} - -func sovSchedule(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSchedule(x uint64) (n int) { - return sovSchedule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Schedule) 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 ErrIntOverflowSchedule - } - 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: Schedule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schedule: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) - } - m.Period = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Period |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msgs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSchedule - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msgs = append(m.Msgs, MsgExecuteContract{}) - if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastExecuteHeight", wireType) - } - m.LastExecuteHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastExecuteHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecutionStage", wireType) - } - m.ExecutionStage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExecutionStage |= ExecutionStage(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExecuteContract) 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 ErrIntOverflowSchedule - } - 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: MsgExecuteContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScheduleCount) 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 ErrIntOverflowSchedule - } - 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: ScheduleCount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScheduleCount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSchedule(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, ErrIntOverflowSchedule - } - 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, ErrIntOverflowSchedule - } - 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, ErrIntOverflowSchedule - } - 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, ErrInvalidLengthSchedule - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSchedule - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSchedule - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSchedule = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSchedule = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSchedule = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/cron/types/tx.go b/x/cron/types/tx.go deleted file mode 100644 index 27b4ceec4..000000000 --- a/x/cron/types/tx.go +++ /dev/null @@ -1,125 +0,0 @@ -package types - -import ( - "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var _ sdk.Msg = &MsgAddSchedule{} - -func (msg *MsgAddSchedule) Route() string { - return RouterKey -} - -func (msg *MsgAddSchedule) Type() string { - return "add-schedule" -} - -func (msg *MsgAddSchedule) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgAddSchedule) GetSignBytes() []byte { - return ModuleCdc.MustMarshalJSON(msg) -} - -func (msg *MsgAddSchedule) Validate() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errors.Wrap(err, "authority is invalid") - } - - if msg.Name == "" { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "name is invalid") - } - - if msg.Period == 0 { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "period is invalid") - } - - if len(msg.Msgs) == 0 { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "msgs should not be empty") - } - - if _, ok := ExecutionStage_name[int32(msg.ExecutionStage)]; !ok { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "execution stage is invalid") - } - - return nil -} - -//---------------------------------------------------------------- - -var _ sdk.Msg = &MsgRemoveSchedule{} - -func (msg *MsgRemoveSchedule) Route() string { - return RouterKey -} - -func (msg *MsgRemoveSchedule) Type() string { - return "remove-schedule" -} - -func (msg *MsgRemoveSchedule) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgRemoveSchedule) GetSignBytes() []byte { - return ModuleCdc.MustMarshalJSON(msg) -} - -func (msg *MsgRemoveSchedule) Validate() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errors.Wrap(err, "authority is invalid") - } - - if msg.Name == "" { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "name is invalid") - } - - return nil -} - -//---------------------------------------------------------------- - -var _ sdk.Msg = &MsgUpdateParams{} - -func (msg *MsgUpdateParams) Route() string { - return RouterKey -} - -func (msg *MsgUpdateParams) Type() string { - return "update-params" -} - -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgUpdateParams) GetSignBytes() []byte { - return ModuleCdc.MustMarshalJSON(msg) -} - -func (msg *MsgUpdateParams) Validate() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errors.Wrap(err, "authority is invalid") - } - - if _, err := sdk.AccAddressFromBech32(msg.Params.SecurityAddress); err != nil { - return errors.Wrap(err, "security_address is invalid") - } - - return nil -} diff --git a/x/cron/types/tx.pb.go b/x/cron/types/tx.pb.go deleted file mode 100644 index c5ffb7299..000000000 --- a/x/cron/types/tx.pb.go +++ /dev/null @@ -1,1511 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/tx.proto - -package types - -import ( - context "context" - 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" - 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 - -// The MsgAddSchedule request type. -type MsgAddSchedule struct { - // The address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // Name of the schedule - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Period in blocks - Period uint64 `protobuf:"varint,3,opt,name=period,proto3" json:"period,omitempty"` - // Msgs that will be executed every certain number of blocks, specified in the `period` field - Msgs []MsgExecuteContract `protobuf:"bytes,4,rep,name=msgs,proto3" json:"msgs"` - // Stage when messages will be executed - ExecutionStage ExecutionStage `protobuf:"varint,5,opt,name=execution_stage,json=executionStage,proto3,enum=neutron.cron.ExecutionStage" json:"execution_stage,omitempty"` -} - -func (m *MsgAddSchedule) Reset() { *m = MsgAddSchedule{} } -func (m *MsgAddSchedule) String() string { return proto.CompactTextString(m) } -func (*MsgAddSchedule) ProtoMessage() {} -func (*MsgAddSchedule) Descriptor() ([]byte, []int) { - return fileDescriptor_c9e0a673aba8d6fd, []int{0} -} -func (m *MsgAddSchedule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddSchedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddSchedule.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 *MsgAddSchedule) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddSchedule.Merge(m, src) -} -func (m *MsgAddSchedule) XXX_Size() int { - return m.Size() -} -func (m *MsgAddSchedule) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddSchedule.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddSchedule proto.InternalMessageInfo - -func (m *MsgAddSchedule) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgAddSchedule) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *MsgAddSchedule) GetPeriod() uint64 { - if m != nil { - return m.Period - } - return 0 -} - -func (m *MsgAddSchedule) GetMsgs() []MsgExecuteContract { - if m != nil { - return m.Msgs - } - return nil -} - -func (m *MsgAddSchedule) GetExecutionStage() ExecutionStage { - if m != nil { - return m.ExecutionStage - } - return ExecutionStage_EXECUTION_STAGE_END_BLOCKER -} - -// Defines the response structure for executing a MsgAddSchedule message. -type MsgAddScheduleResponse struct { -} - -func (m *MsgAddScheduleResponse) Reset() { *m = MsgAddScheduleResponse{} } -func (m *MsgAddScheduleResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddScheduleResponse) ProtoMessage() {} -func (*MsgAddScheduleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c9e0a673aba8d6fd, []int{1} -} -func (m *MsgAddScheduleResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddScheduleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddScheduleResponse.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 *MsgAddScheduleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddScheduleResponse.Merge(m, src) -} -func (m *MsgAddScheduleResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddScheduleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddScheduleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddScheduleResponse proto.InternalMessageInfo - -// The MsgRemoveSchedule request type. -type MsgRemoveSchedule struct { - // The address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // Name of the schedule - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (m *MsgRemoveSchedule) Reset() { *m = MsgRemoveSchedule{} } -func (m *MsgRemoveSchedule) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveSchedule) ProtoMessage() {} -func (*MsgRemoveSchedule) Descriptor() ([]byte, []int) { - return fileDescriptor_c9e0a673aba8d6fd, []int{2} -} -func (m *MsgRemoveSchedule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveSchedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveSchedule.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 *MsgRemoveSchedule) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveSchedule.Merge(m, src) -} -func (m *MsgRemoveSchedule) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveSchedule) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveSchedule.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveSchedule proto.InternalMessageInfo - -func (m *MsgRemoveSchedule) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgRemoveSchedule) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Defines the response structure for executing a MsgRemoveSchedule message. -type MsgRemoveScheduleResponse struct { -} - -func (m *MsgRemoveScheduleResponse) Reset() { *m = MsgRemoveScheduleResponse{} } -func (m *MsgRemoveScheduleResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveScheduleResponse) ProtoMessage() {} -func (*MsgRemoveScheduleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c9e0a673aba8d6fd, []int{3} -} -func (m *MsgRemoveScheduleResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveScheduleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveScheduleResponse.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 *MsgRemoveScheduleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveScheduleResponse.Merge(m, src) -} -func (m *MsgRemoveScheduleResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveScheduleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveScheduleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveScheduleResponse proto.InternalMessageInfo - -// The MsgUpdateParams request type. -// -// Since: 0.47 -type MsgUpdateParams struct { - // The address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // Defines the x/cron parameters to update. - // - // NOTE: All parameters must be supplied. - Params 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_c9e0a673aba8d6fd, []int{4} -} -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() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// Defines the response structure for executing a MsgUpdateParams message. -// -// Since: 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_c9e0a673aba8d6fd, []int{5} -} -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((*MsgAddSchedule)(nil), "neutron.cron.MsgAddSchedule") - proto.RegisterType((*MsgAddScheduleResponse)(nil), "neutron.cron.MsgAddScheduleResponse") - proto.RegisterType((*MsgRemoveSchedule)(nil), "neutron.cron.MsgRemoveSchedule") - proto.RegisterType((*MsgRemoveScheduleResponse)(nil), "neutron.cron.MsgRemoveScheduleResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "neutron.cron.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.cron.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("neutron/cron/tx.proto", fileDescriptor_c9e0a673aba8d6fd) } - -var fileDescriptor_c9e0a673aba8d6fd = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xbf, 0x6b, 0xdb, 0x40, - 0x14, 0xf6, 0xd9, 0x8e, 0xc1, 0xe7, 0xe0, 0x10, 0xd5, 0x75, 0x64, 0x25, 0x55, 0x8c, 0x68, 0x1b, - 0xd7, 0x10, 0x89, 0xba, 0xb4, 0x05, 0x6f, 0x71, 0x31, 0x74, 0x11, 0xb4, 0x72, 0xbb, 0x64, 0x09, - 0x8a, 0x74, 0x9c, 0x05, 0x95, 0x4e, 0xe8, 0x4e, 0xc6, 0xd9, 0x4a, 0xc7, 0x4c, 0xed, 0x5f, 0xd0, - 0xb5, 0xd0, 0xc5, 0x43, 0xff, 0x88, 0x8c, 0xa1, 0x53, 0xa7, 0x52, 0xec, 0xc1, 0xff, 0x46, 0xd1, - 0xaf, 0x44, 0x17, 0x41, 0x0a, 0x85, 0x2c, 0xa7, 0x7b, 0xef, 0xfb, 0xde, 0xd3, 0x77, 0xdf, 0x3d, - 0x0e, 0xde, 0xf7, 0x50, 0xc8, 0x02, 0xe2, 0x69, 0x56, 0xb4, 0xb0, 0xb9, 0xea, 0x07, 0x84, 0x11, - 0x61, 0x33, 0x4d, 0xab, 0x51, 0x5a, 0xda, 0x36, 0x5d, 0xc7, 0x23, 0x5a, 0xbc, 0x26, 0x04, 0x69, - 0xc7, 0x22, 0xd4, 0x25, 0x54, 0x73, 0x29, 0xd6, 0x66, 0x4f, 0xa3, 0x4f, 0x0a, 0x74, 0x12, 0xe0, - 0x24, 0x8e, 0xb4, 0x24, 0x48, 0xa1, 0x16, 0x26, 0x98, 0x24, 0xf9, 0x68, 0x97, 0x15, 0x70, 0x0a, - 0x7c, 0x33, 0x30, 0xdd, 0xac, 0x60, 0x97, 0x83, 0xa8, 0x35, 0x45, 0x76, 0xf8, 0x01, 0x25, 0xa0, - 0xf2, 0xb5, 0x0c, 0x9b, 0x3a, 0xc5, 0x47, 0xb6, 0x3d, 0x49, 0x01, 0xe1, 0x05, 0xac, 0x9b, 0x21, - 0x9b, 0x92, 0xc0, 0x61, 0x67, 0x22, 0xe8, 0x82, 0x5e, 0x7d, 0x24, 0xfe, 0xfc, 0x71, 0xd8, 0x4a, - 0x55, 0x1c, 0xd9, 0x76, 0x80, 0x28, 0x9d, 0xb0, 0xc0, 0xf1, 0xb0, 0x71, 0x4d, 0x15, 0x04, 0x58, - 0xf5, 0x4c, 0x17, 0x89, 0xe5, 0xa8, 0xc4, 0x88, 0xf7, 0x42, 0x1b, 0xd6, 0x7c, 0x14, 0x38, 0xc4, - 0x16, 0x2b, 0x5d, 0xd0, 0xab, 0x1a, 0x69, 0x24, 0x0c, 0x61, 0xd5, 0xa5, 0x98, 0x8a, 0xd5, 0x6e, - 0xa5, 0xd7, 0x18, 0x74, 0xd5, 0xbc, 0x51, 0xaa, 0x4e, 0xf1, 0x78, 0x8e, 0xac, 0x90, 0xa1, 0x57, - 0xc4, 0x63, 0x81, 0x69, 0xb1, 0x51, 0xf5, 0xe2, 0xf7, 0x7e, 0xc9, 0x88, 0x6b, 0x84, 0x31, 0xdc, - 0x42, 0x31, 0xec, 0x10, 0xef, 0x84, 0x32, 0x13, 0x23, 0x71, 0xa3, 0x0b, 0x7a, 0xcd, 0xc1, 0x1e, - 0xdf, 0x66, 0x9c, 0x91, 0x26, 0x11, 0xc7, 0x68, 0x22, 0x2e, 0x1e, 0x3e, 0xfe, 0xb4, 0x5e, 0xf4, - 0xaf, 0xe5, 0x9f, 0xaf, 0x17, 0xfd, 0x7b, 0xb1, 0x43, 0xbc, 0x1d, 0x8a, 0x08, 0xdb, 0x7c, 0xc6, - 0x40, 0xd4, 0x27, 0x1e, 0x45, 0xca, 0x39, 0x80, 0xdb, 0x3a, 0xc5, 0x06, 0x72, 0xc9, 0x0c, 0xdd, - 0x85, 0x7d, 0xc3, 0x27, 0x45, 0x8d, 0xed, 0x4c, 0x23, 0xff, 0x5b, 0x65, 0x17, 0x76, 0x0a, 0xc9, - 0x2b, 0xa5, 0xdf, 0x01, 0xdc, 0xd2, 0x29, 0x7e, 0xef, 0xdb, 0x26, 0x43, 0x6f, 0xe2, 0xe1, 0xf8, - 0x6f, 0x9d, 0x2f, 0x61, 0x2d, 0x19, 0xaf, 0x58, 0x69, 0x63, 0xd0, 0xe2, 0x5d, 0x4f, 0xba, 0x8f, - 0xea, 0xd1, 0x85, 0x7d, 0x5b, 0x2f, 0xfa, 0xc0, 0x48, 0xe9, 0xc3, 0x83, 0xe2, 0x61, 0x5a, 0xd9, - 0x61, 0xf2, 0xca, 0x94, 0x0e, 0xdc, 0xb9, 0x91, 0xca, 0x0e, 0x32, 0xf8, 0x52, 0x86, 0x15, 0x9d, - 0x62, 0xe1, 0x2d, 0x6c, 0xe4, 0x47, 0x76, 0xaf, 0x30, 0x40, 0x39, 0x54, 0x7a, 0x78, 0x1b, 0x9a, - 0xb5, 0x16, 0x8e, 0x61, 0xf3, 0xc6, 0x4d, 0xee, 0x17, 0xea, 0x78, 0x82, 0x74, 0xf0, 0x0f, 0xc2, - 0x55, 0xef, 0x77, 0x70, 0x93, 0xf3, 0xfe, 0x41, 0xa1, 0x30, 0x0f, 0x4b, 0x8f, 0x6e, 0x85, 0xb3, - 0xae, 0xd2, 0xc6, 0xc7, 0xc8, 0xdf, 0xd1, 0xeb, 0x8b, 0xa5, 0x0c, 0x2e, 0x97, 0x32, 0xf8, 0xb3, - 0x94, 0xc1, 0xe7, 0x95, 0x5c, 0xba, 0x5c, 0xc9, 0xa5, 0x5f, 0x2b, 0xb9, 0x74, 0xac, 0x62, 0x87, - 0x4d, 0xc3, 0x53, 0xd5, 0x22, 0xae, 0x96, 0x76, 0x3c, 0x24, 0x01, 0xce, 0xf6, 0xda, 0xec, 0xb9, - 0x36, 0x4f, 0x9f, 0xac, 0x33, 0x1f, 0xd1, 0xd3, 0x5a, 0xfc, 0x26, 0x3c, 0xfb, 0x1b, 0x00, 0x00, - 0xff, 0xff, 0x37, 0xae, 0x51, 0x3e, 0xcf, 0x04, 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 { - // Adds new schedule. - AddSchedule(ctx context.Context, in *MsgAddSchedule, opts ...grpc.CallOption) (*MsgAddScheduleResponse, error) - // Removes schedule. - RemoveSchedule(ctx context.Context, in *MsgRemoveSchedule, opts ...grpc.CallOption) (*MsgRemoveScheduleResponse, error) - // Updates the module parameters. - 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) AddSchedule(ctx context.Context, in *MsgAddSchedule, opts ...grpc.CallOption) (*MsgAddScheduleResponse, error) { - out := new(MsgAddScheduleResponse) - err := c.cc.Invoke(ctx, "/neutron.cron.Msg/AddSchedule", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveSchedule(ctx context.Context, in *MsgRemoveSchedule, opts ...grpc.CallOption) (*MsgRemoveScheduleResponse, error) { - out := new(MsgRemoveScheduleResponse) - err := c.cc.Invoke(ctx, "/neutron.cron.Msg/RemoveSchedule", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/neutron.cron.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 { - // Adds new schedule. - AddSchedule(context.Context, *MsgAddSchedule) (*MsgAddScheduleResponse, error) - // Removes schedule. - RemoveSchedule(context.Context, *MsgRemoveSchedule) (*MsgRemoveScheduleResponse, error) - // Updates the module parameters. - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) AddSchedule(ctx context.Context, req *MsgAddSchedule) (*MsgAddScheduleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddSchedule not implemented") -} -func (*UnimplementedMsgServer) RemoveSchedule(ctx context.Context, req *MsgRemoveSchedule) (*MsgRemoveScheduleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveSchedule not implemented") -} -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_AddSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddSchedule) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddSchedule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neutron.cron.Msg/AddSchedule", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddSchedule(ctx, req.(*MsgAddSchedule)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveSchedule) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveSchedule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neutron.cron.Msg/RemoveSchedule", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveSchedule(ctx, req.(*MsgRemoveSchedule)) - } - return interceptor(ctx, in, info, handler) -} - -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: "/neutron.cron.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: "neutron.cron.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddSchedule", - Handler: _Msg_AddSchedule_Handler, - }, - { - MethodName: "RemoveSchedule", - Handler: _Msg_RemoveSchedule_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "neutron/cron/tx.proto", -} - -func (m *MsgAddSchedule) 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 *MsgAddSchedule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddSchedule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExecutionStage != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ExecutionStage)) - i-- - dAtA[i] = 0x28 - } - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Period != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Period)) - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - 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 *MsgAddScheduleResponse) 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 *MsgAddScheduleResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddScheduleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgRemoveSchedule) 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 *MsgRemoveSchedule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveSchedule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - 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 *MsgRemoveScheduleResponse) 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 *MsgRemoveScheduleResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveScheduleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -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 *MsgAddSchedule) 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 = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Period != 0 { - n += 1 + sovTx(uint64(m.Period)) - } - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.ExecutionStage != 0 { - n += 1 + sovTx(uint64(m.ExecutionStage)) - } - return n -} - -func (m *MsgAddScheduleResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRemoveSchedule) 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 = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRemoveScheduleResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -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 *MsgAddSchedule) 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: MsgAddSchedule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddSchedule: 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 Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) - } - m.Period = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Period |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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 - } - m.Msgs = append(m.Msgs, MsgExecuteContract{}) - if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecutionStage", wireType) - } - m.ExecutionStage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExecutionStage |= ExecutionStage(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddScheduleResponse) 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: MsgAddScheduleResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddScheduleResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRemoveSchedule) 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: MsgRemoveSchedule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveSchedule: 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 Name", 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.Name = string(dAtA[iNdEx:postIndex]) - 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 *MsgRemoveScheduleResponse) 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: MsgRemoveScheduleResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveScheduleResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *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/cron/types/types.go b/x/cron/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/cron/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/cron/types/v1/schedule.pb.go b/x/cron/types/v1/schedule.pb.go deleted file mode 100644 index a37932a39..000000000 --- a/x/cron/types/v1/schedule.pb.go +++ /dev/null @@ -1,842 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: neutron/cron/v1/schedule.proto - -package v1 - -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 - -// Defines the schedule for execution -type Schedule struct { - // Name of schedule - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Period in blocks - Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` - // Msgs that will be executed every certain number of blocks, specified in the `period` field - Msgs []MsgExecuteContract `protobuf:"bytes,3,rep,name=msgs,proto3" json:"msgs"` - // Last execution's block height - LastExecuteHeight uint64 `protobuf:"varint,4,opt,name=last_execute_height,json=lastExecuteHeight,proto3" json:"last_execute_height,omitempty"` -} - -func (m *Schedule) Reset() { *m = Schedule{} } -func (m *Schedule) String() string { return proto.CompactTextString(m) } -func (*Schedule) ProtoMessage() {} -func (*Schedule) Descriptor() ([]byte, []int) { - return fileDescriptor_cd4938034d592826, []int{0} -} -func (m *Schedule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Schedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Schedule.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 *Schedule) XXX_Merge(src proto.Message) { - xxx_messageInfo_Schedule.Merge(m, src) -} -func (m *Schedule) XXX_Size() int { - return m.Size() -} -func (m *Schedule) XXX_DiscardUnknown() { - xxx_messageInfo_Schedule.DiscardUnknown(m) -} - -var xxx_messageInfo_Schedule proto.InternalMessageInfo - -func (m *Schedule) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Schedule) GetPeriod() uint64 { - if m != nil { - return m.Period - } - return 0 -} - -func (m *Schedule) GetMsgs() []MsgExecuteContract { - if m != nil { - return m.Msgs - } - return nil -} - -func (m *Schedule) GetLastExecuteHeight() uint64 { - if m != nil { - return m.LastExecuteHeight - } - return 0 -} - -// Defines the contract and the message to pass -type MsgExecuteContract struct { - // The address of the smart contract - Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` - // JSON encoded message to be passed to the contract - Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` -} - -func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } -func (m *MsgExecuteContract) String() string { return proto.CompactTextString(m) } -func (*MsgExecuteContract) ProtoMessage() {} -func (*MsgExecuteContract) Descriptor() ([]byte, []int) { - return fileDescriptor_cd4938034d592826, []int{1} -} -func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExecuteContract.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 *MsgExecuteContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExecuteContract.Merge(m, src) -} -func (m *MsgExecuteContract) XXX_Size() int { - return m.Size() -} -func (m *MsgExecuteContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo - -func (m *MsgExecuteContract) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -func (m *MsgExecuteContract) GetMsg() string { - if m != nil { - return m.Msg - } - return "" -} - -// Defines the number of current schedules -type ScheduleCount struct { - // The number of current schedules - Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` -} - -func (m *ScheduleCount) Reset() { *m = ScheduleCount{} } -func (m *ScheduleCount) String() string { return proto.CompactTextString(m) } -func (*ScheduleCount) ProtoMessage() {} -func (*ScheduleCount) Descriptor() ([]byte, []int) { - return fileDescriptor_cd4938034d592826, []int{2} -} -func (m *ScheduleCount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ScheduleCount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ScheduleCount.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 *ScheduleCount) XXX_Merge(src proto.Message) { - xxx_messageInfo_ScheduleCount.Merge(m, src) -} -func (m *ScheduleCount) XXX_Size() int { - return m.Size() -} -func (m *ScheduleCount) XXX_DiscardUnknown() { - xxx_messageInfo_ScheduleCount.DiscardUnknown(m) -} - -var xxx_messageInfo_ScheduleCount proto.InternalMessageInfo - -func (m *ScheduleCount) GetCount() int32 { - if m != nil { - return m.Count - } - return 0 -} - -func init() { - proto.RegisterType((*Schedule)(nil), "neutron.cron.v1.Schedule") - proto.RegisterType((*MsgExecuteContract)(nil), "neutron.cron.v1.MsgExecuteContract") - proto.RegisterType((*ScheduleCount)(nil), "neutron.cron.v1.ScheduleCount") -} - -func init() { proto.RegisterFile("neutron/cron/v1/schedule.proto", fileDescriptor_cd4938034d592826) } - -var fileDescriptor_cd4938034d592826 = []byte{ - // 316 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x4a, 0xc3, 0x30, - 0x18, 0xc7, 0x1b, 0xd7, 0x8d, 0x2d, 0x22, 0x6a, 0x1c, 0x52, 0x76, 0x88, 0x63, 0x22, 0xec, 0x62, - 0x42, 0x15, 0x8f, 0x5e, 0x36, 0x04, 0x41, 0xbc, 0xd4, 0x9b, 0x97, 0xb1, 0x65, 0x21, 0x1d, 0xac, - 0x4d, 0x69, 0xd2, 0x32, 0xdf, 0xc2, 0x97, 0xf0, 0x5d, 0x76, 0xdc, 0xd1, 0x93, 0x48, 0xfb, 0x22, - 0x92, 0x34, 0xf3, 0xa0, 0x97, 0xf0, 0xfb, 0xf3, 0xff, 0xfe, 0xf9, 0xbe, 0x2f, 0x81, 0x38, 0xe5, - 0x85, 0xce, 0x65, 0x4a, 0x99, 0x39, 0xca, 0x90, 0x2a, 0x16, 0xf3, 0x65, 0xb1, 0xe6, 0x24, 0xcb, - 0xa5, 0x96, 0xe8, 0xd8, 0xf9, 0xc4, 0xf8, 0xa4, 0x0c, 0x07, 0x7d, 0x21, 0x85, 0xb4, 0x1e, 0x35, - 0xd4, 0x94, 0x8d, 0x3e, 0x00, 0xec, 0xbe, 0xb8, 0x24, 0x42, 0xd0, 0x4f, 0xe7, 0x09, 0x0f, 0xc0, - 0x10, 0x8c, 0x7b, 0x91, 0x65, 0x74, 0x0e, 0x3b, 0x19, 0xcf, 0x57, 0x72, 0x19, 0x1c, 0x0c, 0xc1, - 0xd8, 0x8f, 0x9c, 0x42, 0xf7, 0xd0, 0x4f, 0x94, 0x50, 0x41, 0x6b, 0xd8, 0x1a, 0x1f, 0xde, 0x5c, - 0x92, 0x3f, 0xed, 0xc8, 0xb3, 0x12, 0x0f, 0x1b, 0xce, 0x0a, 0xcd, 0xa7, 0x32, 0xd5, 0xf9, 0x9c, - 0xe9, 0x89, 0xbf, 0xfd, 0xba, 0xf0, 0x22, 0x1b, 0x43, 0x04, 0x9e, 0xad, 0xe7, 0x4a, 0xcf, 0x78, - 0x53, 0x33, 0x8b, 0xf9, 0x4a, 0xc4, 0x3a, 0xf0, 0x6d, 0x8f, 0x53, 0x63, 0xb9, 0xf4, 0xa3, 0x35, - 0x46, 0x13, 0x88, 0xfe, 0xdf, 0x88, 0x06, 0xb0, 0xcb, 0x1c, 0xbb, 0xa1, 0x7f, 0x35, 0x3a, 0x81, - 0xad, 0x44, 0x09, 0x3b, 0x75, 0x2f, 0x32, 0x38, 0xba, 0x82, 0x47, 0xfb, 0x55, 0xa7, 0xb2, 0x48, - 0x35, 0xea, 0xc3, 0x36, 0x33, 0x60, 0xb3, 0xed, 0xa8, 0x11, 0x93, 0xa7, 0x6d, 0x85, 0xc1, 0xae, - 0xc2, 0xe0, 0xbb, 0xc2, 0xe0, 0xbd, 0xc6, 0xde, 0xae, 0xc6, 0xde, 0x67, 0x8d, 0xbd, 0xd7, 0x50, - 0xac, 0x74, 0x5c, 0x2c, 0x08, 0x93, 0x09, 0x75, 0xfb, 0x5e, 0xcb, 0x5c, 0xec, 0x99, 0x96, 0x77, - 0x74, 0xd3, 0xfc, 0x87, 0x7e, 0xcb, 0xb8, 0xa2, 0x65, 0xb8, 0xe8, 0xd8, 0x67, 0xbe, 0xfd, 0x09, - 0x00, 0x00, 0xff, 0xff, 0x43, 0xbd, 0xcc, 0x86, 0xaf, 0x01, 0x00, 0x00, -} - -func (m *Schedule) 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 *Schedule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Schedule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LastExecuteHeight != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.LastExecuteHeight)) - i-- - dAtA[i] = 0x20 - } - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSchedule(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Period != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.Period)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgExecuteContract) 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 *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msg) > 0 { - i -= len(m.Msg) - copy(dAtA[i:], m.Msg) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Msg))) - i-- - dAtA[i] = 0x12 - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintSchedule(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ScheduleCount) 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 *ScheduleCount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ScheduleCount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Count != 0 { - i = encodeVarintSchedule(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintSchedule(dAtA []byte, offset int, v uint64) int { - offset -= sovSchedule(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Schedule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - if m.Period != 0 { - n += 1 + sovSchedule(uint64(m.Period)) - } - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovSchedule(uint64(l)) - } - } - if m.LastExecuteHeight != 0 { - n += 1 + sovSchedule(uint64(m.LastExecuteHeight)) - } - return n -} - -func (m *MsgExecuteContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovSchedule(uint64(l)) - } - return n -} - -func (m *ScheduleCount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Count != 0 { - n += 1 + sovSchedule(uint64(m.Count)) - } - return n -} - -func sovSchedule(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSchedule(x uint64) (n int) { - return sovSchedule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Schedule) 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 ErrIntOverflowSchedule - } - 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: Schedule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schedule: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) - } - m.Period = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Period |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msgs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSchedule - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msgs = append(m.Msgs, MsgExecuteContract{}) - if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastExecuteHeight", wireType) - } - m.LastExecuteHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastExecuteHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExecuteContract) 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 ErrIntOverflowSchedule - } - 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: MsgExecuteContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - 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 ErrInvalidLengthSchedule - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchedule - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScheduleCount) 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 ErrIntOverflowSchedule - } - 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: ScheduleCount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScheduleCount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchedule - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSchedule(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchedule - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSchedule(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, ErrIntOverflowSchedule - } - 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, ErrIntOverflowSchedule - } - 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, ErrIntOverflowSchedule - } - 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, ErrInvalidLengthSchedule - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSchedule - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSchedule - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSchedule = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSchedule = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSchedule = fmt.Errorf("proto: unexpected end of group") -)