Implement onboarding module for testnet validator enrollment (#3)

* Add proto files for onboarding module

* Add generated proto bindings

* Define onboarding object

* Define the participants state in keeper

* Update genesis file to initialize and export module state to/from genesis

* Add msg to onboard participant

* Register command to enroll participant

* Add functionality to decode ethereum address from signature

* Add comments for messages and fields

* Fix lint errors in proto files

* Add message validation and events in msg_server

* Reuse crypto utils from go-nitro

* Sign entire eth_payload object

* Use google API for rpc method

* Regenerate proto bindings

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
Isha Venikar
2024-07-16 09:25:39 +05:30
committed by nabarun
co-authored by prathamesh
parent 7369264f0a
commit a21e9ea387
31 changed files with 4419 additions and 181 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo
return data.Validate()
}
// InitGenesis performs genesis initialization for the checkers module.
// InitGenesis performs genesis initialization for the auction module.
// It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesisState auction.GenesisState
-11
View File
@@ -1,11 +0,0 @@
package bond
import "cosmossdk.io/errors"
var (
ErrIndexTooLong = errors.Register(ModuleName, 2, "index too long")
ErrDuplicateAddress = errors.Register(ModuleName, 3, "duplicate address")
ErrInvalidBlack = errors.Register(ModuleName, 4, "black address is invalid: %s")
ErrInvalidRed = errors.Register(ModuleName, 5, "red address is invalid: %s")
ErrGameNotParseable = errors.Register(ModuleName, 6, "game cannot be parsed")
)
+1 -1
View File
@@ -3,7 +3,7 @@ package bond
// bond module event types
const (
EventTypeCreateBond = "crate_bond"
EventTypeCreateBond = "create_bond"
EventTypeRefillBond = "refill_bond"
EventTypeCancelBond = "cancel_bond"
EventTypeWithdrawBond = "withdraw_bond"
+1 -1
View File
@@ -88,7 +88,7 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingCo
return data.Validate()
}
// InitGenesis performs genesis initialization for the checkers module.
// InitGenesis performs genesis initialization for the bond module.
// It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesisState bond.GenesisState
+6 -1
View File
@@ -2,9 +2,14 @@ package onboarding
import (
types "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
// RegisterInterfaces registers the interfaces types with the interface registry.
func RegisterInterfaces(registry types.InterfaceRegistry) {
// TODO: Implement
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgOnboardParticipant{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
+11
View File
@@ -0,0 +1,11 @@
package onboarding
// onboarding module event types
const (
EventTypeOnboardParticipant = "onboard_participant"
AttributeKeySigner = "signer"
AttributeKeyEthAddress = "eth_address"
AttributeValueCategory = ModuleName
)
+10 -3
View File
@@ -1,9 +1,16 @@
package onboarding
// NewGenesisState creates a new genesis state with default values.
func NewGenesisState() *GenesisState {
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
Params: DefaultParams(),
Participants: []Participant{},
}
}
func NewGenesisState(params Params, participants []Participant) *GenesisState {
return &GenesisState{
Params: params,
Participants: participants,
}
}
+76 -10
View File
@@ -23,9 +23,12 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the onboarding module's genesis state.
type GenesisState struct {
// params defines all the parameters of the module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
// participants defines all the participants
Participants []Participant `protobuf:"bytes,2,rep,name=participants,proto3" json:"participants"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -68,6 +71,13 @@ func (m *GenesisState) GetParams() Params {
return Params{}
}
func (m *GenesisState) GetParticipants() []Participant {
if m != nil {
return m.Participants
}
return nil
}
func init() {
proto.RegisterType((*GenesisState)(nil), "cerc.onboarding.v1.GenesisState")
}
@@ -75,20 +85,22 @@ func init() {
func init() { proto.RegisterFile("cerc/onboarding/v1/genesis.proto", fileDescriptor_d21793296c3d9d75) }
var fileDescriptor_d21793296c3d9d75 = []byte{
// 200 bytes of a gzipped FileDescriptorProto
// 234 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0x4e, 0x2d, 0x4a,
0xd6, 0xcf, 0xcf, 0x4b, 0xca, 0x4f, 0x2c, 0x4a, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x33, 0xd4, 0x4f,
0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x02, 0xa9,
0xd0, 0x43, 0xa8, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83,
0x58, 0x10, 0x95, 0x52, 0xca, 0x58, 0xcc, 0x42, 0xd2, 0x07, 0x56, 0xa4, 0xe4, 0xc1, 0xc5, 0xe3,
0x0e, 0x31, 0x3f, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x82, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31,
0xb7, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x4a, 0x0f, 0xd3, 0x3e, 0xbd, 0x00, 0xb0,
0x0a, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0xea, 0x9d, 0x9c, 0x4e, 0x3c, 0x92, 0x63,
0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96,
0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x23, 0x3d, 0xb3, 0x44, 0xaf, 0x2c, 0x25, 0x49, 0xaf,
0x24, 0x5f, 0x1f, 0x64, 0x9a, 0x6e, 0x66, 0xbe, 0x7e, 0x4e, 0x62, 0x72, 0x7e, 0x5e, 0x66, 0x72,
0x8a, 0x7e, 0x05, 0x92, 0x9b, 0x92, 0xd8, 0xc0, 0x8e, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff,
0x79, 0x00, 0xd0, 0xb1, 0x07, 0x01, 0x00, 0x00,
0x58, 0x10, 0x95, 0x52, 0xca, 0x58, 0xcc, 0x42, 0xd2, 0x07, 0x56, 0xa4, 0x34, 0x99, 0x91, 0x8b,
0xc7, 0x1d, 0x62, 0x41, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x05, 0x17, 0x5b, 0x41, 0x62, 0x51,
0x62, 0x6e, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x94, 0x1e, 0xa6, 0x85, 0x7a, 0x01,
0x60, 0x15, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0xd5, 0x0b, 0x79, 0x72, 0xf1, 0x14,
0x24, 0x16, 0x95, 0x64, 0x26, 0x67, 0x16, 0x24, 0xe6, 0x95, 0x14, 0x4b, 0x30, 0x29, 0x30, 0x6b,
0x70, 0x1b, 0xc9, 0xe3, 0xd0, 0x0f, 0x53, 0x07, 0x35, 0x04, 0x45, 0xab, 0x93, 0xd3, 0x89, 0x47,
0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85,
0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa4, 0x67, 0x96, 0xe8, 0x95, 0xa5, 0x24,
0xe9, 0x95, 0xe4, 0xeb, 0x83, 0x0c, 0xd6, 0xcd, 0xcc, 0xd7, 0xcf, 0x49, 0x4c, 0xce, 0xcf, 0xcb,
0x4c, 0x4e, 0xd1, 0xaf, 0x40, 0xf2, 0x5f, 0x12, 0x1b, 0xd8, 0x83, 0xc6, 0x80, 0x00, 0x00, 0x00,
0xff, 0xff, 0x90, 0xbd, 0x55, 0xee, 0x53, 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -111,6 +123,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Participants) > 0 {
for iNdEx := len(m.Participants) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Participants[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@@ -143,6 +169,12 @@ func (m *GenesisState) Size() (n int) {
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.Participants) > 0 {
for _, e := range m.Participants {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
@@ -214,6 +246,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Participants", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Participants = append(m.Participants, Participant{})
if err := m.Participants[len(m.Participants)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
+16 -1
View File
@@ -12,6 +12,12 @@ func (k *Keeper) InitGenesis(ctx context.Context, data *onboarding.GenesisState)
return err
}
for _, participant := range data.Participants {
if err := k.Participants.Set(ctx, participant.CosmosAddress, participant); err != nil {
return err
}
}
return nil
}
@@ -22,7 +28,16 @@ func (k *Keeper) ExportGenesis(ctx context.Context) (*onboarding.GenesisState, e
return nil, err
}
var participants []onboarding.Participant
if err := k.Participants.Walk(ctx, nil, func(cosmosAddress string, participant onboarding.Participant) (bool, error) {
participants = append(participants, participant)
return false, nil
}); err != nil {
return nil, err
}
return &onboarding.GenesisState{
Params: params,
Params: params,
Participants: participants,
}, nil
}
+47 -4
View File
@@ -1,13 +1,20 @@
package keeper
import (
"encoding/json"
"fmt"
"cosmossdk.io/collections"
"cosmossdk.io/core/address"
storetypes "cosmossdk.io/core/store"
"github.com/cosmos/cosmos-sdk/codec"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"git.vdb.to/cerc-io/laconicd/utils"
"git.vdb.to/cerc-io/laconicd/x/onboarding"
)
@@ -20,8 +27,9 @@ type Keeper struct {
authority string
// state management
Schema collections.Schema
Params collections.Item[onboarding.Params]
Schema collections.Schema
Params collections.Item[onboarding.Params]
Participants collections.Map[string, onboarding.Participant]
}
// NewKeeper creates a new Keeper instance
@@ -35,7 +43,8 @@ func NewKeeper(cdc codec.BinaryCodec, addressCodec address.Codec, storeService s
cdc: cdc,
addressCodec: addressCodec,
authority: authority,
Params: collections.NewItem(sb, onboarding.ParamsKey, "params", codec.CollValue[onboarding.Params](cdc)),
Params: collections.NewItem(sb, onboarding.ParamsPrefix, "params", codec.CollValue[onboarding.Params](cdc)),
Participants: collections.NewMap(sb, onboarding.ParticipantsPrefix, "participants", collections.StringKey, codec.CollValue[onboarding.Participant](cdc)),
}
schema, err := sb.Build()
@@ -52,3 +61,37 @@ func NewKeeper(cdc codec.BinaryCodec, addressCodec address.Codec, storeService s
func (k Keeper) GetAuthority() string {
return k.authority
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", onboarding.ModuleName)
}
func (k Keeper) OnboardParticipant(ctx sdk.Context, msg *onboarding.MsgOnboardParticipant, signerAddress sdk.AccAddress) (*onboarding.MsgOnboardParticipantResponse, error) {
message, err := json.Marshal(msg.EthPayload)
if err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid format for payload")
}
ethereumAddress, err := utils.DecodeEthereumAddress(message, msg.EthSignature)
if ethereumAddress != msg.EthPayload.Address {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Recovered ethereum address does not match the address set in payload")
}
participant := &onboarding.Participant{
CosmosAddress: signerAddress.String(),
EthereumAddress: ethereumAddress,
}
if err := k.StoreParticipant(ctx, participant); err != nil {
return nil, err
}
return nil, err
}
func (k Keeper) StoreParticipant(ctx sdk.Context, participant *onboarding.Participant) error {
key := participant.CosmosAddress
k.Participants.Set(ctx, key, *participant)
return nil
}
+57
View File
@@ -0,0 +1,57 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/utils"
"git.vdb.to/cerc-io/laconicd/x/onboarding"
)
type msgServer struct {
k Keeper
}
var _ onboarding.MsgServer = msgServer{}
// NewMsgServerImpl returns an implementation of the module MsgServer interface.
func NewMsgServerImpl(keeper *Keeper) onboarding.MsgServer {
return &msgServer{k: *keeper}
}
func (ms msgServer) OnboardParticipant(c context.Context, msg *onboarding.MsgOnboardParticipant) (*onboarding.MsgOnboardParticipantResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Participant)
if err != nil {
return nil, err
}
_, err = ms.k.OnboardParticipant(ctx, msg, signerAddress)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
onboarding.EventTypeOnboardParticipant,
sdk.NewAttribute(onboarding.AttributeKeySigner, msg.Participant),
sdk.NewAttribute(onboarding.AttributeKeyEthAddress, msg.EthPayload.Address),
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, onboarding.AttributeValueCategory),
sdk.NewAttribute(onboarding.AttributeKeySigner, msg.Participant),
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "OnboardParticipant")
return &onboarding.MsgOnboardParticipantResponse{}, nil
}
+9 -2
View File
@@ -2,8 +2,15 @@ package onboarding
import "cosmossdk.io/collections"
const ModuleName = "onboarding"
const (
ModuleName = "onboarding"
// StoreKey defines the primary module store key
StoreKey = ModuleName
)
var (
ParamsKey = collections.NewPrefix("Params")
ParamsPrefix = collections.NewPrefix(0)
ParticipantsPrefix = collections.NewPrefix(1)
)
+18 -1
View File
@@ -2,12 +2,29 @@ package module
import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
onboardingv1 "git.vdb.to/cerc-io/laconicd/api/cerc/onboarding/v1"
)
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: nil,
Tx: nil,
// TODO: Use JSON file for input
Tx: &autocliv1.ServiceCommandDescriptor{
Service: onboardingv1.Msg_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "OnboardParticipant",
Use: "enroll",
Short: "Enroll a testnet validator",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "ethPayload"},
{ProtoField: "ethSignature"},
{ProtoField: "message"},
},
},
},
},
}
}
+2 -2
View File
@@ -70,7 +70,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
func (am AppModule) RegisterServices(cfg module.Configurator) {
// TODO: Implement
// Register servers
// onboarding.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
onboarding.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
// onboarding.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
// Register in place module state migration migrations
@@ -82,7 +82,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
// DefaultGenesis returns default genesis state as raw bytes for the module.
func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(onboarding.NewGenesisState())
return cdc.MustMarshalJSON(onboarding.DefaultGenesisState())
}
// ValidateGenesis performs genesis state validation for the circuit module.
+27
View File
@@ -0,0 +1,27 @@
package onboarding
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
var (
_ sdk.Msg = &MsgOnboardParticipant{}
)
func (msg MsgOnboardParticipant) ValidateBasic() error {
if len(msg.Participant) == 0 {
return errorsmod.Wrap(sdkerrors.ErrorInvalidSigner, msg.Participant)
}
if len(msg.EthPayload.Address) != 42 {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Participant)
}
if len(msg.EthSignature) != 132 {
return errorsmod.Wrap(sdkerrors.ErrNoSignatures, "Invalid signature.")
}
return nil
}
+465 -13
View File
@@ -5,7 +5,6 @@ package onboarding
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
io "io"
@@ -61,8 +60,116 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo
// Participant defines the data that will be stored for each enrolled participant
type Participant struct {
CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty" json:"cosmos_address" yaml:"cosmos_address"`
EthereumAddress string `protobuf:"bytes,2,opt,name=ethereum_address,json=ethereumAddress,proto3" json:"ethereum_address,omitempty" json:"ethereum_address" yaml:"ethereum_address"`
}
func (m *Participant) Reset() { *m = Participant{} }
func (m *Participant) String() string { return proto.CompactTextString(m) }
func (*Participant) ProtoMessage() {}
func (*Participant) Descriptor() ([]byte, []int) {
return fileDescriptor_59afed779274eaf0, []int{1}
}
func (m *Participant) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Participant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Participant.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 *Participant) XXX_Merge(src proto.Message) {
xxx_messageInfo_Participant.Merge(m, src)
}
func (m *Participant) XXX_Size() int {
return m.Size()
}
func (m *Participant) XXX_DiscardUnknown() {
xxx_messageInfo_Participant.DiscardUnknown(m)
}
var xxx_messageInfo_Participant proto.InternalMessageInfo
func (m *Participant) GetCosmosAddress() string {
if m != nil {
return m.CosmosAddress
}
return ""
}
func (m *Participant) GetEthereumAddress() string {
if m != nil {
return m.EthereumAddress
}
return ""
}
// EthPayload defines the payload that is signed by the ethereum private key
type EthPayload struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" json:"address" yaml:"address"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty" json:"msg" yaml:"msg"`
}
func (m *EthPayload) Reset() { *m = EthPayload{} }
func (m *EthPayload) String() string { return proto.CompactTextString(m) }
func (*EthPayload) ProtoMessage() {}
func (*EthPayload) Descriptor() ([]byte, []int) {
return fileDescriptor_59afed779274eaf0, []int{2}
}
func (m *EthPayload) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EthPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EthPayload.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 *EthPayload) XXX_Merge(src proto.Message) {
xxx_messageInfo_EthPayload.Merge(m, src)
}
func (m *EthPayload) XXX_Size() int {
return m.Size()
}
func (m *EthPayload) XXX_DiscardUnknown() {
xxx_messageInfo_EthPayload.DiscardUnknown(m)
}
var xxx_messageInfo_EthPayload proto.InternalMessageInfo
func (m *EthPayload) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func (m *EthPayload) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
func init() {
proto.RegisterType((*Params)(nil), "cerc.onboarding.v1.Params")
proto.RegisterType((*Participant)(nil), "cerc.onboarding.v1.Participant")
proto.RegisterType((*EthPayload)(nil), "cerc.onboarding.v1.EthPayload")
}
func init() {
@@ -70,18 +177,27 @@ func init() {
}
var fileDescriptor_59afed779274eaf0 = []byte{
// 176 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x4e, 0x2d, 0x4a,
0xd6, 0xcf, 0xcf, 0x4b, 0xca, 0x4f, 0x2c, 0x4a, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x33, 0x44, 0xe2,
0xe9, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x81, 0x14, 0xe9, 0x21, 0x09, 0x97, 0x19, 0x4a,
0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, 0xf5, 0x41, 0x2c, 0x88, 0x4a, 0x29, 0xb9, 0xe4, 0xfc,
0xe2, 0xdc, 0xfc, 0x62, 0xfd, 0xa4, 0xc4, 0xe2, 0x54, 0xfd, 0x32, 0xc3, 0xa4, 0xd4, 0x92, 0x44,
0x43, 0xfd, 0xe4, 0xfc, 0xcc, 0x3c, 0x88, 0xbc, 0x12, 0x07, 0x17, 0x5b, 0x40, 0x62, 0x51, 0x62,
0x6e, 0xb1, 0x93, 0xd3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7,
0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa4,
0x67, 0x96, 0xe8, 0x95, 0xa5, 0x24, 0xe9, 0x95, 0xe4, 0xeb, 0x83, 0x2c, 0xd6, 0xcd, 0xcc, 0xd7,
0xcf, 0x49, 0x4c, 0xce, 0xcf, 0xcb, 0x4c, 0x4e, 0xd1, 0xaf, 0x40, 0x72, 0x5d, 0x12, 0x1b, 0xd8,
0x50, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x41, 0xff, 0xee, 0x2e, 0xc5, 0x00, 0x00, 0x00,
// 313 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4a, 0x03, 0x31,
0x14, 0x85, 0x3b, 0x0a, 0x55, 0x23, 0xfe, 0x30, 0x28, 0xa8, 0x60, 0xa6, 0x8e, 0x9b, 0x42, 0x71,
0x42, 0xe9, 0x4e, 0x57, 0x16, 0xdc, 0x97, 0x2e, 0x5c, 0xb8, 0x50, 0xd2, 0x64, 0x48, 0x23, 0xcd,
0xdc, 0x92, 0xc4, 0xc1, 0xbe, 0x85, 0x2f, 0x25, 0xb8, 0xec, 0xd2, 0xd5, 0x20, 0xed, 0x1b, 0xcc,
0x13, 0xc8, 0x34, 0x9d, 0x32, 0x6d, 0x77, 0xb9, 0xe7, 0x9e, 0xf3, 0xe5, 0xc2, 0x41, 0xb7, 0x2c,
0xd6, 0x8c, 0x40, 0x32, 0x00, 0xaa, 0xb9, 0x4c, 0x04, 0x49, 0xdb, 0x95, 0x29, 0x1a, 0x6b, 0xb0,
0xe0, 0xfb, 0x85, 0x29, 0xaa, 0xc8, 0x69, 0xfb, 0xea, 0x4c, 0x80, 0x80, 0xc5, 0x9a, 0x14, 0x2f,
0xe7, 0x0c, 0xf7, 0x51, 0xbd, 0x47, 0x35, 0x55, 0x26, 0xfc, 0xf6, 0xd0, 0x61, 0x8f, 0x6a, 0x2b,
0x99, 0x1c, 0xd3, 0xc4, 0xfa, 0xcf, 0xe8, 0x98, 0x81, 0x51, 0x60, 0xde, 0x28, 0xe7, 0x3a, 0x36,
0xe6, 0xc2, 0x6b, 0x78, 0xcd, 0x83, 0x2e, 0xc9, 0xb3, 0xa0, 0xf5, 0x6e, 0x20, 0xb9, 0x0f, 0xd7,
0xf7, 0x61, 0x63, 0x42, 0xd5, 0x68, 0x4b, 0xed, 0x1f, 0x39, 0xe1, 0xd1, 0xcd, 0xfe, 0x2b, 0x3a,
0x8d, 0xed, 0x30, 0xd6, 0xf1, 0x87, 0x5a, 0x91, 0x77, 0x16, 0xe4, 0x4e, 0x9e, 0x05, 0xc4, 0x91,
0x37, 0x1d, 0x25, 0x7b, 0x4b, 0xef, 0x9f, 0x94, 0xd2, 0x92, 0x1f, 0xa6, 0x08, 0x3d, 0xd9, 0x61,
0x8f, 0x4e, 0x46, 0x40, 0xb9, 0xff, 0x80, 0xf6, 0xd6, 0xcf, 0xbf, 0xc9, 0xb3, 0xe0, 0xda, 0x7d,
0xb2, 0xc1, 0x5e, 0x21, 0xcb, 0x84, 0xdf, 0x42, 0xbb, 0xca, 0x88, 0xe5, 0x75, 0x97, 0x79, 0x16,
0x9c, 0xbb, 0xa0, 0x32, 0xa2, 0x0c, 0x15, 0xcf, 0x7e, 0xe1, 0xea, 0x76, 0x7f, 0x66, 0xd8, 0x9b,
0xce, 0xb0, 0xf7, 0x37, 0xc3, 0xde, 0xd7, 0x1c, 0xd7, 0xa6, 0x73, 0x5c, 0xfb, 0x9d, 0xe3, 0xda,
0x4b, 0x53, 0x48, 0x1b, 0xa5, 0x7c, 0x10, 0x59, 0x20, 0x45, 0x31, 0x77, 0x12, 0xc8, 0x88, 0x32,
0x48, 0x24, 0xe3, 0xe4, 0xb3, 0xd2, 0xde, 0xa0, 0xbe, 0x28, 0xa5, 0xf3, 0x1f, 0x00, 0x00, 0xff,
0xff, 0x48, 0x0e, 0x81, 0xbf, 0xe5, 0x01, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -107,6 +223,80 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *Participant) 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 *Participant) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Participant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.EthereumAddress) > 0 {
i -= len(m.EthereumAddress)
copy(dAtA[i:], m.EthereumAddress)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.EthereumAddress)))
i--
dAtA[i] = 0x12
}
if len(m.CosmosAddress) > 0 {
i -= len(m.CosmosAddress)
copy(dAtA[i:], m.CosmosAddress)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.CosmosAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EthPayload) 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 *EthPayload) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EthPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Msg) > 0 {
i -= len(m.Msg)
copy(dAtA[i:], m.Msg)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.Msg)))
i--
dAtA[i] = 0x12
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintOnboarding(dAtA []byte, offset int, v uint64) int {
offset -= sovOnboarding(v)
base := offset
@@ -127,6 +317,40 @@ func (m *Params) Size() (n int) {
return n
}
func (m *Participant) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.CosmosAddress)
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
l = len(m.EthereumAddress)
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
return n
}
func (m *EthPayload) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
l = len(m.Msg)
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
return n
}
func sovOnboarding(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -183,6 +407,234 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Participant) 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 ErrIntOverflowOnboarding
}
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: Participant: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Participant: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CosmosAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOnboarding
}
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 ErrInvalidLengthOnboarding
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOnboarding
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CosmosAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthereumAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOnboarding
}
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 ErrInvalidLengthOnboarding
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOnboarding
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EthereumAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipOnboarding(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthOnboarding
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EthPayload) 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 ErrIntOverflowOnboarding
}
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: EthPayload: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EthPayload: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOnboarding
}
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 ErrInvalidLengthOnboarding
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOnboarding
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOnboarding
}
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 ErrInvalidLengthOnboarding
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOnboarding
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Msg = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipOnboarding(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthOnboarding
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipOnboarding(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
+36
View File
@@ -0,0 +1,36 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/onboarding/v1/query.proto
package onboarding
import (
fmt "fmt"
proto "github.com/cosmos/gogoproto/proto"
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("cerc/onboarding/v1/query.proto", fileDescriptor_80831d904221d27d) }
var fileDescriptor_80831d904221d27d = []byte{
// 130 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4e, 0x2d, 0x4a,
0xd6, 0xcf, 0xcf, 0x4b, 0xca, 0x4f, 0x2c, 0x4a, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x33, 0xd4, 0x2f,
0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x02, 0xc9, 0xeb, 0x21,
0xe4, 0xf5, 0xca, 0x0c, 0x9d, 0x9c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1,
0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21,
0x4a, 0x23, 0x3d, 0xb3, 0x44, 0xaf, 0x2c, 0x25, 0x49, 0xaf, 0x24, 0x5f, 0x1f, 0xa4, 0x51, 0x37,
0x33, 0x5f, 0x3f, 0x27, 0x31, 0x39, 0x3f, 0x2f, 0x33, 0x39, 0x45, 0xbf, 0x02, 0xc9, 0x9a, 0x24,
0x36, 0xb0, 0xf1, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0x20, 0xf3, 0xc5, 0x80, 0x00,
0x00, 0x00,
}
+695
View File
@@ -0,0 +1,695 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/onboarding/v1/tx.proto
package onboarding
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// MsgOnboardParticipant defines a SDK message for enrolling a new validator.
type MsgOnboardParticipant struct {
// Participant is the msg sender
Participant string `protobuf:"bytes,1,opt,name=participant,proto3" json:"participant,omitempty"`
EthPayload EthPayload `protobuf:"bytes,2,opt,name=eth_payload,json=ethPayload,proto3" json:"eth_payload"`
EthSignature string `protobuf:"bytes,3,opt,name=eth_signature,json=ethSignature,proto3" json:"eth_signature,omitempty"`
Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
}
func (m *MsgOnboardParticipant) Reset() { *m = MsgOnboardParticipant{} }
func (m *MsgOnboardParticipant) String() string { return proto.CompactTextString(m) }
func (*MsgOnboardParticipant) ProtoMessage() {}
func (*MsgOnboardParticipant) Descriptor() ([]byte, []int) {
return fileDescriptor_6bfde34a550e231e, []int{0}
}
func (m *MsgOnboardParticipant) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgOnboardParticipant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgOnboardParticipant.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 *MsgOnboardParticipant) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgOnboardParticipant.Merge(m, src)
}
func (m *MsgOnboardParticipant) XXX_Size() int {
return m.Size()
}
func (m *MsgOnboardParticipant) XXX_DiscardUnknown() {
xxx_messageInfo_MsgOnboardParticipant.DiscardUnknown(m)
}
var xxx_messageInfo_MsgOnboardParticipant proto.InternalMessageInfo
func (m *MsgOnboardParticipant) GetParticipant() string {
if m != nil {
return m.Participant
}
return ""
}
func (m *MsgOnboardParticipant) GetEthPayload() EthPayload {
if m != nil {
return m.EthPayload
}
return EthPayload{}
}
func (m *MsgOnboardParticipant) GetEthSignature() string {
if m != nil {
return m.EthSignature
}
return ""
}
func (m *MsgOnboardParticipant) GetMessage() string {
if m != nil {
return m.Message
}
return ""
}
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type.
type MsgOnboardParticipantResponse struct {
}
func (m *MsgOnboardParticipantResponse) Reset() { *m = MsgOnboardParticipantResponse{} }
func (m *MsgOnboardParticipantResponse) String() string { return proto.CompactTextString(m) }
func (*MsgOnboardParticipantResponse) ProtoMessage() {}
func (*MsgOnboardParticipantResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6bfde34a550e231e, []int{1}
}
func (m *MsgOnboardParticipantResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgOnboardParticipantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgOnboardParticipantResponse.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 *MsgOnboardParticipantResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgOnboardParticipantResponse.Merge(m, src)
}
func (m *MsgOnboardParticipantResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgOnboardParticipantResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgOnboardParticipantResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgOnboardParticipantResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgOnboardParticipant)(nil), "cerc.onboarding.v1.MsgOnboardParticipant")
proto.RegisterType((*MsgOnboardParticipantResponse)(nil), "cerc.onboarding.v1.MsgOnboardParticipantResponse")
}
func init() { proto.RegisterFile("cerc/onboarding/v1/tx.proto", fileDescriptor_6bfde34a550e231e) }
var fileDescriptor_6bfde34a550e231e = []byte{
// 384 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xc1, 0x8a, 0x1a, 0x41,
0x14, 0x9c, 0x56, 0x93, 0x90, 0x36, 0x81, 0xd0, 0x24, 0x64, 0x98, 0x24, 0xa3, 0x8c, 0x87, 0xa8,
0x90, 0x69, 0x34, 0xb7, 0x1c, 0x05, 0x8f, 0x12, 0x31, 0xb7, 0x5c, 0xa4, 0x9d, 0x69, 0xda, 0x06,
0xa7, 0xdf, 0x30, 0xdd, 0x11, 0x73, 0x0b, 0x7e, 0x41, 0x60, 0x3f, 0x61, 0x7f, 0x40, 0xf6, 0x2b,
0x3c, 0xba, 0xec, 0x65, 0x4f, 0xcb, 0xa2, 0x0b, 0xfe, 0xc6, 0xe2, 0xa8, 0xeb, 0xc0, 0xce, 0xc2,
0xde, 0xde, 0xab, 0x2a, 0xaa, 0x5e, 0xf1, 0xf0, 0xa7, 0x80, 0x27, 0x01, 0x05, 0x35, 0x02, 0x96,
0x84, 0x52, 0x09, 0x3a, 0x6d, 0x51, 0x33, 0xf3, 0xe3, 0x04, 0x0c, 0x10, 0xb2, 0x23, 0xfd, 0x13,
0xe9, 0x4f, 0x5b, 0xce, 0xc7, 0x00, 0x74, 0x04, 0x9a, 0x46, 0x3a, 0xd5, 0x46, 0x5a, 0xec, 0xc5,
0xce, 0x67, 0x01, 0x20, 0x26, 0x9c, 0xb2, 0x58, 0x52, 0xa6, 0x14, 0x18, 0x66, 0x24, 0x28, 0x7d,
0x60, 0xdf, 0x0b, 0x10, 0x90, 0x8e, 0x74, 0x37, 0x1d, 0xd0, 0x5a, 0x4e, 0x7a, 0x26, 0x2e, 0x15,
0x79, 0x97, 0x08, 0x7f, 0xe8, 0x69, 0xf1, 0x73, 0x8f, 0xf7, 0x59, 0x62, 0x64, 0x20, 0x63, 0xa6,
0x0c, 0xa9, 0xe2, 0x72, 0x7c, 0x5a, 0x6d, 0x54, 0x45, 0xf5, 0xd7, 0x83, 0x2c, 0x44, 0xba, 0xb8,
0xcc, 0xcd, 0x78, 0x18, 0xb3, 0xbf, 0x13, 0x60, 0xa1, 0x5d, 0xa8, 0xa2, 0x7a, 0xb9, 0xed, 0xfa,
0x8f, 0x7b, 0xf9, 0x5d, 0x33, 0xee, 0xef, 0x55, 0x9d, 0xd2, 0xf2, 0xa6, 0x62, 0x0d, 0x30, 0x7f,
0x40, 0x48, 0x0d, 0xbf, 0xdd, 0xd9, 0x68, 0x29, 0x14, 0x33, 0x7f, 0x12, 0x6e, 0x17, 0xd3, 0xa8,
0x37, 0xdc, 0x8c, 0x7f, 0x1d, 0x31, 0x62, 0xe3, 0x57, 0x11, 0xd7, 0x9a, 0x09, 0x6e, 0x97, 0x52,
0xfa, 0xb8, 0xfe, 0x78, 0x37, 0xdf, 0x2e, 0x9a, 0xd9, 0xbb, 0xbc, 0x0a, 0xfe, 0x92, 0x5b, 0x69,
0xc0, 0x75, 0x0c, 0x4a, 0xf3, 0xf6, 0x05, 0xc2, 0xc5, 0x9e, 0x16, 0xe4, 0x1c, 0x61, 0x92, 0xd3,
0xbc, 0x91, 0x57, 0x21, 0xd7, 0xd1, 0x69, 0x3d, 0x5b, 0x7a, 0x0c, 0xf7, 0xe8, 0xfc, 0xea, 0xee,
0xac, 0xd0, 0xf0, 0xbe, 0xd2, 0xa7, 0xff, 0x33, 0xcc, 0xd4, 0x71, 0x5e, 0xfc, 0xdb, 0x2e, 0x9a,
0xa8, 0xd3, 0x59, 0xae, 0x5d, 0xb4, 0x5a, 0xbb, 0xe8, 0x76, 0xed, 0xa2, 0xff, 0x1b, 0xd7, 0x5a,
0x6d, 0x5c, 0xeb, 0x7a, 0xe3, 0x5a, 0xbf, 0xeb, 0x42, 0x1a, 0x7f, 0x1a, 0x8e, 0x7c, 0x03, 0xa9,
0xe7, 0x37, 0x09, 0x74, 0xc2, 0x02, 0x50, 0x32, 0x08, 0xe9, 0x2c, 0x93, 0x30, 0x7a, 0x99, 0x3e,
0xfd, 0xfb, 0x7d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xe2, 0xe0, 0x84, 0x99, 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 {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error) {
out := new(MsgOnboardParticipantResponse)
err := c.cc.Invoke(ctx, "/cerc.onboarding.v1.Msg/OnboardParticipant", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(context.Context, *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) OnboardParticipant(ctx context.Context, req *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnboardParticipant not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_OnboardParticipant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgOnboardParticipant)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).OnboardParticipant(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cerc.onboarding.v1.Msg/OnboardParticipant",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).OnboardParticipant(ctx, req.(*MsgOnboardParticipant))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.onboarding.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "OnboardParticipant",
Handler: _Msg_OnboardParticipant_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/onboarding/v1/tx.proto",
}
func (m *MsgOnboardParticipant) 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 *MsgOnboardParticipant) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgOnboardParticipant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Message) > 0 {
i -= len(m.Message)
copy(dAtA[i:], m.Message)
i = encodeVarintTx(dAtA, i, uint64(len(m.Message)))
i--
dAtA[i] = 0x22
}
if len(m.EthSignature) > 0 {
i -= len(m.EthSignature)
copy(dAtA[i:], m.EthSignature)
i = encodeVarintTx(dAtA, i, uint64(len(m.EthSignature)))
i--
dAtA[i] = 0x1a
}
{
size, err := m.EthPayload.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Participant) > 0 {
i -= len(m.Participant)
copy(dAtA[i:], m.Participant)
i = encodeVarintTx(dAtA, i, uint64(len(m.Participant)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgOnboardParticipantResponse) 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 *MsgOnboardParticipantResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgOnboardParticipantResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgOnboardParticipant) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Participant)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.EthPayload.Size()
n += 1 + l + sovTx(uint64(l))
l = len(m.EthSignature)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Message)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgOnboardParticipantResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgOnboardParticipant) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgOnboardParticipant: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgOnboardParticipant: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Participant", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Participant = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthPayload", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.EthPayload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthSignature", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EthSignature = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Message = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgOnboardParticipantResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgOnboardParticipantResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgOnboardParticipantResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
+171
View File
@@ -0,0 +1,171 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: cerc/onboarding/v1/tx.proto
/*
Package onboarding is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package onboarding
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
var (
filter_Msg_OnboardParticipant_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Msg_OnboardParticipant_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgOnboardParticipant
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_OnboardParticipant_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.OnboardParticipant(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Msg_OnboardParticipant_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgOnboardParticipant
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_OnboardParticipant_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.OnboardParticipant(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 to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
mux.Handle("POST", pattern_Msg_OnboardParticipant_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Msg_OnboardParticipant_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_OnboardParticipant_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_OnboardParticipant_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_OnboardParticipant_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_OnboardParticipant_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Msg_OnboardParticipant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "onboarding", "v1", "onboard_participant"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Msg_OnboardParticipant_0 = runtime.ForwardResponseMessage
)
+5 -5
View File
@@ -52,21 +52,21 @@ func NewAppModuleBasic(m AppModule) module.AppModuleBasic {
// module.AppModuleBasic
// Name returns the checkers module's name.
// Name returns the registry module's name.
func (AppModule) Name() string { return registrytypes.ModuleName }
// RegisterLegacyAminoCodec registers the checkers module's types on the LegacyAmino codec.
// RegisterLegacyAminoCodec registers the registry module's types on the LegacyAmino codec.
// New modules do not need to support Amino.
func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the checkers module.
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the registry module.
func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) {
if err := registrytypes.RegisterQueryHandlerClient(context.Background(), mux, registrytypes.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}
// RegisterInterfaces registers interfaces and implementations of the checkers module.
// RegisterInterfaces registers interfaces and implementations of the registry module.
func (AppModule) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registrytypes.RegisterInterfaces(registry)
}
@@ -91,7 +91,7 @@ func (AppModule) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig,
return data.Validate()
}
// InitGenesis performs genesis initialization for the checkers module.
// InitGenesis performs genesis initialization for the registry module.
// It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesisState registrytypes.GenesisState