diff --git a/app/app.go b/app/app.go index 30d75bf846..ea8262c6a8 100644 --- a/app/app.go +++ b/app/app.go @@ -78,6 +78,10 @@ import ( paymentmodule "github.com/celestiaorg/celestia-app/x/payment" paymentmodulekeeper "github.com/celestiaorg/celestia-app/x/payment/keeper" paymentmoduletypes "github.com/celestiaorg/celestia-app/x/payment/types" + + qgbmodule "github.com/celestiaorg/celestia-app/x/qgb" + qgbmodulekeeper "github.com/celestiaorg/celestia-app/x/qgb/keeper" + qgbmoduletypes "github.com/celestiaorg/celestia-app/x/qgb/types" // this line is used by starport scaffolding # stargate/app/moduleImport ) @@ -115,6 +119,7 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, paymentmodule.AppModuleBasic{}, + qgbmodule.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -183,6 +188,7 @@ type App struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper PaymentKeeper paymentmodulekeeper.Keeper + QgbKeeper qgbmodulekeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration // the module manager @@ -219,6 +225,7 @@ func New( paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, paymentmoduletypes.StoreKey, + qgbmoduletypes.StoreKey, // this line is used by starport scaffolding # stargate/app/storeKey ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -313,6 +320,13 @@ func New( ) paymentmodule := paymentmodule.NewAppModule(appCodec, app.PaymentKeeper) + app.QgbKeeper = *qgbmodulekeeper.NewKeeper( + appCodec, + keys[qgbmoduletypes.StoreKey], + keys[qgbmoduletypes.MemStoreKey], + ) + qgbmodule := qgbmodule.NewAppModule(appCodec, app.QgbKeeper) + // this line is used by starport scaffolding # stargate/app/keeperDefinition // Create static IBC router, add transfer route, then set and seal it @@ -351,6 +365,7 @@ func New( params.NewAppModule(app.ParamsKeeper), transferModule, paymentmodule, + qgbmodule, // this line is used by starport scaffolding # stargate/app/appModule ) @@ -385,6 +400,7 @@ func New( evidencetypes.ModuleName, ibctransfertypes.ModuleName, paymentmoduletypes.ModuleName, + qgbmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) @@ -568,6 +584,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(paymentmoduletypes.ModuleName) + paramsKeeper.Subspace(qgbmoduletypes.ModuleName) // this line is used by starport scaffolding # stargate/app/paramSubspace return paramsKeeper diff --git a/proto/qgb/genesis.proto b/proto/qgb/genesis.proto new file mode 100644 index 0000000000..b21513621a --- /dev/null +++ b/proto/qgb/genesis.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package qgb; + +option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; + +// GenesisState defines the capability module's genesis state. +message GenesisState {} diff --git a/proto/qgb/msgs.proto b/proto/qgb/msgs.proto new file mode 100644 index 0000000000..acefffa1a6 --- /dev/null +++ b/proto/qgb/msgs.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package qgb; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; + +// Msg defines the state transitions possible for QGB +service Msg { + // ValsetConfirm allows the validators to submit their signatures over the validator set. + rpc ValsetConfirm(MsgValsetConfirm) returns (MsgValsetConfirmResponse) { + option (google.api.http).post = "/qgb/valset_confirm"; + } + // DataCommitmentConfirm allows the validators to submit a confirmation for a data commitment. + rpc DataCommitmentConfirm(MsgDataCommitmentConfirm) returns (MsgDataCommitmentConfirmResponse) { + option (google.api.http).post = "/qgb/data_commitment_confirm"; + } +} + +// MsgValsetConfirm +// this is the message sent by the validators when they wish to submit their +// signatures over the validator set at a given block height. A validator must +// first call MsgSetEthAddress to set their Ethereum address to be used for +// signing. Then someone (anyone) must make a ValsetRequest, the request is +// essentially a messaging mechanism to determine which block all validators +// should submit signatures over. Finally validators sign the validator set, +// powers, and Ethereum addresses of the entire validator set at the height of a +// ValsetRequest and submit that signature with this message. +// +// If a sufficient number of validators (66% of voting power) (A) have set +// Ethereum addresses and (B) submit ValsetConfirm messages with their +// signatures it is then possible for anyone to view these signatures in the +// chain store and submit them to Ethereum to update the validator set +// ------------- +message MsgValsetConfirm { + uint64 nonce = 1; + string orchestrator = 2; + string eth_address = 3; + string signature = 4; +} + +// MsgValsetConfirmResponse describes the response returned after the submission +// of a MsgValsetConfirm. +message MsgValsetConfirmResponse {} + +// MsgDataCommitmentConfirm describes a data commitment for a set of blocks. +message MsgDataCommitmentConfirm {} + +// MsgValsetConfirmResponse describes the response returned after the submission +// of a MsgDataCommitmentConfirm. +message MsgDataCommitmentConfirmResponse {} diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto new file mode 100644 index 0000000000..ec2921a199 --- /dev/null +++ b/proto/qgb/query.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package qgb; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +// this line is used by starport scaffolding # 1 + +option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; + +// Query defines the gRPC querier service. +service Query { + // this line is used by starport scaffolding # 2 +} + +// this line is used by starport scaffolding # 3 diff --git a/x/payment/types/tx.pb.go b/x/payment/types/tx.pb.go index 9192b6e80a..376615970c 100644 --- a/x/payment/types/tx.pb.go +++ b/x/payment/types/tx.pb.go @@ -29,8 +29,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgWirePayForMessage describes the format of data that is sent over the wire for -// each PayForMessage +// MsgWirePayForMessage describes the format of data that is sent over the wire +// for each PayForMessage type MsgWirePayForMessage struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` MessageNameSpaceId []byte `protobuf:"bytes,2,opt,name=message_name_space_id,json=messageNameSpaceId,proto3" json:"message_name_space_id,omitempty"` @@ -107,7 +107,8 @@ func (m *MsgWirePayForMessage) GetMessageShareCommitment() []ShareCommitAndSigna return nil } -// MsgWirePayForMessageResponse describes the response returned after the submission of a WirePayForMessage +// MsgWirePayForMessageResponse describes the response returned after the +// submission of a WirePayForMessage type MsgWirePayForMessageResponse struct { } @@ -205,8 +206,10 @@ func (m *ShareCommitAndSignature) GetSignature() []byte { return nil } -// MsgPayForMessage is what gets signed by users when creating ShareCommitSignatures. -// Multiple versions are signed and included, each version creates a commitment for a +// MsgPayForMessage is what gets signed by users when creating +// ShareCommitSignatures. +// Multiple versions are signed and included, each version creates a commitment +// for a // specific square size. type MsgPayForMessage struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` @@ -276,7 +279,8 @@ func (m *MsgPayForMessage) GetMessageShareCommitment() []byte { return nil } -// MsgPayForMessageResponse describes the response returned after the submission of a PayForMessage +// MsgPayForMessageResponse describes the response returned after the submission +// of a PayForMessage type MsgPayForMessageResponse struct { } diff --git a/x/qgb/client/cli/datacommitment.go b/x/qgb/client/cli/datacommitment.go new file mode 100644 index 0000000000..a399dbf9b3 --- /dev/null +++ b/x/qgb/client/cli/datacommitment.go @@ -0,0 +1,21 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdGetDataCommitmentConfirm() *cobra.Command { + //nolint: exhaustivestruct + cmd := &cobra.Command{ + Use: "datacommitment-confirm // TODO", + Short: "Get data commitment // TODO", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + // TODO + return nil + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/qgb/client/cli/valsetconfirm.go b/x/qgb/client/cli/valsetconfirm.go new file mode 100644 index 0000000000..b2b29967d1 --- /dev/null +++ b/x/qgb/client/cli/valsetconfirm.go @@ -0,0 +1,21 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdGetValsetConfirm() *cobra.Command { + //nolint: exhaustivestruct + cmd := &cobra.Command{ + Use: "valset-confirm [nonce] [bech32 validator address]", + Short: "Get valset confirmation with a particular nonce from a particular validator", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + // TODO + return nil + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/qgb/genesis.go b/x/qgb/genesis.go new file mode 100644 index 0000000000..bd21f431cd --- /dev/null +++ b/x/qgb/genesis.go @@ -0,0 +1,22 @@ +package qgb + +import ( + "github.com/celestiaorg/celestia-app/x/qgb/keeper" + "github.com/celestiaorg/celestia-app/x/qgb/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/qgb/handler.go b/x/qgb/handler.go new file mode 100644 index 0000000000..f8b59b3148 --- /dev/null +++ b/x/qgb/handler.go @@ -0,0 +1,30 @@ +package qgb + +import ( + "fmt" + + "github.com/celestiaorg/celestia-app/x/qgb/keeper" + "github.com/celestiaorg/celestia-app/x/qgb/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// NewHandler uses the provided qgb keeper to create an sdk.Handler +func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + switch msg := msg.(type) { + case *types.MsgValsetConfirm: + res, err := msgServer.ValsetConfirm(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgDataCommitmentConfirm: + res, err := msgServer.DataCommitmentConfirm(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/qgb/keeper/keeper.go b/x/qgb/keeper/keeper.go new file mode 100644 index 0000000000..5756a14c97 --- /dev/null +++ b/x/qgb/keeper/keeper.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey +} + +func NewKeeper(cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/qgb/keeper/keeper_data_commitment.go b/x/qgb/keeper/keeper_data_commitment.go new file mode 100644 index 0000000000..552cac92b1 --- /dev/null +++ b/x/qgb/keeper/keeper_data_commitment.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "github.com/celestiaorg/celestia-app/x/qgb/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetDataCommitmentConfirm +func (k Keeper) GetDataCommitmentConfirm(ctx sdk.Context) *types.MsgDataCommitmentConfirm { + // TODO + return nil +} + +// SetDataCommitmentConfirm +func (k Keeper) SetDataCommitmentConfirm(ctx sdk.Context, dcConf types.MsgDataCommitmentConfirm) []byte { + // TODO + return nil +} + +// DeleteDataCommitmentConfirms +func (k Keeper) DeleteDataCommitmentConfirms(ctx sdk.Context) { + // TODO +} diff --git a/x/qgb/keeper/keeper_valset.go b/x/qgb/keeper/keeper_valset.go new file mode 100644 index 0000000000..f548583b02 --- /dev/null +++ b/x/qgb/keeper/keeper_valset.go @@ -0,0 +1,30 @@ +package keeper + +import ( + "github.com/celestiaorg/celestia-app/x/qgb/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetValsetConfirm +func (k Keeper) GetValsetConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgValsetConfirm { + // TODO + return nil +} + +// SetValsetConfirm +func (k Keeper) SetValsetConfirm(ctx sdk.Context, valsetConf types.MsgValsetConfirm) []byte { + // TODO + return nil +} + +// GetValsetConfirms +func (k Keeper) GetValsetConfirms(ctx sdk.Context, nonce uint64) (confirms []types.MsgValsetConfirm) { + // TODO + return nil +} + +// DeleteValsetConfirms +func (k Keeper) DeleteValsetConfirms(ctx sdk.Context, nonce uint64) { + // TODO +} diff --git a/x/qgb/keeper/msg_server.go b/x/qgb/keeper/msg_server.go new file mode 100644 index 0000000000..c63cbf6065 --- /dev/null +++ b/x/qgb/keeper/msg_server.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "context" + + "github.com/celestiaorg/celestia-app/x/qgb/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the gov MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +// ValsetConfirm handles MsgValsetConfirm +func (k msgServer) ValsetConfirm(c context.Context, msg *types.MsgValsetConfirm) (*types.MsgValsetConfirmResponse, error) { + // TODO + return &types.MsgValsetConfirmResponse{}, nil +} + +// DataCommitmentConfirm handles MsgDataCommitmentConfirm +func (k msgServer) DataCommitmentConfirm(context.Context, *types.MsgDataCommitmentConfirm) (*types.MsgDataCommitmentConfirmResponse, error) { + // TODO + return &types.MsgDataCommitmentConfirmResponse{}, nil +} diff --git a/x/qgb/module.go b/x/qgb/module.go new file mode 100644 index 0000000000..08fc8d2548 --- /dev/null +++ b/x/qgb/module.go @@ -0,0 +1,168 @@ +package qgb + +import ( + "encoding/json" + "fmt" + + // this line is used by starport scaffolding # 1 + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/celestiaorg/celestia-app/x/qgb/keeper" + "github.com/celestiaorg/celestia-app/x/qgb/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // this line is used by starport scaffolding # 2 +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + // TODO + return nil +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + // TODO + return nil +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// 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) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability 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 capability 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 implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/qgb/types/codec.go b/x/qgb/types/codec.go new file mode 100644 index 0000000000..0727f69600 --- /dev/null +++ b/x/qgb/types/codec.go @@ -0,0 +1,27 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/msgservice" + + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgDataCommitmentConfirm{}, "qgb/DataCommitmentConfirm", nil) + cdc.RegisterConcrete(&MsgValsetConfirm{}, "qgb/ValSetConfirm", nil) + // this line is used by starport scaffolding # 2 +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgDataCommitmentConfirm{}, + ) + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgValsetConfirm{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/qgb/types/datacommitmentconfirm.go b/x/qgb/types/datacommitmentconfirm.go new file mode 100644 index 0000000000..2fcb17a476 --- /dev/null +++ b/x/qgb/types/datacommitmentconfirm.go @@ -0,0 +1,15 @@ +package types + +import sdk "github.com/cosmos/cosmos-sdk/types" + +// GetSigners defines whose signature is required +func (msg *MsgDataCommitmentConfirm) GetSigners() []sdk.AccAddress { + // TODO + return []sdk.AccAddress{} +} + +// ValidateBasic +func (msg *MsgDataCommitmentConfirm) ValidateBasic() error { + // TODO + return nil +} diff --git a/x/qgb/types/genesis.go b/x/qgb/types/genesis.go new file mode 100644 index 0000000000..d5124e4073 --- /dev/null +++ b/x/qgb/types/genesis.go @@ -0,0 +1,21 @@ +package types + +// this line is used by starport scaffolding # genesis/types/import + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return nil +} diff --git a/x/qgb/types/genesis.pb.go b/x/qgb/types/genesis.pb.go new file mode 100644 index 0000000000..5d24ce1db9 --- /dev/null +++ b/x/qgb/types/genesis.pb.go @@ -0,0 +1,263 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: qgb/genesis.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the capability module's genesis state. +type GenesisState struct { +} + +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_afeb526ae8d4446d, []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 init() { + proto.RegisterType((*GenesisState)(nil), "qgb.GenesisState") +} + +func init() { proto.RegisterFile("qgb/genesis.proto", fileDescriptor_afeb526ae8d4446d) } + +var fileDescriptor_afeb526ae8d4446d = []byte{ + // 132 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x4c, 0x4f, 0xd2, + 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2e, + 0x4c, 0x4f, 0x52, 0xe2, 0xe3, 0xe2, 0x71, 0x87, 0x88, 0x06, 0x97, 0x24, 0x96, 0xa4, 0x3a, 0x79, + 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, + 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x72, 0x6a, 0x4e, 0x6a, 0x71, 0x49, 0x66, 0x62, 0x7e, + 0x51, 0x3a, 0x9c, 0xad, 0x9b, 0x58, 0x50, 0xa0, 0x5f, 0xa1, 0x0f, 0xb2, 0xa7, 0xa4, 0xb2, 0x20, + 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0x8d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x88, 0xcb, 0xb9, 0x1a, + 0x7b, 0x00, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 + 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 { + 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/qgb/types/keys.go b/x/qgb/types/keys.go new file mode 100644 index 0000000000..2220caae92 --- /dev/null +++ b/x/qgb/types/keys.go @@ -0,0 +1,18 @@ +package types + +const ( + // ModuleName is the name of the module + ModuleName = "gqb" + + // StoreKey to be used when creating the KVStore + StoreKey = ModuleName + + // RouterKey is the module name router key + RouterKey = ModuleName + + // QuerierRoute to be used for querierer msgs + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_payment" +) diff --git a/x/qgb/types/msgs.pb.go b/x/qgb/types/msgs.pb.go new file mode 100644 index 0000000000..49dbd62241 --- /dev/null +++ b/x/qgb/types/msgs.pb.go @@ -0,0 +1,969 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: qgb/msgs.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// MsgValsetConfirm +// this is the message sent by the validators when they wish to submit their +// signatures over the validator set at a given block height. A validator must +// first call MsgSetEthAddress to set their Ethereum address to be used for +// signing. Then someone (anyone) must make a ValsetRequest, the request is +// essentially a messaging mechanism to determine which block all validators +// should submit signatures over. Finally validators sign the validator set, +// powers, and Ethereum addresses of the entire validator set at the height of a +// ValsetRequest and submit that signature with this message. +// +// If a sufficient number of validators (66% of voting power) (A) have set +// Ethereum addresses and (B) submit ValsetConfirm messages with their +// signatures it is then possible for anyone to view these signatures in the +// chain store and submit them to Ethereum to update the validator set +// ------------- +type MsgValsetConfirm struct { + Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` + Orchestrator string `protobuf:"bytes,2,opt,name=orchestrator,proto3" json:"orchestrator,omitempty"` + EthAddress string `protobuf:"bytes,3,opt,name=eth_address,json=ethAddress,proto3" json:"eth_address,omitempty"` + Signature string `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *MsgValsetConfirm) Reset() { *m = MsgValsetConfirm{} } +func (m *MsgValsetConfirm) String() string { return proto.CompactTextString(m) } +func (*MsgValsetConfirm) ProtoMessage() {} +func (*MsgValsetConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_c696c358dc748aba, []int{0} +} +func (m *MsgValsetConfirm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValsetConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValsetConfirm.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 *MsgValsetConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValsetConfirm.Merge(m, src) +} +func (m *MsgValsetConfirm) XXX_Size() int { + return m.Size() +} +func (m *MsgValsetConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValsetConfirm.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgValsetConfirm proto.InternalMessageInfo + +func (m *MsgValsetConfirm) GetNonce() uint64 { + if m != nil { + return m.Nonce + } + return 0 +} + +func (m *MsgValsetConfirm) GetOrchestrator() string { + if m != nil { + return m.Orchestrator + } + return "" +} + +func (m *MsgValsetConfirm) GetEthAddress() string { + if m != nil { + return m.EthAddress + } + return "" +} + +func (m *MsgValsetConfirm) GetSignature() string { + if m != nil { + return m.Signature + } + return "" +} + +// MsgValsetConfirmResponse describes the response returned after the submission +// of a MsgValsetConfirm. +type MsgValsetConfirmResponse struct { +} + +func (m *MsgValsetConfirmResponse) Reset() { *m = MsgValsetConfirmResponse{} } +func (m *MsgValsetConfirmResponse) String() string { return proto.CompactTextString(m) } +func (*MsgValsetConfirmResponse) ProtoMessage() {} +func (*MsgValsetConfirmResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c696c358dc748aba, []int{1} +} +func (m *MsgValsetConfirmResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValsetConfirmResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValsetConfirmResponse.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 *MsgValsetConfirmResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValsetConfirmResponse.Merge(m, src) +} +func (m *MsgValsetConfirmResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgValsetConfirmResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValsetConfirmResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgValsetConfirmResponse proto.InternalMessageInfo + +// MsgDataCommitmentConfirm describes a data commitment for a set of blocks. +type MsgDataCommitmentConfirm struct { +} + +func (m *MsgDataCommitmentConfirm) Reset() { *m = MsgDataCommitmentConfirm{} } +func (m *MsgDataCommitmentConfirm) String() string { return proto.CompactTextString(m) } +func (*MsgDataCommitmentConfirm) ProtoMessage() {} +func (*MsgDataCommitmentConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_c696c358dc748aba, []int{2} +} +func (m *MsgDataCommitmentConfirm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDataCommitmentConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDataCommitmentConfirm.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 *MsgDataCommitmentConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDataCommitmentConfirm.Merge(m, src) +} +func (m *MsgDataCommitmentConfirm) XXX_Size() int { + return m.Size() +} +func (m *MsgDataCommitmentConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDataCommitmentConfirm.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDataCommitmentConfirm proto.InternalMessageInfo + +// MsgValsetConfirmResponse describes the response returned after the submission +// of a MsgDataCommitmentConfirm. +type MsgDataCommitmentConfirmResponse struct { +} + +func (m *MsgDataCommitmentConfirmResponse) Reset() { *m = MsgDataCommitmentConfirmResponse{} } +func (m *MsgDataCommitmentConfirmResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDataCommitmentConfirmResponse) ProtoMessage() {} +func (*MsgDataCommitmentConfirmResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c696c358dc748aba, []int{3} +} +func (m *MsgDataCommitmentConfirmResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDataCommitmentConfirmResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDataCommitmentConfirmResponse.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 *MsgDataCommitmentConfirmResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDataCommitmentConfirmResponse.Merge(m, src) +} +func (m *MsgDataCommitmentConfirmResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDataCommitmentConfirmResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDataCommitmentConfirmResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDataCommitmentConfirmResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgValsetConfirm)(nil), "qgb.MsgValsetConfirm") + proto.RegisterType((*MsgValsetConfirmResponse)(nil), "qgb.MsgValsetConfirmResponse") + proto.RegisterType((*MsgDataCommitmentConfirm)(nil), "qgb.MsgDataCommitmentConfirm") + proto.RegisterType((*MsgDataCommitmentConfirmResponse)(nil), "qgb.MsgDataCommitmentConfirmResponse") +} + +func init() { proto.RegisterFile("qgb/msgs.proto", fileDescriptor_c696c358dc748aba) } + +var fileDescriptor_c696c358dc748aba = []byte{ + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x3d, 0x4f, 0xe3, 0x40, + 0x14, 0xcc, 0x26, 0xb9, 0x93, 0xb2, 0xf7, 0xa1, 0x93, 0x2f, 0x91, 0x2c, 0x5f, 0xce, 0x17, 0x59, + 0x77, 0x52, 0x9a, 0xf3, 0x4a, 0xf0, 0x0b, 0x20, 0x34, 0x14, 0x69, 0x52, 0x50, 0xd0, 0x44, 0x6b, + 0x67, 0x59, 0x5b, 0x8a, 0xf7, 0x39, 0xbb, 0x2f, 0x08, 0x5a, 0x28, 0x69, 0x90, 0xf8, 0x53, 0x94, + 0x91, 0x68, 0x28, 0x51, 0x42, 0xcf, 0x5f, 0x40, 0xd9, 0xc4, 0x46, 0x89, 0x02, 0xdd, 0x7b, 0x33, + 0xf3, 0x66, 0xc6, 0xf2, 0xd2, 0xef, 0x13, 0x19, 0xb1, 0xcc, 0x48, 0x13, 0xe6, 0x1a, 0x10, 0x9c, + 0xda, 0x44, 0x46, 0x5e, 0x53, 0x82, 0x04, 0xbb, 0xb3, 0xe5, 0xb4, 0xa2, 0xbc, 0xb6, 0x04, 0x90, + 0x63, 0xc1, 0x78, 0x9e, 0x32, 0xae, 0x14, 0x20, 0xc7, 0x14, 0xd4, 0xfa, 0x30, 0xb8, 0x21, 0xf4, + 0x47, 0xdf, 0xc8, 0x13, 0x3e, 0x36, 0x02, 0x7b, 0xa0, 0xce, 0x52, 0x9d, 0x39, 0x4d, 0xfa, 0x49, + 0x81, 0x8a, 0x85, 0x4b, 0x3a, 0xa4, 0x5b, 0x1f, 0xac, 0x16, 0x27, 0xa0, 0x5f, 0x41, 0xc7, 0x89, + 0x30, 0xa8, 0x39, 0x82, 0x76, 0xab, 0x1d, 0xd2, 0x6d, 0x0c, 0x36, 0x30, 0xe7, 0x0f, 0xfd, 0x22, + 0x30, 0x19, 0xf2, 0xd1, 0x48, 0x0b, 0x63, 0xdc, 0x9a, 0x95, 0x50, 0x81, 0xc9, 0xc1, 0x0a, 0x71, + 0xda, 0xb4, 0x61, 0x52, 0xa9, 0x38, 0x4e, 0xb5, 0x70, 0xeb, 0x96, 0x7e, 0x03, 0x02, 0x8f, 0xba, + 0xdb, 0x65, 0x06, 0xc2, 0xe4, 0xa0, 0x4c, 0xc1, 0x1d, 0x71, 0xe4, 0x3d, 0xc8, 0xb2, 0x14, 0x33, + 0xa1, 0x0a, 0x4d, 0x10, 0xd0, 0xce, 0x7b, 0x5c, 0x71, 0xbf, 0xf7, 0x42, 0x68, 0xad, 0x6f, 0xa4, + 0x13, 0xd1, 0x6f, 0x9b, 0x5f, 0xdb, 0x0a, 0x27, 0x32, 0x0a, 0xb7, 0x73, 0xbd, 0xdf, 0x3b, 0xe1, + 0xb2, 0xce, 0xaf, 0xab, 0x87, 0xe7, 0xbb, 0x6a, 0x2b, 0xf8, 0xc9, 0x96, 0xbf, 0xe2, 0xdc, 0x6a, + 0x86, 0xf1, 0xda, 0xf2, 0x9a, 0xd0, 0xd6, 0xce, 0x36, 0x4e, 0xe9, 0xba, 0x93, 0xf6, 0xfe, 0x7d, + 0x48, 0x97, 0xe1, 0x7f, 0x6d, 0xb8, 0x1f, 0xb4, 0x6d, 0xf8, 0x88, 0x23, 0x1f, 0xc6, 0xa5, 0xb8, + 0x68, 0x71, 0x78, 0x7c, 0x3f, 0xf7, 0xc9, 0x6c, 0xee, 0x93, 0xa7, 0xb9, 0x4f, 0x6e, 0x17, 0x7e, + 0x65, 0xb6, 0xf0, 0x2b, 0x8f, 0x0b, 0xbf, 0x72, 0xca, 0x64, 0x8a, 0xc9, 0x34, 0x0a, 0x63, 0xc8, + 0x58, 0x2c, 0xc6, 0xc2, 0x60, 0xca, 0x41, 0xcb, 0x72, 0xfe, 0xcf, 0xf3, 0x9c, 0x5d, 0x58, 0x73, + 0xbc, 0xcc, 0x85, 0x89, 0x3e, 0xdb, 0xd7, 0xb2, 0xff, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x07, 0xdd, + 0x60, 0xa7, 0x78, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // ValsetConfirm allows the validators to submit their signatures over the validator set. + ValsetConfirm(ctx context.Context, in *MsgValsetConfirm, opts ...grpc.CallOption) (*MsgValsetConfirmResponse, error) + // DataCommitmentConfirm allows the validators to submit a confirmation for a data commitment. + DataCommitmentConfirm(ctx context.Context, in *MsgDataCommitmentConfirm, opts ...grpc.CallOption) (*MsgDataCommitmentConfirmResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) ValsetConfirm(ctx context.Context, in *MsgValsetConfirm, opts ...grpc.CallOption) (*MsgValsetConfirmResponse, error) { + out := new(MsgValsetConfirmResponse) + err := c.cc.Invoke(ctx, "/qgb.Msg/ValsetConfirm", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DataCommitmentConfirm(ctx context.Context, in *MsgDataCommitmentConfirm, opts ...grpc.CallOption) (*MsgDataCommitmentConfirmResponse, error) { + out := new(MsgDataCommitmentConfirmResponse) + err := c.cc.Invoke(ctx, "/qgb.Msg/DataCommitmentConfirm", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // ValsetConfirm allows the validators to submit their signatures over the validator set. + ValsetConfirm(context.Context, *MsgValsetConfirm) (*MsgValsetConfirmResponse, error) + // DataCommitmentConfirm allows the validators to submit a confirmation for a data commitment. + DataCommitmentConfirm(context.Context, *MsgDataCommitmentConfirm) (*MsgDataCommitmentConfirmResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) ValsetConfirm(ctx context.Context, req *MsgValsetConfirm) (*MsgValsetConfirmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValsetConfirm not implemented") +} +func (*UnimplementedMsgServer) DataCommitmentConfirm(ctx context.Context, req *MsgDataCommitmentConfirm) (*MsgDataCommitmentConfirmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DataCommitmentConfirm not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_ValsetConfirm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgValsetConfirm) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ValsetConfirm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/qgb.Msg/ValsetConfirm", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ValsetConfirm(ctx, req.(*MsgValsetConfirm)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DataCommitmentConfirm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDataCommitmentConfirm) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DataCommitmentConfirm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/qgb.Msg/DataCommitmentConfirm", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DataCommitmentConfirm(ctx, req.(*MsgDataCommitmentConfirm)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "qgb.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ValsetConfirm", + Handler: _Msg_ValsetConfirm_Handler, + }, + { + MethodName: "DataCommitmentConfirm", + Handler: _Msg_DataCommitmentConfirm_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "qgb/msgs.proto", +} + +func (m *MsgValsetConfirm) 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 *MsgValsetConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValsetConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintMsgs(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x22 + } + if len(m.EthAddress) > 0 { + i -= len(m.EthAddress) + copy(dAtA[i:], m.EthAddress) + i = encodeVarintMsgs(dAtA, i, uint64(len(m.EthAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Orchestrator) > 0 { + i -= len(m.Orchestrator) + copy(dAtA[i:], m.Orchestrator) + i = encodeVarintMsgs(dAtA, i, uint64(len(m.Orchestrator))) + i-- + dAtA[i] = 0x12 + } + if m.Nonce != 0 { + i = encodeVarintMsgs(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgValsetConfirmResponse) 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 *MsgValsetConfirmResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValsetConfirmResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDataCommitmentConfirm) 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 *MsgDataCommitmentConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDataCommitmentConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDataCommitmentConfirmResponse) 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 *MsgDataCommitmentConfirmResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDataCommitmentConfirmResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintMsgs(dAtA []byte, offset int, v uint64) int { + offset -= sovMsgs(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgValsetConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonce != 0 { + n += 1 + sovMsgs(uint64(m.Nonce)) + } + l = len(m.Orchestrator) + if l > 0 { + n += 1 + l + sovMsgs(uint64(l)) + } + l = len(m.EthAddress) + if l > 0 { + n += 1 + l + sovMsgs(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovMsgs(uint64(l)) + } + return n +} + +func (m *MsgValsetConfirmResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDataCommitmentConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDataCommitmentConfirmResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovMsgs(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMsgs(x uint64) (n int) { + return sovMsgs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgValsetConfirm) 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 ErrIntOverflowMsgs + } + 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: MsgValsetConfirm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgValsetConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMsgs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orchestrator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMsgs + } + 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 ErrInvalidLengthMsgs + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMsgs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orchestrator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EthAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMsgs + } + 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 ErrInvalidLengthMsgs + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMsgs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EthAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMsgs + } + 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 ErrInvalidLengthMsgs + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMsgs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMsgs(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMsgs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgValsetConfirmResponse) 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 ErrIntOverflowMsgs + } + 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: MsgValsetConfirmResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgValsetConfirmResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMsgs(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMsgs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDataCommitmentConfirm) 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 ErrIntOverflowMsgs + } + 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: MsgDataCommitmentConfirm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDataCommitmentConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMsgs(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMsgs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDataCommitmentConfirmResponse) 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 ErrIntOverflowMsgs + } + 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: MsgDataCommitmentConfirmResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDataCommitmentConfirmResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMsgs(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMsgs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMsgs(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, ErrIntOverflowMsgs + } + 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, ErrIntOverflowMsgs + } + 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, ErrIntOverflowMsgs + } + 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, ErrInvalidLengthMsgs + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMsgs + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMsgs + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMsgs = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMsgs = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMsgs = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/qgb/types/msgs.pb.gw.go b/x/qgb/types/msgs.pb.gw.go new file mode 100644 index 0000000000..a654b76d49 --- /dev/null +++ b/x/qgb/types/msgs.pb.gw.go @@ -0,0 +1,228 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: qgb/msgs.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/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 ( + filter_Msg_ValsetConfirm_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_ValsetConfirm_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgValsetConfirm + 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_Msg_ValsetConfirm_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ValsetConfirm(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_ValsetConfirm_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgValsetConfirm + 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_Msg_ValsetConfirm_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ValsetConfirm(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Msg_DataCommitmentConfirm_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgDataCommitmentConfirm + var metadata runtime.ServerMetadata + + msg, err := client.DataCommitmentConfirm(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_DataCommitmentConfirm_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgDataCommitmentConfirm + var metadata runtime.ServerMetadata + + msg, err := server.DataCommitmentConfirm(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_ValsetConfirm_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_ValsetConfirm_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_ValsetConfirm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_DataCommitmentConfirm_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_DataCommitmentConfirm_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_DataCommitmentConfirm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_ValsetConfirm_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_Msg_ValsetConfirm_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_ValsetConfirm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_DataCommitmentConfirm_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_Msg_DataCommitmentConfirm_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_DataCommitmentConfirm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_ValsetConfirm_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qgb", "valset_confirm"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_DataCommitmentConfirm_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qgb", "data_commitment_confirm"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Msg_ValsetConfirm_0 = runtime.ForwardResponseMessage + + forward_Msg_DataCommitmentConfirm_0 = runtime.ForwardResponseMessage +) diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go new file mode 100644 index 0000000000..8fb42b0585 --- /dev/null +++ b/x/qgb/types/query.pb.go @@ -0,0 +1,86 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: qgb/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("qgb/query.proto", fileDescriptor_f3c1fd86445aad81) } + +var fileDescriptor_f3c1fd86445aad81 = []byte{ + // 185 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0xce, 0x31, 0xaa, 0xc2, 0x40, + 0x10, 0x06, 0xe0, 0x84, 0xc7, 0x7b, 0x0f, 0xd2, 0x08, 0x96, 0x41, 0xf6, 0x00, 0x82, 0x19, 0xa2, + 0x37, 0xb0, 0xb3, 0xb4, 0xb5, 0x9b, 0x0d, 0xcb, 0xb8, 0x90, 0xec, 0x6c, 0xb2, 0x13, 0x31, 0xb7, + 0xf0, 0x58, 0x96, 0x29, 0x2d, 0x25, 0xb9, 0x88, 0x24, 0x01, 0xbb, 0xbf, 0xf8, 0xfe, 0x9f, 0x3f, + 0x59, 0xd5, 0xa4, 0xa1, 0x6e, 0x4d, 0xd3, 0x65, 0xbe, 0x61, 0xe1, 0xf5, 0x4f, 0x4d, 0x3a, 0xdd, + 0x10, 0x33, 0x95, 0x06, 0xd0, 0x5b, 0x40, 0xe7, 0x58, 0x50, 0x2c, 0xbb, 0xb0, 0x90, 0x74, 0x5b, + 0x70, 0xa8, 0x38, 0x80, 0xc6, 0x60, 0x96, 0x2e, 0xdc, 0x72, 0x6d, 0x04, 0x73, 0xf0, 0x48, 0xd6, + 0xcd, 0x78, 0xb1, 0xfb, 0xff, 0xe4, 0xf7, 0x3c, 0x89, 0xe3, 0xe9, 0x39, 0xa8, 0xb8, 0x1f, 0x54, + 0xfc, 0x1e, 0x54, 0xfc, 0x18, 0x55, 0xd4, 0x8f, 0x2a, 0x7a, 0x8d, 0x2a, 0xba, 0x00, 0x59, 0xb9, + 0xb6, 0x3a, 0x2b, 0xb8, 0x82, 0xc2, 0x94, 0x26, 0x88, 0x45, 0x6e, 0xe8, 0x9b, 0x77, 0xe8, 0x3d, + 0xdc, 0x61, 0x3a, 0x2a, 0x9d, 0x37, 0x41, 0xff, 0xcd, 0xd3, 0x87, 0x4f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x2e, 0xe6, 0x68, 0x3e, 0xbc, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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 { +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +// QueryServer is the server API for Query service. +type QueryServer interface { +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "qgb.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "qgb/query.proto", +} diff --git a/x/qgb/types/valsetconfirm.go b/x/qgb/types/valsetconfirm.go new file mode 100644 index 0000000000..526e5e29ed --- /dev/null +++ b/x/qgb/types/valsetconfirm.go @@ -0,0 +1,21 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetSigners defines whose signature is required +func (msg *MsgValsetConfirm) GetSigners() []sdk.AccAddress { + // TODO: figure out how to convert between AccAddress and ValAddress properly + acc, err := sdk.AccAddressFromBech32(msg.Orchestrator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{acc} +} + +// ValidateBasic +func (msg *MsgValsetConfirm) ValidateBasic() error { + // TODO + return nil +}