laconicd/x/onboarding/onboarding.pb.go
Isha Venikar a21e9ea387 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>
2024-07-16 09:25:39 +05:30

722 lines
18 KiB
Go

// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/onboarding/v1/onboarding.proto
package onboarding
import (
fmt "fmt"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters of the onboarding module.
type Params struct {
}
func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_59afed779274eaf0, []int{0}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
// 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() {
proto.RegisterFile("cerc/onboarding/v1/onboarding.proto", fileDescriptor_59afed779274eaf0)
}
var fileDescriptor_59afed779274eaf0 = []byte{
// 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, 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, 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) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (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
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (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
}
func sozOnboarding(x uint64) (n int) {
return sovOnboarding(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 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: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := 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 *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
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowOnboarding
}
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, ErrIntOverflowOnboarding
}
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, ErrIntOverflowOnboarding
}
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, ErrInvalidLengthOnboarding
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupOnboarding
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthOnboarding
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthOnboarding = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowOnboarding = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupOnboarding = fmt.Errorf("proto: unexpected end of group")
)