From 3aed8f1de69579559dae80986f3eb4c6b897af1b Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 20 Dec 2024 10:20:35 -0400 Subject: [PATCH 1/3] MEV --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 29dd6b34b8..2cd43f481e 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Sei +# Sei with MEV by MEVVY! ![Banner!](assets/SeiLogo.png) From 238f67e87bb58ac11a367640b18a2a5a3b1247ad Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 20 Dec 2024 11:38:37 -0400 Subject: [PATCH 2/3] Rough draft of MEV Module --- app/app.go | 16 ++++ x/mev/keeper/keeper.go | 21 ++++++ x/mev/module.go | 164 +++++++++++++++++++++++++++++++++++++++++ x/mev/module_test.go | 41 +++++++++++ x/mev/types/genesis.go | 20 +++++ x/mev/types/keys.go | 8 ++ x/mev/types/types.go | 3 + 7 files changed, 273 insertions(+) create mode 100644 x/mev/keeper/keeper.go create mode 100644 x/mev/module.go create mode 100644 x/mev/module_test.go create mode 100644 x/mev/types/genesis.go create mode 100644 x/mev/types/keys.go create mode 100644 x/mev/types/types.go diff --git a/app/app.go b/app/app.go index 2c0f204c32..edf3442562 100644 --- a/app/app.go +++ b/app/app.go @@ -156,6 +156,10 @@ import ( // unnamed import of statik for openapi/swagger UI support _ "github.com/sei-protocol/sei-chain/docs/swagger" ssconfig "github.com/sei-protocol/sei-db/config" + + mev "github.com/sei-protocol/sei-chain/x/mev" + mevkeeper "github.com/sei-protocol/sei-chain/x/mev/keeper" + mevtypes "github.com/sei-protocol/sei-chain/x/mev/types" ) // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals @@ -330,6 +334,7 @@ type App struct { WasmKeeper wasm.Keeper OracleKeeper oraclekeeper.Keeper EvmKeeper evmkeeper.Keeper + MevKeeper mevkeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -543,6 +548,13 @@ func New( app.DistrKeeper, ) + keys[mevtypes.StoreKey] = storetypes.NewKVStoreKey(mevtypes.StoreKey) + + app.MevKeeper = mevkeeper.NewKeeper( + appCodec, + keys[mevtypes.StoreKey], + ) + // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks supportedFeatures := "iterator,staking,stargate,sei" @@ -747,6 +759,7 @@ func New( tokenfactorymodule.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), // this line is used by starport scaffolding # stargate/app/appModule + mev.NewAppModule(appCodec, app.MevKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -778,6 +791,7 @@ func New( wasm.ModuleName, tokenfactorytypes.ModuleName, acltypes.ModuleName, + mevtypes.ModuleName, // Add here ) app.mm.SetOrderMidBlockers( @@ -809,6 +823,7 @@ func New( wasm.ModuleName, tokenfactorytypes.ModuleName, acltypes.ModuleName, + mevtypes.ModuleName, // Add here ) // NOTE: The genutils module must occur after staking so that pools are @@ -842,6 +857,7 @@ func New( evmtypes.ModuleName, acltypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis + mevtypes.ModuleName, // Add here ) app.mm.RegisterInvariants(&app.CrisisKeeper) diff --git a/x/mev/keeper/keeper.go b/x/mev/keeper/keeper.go new file mode 100644 index 0000000000..419de039a3 --- /dev/null +++ b/x/mev/keeper/keeper.go @@ -0,0 +1,21 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey sdk.StoreKey +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey sdk.StoreKey, +) Keeper { + return Keeper{ + cdc: cdc, + storeKey: storeKey, + } +} diff --git a/x/mev/module.go b/x/mev/module.go new file mode 100644 index 0000000000..bbc4f68b60 --- /dev/null +++ b/x/mev/module.go @@ -0,0 +1,164 @@ +package mev + +import ( + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/sei-protocol/sei-chain/x/mev/keeper" + "github.com/sei-protocol/sei-chain/x/mev/types" + abci "github.com/tendermint/tendermint/abci/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// AppModuleBasic defines the basic application module used by the mev module. +type AppModuleBasic struct { + cdc codec.Codec +} + +func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the mev module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the mev module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(_ codectypes.InterfaceRegistry) {} + +// DefaultGenesis returns default genesis state as raw bytes for the mev module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the mev module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return nil +} + +// ValidateGenesisStream performs genesis state validation for the mev module in a streaming fashion. +func (am AppModuleBasic) ValidateGenesisStream(cdc codec.JSONCodec, config client.TxEncodingConfig, genesisCh <-chan json.RawMessage) error { + for genesis := range genesisCh { + err := am.ValidateGenesis(cdc, config, genesis) + if err != nil { + return err + } + } + return nil +} + +// RegisterRESTRoutes registers the REST routes for the mev module. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the mev module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // Register your routes here if needed +} + +// GetTxCmd returns the root tx command for the mev module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns the root query command for the mev module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return nil +} + +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: k, + } +} + +// Name returns the mev module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterInvariants registers the mev module invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// Route returns the message routing key for the mev module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, nil) +} + +// QuerierRoute returns the mev module's querier route name. +func (AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +// LegacyQuerierHandler returns the mev module sdk.Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// InitGenesis performs genesis initialization for the mev module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the mev module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ExportGenesisStream returns the mev module's exported genesis state as raw JSON bytes in a streaming fashion. +func (am AppModule) ExportGenesisStream(ctx sdk.Context, cdc codec.JSONCodec) <-chan json.RawMessage { + ch := make(chan json.RawMessage) + go func() { + ch <- am.ExportGenesis(ctx, cdc) + close(ch) + }() + return ch +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock returns the begin blocker for the mev module. +func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock returns the end blocker for the mev module. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + // Register services here when needed + // For now, we'll just register a basic migration like other modules + _ = cfg.RegisterMigration(types.ModuleName, 1, func(ctx sdk.Context) error { + return nil + }) +} diff --git a/x/mev/module_test.go b/x/mev/module_test.go new file mode 100644 index 0000000000..6bae521647 --- /dev/null +++ b/x/mev/module_test.go @@ -0,0 +1,41 @@ +package mev_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/sei-protocol/sei-chain/app" + "github.com/sei-protocol/sei-chain/x/mev" + "github.com/sei-protocol/sei-chain/x/mev/types" +) + +func TestBasicModule(t *testing.T) { + app := app.Setup(false, false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + module := mev.NewAppModule( + app.AppCodec(), + app.MevKeeper, + ) + + // Test basic module properties + require.Equal(t, types.ModuleName, module.Name()) + require.NotNil(t, module) + + // Test BeginBlock and EndBlock + module.BeginBlock(ctx, abci.RequestBeginBlock{}) + require.Equal(t, []abci.ValidatorUpdate{}, module.EndBlock(ctx, abci.RequestEndBlock{})) +} + +func TestModuleRegistration(t *testing.T) { + app := app.Setup(false, false) + + // Verify the module is properly registered in the app + require.NotNil(t, app.MevKeeper) + + // Test module name matches + require.Equal(t, types.ModuleName, types.ModuleName) +} diff --git a/x/mev/types/genesis.go b/x/mev/types/genesis.go new file mode 100644 index 0000000000..828bb929f4 --- /dev/null +++ b/x/mev/types/genesis.go @@ -0,0 +1,20 @@ +package types + +import ( + "github.com/gogo/protobuf/proto" +) + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// GenesisState defines the mev module's genesis state +type GenesisState struct { + // Add your genesis state fields here +} + +// implement proto.Message interface +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} diff --git a/x/mev/types/keys.go b/x/mev/types/keys.go new file mode 100644 index 0000000000..1b788da888 --- /dev/null +++ b/x/mev/types/keys.go @@ -0,0 +1,8 @@ +package types + +const ( + ModuleName = "mev" + StoreKey = ModuleName + RouterKey = ModuleName + QuerierRoute = ModuleName +) diff --git a/x/mev/types/types.go b/x/mev/types/types.go new file mode 100644 index 0000000000..b542a2a94e --- /dev/null +++ b/x/mev/types/types.go @@ -0,0 +1,3 @@ +package types + +// empty for now, will add types as needed From e99ed1df83d3a23e8994acf056be40fb00740b02 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 14 Jan 2025 11:56:16 -0400 Subject: [PATCH 3/3] test --- proto/mev/genesis.proto | 19 +++ proto/mev/params.proto | 11 ++ proto/mev/query.proto | 24 +++ x/mev/client/cli/query.go | 54 +++++++ x/mev/client/cli/tx.go | 27 ++++ x/mev/keeper/grpc_query.go | 18 +++ x/mev/keeper/params.go | 18 +++ x/mev/types/codec.go | 19 +++ x/mev/types/genesis.pb.go | 304 +++++++++++++++++++++++++++++++++++++ x/mev/types/params.pb.go | 14 ++ x/mev/types/query.pb.go | 79 ++++++++++ 11 files changed, 587 insertions(+) create mode 100644 proto/mev/genesis.proto create mode 100644 proto/mev/params.proto create mode 100644 proto/mev/query.proto create mode 100644 x/mev/client/cli/query.go create mode 100644 x/mev/client/cli/tx.go create mode 100644 x/mev/keeper/grpc_query.go create mode 100644 x/mev/keeper/params.go create mode 100644 x/mev/types/codec.go create mode 100644 x/mev/types/genesis.pb.go create mode 100644 x/mev/types/params.pb.go create mode 100644 x/mev/types/query.pb.go diff --git a/proto/mev/genesis.proto b/proto/mev/genesis.proto new file mode 100644 index 0000000000..d912372845 --- /dev/null +++ b/proto/mev/genesis.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package seiprotocol.seichain.mev; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/sei-protocol/sei-chain/x/mev/types"; + +// GenesisState defines the mev module's genesis state +message GenesisState { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + Params params = 1 [(gogoproto.nullable) = false]; +} + +// Params defines the parameters for the mev module +message Params { + option (gogoproto.goproto_stringer) = false; +} diff --git a/proto/mev/params.proto b/proto/mev/params.proto new file mode 100644 index 0000000000..e67f539442 --- /dev/null +++ b/proto/mev/params.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package seiprotocol.seichain.mev; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/sei-protocol/sei-chain/x/mev/types"; + +// Params defines the parameters for the mev module. +message Params { + option (gogoproto.goproto_stringer) = false; +} \ No newline at end of file diff --git a/proto/mev/query.proto b/proto/mev/query.proto new file mode 100644 index 0000000000..8ad1f2b99a --- /dev/null +++ b/proto/mev/query.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package seiprotocol.seichain.mev; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "mev/params.proto"; + +option go_package = "github.com/sei-protocol/sei-chain/x/mev/types"; + +// Query defines the gRPC querier service. +service Query { + // Params returns the total set of mev parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/sei-protocol/sei-chain/mev/params"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/x/mev/client/cli/query.go b/x/mev/client/cli/query.go new file mode 100644 index 0000000000..6a5a0900f1 --- /dev/null +++ b/x/mev/client/cli/query.go @@ -0,0 +1,54 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/sei-protocol/sei-chain/x/mev/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + 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( + GetParamsCmd(), + ) + + return cmd +} + +func GetParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current mev module parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/mev/client/cli/tx.go b/x/mev/client/cli/tx.go new file mode 100644 index 0000000000..745cce0dd9 --- /dev/null +++ b/x/mev/client/cli/tx.go @@ -0,0 +1,27 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/sei-protocol/sei-chain/x/mev/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, + } + + // Add tx commands here when needed + + return cmd +} diff --git a/x/mev/keeper/grpc_query.go b/x/mev/keeper/grpc_query.go new file mode 100644 index 0000000000..6908bf0566 --- /dev/null +++ b/x/mev/keeper/grpc_query.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sei-protocol/sei-chain/x/mev/types" +) + +var _ types.QueryServer = Keeper{} + +// Params implements the Query/Params gRPC method +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/mev/keeper/params.go b/x/mev/keeper/params.go new file mode 100644 index 0000000000..19f3ac62ae --- /dev/null +++ b/x/mev/keeper/params.go @@ -0,0 +1,18 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sei-protocol/sei-chain/x/mev/types" +) + +// GetParams returns the total set of mev parameters. +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + var params types.Params + k.paramstore.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the mev parameters to the param space. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/mev/types/codec.go b/x/mev/types/codec.go new file mode 100644 index 0000000000..b70e2a444a --- /dev/null +++ b/x/mev/types/codec.go @@ -0,0 +1,19 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/mev/types/genesis.pb.go b/x/mev/types/genesis.pb.go new file mode 100644 index 0000000000..ec20fc8a5a --- /dev/null +++ b/x/mev/types/genesis.pb.go @@ -0,0 +1,304 @@ +package types + +import ( + "fmt" + "io" + "math/bits" + + proto "github.com/gogo/protobuf/proto" +) + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) + +// GenesisState defines the mev module's genesis state +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_234233223343802, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +var ( + xxx_messageInfo_GenesisState proto.InternalMessageInfo +) + +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} + +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} + +func sovGenesis(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} + +var fileDescriptor_genesis_234233223343802 = []byte{ + // Add your descriptor bytes here if needed +} + +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 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := 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 +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} diff --git a/x/mev/types/params.pb.go b/x/mev/types/params.pb.go new file mode 100644 index 0000000000..9dd7221cdd --- /dev/null +++ b/x/mev/types/params.pb.go @@ -0,0 +1,14 @@ +package types + +import ( + proto "github.com/gogo/protobuf/proto" +) + +// Params defines the parameters for the mev module. +type Params struct { + // Define your params fields here +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} diff --git a/x/mev/types/query.pb.go b/x/mev/types/query.pb.go new file mode 100644 index 0000000000..24cdd768bf --- /dev/null +++ b/x/mev/types/query.pb.go @@ -0,0 +1,79 @@ +// Code generated by protoc-gen-gogo. +// source: evm/query.proto + +package types + +import ( + context "context" + fmt "fmt" + math "math" + + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// 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 + +// QueryClient is the client API for Query service +type QueryClient interface { + // Params returns the mev module parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) 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, "/seiprotocol.seichain.mev.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryParamsRequest is 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() {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + 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() {} + +type QueryServer interface { + // Params returns the total set of mev parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct{} + +func (*UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +}