diff --git a/abci/validator_set.go b/abci/validator_set.go index d38196ba..cf7eb3f8 100644 --- a/abci/validator_set.go +++ b/abci/validator_set.go @@ -92,10 +92,7 @@ func (h *ABCIHandler) calculateValidatorSetRoot(ctx sdk.Context, valInfo []staki return nil, ErrValidatorSetRootHashFailed } - validatorRoot, err := merklelist.NewMerkleList(ValidatorSetMerklePrefix) - if err != nil { - return nil, fmt.Errorf("%w: %v", ErrValidatorSetRootHashFailed, err) - } + validatorRoot := merklelist.NewMerkleList(ValidatorSetMerklePrefix) for _, validator := range valInfo { consAddr, err := validator.GetConsAddr() diff --git a/api/pulsarchain/abci/payload.pb.go b/api/pulsarchain/abci/payload.pb.go new file mode 100644 index 00000000..6adc1b07 --- /dev/null +++ b/api/pulsarchain/abci/payload.pb.go @@ -0,0 +1,590 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/abci/payload.proto + +package abcipb + +import ( + fmt "fmt" + 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 + +type Payload struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Votes []*Votes `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes,omitempty"` +} + +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} +func (*Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_5a138d1c833ef562, []int{0} +} +func (m *Payload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Payload.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 *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(m, src) +} +func (m *Payload) XXX_Size() int { + return m.Size() +} +func (m *Payload) XXX_DiscardUnknown() { + xxx_messageInfo_Payload.DiscardUnknown(m) +} + +var xxx_messageInfo_Payload proto.InternalMessageInfo + +func (m *Payload) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *Payload) GetVotes() []*Votes { + if m != nil { + return m.Votes + } + return nil +} + +type Votes struct { + ConsensusPublicKey string `protobuf:"bytes,1,opt,name=consensus_public_key,json=consensusPublicKey,proto3" json:"consensus_public_key,omitempty"` + VoteExtension []byte `protobuf:"bytes,2,opt,name=vote_extension,json=voteExtension,proto3" json:"vote_extension,omitempty"` +} + +func (m *Votes) Reset() { *m = Votes{} } +func (m *Votes) String() string { return proto.CompactTextString(m) } +func (*Votes) ProtoMessage() {} +func (*Votes) Descriptor() ([]byte, []int) { + return fileDescriptor_5a138d1c833ef562, []int{1} +} +func (m *Votes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Votes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Votes.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 *Votes) XXX_Merge(src proto.Message) { + xxx_messageInfo_Votes.Merge(m, src) +} +func (m *Votes) XXX_Size() int { + return m.Size() +} +func (m *Votes) XXX_DiscardUnknown() { + xxx_messageInfo_Votes.DiscardUnknown(m) +} + +var xxx_messageInfo_Votes proto.InternalMessageInfo + +func (m *Votes) GetConsensusPublicKey() string { + if m != nil { + return m.ConsensusPublicKey + } + return "" +} + +func (m *Votes) GetVoteExtension() []byte { + if m != nil { + return m.VoteExtension + } + return nil +} + +func init() { + proto.RegisterType((*Payload)(nil), "pulsarchain.abci.Payload") + proto.RegisterType((*Votes)(nil), "pulsarchain.abci.Votes") +} + +func init() { proto.RegisterFile("pulsarchain/abci/payload.proto", fileDescriptor_5a138d1c833ef562) } + +var fileDescriptor_5a138d1c833ef562 = []byte{ + // 260 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x28, 0xcd, 0x29, + 0x4e, 0x2c, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x4f, 0x4c, 0x4a, 0xce, 0xd4, 0x2f, 0x48, 0xac, + 0xcc, 0xc9, 0x4f, 0x4c, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40, 0x92, 0xd7, 0x03, + 0xc9, 0x2b, 0x05, 0x70, 0xb1, 0x07, 0x40, 0x94, 0x08, 0x89, 0x71, 0xb1, 0x65, 0xa4, 0x66, 0xa6, + 0x67, 0x94, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x41, 0x79, 0x42, 0xba, 0x5c, 0xac, 0x65, + 0xf9, 0x25, 0xa9, 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xe2, 0x7a, 0xe8, 0x86, 0xe8, + 0x85, 0x81, 0xa4, 0x83, 0x20, 0xaa, 0x94, 0x12, 0xb8, 0x58, 0xc1, 0x7c, 0x21, 0x03, 0x2e, 0x91, + 0xe4, 0xfc, 0xbc, 0xe2, 0xd4, 0xbc, 0xe2, 0xd2, 0xe2, 0xf8, 0x82, 0xd2, 0xa4, 0x9c, 0xcc, 0xe4, + 0xf8, 0xec, 0xd4, 0x4a, 0xb0, 0xe9, 0x9c, 0x41, 0x42, 0x70, 0xb9, 0x00, 0xb0, 0x94, 0x77, 0x6a, + 0xa5, 0x90, 0x2a, 0x17, 0x1f, 0xc8, 0x8c, 0xf8, 0xd4, 0x8a, 0x92, 0xd4, 0xbc, 0xe2, 0xcc, 0xfc, + 0x3c, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x5e, 0x90, 0xa8, 0x2b, 0x4c, 0xd0, 0x29, 0xe2, + 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, + 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xec, 0xd2, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf2, 0x53, 0x52, 0x0d, 0x0d, 0x0c, 0x75, 0x33, 0xf3, + 0xf5, 0x21, 0x0e, 0xd6, 0x85, 0x06, 0x4b, 0x41, 0xa6, 0x3e, 0x7a, 0x30, 0x59, 0x83, 0x88, 0x82, + 0xa4, 0x24, 0x36, 0x70, 0x30, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x85, 0xf8, 0xb6, 0x21, + 0x48, 0x01, 0x00, 0x00, +} + +func (m *Payload) 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 *Payload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Payload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Height != 0 { + i = encodeVarintPayload(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Votes) 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 *Votes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Votes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VoteExtension) > 0 { + i -= len(m.VoteExtension) + copy(dAtA[i:], m.VoteExtension) + i = encodeVarintPayload(dAtA, i, uint64(len(m.VoteExtension))) + i-- + dAtA[i] = 0x12 + } + if len(m.ConsensusPublicKey) > 0 { + i -= len(m.ConsensusPublicKey) + copy(dAtA[i:], m.ConsensusPublicKey) + i = encodeVarintPayload(dAtA, i, uint64(len(m.ConsensusPublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPayload(dAtA []byte, offset int, v uint64) int { + offset -= sovPayload(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Payload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovPayload(uint64(m.Height)) + } + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovPayload(uint64(l)) + } + } + return n +} + +func (m *Votes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsensusPublicKey) + if l > 0 { + n += 1 + l + sovPayload(uint64(l)) + } + l = len(m.VoteExtension) + if l > 0 { + n += 1 + l + sovPayload(uint64(l)) + } + return n +} + +func sovPayload(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPayload(x uint64) (n int) { + return sovPayload(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Payload) 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 ErrIntOverflowPayload + } + 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: Payload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Payload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPayload + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPayload + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, &Votes{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPayload(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPayload + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Votes) 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 ErrIntOverflowPayload + } + 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: Votes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Votes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPublicKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + 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 ErrInvalidLengthPayload + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPayload + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsensusPublicKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteExtension", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPayload + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPayload + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VoteExtension = append(m.VoteExtension[:0], dAtA[iNdEx:postIndex]...) + if m.VoteExtension == nil { + m.VoteExtension = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPayload(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPayload + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPayload(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, ErrIntOverflowPayload + } + 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, ErrIntOverflowPayload + } + 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, ErrIntOverflowPayload + } + 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, ErrInvalidLengthPayload + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPayload + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPayload + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPayload = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPayload = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/app_config.go b/app/app_config.go index dc747fa5..fd2e8f2b 100644 --- a/app/app_config.go +++ b/app/app_config.go @@ -3,6 +3,8 @@ package app import ( "time" + _ "github.com/node101-io/pulsar-chain/x/bridge/module" + bridgemoduletypes "github.com/node101-io/pulsar-chain/x/bridge/types" _ "github.com/node101-io/pulsar-chain/x/keyregistry/module" keyregistrymoduletypes "github.com/node101-io/pulsar-chain/x/keyregistry/types" _ "github.com/node101-io/pulsar-chain/x/pulsar/module" @@ -88,6 +90,7 @@ var ( {Account: nft.ModuleName}, {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, {Account: icatypes.ModuleName}, + {Account: bridgemoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, } // blocked account addresses @@ -98,6 +101,7 @@ var ( stakingtypes.BondedPoolName, stakingtypes.NotBondedPoolName, nft.ModuleName, + bridgemoduletypes.ModuleName, // We allow the following module accounts to receive funds: // govtypes.ModuleName } @@ -133,6 +137,7 @@ var ( pulsarmoduletypes.ModuleName, keyregistrymoduletypes.ModuleName, votepersistencemoduletypes.ModuleName, + bridgemoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers }, EndBlockers: []string{ @@ -144,6 +149,7 @@ var ( pulsarmoduletypes.ModuleName, keyregistrymoduletypes.ModuleName, votepersistencemoduletypes.ModuleName, + bridgemoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers }, // The following is mostly only needed when ModuleName != StoreKey name. @@ -183,6 +189,7 @@ var ( pulsarmoduletypes.ModuleName, keyregistrymoduletypes.ModuleName, votepersistencemoduletypes.ModuleName, + bridgemoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis }, }), @@ -279,6 +286,10 @@ var ( Name: epochstypes.ModuleName, Config: appconfig.WrapAny(&epochsmodulev1.Module{}), }, + { + Name: bridgemoduletypes.ModuleName, + Config: appconfig.WrapAny(&bridgemoduletypes.Module{}), + }, { Name: pulsarmoduletypes.ModuleName, Config: appconfig.WrapAny(&pulsarmoduletypes.Module{}), diff --git a/buf.lock b/buf.lock index 2da6522e..fd28dbd0 100644 --- a/buf.lock +++ b/buf.lock @@ -17,8 +17,8 @@ deps: commit: dc427cb4519143d8996361c045a29ad7 digest: b5:8693e72e230bfaf58a88a47a4093ba99f6252c1957a45582567959b38a8563e2abd11443372283d75f4f2306a7e3cc9bf63604d284a016c11966fca4b74b7a28 - name: buf.build/googleapis/googleapis - commit: 536964a08a534d51b8f30f2d6751f1f9 - digest: b5:3e05d27e797b00c345fadd3c15cf0e16c4cc693036a55059721e66d6ce22a96264a4897658c9243bb0874fa9ca96e437589eb512189d2754604a626c632f6030 + commit: c17df5b2beca46928cc87d5656bd5343 + digest: b5:648a01e0170d4512dea7d564016165decd1ed6e34bef79fe54753e51ad7e27545709ad9157d7551270147d551155c595a2fb0bf5bb33b1c83040ddbce915c604 - name: buf.build/protocolbuffers/wellknowntypes commit: 9d16d599a978406980f6e2f081331a93 digest: b5:dd06e497a5c52f5ddf6ec02b3c7d289cc6c0432093fc2f6bf7a4fb5fae786c3e4c893e55d2759ffb6833268daf3de0bce303a406fed15725790528f2c27dc219 diff --git a/docs/static/openapi.json b/docs/static/openapi.json index b3232407..ad0dae3b 100644 --- a/docs/static/openapi.json +++ b/docs/static/openapi.json @@ -1 +1 @@ -{"id":"github.com/node101-io/pulsar-chain","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/node101-io/pulsar-chain REST API","title":"HTTP API Console","contact":{"name":"github.com/node101-io/pulsar-chain"},"version":"version not set"},"paths":{"/node101-io/pulsar-chain/keyregistry/v1/get_user_cosmos_public_key/{user_mina_public_key}":{"get":{"tags":["Query"],"summary":"GetUserCosmosPublicKey Queries a list of GetUserCosmosPublicKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserCosmosPublicKey","parameters":[{"type":"string","format":"byte","name":"user_mina_public_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserCosmosPublicKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_user_mina_public_key/{user_cosmos_public_key}":{"get":{"tags":["Query"],"summary":"GetUserMinaPublicKey Queries a list of GetUserMinaPublicKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserMinaPublicKey","parameters":[{"type":"string","format":"byte","name":"user_cosmos_public_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserMinaPublicKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_cosmos_pub_key/{validator_mina_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorCosmosPubKey Queries a list of GetValidatorCosmosPubKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorCosmosPubKey","parameters":[{"type":"string","format":"byte","name":"validator_mina_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_mina_pub_key/{validator_cosmos_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorMinaPubKey Queries a list of GetValidatorMinaPubKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorMinaPubKey","parameters":[{"type":"string","format":"byte","name":"validator_cosmos_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin9","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/votepersistence/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin13","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/votepersistence/v1/vote_ext_body_by_height/{block_height}":{"get":{"tags":["Query"],"summary":"VoteExtBodyByHeight queries the vote extension body for a block height.","operationId":"GithubComnode101IopulsarChainQuery_VoteExtBodyByHeight","parameters":[{"type":"string","format":"int64","name":"block_height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.QueryVoteExtBodyByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/votepersistence/v1/vote_extensions":{"get":{"tags":["Query"],"summary":"VoteExtensions queries the currently persisted vote extensions.","operationId":"GithubComnode101IopulsarChainQuery_VoteExtensions","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.QueryVoteExtensionsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/pulsar/pulsar/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsar.pulsar.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}},"pulsar.pulsar.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsar.pulsar.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsar.pulsar.v1.Params"}}},"pulsarchain.keyregistry.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.keyregistry.v1.QueryGetUserCosmosPublicKeyResponse":{"description":"QueryGetUserCosmosPublicKeyResponse defines the QueryGetUserCosmosPublicKeyResponse message.","type":"object","properties":{"user_cosmos_public_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetUserMinaPublicKeyResponse":{"description":"QueryGetUserMinaPublicKeyResponse defines the QueryGetUserMinaPublicKeyResponse message.","type":"object","properties":{"user_mina_public_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse":{"description":"QueryGetValidatorCosmosPubKeyResponse defines the QueryGetValidatorCosmosPubKeyResponse message.","type":"object","properties":{"validator_cosmos_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse":{"description":"QueryGetValidatorMinaPubKeyResponse defines the QueryGetValidatorMinaPubKeyResponse message.","type":"object","properties":{"validator_mina_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.keyregistry.v1.Params"}}},"pulsarchain.votepersistence.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.votepersistence.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.votepersistence.v1.Params"}}},"pulsarchain.votepersistence.v1.QueryVoteExtBodyByHeightResponse":{"description":"QueryVoteExtBodyByHeightResponse defines the QueryVoteExtBodyByHeightResponse message.","type":"object","properties":{"vote_ext_body":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.VoteExtBody"}}},"pulsarchain.votepersistence.v1.QueryVoteExtensionsResponse":{"description":"QueryVoteExtensionsResponse defines the QueryVoteExtensionsResponse message.","type":"object","properties":{"persisted_vote_extensions_block_height":{"type":"string","format":"int64"},"query_block_height":{"type":"string","format":"int64"},"vote_extensions":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.votepersistence.v1.StoredVoteExtension"}}}},"pulsarchain.votepersistence.v1.StoredVoteExtension":{"description":"StoredVoteExtension defines a persisted Mina validator vote extension.","type":"object","properties":{"mina_public_key":{"type":"string","format":"byte"},"vote_extension":{"type":"string","format":"byte"}}},"pulsarchain.votepersistence.v1.VoteExtBody":{"description":"VoteExtBody defines the VoteExtBody message.","type":"object","properties":{"actions_reduced_root":{"type":"string"},"current_block_height":{"type":"string","format":"int64"},"current_state_root":{"type":"string","format":"byte"},"next_validator_set_hash":{"type":"string","format":"byte"}}}},"tags":[{"name":"Query"},{"name":"Msg"}]} \ No newline at end of file +{"id":"github.com/node101-io/pulsar-chain","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/node101-io/pulsar-chain REST API","title":"HTTP API Console","contact":{"name":"github.com/node101-io/pulsar-chain"},"version":"version not set"},"paths":{"/node101-io/pulsar-chain/abci/v1/vote_ext_body_by_height/{vote_extension_height}":{"get":{"tags":["Query"],"summary":"VoteExtBodyByHeight queries the vote extension body for a vote-extension\nconsensus height.","operationId":"GithubComnode101IopulsarChainQuery_VoteExtBodyByHeight","parameters":[{"type":"string","format":"int64","description":"vote_extension_height is the consensus height N where the vote extension is\nproduced. The returned body signs the transition from state N-2 to state N-1.","name":"vote_extension_height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.abci.QueryVoteExtBodyByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/bridge/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin10","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.bridge.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_user_cosmos_public_key/{user_mina_public_key}":{"get":{"tags":["Query"],"summary":"GetUserCosmosPublicKey Queries a list of GetUserCosmosPublicKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserCosmosPublicKey","parameters":[{"type":"string","format":"byte","name":"user_mina_public_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserCosmosPublicKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_user_mina_public_key/{user_cosmos_public_key}":{"get":{"tags":["Query"],"summary":"GetUserMinaPublicKey Queries a list of GetUserMinaPublicKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserMinaPublicKey","parameters":[{"type":"string","format":"byte","name":"user_cosmos_public_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserMinaPublicKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_cosmos_pub_key/{validator_mina_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorCosmosPubKey Queries a list of GetValidatorCosmosPubKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorCosmosPubKey","parameters":[{"type":"string","format":"byte","name":"validator_mina_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_mina_pub_key/{validator_cosmos_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorMinaPubKey Queries a list of GetValidatorMinaPubKey items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorMinaPubKey","parameters":[{"type":"string","format":"byte","name":"validator_cosmos_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin16","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/votepersistence/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin20","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/votepersistence/v1/vote_extensions":{"get":{"tags":["Query"],"summary":"VoteExtensions queries the currently persisted vote extensions.","operationId":"GithubComnode101IopulsarChainQuery_VoteExtensions","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.QueryVoteExtensionsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/pulsar/pulsar/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsar.pulsar.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}},"pulsar.pulsar.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsar.pulsar.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsar.pulsar.v1.Params"}}},"pulsarchain.abci.QueryVoteExtBodyByHeightResponse":{"description":"QueryVoteExtBodyByHeightResponse defines the response for VoteExtBodyByHeight.","type":"object","properties":{"vote_ext_body":{"$ref":"#/definitions/pulsarchain.votepersistence.v1.VoteExtBody"}}},"pulsarchain.bridge.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.bridge.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.bridge.v1.Params"}}},"pulsarchain.keyregistry.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.keyregistry.v1.QueryGetUserCosmosPublicKeyResponse":{"description":"QueryGetUserCosmosPublicKeyResponse defines the QueryGetUserCosmosPublicKeyResponse message.","type":"object","properties":{"user_cosmos_public_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetUserMinaPublicKeyResponse":{"description":"QueryGetUserMinaPublicKeyResponse defines the QueryGetUserMinaPublicKeyResponse message.","type":"object","properties":{"user_mina_public_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse":{"description":"QueryGetValidatorCosmosPubKeyResponse defines the QueryGetValidatorCosmosPubKeyResponse message.","type":"object","properties":{"validator_cosmos_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse":{"description":"QueryGetValidatorMinaPubKeyResponse defines the QueryGetValidatorMinaPubKeyResponse message.","type":"object","properties":{"validator_mina_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.keyregistry.v1.Params"}}},"pulsarchain.votepersistence.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.votepersistence.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.votepersistence.v1.Params"}}},"pulsarchain.votepersistence.v1.QueryVoteExtensionsResponse":{"description":"QueryVoteExtensionsResponse defines the QueryVoteExtensionsResponse message.","type":"object","properties":{"persisted_vote_extensions_block_height":{"description":"persisted_vote_extensions_block_height is the signed source/current state\nheight. For vote extensions produced at height N, this value is N-2.","type":"string","format":"int64"},"query_block_height":{"type":"string","format":"int64"},"vote_extensions":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.votepersistence.v1.StoredVoteExtension"}}}},"pulsarchain.votepersistence.v1.StoredVoteExtension":{"description":"StoredVoteExtension defines a persisted Mina validator vote extension.","type":"object","properties":{"mina_public_key":{"type":"string","format":"byte"},"vote_extension":{"type":"string","format":"byte"}}},"pulsarchain.votepersistence.v1.VoteExtBody":{"description":"VoteExtBody defines the VoteExtBody message.","type":"object","properties":{"actions_reduced_root":{"type":"string"},"current_block_height":{"type":"string","format":"int64"},"current_state_root":{"type":"string","format":"byte"},"next_validator_set_hash":{"type":"string","format":"byte"}}}},"tags":[{"name":"Query"},{"name":"Msg"}]} \ No newline at end of file diff --git a/go.mod b/go.mod index ce73609e..dd5a1f1f 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/node101-io/mina-signer-go v0.0.0-20260528161125-58c8e2225973 + github.com/node101-io/mina-signer-go v0.0.0-20260601165332-9dc4888e6819 github.com/spf13/cast v1.10.0 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 diff --git a/go.sum b/go.sum index a546db23..f44c2ca3 100644 --- a/go.sum +++ b/go.sum @@ -1674,6 +1674,8 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/node101-io/mina-signer-go v0.0.0-20260528161125-58c8e2225973 h1:BcjpAAukbhts/ttAtpzof+Ek91D7Kc5wQ2txPbhZOMI= github.com/node101-io/mina-signer-go v0.0.0-20260528161125-58c8e2225973/go.mod h1:vGZaN+qwZwJzSm5WQ4hTs95ULhysLLhz7kV+SLj4Abc= +github.com/node101-io/mina-signer-go v0.0.0-20260601165332-9dc4888e6819 h1:PYnyy92xzQ8oNjsydAenjPURHvOcTu6lsPiJ0iFYCoI= +github.com/node101-io/mina-signer-go v0.0.0-20260601165332-9dc4888e6819/go.mod h1:vGZaN+qwZwJzSm5WQ4hTs95ULhysLLhz7kV+SLj4Abc= github.com/nunnatsa/ginkgolinter v0.19.1 h1:mjwbOlDQxZi9Cal+KfbEJTCz327OLNfwNvoZ70NJ+c4= github.com/nunnatsa/ginkgolinter v0.19.1/go.mod h1:jkQ3naZDmxaZMXPWaS9rblH+i+GWXQCaS/JFIWcOH2s= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/proto/pulsarchain/bridge/module/v1/module.proto b/proto/pulsarchain/bridge/module/v1/module.proto new file mode 100644 index 00000000..814a8911 --- /dev/null +++ b/proto/pulsarchain/bridge/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package pulsarchain.bridge.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = {go_import: "github.com/node101-io/pulsar-chain/x/bridge"}; + + // authority defines the custom module authority. + // If not set, defaults to the governance module. + string authority = 1; +} diff --git a/proto/pulsarchain/bridge/v1/action.proto b/proto/pulsarchain/bridge/v1/action.proto new file mode 100644 index 00000000..9bf40176 --- /dev/null +++ b/proto/pulsarchain/bridge/v1/action.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package pulsarchain.bridge.v1; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +enum ActionType { + UNSPECIFIED = 0; + DEPOSIT = 1; + WITHDRAW = 2; +} + + +message Action { + int64 block_height = 1; + bytes fee_payer = 2; + ActionType action_type = 3; + int64 amount = 4; +} diff --git a/proto/pulsarchain/bridge/v1/bridge_state.proto b/proto/pulsarchain/bridge/v1/bridge_state.proto new file mode 100644 index 00000000..8a346cb4 --- /dev/null +++ b/proto/pulsarchain/bridge/v1/bridge_state.proto @@ -0,0 +1,11 @@ +// proto/pulsarchain/bridge/v1/state.proto +syntax = "proto3"; +package pulsarchain.bridge.v1; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +message BridgeState { + int64 latest_fetched_mina_height = 1; + + bytes actions_reduced_root = 2; +} diff --git a/proto/pulsarchain/bridge/v1/genesis.proto b/proto/pulsarchain/bridge/v1/genesis.proto new file mode 100644 index 00000000..d6323847 --- /dev/null +++ b/proto/pulsarchain/bridge/v1/genesis.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package pulsarchain.bridge.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "pulsarchain/bridge/v1/params.proto"; +import "pulsarchain/bridge/v1/bridge_state.proto"; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +// GenesisState defines the bridge module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + BridgeState bridge_state = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/pulsarchain/bridge/v1/params.proto b/proto/pulsarchain/bridge/v1/params.proto new file mode 100644 index 00000000..98bbe2b4 --- /dev/null +++ b/proto/pulsarchain/bridge/v1/params.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package pulsarchain.bridge.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "pulsarchain/x/bridge/Params"; + option (gogoproto.equal) = true; +} diff --git a/proto/pulsarchain/bridge/v1/query.proto b/proto/pulsarchain/bridge/v1/query.proto new file mode 100644 index 00000000..e71680ad --- /dev/null +++ b/proto/pulsarchain/bridge/v1/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package pulsarchain.bridge.v1; + +import "amino/amino.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "pulsarchain/bridge/v1/params.proto"; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/node101-io/pulsar-chain/bridge/v1/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/pulsarchain/bridge/v1/tx.proto b/proto/pulsarchain/bridge/v1/tx.proto new file mode 100644 index 00000000..67a1912c --- /dev/null +++ b/proto/pulsarchain/bridge/v1/tx.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package pulsarchain.bridge.v1; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "pulsarchain/bridge/v1/params.proto"; + +option go_package = "github.com/node101-io/pulsar-chain/x/bridge/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // PushNewActions defines the PushNewActions RPC. + rpc PushNewActions(MsgPushNewActions) returns (MsgPushNewActionsResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "pulsarchain/x/bridge/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +// MsgPushNewActions defines the MsgPushNewActions message. +message MsgPushNewActions { + option (cosmos.msg.v1.signer) = "creator"; + string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + int64 mina_block_height = 2; +} + +// MsgPushNewActionsResponse defines the MsgPushNewActionsResponse message. +message MsgPushNewActionsResponse {} diff --git a/proto/pulsarchain/keyregistry/v1/tx.proto b/proto/pulsarchain/keyregistry/v1/tx.proto index 3c8a4dae..324f8f08 100644 --- a/proto/pulsarchain/keyregistry/v1/tx.proto +++ b/proto/pulsarchain/keyregistry/v1/tx.proto @@ -6,8 +6,8 @@ import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "pulsarchain/keyregistry/v1/params.proto"; import "pulsarchain/keyregistry/v1/key_update_type.proto"; +import "pulsarchain/keyregistry/v1/params.proto"; option go_package = "github.com/node101-io/pulsar-chain/x/keyregistry/types"; diff --git a/x/bridge/keeper/genesis.go b/x/bridge/keeper/genesis.go new file mode 100644 index 00000000..cc10f07a --- /dev/null +++ b/x/bridge/keeper/genesis.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "context" + + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func (k Keeper) InitGenesis(ctx context.Context, genState types.GenesisState) error { + + err := k.BridgeState.Set(ctx, genState.BridgeState) + if err != nil { + return err + } + return k.Params.Set(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) { + var err error + + genesis := types.DefaultGenesis() + genesis.Params, err = k.Params.Get(ctx) + if err != nil { + return nil, err + } + + genesis.BridgeState, err = k.GetBridgeState(ctx) + if err != nil { + return nil, err + } + + return genesis, nil +} diff --git a/x/bridge/keeper/genesis_test.go b/x/bridge/keeper/genesis_test.go new file mode 100644 index 00000000..0973f70d --- /dev/null +++ b/x/bridge/keeper/genesis_test.go @@ -0,0 +1,26 @@ +package keeper_test + +import ( + "testing" + + "github.com/node101-io/pulsar-chain/x/bridge/types" + + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + BridgeState: types.DefaultBridgeState(), + } + + f := initFixture(t) + err := f.keeper.InitGenesis(f.ctx, genesisState) + require.NoError(t, err) + got, err := f.keeper.ExportGenesis(f.ctx) + require.NoError(t, err) + require.NotNil(t, got) + + require.EqualExportedValues(t, genesisState.Params, got.Params) + require.EqualExportedValues(t, genesisState.BridgeState, got.BridgeState) +} diff --git a/x/bridge/keeper/helpers_push_new_actions.go b/x/bridge/keeper/helpers_push_new_actions.go new file mode 100644 index 00000000..679e41ba --- /dev/null +++ b/x/bridge/keeper/helpers_push_new_actions.go @@ -0,0 +1,146 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/node101-io/pulsar-chain/x/bridge/types" + keyregistryTypes "github.com/node101-io/pulsar-chain/x/keyregistry/types" +) + +func (k *Keeper) isValid(ctx context.Context, act *types.Action) (bool, error) { + if k.keyRegistryKeeper == nil { + return false, types.ErrKeyRegistryKeeperNotConfigured + } + switch act.ActionType { + case types.ActionType_DEPOSIT: + return k.isValidDeposit(ctx, act) + case types.ActionType_WITHDRAW: + return k.isValidWithdrawal(ctx, act) + default: + return false, types.ErrUnspecified + } +} + +func (k *Keeper) isValidDeposit(ctx context.Context, act *types.Action) (bool, error) { + + exists, err := k.keyRegistryKeeper.UserMinaToCosmosHas(ctx, act.FeePayer) + if err != nil { + return false, err + } + if !exists { + return false, nil + } + return true, nil +} + +func (k *Keeper) isValidWithdrawal(ctx context.Context, act *types.Action) (bool, error) { + + exists, err := k.keyRegistryKeeper.UserMinaToCosmosHas(ctx, act.FeePayer) + if err != nil { + return false, err + } + if !exists { + return false, nil + } + + cosmosPubKey, err := k.keyRegistryKeeper.UserGetMinaToCosmos(ctx, act.FeePayer) + if err != nil { + return false, err + } + + addr, err := userAddressFromCosmosPubKey(cosmosPubKey) + if err != nil { + return false, err + } + + if k.bankKeeper.SpendableCoins(ctx, addr).AmountOf(types.Denom).Uint64() < uint64(act.Amount) { + return false, nil + } + + return true, nil +} + +func (k *Keeper) apply(ctx context.Context, act *types.Action) error { + + if k.bankKeeper == nil { + return types.ErrBankKeeperNotConfigured + } + + switch act.ActionType { + case types.ActionType_DEPOSIT: + return k.applyDeposit(ctx, act) + case types.ActionType_WITHDRAW: + return k.applyWithdrawal(ctx, act) + default: + return types.ErrUnspecified + } +} + +func (k *Keeper) applyDeposit(ctx context.Context, act *types.Action) error { + + cosmosPubKey, err := k.keyRegistryKeeper.UserGetMinaToCosmos(ctx, act.FeePayer) + if err != nil { + return err + } + + addr, err := userAddressFromCosmosPubKey(cosmosPubKey) + if err != nil { + return err + } + + coins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(act.Amount))) + + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins); err != nil { + return err + } + + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coins) +} + +func (k *Keeper) applyWithdrawal(ctx context.Context, act *types.Action) error { + + cosmosPubKey, err := k.keyRegistryKeeper.UserGetMinaToCosmos(ctx, act.FeePayer) + if err != nil { + return err + } + + addr, err := userAddressFromCosmosPubKey(cosmosPubKey) + if err != nil { + return err + } + + spendableCoins := k.bankKeeper.SpendableCoins(ctx, addr) + + minaAmount := spendableCoins.AmountOf(types.Denom) + + err = spendableCoins.Validate() + if err != nil { + return err + } + + if minaAmount.Uint64() < uint64(act.Amount) { + return types.ErrNotEnoughBalance + } + + coins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(act.Amount))) + + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, coins); err != nil { + return err + } + + return k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) +} + +func userAddressFromCosmosPubKey(cosmosPubKey []byte) (sdk.AccAddress, error) { + if len(cosmosPubKey) != secp256k1.PubKeySize { + return nil, errors.Wrap(keyregistryTypes.ErrInvalidPublicKey, "user cosmos public key must be compressed secp256k1 (33 bytes)") + } + + pubKey := secp256k1.PubKey{Key: cosmosPubKey} + + return sdk.AccAddress(pubKey.Address()), nil +} diff --git a/x/bridge/keeper/keeper.go b/x/bridge/keeper/keeper.go new file mode 100644 index 00000000..459402e2 --- /dev/null +++ b/x/bridge/keeper/keeper.go @@ -0,0 +1,83 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/collections" + "cosmossdk.io/core/address" + corestore "cosmossdk.io/core/store" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +const BridgeStateItemName string = "bridge_state" + +type Keeper struct { + storeService corestore.KVStoreService + cdc codec.Codec + addressCodec address.Codec + // Address capable of executing a MsgUpdateParams message. + // Typically, this should be the x/gov module account. + authority []byte + + Schema collections.Schema + Params collections.Item[types.Params] + BridgeState collections.Item[types.BridgeState] + + bankKeeper types.BankKeeper + keyRegistryKeeper types.KeyregistryKeeper +} + +func NewKeeper( + storeService corestore.KVStoreService, + cdc codec.Codec, + addressCodec address.Codec, + authority []byte, + bankKeeper types.BankKeeper, + keyRegistryKeeper types.KeyregistryKeeper, +) Keeper { + if _, err := addressCodec.BytesToString(authority); err != nil { + panic(fmt.Sprintf("invalid authority address %s: %s", authority, err)) + } + + sb := collections.NewSchemaBuilder(storeService) + + k := Keeper{ + storeService: storeService, + cdc: cdc, + addressCodec: addressCodec, + authority: authority, + + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + BridgeState: collections.NewItem( + sb, + types.BridgeStateKey, + BridgeStateItemName, + codec.CollValue[types.BridgeState](cdc), + ), + bankKeeper: bankKeeper, + keyRegistryKeeper: keyRegistryKeeper, + } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + + return k +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() []byte { + return k.authority +} + +func (k Keeper) GetBridgeState(ctx context.Context) (types.BridgeState, error) { + return k.BridgeState.Get(ctx) +} + +func (k Keeper) setBridgeState(ctx context.Context, st types.BridgeState) error { + return k.BridgeState.Set(ctx, st) +} diff --git a/x/bridge/keeper/keeper_test.go b/x/bridge/keeper/keeper_test.go new file mode 100644 index 00000000..06bca960 --- /dev/null +++ b/x/bridge/keeper/keeper_test.go @@ -0,0 +1,58 @@ +package keeper_test + +import ( + "context" + "testing" + + "cosmossdk.io/core/address" + storetypes "cosmossdk.io/store/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + module "github.com/node101-io/pulsar-chain/x/bridge/module" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +type fixture struct { + ctx context.Context + keeper keeper.Keeper + addressCodec address.Codec +} + +func initFixture(t *testing.T) *fixture { + t.Helper() + + encCfg := moduletestutil.MakeTestEncodingConfig(module.AppModule{}) + addressCodec := addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + storeService := runtime.NewKVStoreService(storeKey) + ctx := testutil.DefaultContextWithDB(t, storeKey, storetypes.NewTransientStoreKey("transient_test")).Ctx + + authority := authtypes.NewModuleAddress(types.GovModuleName) + + k := keeper.NewKeeper( + storeService, + encCfg.Codec, + addressCodec, + authority, + nil, + nil, + ) + + // Initialize params + if err := k.Params.Set(ctx, types.DefaultParams()); err != nil { + t.Fatalf("failed to set params: %v", err) + } + + return &fixture{ + ctx: ctx, + keeper: k, + addressCodec: addressCodec, + } +} diff --git a/x/bridge/keeper/mina_archive.go b/x/bridge/keeper/mina_archive.go new file mode 100644 index 00000000..2c002ad1 --- /dev/null +++ b/x/bridge/keeper/mina_archive.go @@ -0,0 +1,280 @@ +package keeper + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "strconv" + + "github.com/node101-io/mina-signer-go/address" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +var ArchiveGraphQLEndpoint = "https://devnet-archive-node-api.gcp.o1test.net" + +type GraphQLResponse struct { + Data struct { + NetworkState struct { + MaxBlockHeight struct { + PendingMaxBlockHeight int `json:"pendingMaxBlockHeight"` + } `json:"maxBlockHeight"` + } `json:"networkState"` + } `json:"data"` +} + +type GraphQLRequest struct { + Query string `json:"query"` +} + +const ( + pulsarActionTypeIndex = 0 + pulsarActionAmountIndex = 3 + pulsarActionFieldCount = 7 +) + +type archiveActionsResponse struct { + Data archiveActionsData `json:"data"` +} + +type archiveActionsData struct { + Actions []archiveActionGroup `json:"actions"` + Blocks []archiveBlockGroup `json:"blocks"` +} + +type archiveActionGroup struct { + BlockInfo archiveActionBlockInfo `json:"blockInfo"` + ActionData []archiveActionData `json:"actionData"` +} + +type archiveActionBlockInfo struct { + Height int `json:"height"` +} + +type archiveActionData struct { + Data []string `json:"data"` + TransactionInfo archiveTransactionInfo `json:"transactionInfo"` +} + +type archiveTransactionInfo struct { + Hash string `json:"hash"` +} + +type archiveBlockGroup struct { + Transactions archiveBlockTransactions `json:"transactions"` +} + +type archiveBlockTransactions struct { + ZkappCommands []archiveZkappCommand `json:"zkappCommands"` +} + +type archiveZkappCommand struct { + Hash string `json:"hash"` + FeePayer string `json:"feePayer"` +} + +func GetMinaBlockHeight() (int64, error) { + + const query = ` +query GetMinaBlockHeights { + networkState { + maxBlockHeight { + pendingMaxBlockHeight + } + } +}` + + body, err := json.Marshal(GraphQLRequest{ + Query: query, + }) + if err != nil { + return 0, err + } + + req, err := http.NewRequest("POST", ArchiveGraphQLEndpoint, bytes.NewBuffer(body)) + if err != nil { + return 0, err + } + + req.Header.Set("Content-Type", "application/json") + + client := &http.Client{} + + resp, err := client.Do(req) + if err != nil { + return 0, err + } + defer resp.Body.Close() + + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return 0, err + } + + if resp.StatusCode != http.StatusOK { + return 0, fmt.Errorf("request failed: %s\n%s", resp.Status, string(respBody)) + } + + fmt.Println(string(respBody)) + + var result GraphQLResponse + + if err := json.Unmarshal(respBody, &result); err != nil { + return 0, err + } + + return int64(result.Data.NetworkState.MaxBlockHeight.PendingMaxBlockHeight), nil +} + +func fetchActions(contractAddress string, start, end int64) ([]types.Action, error) { + blockLimit := int(end - start + 1) + if blockLimit < 1 { + blockLimit = 1 + } + + query := ` +query ($actionInput: ActionFilterOptionsInput!, $blockQuery: BlockQueryInput!, $blockLimit: Int!) { + actions(input: $actionInput) { + blockInfo { + height + } + actionData { + data + transactionInfo { + hash + } + } + } + blocks(query: $blockQuery, sortBy: BLOCKHEIGHT_ASC, limit: $blockLimit) { + transactions { + zkappCommands { + hash + feePayer + } + } + } +}` + + body := map[string]any{ + "query": query, + "variables": map[string]any{ + "actionInput": map[string]any{ + "address": contractAddress, + "status": "CANONICAL", + "from": start, + "to": end, + }, + "blockQuery": map[string]any{ + "blockHeight_gte": start, + "blockHeight_lt": end + 1, + "canonical": true, + "inBestChain": true, + }, + "blockLimit": blockLimit, + }, + } + + b, err := json.Marshal(body) + if err != nil { + return nil, err + } + + resp, err := http.Post(ArchiveGraphQLEndpoint, "application/json", bytes.NewReader(b)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + out, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("request failed: %s\n%s", resp.Status, string(out)) + } + + var result archiveActionsResponse + + if err := json.Unmarshal(out, &result); err != nil { + return nil, err + } + + feePayerByHash := make(map[string]string) + for _, block := range result.Data.Blocks { + for _, zkappCommand := range block.Transactions.ZkappCommands { + feePayerByHash[zkappCommand.Hash] = zkappCommand.FeePayer + } + } + + actions := make([]types.Action, 0) + for _, block := range result.Data.Actions { + for _, actionData := range block.ActionData { + fetchedAction, err := fetchedActionFromActionData( + block.BlockInfo.Height, + feePayerByHash[actionData.TransactionInfo.Hash], + actionData.Data, + ) + if err != nil { + return nil, err + } + if fetchedAction == nil { + continue + } + + actions = append(actions, *fetchedAction) + } + } + + return actions, nil +} + +func fetchedActionFromActionData(blockHeight int, feePayer string, data []string) (*types.Action, error) { + actionType, amount, err := contractActionTypeAndAmountFromActionData(data) + if err != nil { + return nil, err + } + + if actionType == types.ActionType_UNSPECIFIED { + return nil, nil + } + + minaAddr, err := address.NewAddress(feePayer).Marshal() + if err != nil { + return nil, err + } + + return &types.Action{ + BlockHeight: int64(blockHeight), + FeePayer: minaAddr, + ActionType: actionType, + Amount: amount, + }, nil +} + +func contractActionTypeAndAmountFromActionData(data []string) (types.ActionType, int64, error) { + if len(data) < pulsarActionFieldCount { + return 0, 0, fmt.Errorf("invalid action data length: got %d fields, expected at least %d", len(data), pulsarActionFieldCount) + } + + actionType, err := strconv.Atoi(data[pulsarActionTypeIndex]) + if err != nil { + return 0, 0, fmt.Errorf("invalid action type %q: %w", data[pulsarActionTypeIndex], err) + } + + amount, err := strconv.ParseInt(data[pulsarActionAmountIndex], 10, 64) + if err != nil { + return 0, 0, fmt.Errorf("invalid action amount %q: %w", data[pulsarActionAmountIndex], err) + } + + if amount <= 0 { + return 0, 0, fmt.Errorf("invalid non-positive action amount: %d", amount) + } + + if actionType == int(types.ActionType_UNSPECIFIED) { + return types.ActionType_UNSPECIFIED, 0, nil + } + + return types.ActionType(actionType), amount, nil +} diff --git a/x/bridge/keeper/mina_archive_test.go b/x/bridge/keeper/mina_archive_test.go new file mode 100644 index 00000000..4482e624 --- /dev/null +++ b/x/bridge/keeper/mina_archive_test.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "fmt" + "testing" + + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func TestGetMinaBlockHeights(t *testing.T) { + heights, err := GetMinaBlockHeight() + if err != nil { + t.Fatal(err) + } + + fmt.Println("pending:", heights) +} +func TestFetchActions(t *testing.T) { + + heights := 520114 + + actions, err := fetchActions(types.ContractAddress, int64(heights-2000), int64(heights)) + if err != nil { + t.Fatal(err) + } + + fmt.Printf("%+v\n", actions) + + for _, act := range actions { + + fmt.Println(act.ActionType, act.Amount, act.BlockHeight, act.FeePayer) + + } + +} diff --git a/x/bridge/keeper/msg_server.go b/x/bridge/keeper/msg_server.go new file mode 100644 index 00000000..a6f825f3 --- /dev/null +++ b/x/bridge/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/bridge/keeper/msg_server_push_new_actions.go b/x/bridge/keeper/msg_server_push_new_actions.go new file mode 100644 index 00000000..8540239a --- /dev/null +++ b/x/bridge/keeper/msg_server_push_new_actions.go @@ -0,0 +1,72 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + merkle "github.com/node101-io/mina-signer-go/merklelist" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func (k msgServer) PushNewActions(ctx context.Context, msg *types.MsgPushNewActions) (*types.MsgPushNewActionsResponse, error) { + if _, err := k.addressCodec.StringToBytes(msg.Creator); err != nil { + return nil, errorsmod.Wrap(err, "invalid authority address") + } + + currentMinaBlockHeight, err := GetMinaBlockHeight() + if err != nil { + return nil, err + } + + bridgeState, err := k.Keeper.GetBridgeState(ctx) + if err != nil { + return nil, err + } + + if currentMinaBlockHeight-msg.MinaBlockHeight < types.MINA_HARDFINALITY_BLOCK_DURATION { + return nil, types.ErrMinaBlockNotFinalized + } + + actions, err := fetchActions(types.ContractAddress, bridgeState.LatestFetchedMinaHeight, msg.MinaBlockHeight) + if err != nil { + return nil, err + } + + list, err := merkle.NewMerkleListFromRoot(types.MerkleListPrefix, bridgeState.ActionsReducedRoot) + if err != nil { + return nil, err + } + + for _, act := range actions { + + valid, err := k.isValid(ctx, &act) + if err != nil { + return nil, err + } + if !valid { + continue + } + if err := k.apply(ctx, &act); err != nil { + return nil, err + } + + bz, err := act.Marshal() + if err != nil { + return nil, err + } + + if err := list.Append(bz); err != nil { + return nil, err + } + + } + + if err := k.Keeper.setBridgeState(ctx, types.BridgeState{ + LatestFetchedMinaHeight: msg.MinaBlockHeight, + ActionsReducedRoot: list.Root(), + }); err != nil { + return nil, err + } + + return &types.MsgPushNewActionsResponse{}, nil +} diff --git a/x/bridge/keeper/msg_update_params.go b/x/bridge/keeper/msg_update_params.go new file mode 100644 index 00000000..726ba745 --- /dev/null +++ b/x/bridge/keeper/msg_update_params.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "bytes" + "context" + + errorsmod "cosmossdk.io/errors" + + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + authority, err := k.addressCodec.StringToBytes(req.Authority) + if err != nil { + return nil, errorsmod.Wrap(err, "invalid authority address") + } + + if !bytes.Equal(k.GetAuthority(), authority) { + expectedAuthorityStr, _ := k.addressCodec.BytesToString(k.GetAuthority()) + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", expectedAuthorityStr, req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + if err := k.Params.Set(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/bridge/keeper/msg_update_params_test.go b/x/bridge/keeper/msg_update_params_test.go new file mode 100644 index 00000000..ff12b03f --- /dev/null +++ b/x/bridge/keeper/msg_update_params_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func TestMsgUpdateParams(t *testing.T) { + f := initFixture(t) + ms := keeper.NewMsgServerImpl(f.keeper) + + params := types.DefaultParams() + require.NoError(t, f.keeper.Params.Set(f.ctx, params)) + + authorityStr, err := f.addressCodec.BytesToString(f.keeper.GetAuthority()) + require.NoError(t, err) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: authorityStr, + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: authorityStr, + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(f.ctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/bridge/keeper/query.go b/x/bridge/keeper/query.go new file mode 100644 index 00000000..69201248 --- /dev/null +++ b/x/bridge/keeper/query.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +var _ types.QueryServer = queryServer{} + +// NewQueryServerImpl returns an implementation of the QueryServer interface +// for the provided Keeper. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k} +} + +type queryServer struct { + k Keeper +} diff --git a/x/bridge/keeper/query_params.go b/x/bridge/keeper/query_params.go new file mode 100644 index 00000000..a7e1a382 --- /dev/null +++ b/x/bridge/keeper/query_params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/collections" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func (q queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + params, err := q.k.Params.Get(ctx) + if err != nil && !errors.Is(err, collections.ErrNotFound) { + return nil, status.Error(codes.Internal, "internal error") + } + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/bridge/keeper/query_params_test.go b/x/bridge/keeper/query_params_test.go new file mode 100644 index 00000000..a02909dc --- /dev/null +++ b/x/bridge/keeper/query_params_test.go @@ -0,0 +1,22 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func TestParamsQuery(t *testing.T) { + f := initFixture(t) + + qs := keeper.NewQueryServerImpl(f.keeper) + params := types.DefaultParams() + require.NoError(t, f.keeper.Params.Set(f.ctx, params)) + + response, err := qs.Params(f.ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/bridge/module/autocli.go b/x/bridge/module/autocli.go new file mode 100644 index 00000000..5257bfa7 --- /dev/null +++ b/x/bridge/module/autocli.go @@ -0,0 +1,41 @@ +package bridge + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: types.Query_serviceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: types.Msg_serviceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + { + RpcMethod: "PushNewActions", + Use: "push-new-actions [mina-block-height]", + Short: "Send a PushNewActions tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "mina_block_height"}}, + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/bridge/module/depinject.go b/x/bridge/module/depinject.go new file mode 100644 index 00000000..a27a4e8a --- /dev/null +++ b/x/bridge/module/depinject.go @@ -0,0 +1,66 @@ +package bridge + +import ( + "cosmossdk.io/core/address" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/depinject/appconfig" + "github.com/cosmos/cosmos-sdk/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +var _ depinject.OnePerModuleType = AppModule{} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +func init() { + appconfig.Register( + &types.Module{}, + appconfig.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + Config *types.Module + StoreService store.KVStoreService + Cdc codec.Codec + AddressCodec address.Codec + + AuthKeeper types.AuthKeeper + BankKeeper types.BankKeeper + KeyregistryKeeper types.KeyregistryKeeper +} + +type ModuleOutputs struct { + depinject.Out + + BridgeKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(types.GovModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + + k := keeper.NewKeeper( + in.StoreService, + in.Cdc, + in.AddressCodec, + authority, + in.BankKeeper, + in.KeyregistryKeeper, + ) + m := NewAppModule(in.Cdc, k, in.AuthKeeper, in.BankKeeper) + + return ModuleOutputs{BridgeKeeper: k, Module: m} +} diff --git a/x/bridge/module/module.go b/x/bridge/module/module.go new file mode 100644 index 00000000..c96abb9a --- /dev/null +++ b/x/bridge/module/module.go @@ -0,0 +1,143 @@ +package bridge + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/grpc" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModule = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + cdc codec.Codec + keeper keeper.Keeper + authKeeper types.AuthKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + authKeeper types.AuthKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + cdc: cdc, + keeper: keeper, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + } +} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + +// Name returns the name of the module as a string. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec +func (AppModule) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(clientCtx.CmdContext, mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (AppModule) RegisterInterfaces(registrar codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registrar) +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { + types.RegisterMsgServer(registrar, keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(registrar, keeper.NewQueryServerImpl(am.keeper)) + + return nil +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (am AppModule) DefaultGenesis(codec.JSONCodec) json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (am AppModule) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := am.cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return genState.Validate() +} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, _ codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + if err := am.cdc.UnmarshalJSON(gs, &genState); err != nil { + panic(fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)) + } + + if err := am.keeper.InitGenesis(ctx, genState); err != nil { + panic(fmt.Errorf("failed to initialize %s genesis state: %w", types.ModuleName, err)) + } +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, _ codec.JSONCodec) json.RawMessage { + genState, err := am.keeper.ExportGenesis(ctx) + if err != nil { + panic(fmt.Errorf("failed to export %s genesis state: %w", types.ModuleName, err)) + } + + bz, err := am.cdc.MarshalJSON(genState) + if err != nil { + panic(fmt.Errorf("failed to marshal %s genesis state: %w", types.ModuleName, err)) + } + + return bz +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} diff --git a/x/bridge/module/simulation.go b/x/bridge/module/simulation.go new file mode 100644 index 00000000..7a0e68e1 --- /dev/null +++ b/x/bridge/module/simulation.go @@ -0,0 +1,54 @@ +package bridge + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + bridgesimulation "github.com/node101-io/pulsar-chain/x/bridge/simulation" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + bridgeGenesis := types.GenesisState{ + Params: types.DefaultParams(), + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&bridgeGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + const ( + opWeightMsgPushNewActions = "op_weight_msg_bridge" + defaultWeightMsgPushNewActions int = 100 + ) + + var weightMsgPushNewActions int + simState.AppParams.GetOrGenerate(opWeightMsgPushNewActions, &weightMsgPushNewActions, nil, + func(_ *rand.Rand) { + weightMsgPushNewActions = defaultWeightMsgPushNewActions + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgPushNewActions, + bridgesimulation.SimulateMsgPushNewActions(am.authKeeper, am.bankKeeper, am.keeper, simState.TxConfig), + )) + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{} +} diff --git a/x/bridge/simulation/push_new_actions.go b/x/bridge/simulation/push_new_actions.go new file mode 100644 index 00000000..d6cbfaa0 --- /dev/null +++ b/x/bridge/simulation/push_new_actions.go @@ -0,0 +1,32 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/node101-io/pulsar-chain/x/bridge/keeper" + "github.com/node101-io/pulsar-chain/x/bridge/types" +) + +func SimulateMsgPushNewActions( + ak types.AuthKeeper, + bk types.BankKeeper, + k keeper.Keeper, + txGen client.TxConfig, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgPushNewActions{ + Creator: simAccount.Address.String(), + } + + // TODO: Handle the PushNewActions simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "PushNewActions simulation not implemented"), nil, nil + } +} diff --git a/x/bridge/types/action.pb.go b/x/bridge/types/action.pb.go new file mode 100644 index 00000000..96ff76cf --- /dev/null +++ b/x/bridge/types/action.pb.go @@ -0,0 +1,461 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/action.proto + +package types + +import ( + fmt "fmt" + 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 + +type ActionType int32 + +const ( + ActionType_UNSPECIFIED ActionType = 0 + ActionType_DEPOSIT ActionType = 1 + ActionType_WITHDRAW ActionType = 2 +) + +var ActionType_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "DEPOSIT", + 2: "WITHDRAW", +} + +var ActionType_value = map[string]int32{ + "UNSPECIFIED": 0, + "DEPOSIT": 1, + "WITHDRAW": 2, +} + +func (x ActionType) String() string { + return proto.EnumName(ActionType_name, int32(x)) +} + +func (ActionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_4c3d593beb882b0e, []int{0} +} + +type Action struct { + BlockHeight int64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + FeePayer []byte `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"fee_payer,omitempty"` + ActionType ActionType `protobuf:"varint,3,opt,name=action_type,json=actionType,proto3,enum=pulsarchain.bridge.v1.ActionType" json:"action_type,omitempty"` + Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *Action) Reset() { *m = Action{} } +func (m *Action) String() string { return proto.CompactTextString(m) } +func (*Action) ProtoMessage() {} +func (*Action) Descriptor() ([]byte, []int) { + return fileDescriptor_4c3d593beb882b0e, []int{0} +} +func (m *Action) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Action.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 *Action) XXX_Merge(src proto.Message) { + xxx_messageInfo_Action.Merge(m, src) +} +func (m *Action) XXX_Size() int { + return m.Size() +} +func (m *Action) XXX_DiscardUnknown() { + xxx_messageInfo_Action.DiscardUnknown(m) +} + +var xxx_messageInfo_Action proto.InternalMessageInfo + +func (m *Action) GetBlockHeight() int64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *Action) GetFeePayer() []byte { + if m != nil { + return m.FeePayer + } + return nil +} + +func (m *Action) GetActionType() ActionType { + if m != nil { + return m.ActionType + } + return ActionType_UNSPECIFIED +} + +func (m *Action) GetAmount() int64 { + if m != nil { + return m.Amount + } + return 0 +} + +func init() { + proto.RegisterEnum("pulsarchain.bridge.v1.ActionType", ActionType_name, ActionType_value) + proto.RegisterType((*Action)(nil), "pulsarchain.bridge.v1.Action") +} + +func init() { + proto.RegisterFile("pulsarchain/bridge/v1/action.proto", fileDescriptor_4c3d593beb882b0e) +} + +var fileDescriptor_4c3d593beb882b0e = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x28, 0xcd, 0x29, + 0x4e, 0x2c, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x4f, 0x2a, 0xca, 0x4c, 0x49, 0x4f, 0xd5, 0x2f, + 0x33, 0xd4, 0x4f, 0x4c, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, + 0x45, 0x52, 0xa3, 0x07, 0x51, 0xa3, 0x57, 0x66, 0xa8, 0xb4, 0x84, 0x91, 0x8b, 0xcd, 0x11, 0xac, + 0x4e, 0x48, 0x91, 0x8b, 0x27, 0x29, 0x27, 0x3f, 0x39, 0x3b, 0x3e, 0x23, 0x35, 0x33, 0x3d, 0xa3, + 0x44, 0x82, 0x51, 0x81, 0x51, 0x83, 0x39, 0x88, 0x1b, 0x2c, 0xe6, 0x01, 0x16, 0x12, 0x92, 0xe6, + 0xe2, 0x4c, 0x4b, 0x4d, 0x8d, 0x2f, 0x48, 0xac, 0x4c, 0x2d, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, + 0x09, 0xe2, 0x48, 0x4b, 0x4d, 0x0d, 0x00, 0xf1, 0x85, 0x9c, 0xb8, 0xb8, 0x21, 0x36, 0xc6, 0x97, + 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2b, 0x30, 0x6a, 0xf0, 0x19, 0x29, 0xea, 0x61, 0xb5, 0x57, 0x0f, + 0x62, 0x67, 0x48, 0x65, 0x41, 0x6a, 0x10, 0x57, 0x22, 0x9c, 0x2d, 0x24, 0xc6, 0xc5, 0x96, 0x98, + 0x9b, 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0x02, 0xb6, 0x1d, 0xca, 0xd3, 0xb2, 0xe0, 0xe2, 0x42, 0xe8, + 0x10, 0xe2, 0xe7, 0xe2, 0x0e, 0xf5, 0x0b, 0x0e, 0x70, 0x75, 0xf6, 0x74, 0xf3, 0x74, 0x75, 0x11, + 0x60, 0x10, 0xe2, 0xe6, 0x62, 0x77, 0x71, 0x0d, 0xf0, 0x0f, 0xf6, 0x0c, 0x11, 0x60, 0x14, 0xe2, + 0xe1, 0xe2, 0x08, 0xf7, 0x0c, 0xf1, 0x70, 0x09, 0x72, 0x0c, 0x17, 0x60, 0x72, 0xf2, 0x3e, 0xf1, + 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xc3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xbc, 0xfc, 0x94, 0x54, 0x43, 0x03, 0x43, 0xdd, 0xcc, 0x7c, 0x7d, + 0x88, 0x7b, 0x75, 0x21, 0x81, 0x59, 0x01, 0x0b, 0x4e, 0x90, 0x97, 0x8a, 0x93, 0xd8, 0xc0, 0x61, + 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x2a, 0xe0, 0xc0, 0x71, 0x01, 0x00, 0x00, +} + +func (m *Action) 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 *Action) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Action) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintAction(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if m.ActionType != 0 { + i = encodeVarintAction(dAtA, i, uint64(m.ActionType)) + i-- + dAtA[i] = 0x18 + } + if len(m.FeePayer) > 0 { + i -= len(m.FeePayer) + copy(dAtA[i:], m.FeePayer) + i = encodeVarintAction(dAtA, i, uint64(len(m.FeePayer))) + i-- + dAtA[i] = 0x12 + } + if m.BlockHeight != 0 { + i = encodeVarintAction(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintAction(dAtA []byte, offset int, v uint64) int { + offset -= sovAction(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Action) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeight != 0 { + n += 1 + sovAction(uint64(m.BlockHeight)) + } + l = len(m.FeePayer) + if l > 0 { + n += 1 + l + sovAction(uint64(l)) + } + if m.ActionType != 0 { + n += 1 + sovAction(uint64(m.ActionType)) + } + if m.Amount != 0 { + n += 1 + sovAction(uint64(m.Amount)) + } + return n +} + +func sovAction(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAction(x uint64) (n int) { + return sovAction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Action) 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 ErrIntOverflowAction + } + 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: Action: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Action: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeePayer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAction + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeePayer = append(m.FeePayer[:0], dAtA[iNdEx:postIndex]...) + if m.FeePayer == nil { + m.FeePayer = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActionType", wireType) + } + m.ActionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActionType |= ActionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAction(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, ErrIntOverflowAction + } + 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, ErrIntOverflowAction + } + 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, ErrIntOverflowAction + } + 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, ErrInvalidLengthAction + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAction + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAction + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAction = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAction = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAction = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/bridge_state.pb.go b/x/bridge/types/bridge_state.pb.go new file mode 100644 index 00000000..9bb06648 --- /dev/null +++ b/x/bridge/types/bridge_state.pb.go @@ -0,0 +1,358 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/bridge_state.proto + +package types + +import ( + fmt "fmt" + 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 + +type BridgeState struct { + LatestFetchedMinaHeight int64 `protobuf:"varint,1,opt,name=latest_fetched_mina_height,json=latestFetchedMinaHeight,proto3" json:"latest_fetched_mina_height,omitempty"` + ActionsReducedRoot []byte `protobuf:"bytes,2,opt,name=actions_reduced_root,json=actionsReducedRoot,proto3" json:"actions_reduced_root,omitempty"` +} + +func (m *BridgeState) Reset() { *m = BridgeState{} } +func (m *BridgeState) String() string { return proto.CompactTextString(m) } +func (*BridgeState) ProtoMessage() {} +func (*BridgeState) Descriptor() ([]byte, []int) { + return fileDescriptor_9f537cf215cb7f9d, []int{0} +} +func (m *BridgeState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BridgeState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BridgeState.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 *BridgeState) XXX_Merge(src proto.Message) { + xxx_messageInfo_BridgeState.Merge(m, src) +} +func (m *BridgeState) XXX_Size() int { + return m.Size() +} +func (m *BridgeState) XXX_DiscardUnknown() { + xxx_messageInfo_BridgeState.DiscardUnknown(m) +} + +var xxx_messageInfo_BridgeState proto.InternalMessageInfo + +func (m *BridgeState) GetLatestFetchedMinaHeight() int64 { + if m != nil { + return m.LatestFetchedMinaHeight + } + return 0 +} + +func (m *BridgeState) GetActionsReducedRoot() []byte { + if m != nil { + return m.ActionsReducedRoot + } + return nil +} + +func init() { + proto.RegisterType((*BridgeState)(nil), "pulsarchain.bridge.v1.BridgeState") +} + +func init() { + proto.RegisterFile("pulsarchain/bridge/v1/bridge_state.proto", fileDescriptor_9f537cf215cb7f9d) +} + +var fileDescriptor_9f537cf215cb7f9d = []byte{ + // 239 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4b, 0xc4, 0x30, + 0x18, 0x86, 0x2f, 0x0a, 0x0e, 0xd5, 0xa9, 0x28, 0x1e, 0x0e, 0xe1, 0x70, 0xea, 0x72, 0xed, 0x05, + 0x47, 0xb7, 0x1b, 0x44, 0x10, 0x97, 0xba, 0xb9, 0x84, 0x34, 0xf9, 0x6c, 0x02, 0x77, 0xf9, 0x4a, + 0xf2, 0xf5, 0x50, 0xf0, 0x47, 0xf8, 0xb3, 0x1c, 0x6f, 0x74, 0x94, 0xf6, 0x8f, 0x88, 0xcd, 0x09, + 0x6e, 0xef, 0xcb, 0xf3, 0x2c, 0x4f, 0x56, 0x74, 0xfd, 0x26, 0xaa, 0xa0, 0xad, 0x72, 0xbe, 0x6a, + 0x82, 0x33, 0x2d, 0x54, 0x3b, 0x71, 0x58, 0x32, 0x92, 0x22, 0x28, 0xbb, 0x80, 0x84, 0xf9, 0xc5, + 0x3f, 0xb3, 0x4c, 0xbc, 0xdc, 0x89, 0xeb, 0xf7, 0xec, 0x74, 0x3d, 0x9d, 0xa7, 0x5f, 0x37, 0xbf, + 0xcd, 0xae, 0x36, 0x8a, 0x20, 0x92, 0x7c, 0x01, 0xd2, 0x16, 0x8c, 0xdc, 0x3a, 0xaf, 0xa4, 0x05, + 0xd7, 0x5a, 0x9a, 0xb3, 0x05, 0x2b, 0x8e, 0xeb, 0xcb, 0x64, 0xdc, 0x25, 0xe1, 0xd1, 0x79, 0x75, + 0x3f, 0xe1, 0x7c, 0x95, 0x9d, 0x2b, 0x4d, 0x0e, 0x7d, 0x94, 0x01, 0x4c, 0xaf, 0xc1, 0xc8, 0x80, + 0x48, 0xf3, 0xa3, 0x05, 0x2b, 0xce, 0xea, 0xfc, 0xc0, 0xea, 0x84, 0x6a, 0x44, 0x5a, 0x3f, 0x7c, + 0x0e, 0x9c, 0xed, 0x07, 0xce, 0xbe, 0x07, 0xce, 0x3e, 0x46, 0x3e, 0xdb, 0x8f, 0x7c, 0xf6, 0x35, + 0xf2, 0xd9, 0xb3, 0x68, 0x1d, 0xd9, 0xbe, 0x29, 0x35, 0x6e, 0x2b, 0x8f, 0x06, 0xc4, 0x4a, 0x2c, + 0x1d, 0x56, 0x29, 0x62, 0x99, 0x7a, 0x5f, 0xff, 0x8a, 0xe9, 0xad, 0x83, 0xd8, 0x9c, 0x4c, 0xa1, + 0x37, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x37, 0xe4, 0x84, 0x7a, 0x14, 0x01, 0x00, 0x00, +} + +func (m *BridgeState) 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 *BridgeState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BridgeState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ActionsReducedRoot) > 0 { + i -= len(m.ActionsReducedRoot) + copy(dAtA[i:], m.ActionsReducedRoot) + i = encodeVarintBridgeState(dAtA, i, uint64(len(m.ActionsReducedRoot))) + i-- + dAtA[i] = 0x12 + } + if m.LatestFetchedMinaHeight != 0 { + i = encodeVarintBridgeState(dAtA, i, uint64(m.LatestFetchedMinaHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintBridgeState(dAtA []byte, offset int, v uint64) int { + offset -= sovBridgeState(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BridgeState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LatestFetchedMinaHeight != 0 { + n += 1 + sovBridgeState(uint64(m.LatestFetchedMinaHeight)) + } + l = len(m.ActionsReducedRoot) + if l > 0 { + n += 1 + l + sovBridgeState(uint64(l)) + } + return n +} + +func sovBridgeState(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBridgeState(x uint64) (n int) { + return sovBridgeState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BridgeState) 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 ErrIntOverflowBridgeState + } + 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: BridgeState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BridgeState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFetchedMinaHeight", wireType) + } + m.LatestFetchedMinaHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridgeState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestFetchedMinaHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActionsReducedRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridgeState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBridgeState + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBridgeState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ActionsReducedRoot = append(m.ActionsReducedRoot[:0], dAtA[iNdEx:postIndex]...) + if m.ActionsReducedRoot == nil { + m.ActionsReducedRoot = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBridgeState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBridgeState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBridgeState(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, ErrIntOverflowBridgeState + } + 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, ErrIntOverflowBridgeState + } + 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, ErrIntOverflowBridgeState + } + 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, ErrInvalidLengthBridgeState + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBridgeState + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBridgeState + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBridgeState = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBridgeState = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBridgeState = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/codec.go b/x/bridge/types/codec.go new file mode 100644 index 00000000..40883301 --- /dev/null +++ b/x/bridge/types/codec.go @@ -0,0 +1,18 @@ +package types + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterInterfaces(registrar codectypes.InterfaceRegistry) { + registrar.RegisterImplementations((*sdk.Msg)(nil), + &MsgPushNewActions{}, + ) + + registrar.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) +} diff --git a/x/bridge/types/errors.go b/x/bridge/types/errors.go new file mode 100644 index 00000000..cb4be4fc --- /dev/null +++ b/x/bridge/types/errors.go @@ -0,0 +1,17 @@ +package types + +// DONTCOVER + +import ( + "cosmossdk.io/errors" +) + +// x/bridge module sentinel errors +var ( + ErrInvalidSigner = errors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrUnspecified = errors.Register(ModuleName, 1101, "unspecified action type") + ErrNotEnoughBalance = errors.Register(ModuleName, 1102, "not enough balance") + ErrBankKeeperNotConfigured = errors.Register(ModuleName, 1103, "bank keeper is not configured") + ErrKeyRegistryKeeperNotConfigured = errors.Register(ModuleName, 1104, "keyregistry keeper is not configured") + ErrMinaBlockNotFinalized = errors.Register(ModuleName, 1105, "mina block not finalized") +) diff --git a/x/bridge/types/expected_keepers.go b/x/bridge/types/expected_keepers.go new file mode 100644 index 00000000..f4e8e9f6 --- /dev/null +++ b/x/bridge/types/expected_keepers.go @@ -0,0 +1,41 @@ +package types + +import ( + "context" + + "cosmossdk.io/core/address" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AuthKeeper defines the expected interface for the Auth module. +type AuthKeeper interface { + AddressCodec() address.Codec + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToAccount(context.Context, string, sdk.AccAddress, sdk.Coins) error + SendCoinsFromAccountToModule(context.Context, sdk.AccAddress, string, sdk.Coins) error + MintCoins(context.Context, string, sdk.Coins) error + BurnCoins(context.Context, string, sdk.Coins) error +} + +// KeyregistryKeeper defines the expected interface for the Keyregistry module. +type KeyregistryKeeper interface { + UserGetMinaToCosmos(context.Context, []byte) ([]byte, error) + UserMinaToCosmosHas(context.Context, []byte) (bool, error) + UserCosmosToMinaHas(context.Context, []byte) (bool, error) + + ValidatorGetMinaToCosmos(context.Context, []byte) ([]byte, error) + ValidatorMinaToCosmosHas(context.Context, []byte) (bool, error) + ValidatorCosmosToMinaHas(context.Context, []byte) (bool, error) +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/bridge/types/genesis.go b/x/bridge/types/genesis.go new file mode 100644 index 00000000..aa1dd125 --- /dev/null +++ b/x/bridge/types/genesis.go @@ -0,0 +1,25 @@ +package types + +import minasignergo "github.com/node101-io/mina-signer-go/merklelist" + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + BridgeState: DefaultBridgeState(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} + +func DefaultBridgeState() BridgeState { + + return BridgeState{ + LatestFetchedMinaHeight: 0, + ActionsReducedRoot: minasignergo.NewMerkleList(MerkleListPrefix).Root(), + } +} diff --git a/x/bridge/types/genesis.pb.go b/x/bridge/types/genesis.pb.go new file mode 100644 index 00000000..1017849c --- /dev/null +++ b/x/bridge/types/genesis.pb.go @@ -0,0 +1,382 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "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 + +// GenesisState defines the bridge 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"` + BridgeState BridgeState `protobuf:"bytes,2,opt,name=bridge_state,json=bridgeState,proto3" json:"bridge_state"` +} + +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_41cbd561393f12e3, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetBridgeState() BridgeState { + if m != nil { + return m.BridgeState + } + return BridgeState{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "pulsarchain.bridge.v1.GenesisState") +} + +func init() { + proto.RegisterFile("pulsarchain/bridge/v1/genesis.proto", fileDescriptor_41cbd561393f12e3) +} + +var fileDescriptor_41cbd561393f12e3 = []byte{ + // 262 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x28, 0xcd, 0x29, + 0x4e, 0x2c, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x4f, 0x2a, 0xca, 0x4c, 0x49, 0x4f, 0xd5, 0x2f, + 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x45, 0x52, 0xa4, 0x07, 0x51, 0xa4, 0x57, 0x66, 0x28, 0x25, 0x98, 0x98, 0x9b, 0x99, 0x97, + 0xaf, 0x0f, 0x26, 0x21, 0x2a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4c, 0x7d, 0x10, 0x0b, + 0x2a, 0xaa, 0x84, 0xdd, 0x92, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0x1d, 0x52, 0x1a, 0xd8, 0xd5, + 0x40, 0x58, 0xf1, 0xc5, 0x25, 0x89, 0x25, 0xa9, 0x10, 0x95, 0x4a, 0x8b, 0x18, 0xb9, 0x78, 0xdc, + 0x21, 0xee, 0x0b, 0x06, 0x09, 0x0b, 0x39, 0x70, 0xb1, 0x41, 0x8c, 0x92, 0x60, 0x54, 0x60, 0xd4, + 0xe0, 0x36, 0x92, 0xd5, 0xc3, 0xea, 0x5e, 0xbd, 0x00, 0xb0, 0x22, 0x27, 0xce, 0x13, 0xf7, 0xe4, + 0x19, 0x56, 0x3c, 0xdf, 0xa0, 0xc5, 0x18, 0x04, 0xd5, 0x27, 0x14, 0xc0, 0xc5, 0x83, 0x6c, 0x91, + 0x04, 0x13, 0xd8, 0x1c, 0x25, 0x1c, 0xe6, 0x38, 0x81, 0x59, 0x60, 0xbb, 0x91, 0x0d, 0xe3, 0x4e, + 0x42, 0x12, 0xf7, 0x3e, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, + 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xc3, 0xf4, + 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xbc, 0xfc, 0x94, 0x54, 0x43, 0x03, + 0x43, 0xdd, 0xcc, 0x7c, 0x7d, 0x88, 0x55, 0xba, 0x10, 0xff, 0x57, 0xc0, 0x42, 0xa0, 0xa4, 0xb2, + 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x71, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x65, 0xf3, + 0x37, 0x06, 0xad, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BridgeState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.BridgeState.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BridgeState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BridgeState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/genesis_test.go b/x/bridge/types/genesis_test.go new file mode 100644 index 00000000..95c5c763 --- /dev/null +++ b/x/bridge/types/genesis_test.go @@ -0,0 +1,37 @@ +package types_test + +import ( + "testing" + + "github.com/node101-io/pulsar-chain/x/bridge/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{}, + valid: true, + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/bridge/types/keys.go b/x/bridge/types/keys.go new file mode 100644 index 00000000..c187b4ca --- /dev/null +++ b/x/bridge/types/keys.go @@ -0,0 +1,20 @@ +package types + +import "cosmossdk.io/collections" + +const ( + // ModuleName defines the module name + ModuleName = "bridge" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // GovModuleName duplicates the gov module's name to avoid a dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/gov/types/keys.go#L9 + GovModuleName = "gov" +) + +// ParamsKey is the prefix to retrieve all Params +var ParamsKey = collections.NewPrefix("p_bridge") +var BridgeStateKey = collections.NewPrefix("bridge_state") diff --git a/x/bridge/types/module.pb.go b/x/bridge/types/module.pb.go new file mode 100644 index 00000000..447cd299 --- /dev/null +++ b/x/bridge/types/module.pb.go @@ -0,0 +1,324 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/module/v1/module.proto + +package types + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + 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 + +// Module is the config object for the module. +type Module struct { + // authority defines the custom module authority. + // If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_7b90c92481b7d913, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "pulsarchain.bridge.module.v1.Module") +} + +func init() { + proto.RegisterFile("pulsarchain/bridge/module/v1/module.proto", fileDescriptor_7b90c92481b7d913) +} + +var fileDescriptor_7b90c92481b7d913 = []byte{ + // 209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2c, 0x28, 0xcd, 0x29, + 0x4e, 0x2c, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x4f, 0x2a, 0xca, 0x4c, 0x49, 0x4f, 0xd5, 0xcf, + 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0xd5, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, + 0x85, 0x64, 0x90, 0x94, 0xea, 0x41, 0x94, 0xea, 0x41, 0x15, 0x94, 0x19, 0x4a, 0x29, 0x24, 0xe7, + 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0x27, 0x16, 0x14, 0xe8, 0x97, 0x19, 0x26, 0xe6, 0x14, 0x64, 0x24, + 0xa2, 0xea, 0x57, 0x8a, 0xe6, 0x62, 0xf3, 0x05, 0xf3, 0x85, 0x64, 0xb8, 0x38, 0x13, 0x4b, 0x4b, + 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x10, 0x02, 0x56, + 0xc6, 0xbb, 0x0e, 0x4c, 0xbb, 0xc5, 0xa8, 0xcb, 0xa5, 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, + 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x97, 0x9f, 0x92, 0x6a, 0x68, 0x60, 0xa8, 0x9b, 0x99, 0xaf, 0x0f, + 0x71, 0x85, 0x2e, 0xc4, 0xc5, 0x15, 0x50, 0x37, 0x3b, 0x79, 0x9f, 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, 0x21, 0x09, 0xc6, 0xe8, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, + 0x81, 0x1d, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x59, 0xc3, 0xa9, 0xfb, 0x1d, 0x01, 0x00, + 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/params.go b/x/bridge/types/params.go new file mode 100644 index 00000000..d7e00501 --- /dev/null +++ b/x/bridge/types/params.go @@ -0,0 +1,17 @@ +package types + +// NewParams creates a new Params instance. +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return NewParams() +} + +// Validate validates the set of params. +func (p Params) Validate() error { + + return nil +} diff --git a/x/bridge/types/params.pb.go b/x/bridge/types/params.pb.go new file mode 100644 index 00000000..66ef500c --- /dev/null +++ b/x/bridge/types/params.pb.go @@ -0,0 +1,291 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "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 for the 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_fc1105b3434fe519, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "pulsarchain.bridge.v1.Params") +} + +func init() { + proto.RegisterFile("pulsarchain/bridge/v1/params.proto", fileDescriptor_fc1105b3434fe519) +} + +var fileDescriptor_fc1105b3434fe519 = []byte{ + // 187 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0x28, 0xcd, 0x29, + 0x4e, 0x2c, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x4f, 0x2a, 0xca, 0x4c, 0x49, 0x4f, 0xd5, 0x2f, + 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, + 0x45, 0x52, 0xa3, 0x07, 0x51, 0xa3, 0x57, 0x66, 0x28, 0x25, 0x98, 0x98, 0x9b, 0x99, 0x97, 0xaf, + 0x0f, 0x26, 0x21, 0x2a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4c, 0x7d, 0x10, 0x0b, 0x22, + 0xaa, 0xa4, 0xc7, 0xc5, 0x16, 0x00, 0x36, 0xcf, 0x4a, 0xe5, 0xc5, 0x02, 0x79, 0xc6, 0xae, 0xe7, + 0x1b, 0xb4, 0xa4, 0x91, 0xad, 0xad, 0x80, 0x59, 0x0c, 0x51, 0xe5, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, + 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, + 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, + 0xf9, 0xb9, 0xfa, 0x79, 0xf9, 0x29, 0xa9, 0x86, 0x06, 0x86, 0xba, 0x99, 0xf9, 0xfa, 0x10, 0xc3, + 0x74, 0xd1, 0x4c, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xc1, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0x2e, 0x58, 0x7b, 0x4e, 0xe9, 0x00, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +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 encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/query.pb.go b/x/bridge/types/query.pb.go new file mode 100644 index 00000000..fc15b9e6 --- /dev/null +++ b/x/bridge/types/query.pb.go @@ -0,0 +1,541 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f0aa4d5eadeeb7a5, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f0aa4d5eadeeb7a5, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "pulsarchain.bridge.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "pulsarchain.bridge.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("pulsarchain/bridge/v1/query.proto", fileDescriptor_f0aa4d5eadeeb7a5) } + +var fileDescriptor_f0aa4d5eadeeb7a5 = []byte{ + // 333 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xc1, 0x4a, 0x33, 0x31, + 0x14, 0x85, 0x27, 0x3f, 0xfc, 0x05, 0xc7, 0x95, 0x63, 0x05, 0x29, 0x3a, 0xea, 0xac, 0x6c, 0xa5, + 0x73, 0x4d, 0x7d, 0x01, 0xe9, 0xd6, 0x8d, 0x76, 0x23, 0xb8, 0xcb, 0xb4, 0x21, 0x0d, 0x74, 0x72, + 0xd3, 0x49, 0xa6, 0xd8, 0xad, 0x4f, 0x20, 0xba, 0xf5, 0x01, 0x5c, 0xfa, 0x18, 0x5d, 0x16, 0xdc, + 0xb8, 0x12, 0x69, 0x05, 0x5f, 0x43, 0x3a, 0x19, 0x41, 0xb1, 0x05, 0x37, 0xe1, 0x72, 0xf2, 0x9d, + 0x93, 0x93, 0xeb, 0x1f, 0xe8, 0x7c, 0x60, 0x58, 0xd6, 0xed, 0x33, 0xa9, 0x20, 0xc9, 0x64, 0x4f, + 0x70, 0x18, 0x51, 0x18, 0xe6, 0x3c, 0x1b, 0xc7, 0x3a, 0x43, 0x8b, 0xc1, 0xd6, 0x37, 0x24, 0x76, + 0x48, 0x3c, 0xa2, 0xb5, 0x0d, 0x96, 0x4a, 0x85, 0x50, 0x9c, 0x8e, 0xac, 0x35, 0xba, 0x68, 0x52, + 0x34, 0x90, 0x30, 0xc3, 0x5d, 0x04, 0x8c, 0x68, 0xc2, 0x2d, 0xa3, 0xa0, 0x99, 0x90, 0x8a, 0x59, + 0x89, 0xaa, 0x64, 0xab, 0x02, 0x05, 0x16, 0x23, 0x2c, 0xa6, 0x52, 0xdd, 0x11, 0x88, 0x62, 0xc0, + 0x81, 0x69, 0x09, 0x4c, 0x29, 0xb4, 0x85, 0xc5, 0x94, 0xb7, 0xd1, 0xf2, 0xb2, 0x9a, 0x65, 0x2c, + 0x2d, 0x99, 0xa8, 0xea, 0x07, 0x17, 0x8b, 0x97, 0xcf, 0x0b, 0xb1, 0xc3, 0x87, 0x39, 0x37, 0x36, + 0xba, 0xf4, 0x37, 0x7f, 0xa8, 0x46, 0xa3, 0x32, 0x3c, 0x38, 0xf5, 0x2b, 0xce, 0xbc, 0x4d, 0xf6, + 0xc9, 0xe1, 0x7a, 0x6b, 0x37, 0x5e, 0xfa, 0xd7, 0xd8, 0xd9, 0xda, 0x6b, 0x93, 0xd7, 0x3d, 0xef, + 0xf1, 0xe3, 0xa9, 0x41, 0x3a, 0xa5, 0xaf, 0xf5, 0x40, 0xfc, 0xff, 0x45, 0x72, 0x70, 0x47, 0xfc, + 0x8a, 0xe3, 0x82, 0xfa, 0x8a, 0x98, 0xdf, 0xc5, 0x6a, 0x8d, 0xbf, 0xa0, 0xae, 0x6d, 0x44, 0x6f, + 0x9e, 0xdf, 0xef, 0xff, 0x1d, 0x05, 0x75, 0x50, 0xd8, 0xe3, 0xf4, 0x98, 0x36, 0x25, 0x82, 0xb3, + 0x37, 0x97, 0xef, 0xa4, 0x7d, 0x36, 0x99, 0x85, 0x64, 0x3a, 0x0b, 0xc9, 0xdb, 0x2c, 0x24, 0xb7, + 0xf3, 0xd0, 0x9b, 0xce, 0x43, 0xef, 0x65, 0x1e, 0x7a, 0x57, 0x54, 0x48, 0xdb, 0xcf, 0x93, 0xb8, + 0x8b, 0xe9, 0xca, 0xb8, 0xeb, 0xaf, 0x40, 0x3b, 0xd6, 0xdc, 0x24, 0x95, 0x62, 0xc3, 0x27, 0x9f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0xc3, 0xc9, 0x81, 0x34, 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 + +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/pulsarchain.bridge.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pulsarchain.bridge.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var Query_serviceDesc = _Query_serviceDesc +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pulsarchain.bridge.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pulsarchain/bridge/v1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/query.pb.gw.go b/x/bridge/types/query.pb.gw.go new file mode 100644 index 00000000..29d59084 --- /dev/null +++ b/x/bridge/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: pulsarchain/bridge/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"node101-io", "pulsar-chain", "bridge", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/bridge/types/tx.pb.go b/x/bridge/types/tx.pb.go new file mode 100644 index 00000000..aaafc938 --- /dev/null +++ b/x/bridge/types/tx.pb.go @@ -0,0 +1,968 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pulsarchain/bridge/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_9b52d5e292e8693c, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9b52d5e292e8693c, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +// MsgPushNewActions defines the MsgPushNewActions message. +type MsgPushNewActions struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + MinaBlockHeight int64 `protobuf:"varint,2,opt,name=mina_block_height,json=minaBlockHeight,proto3" json:"mina_block_height,omitempty"` +} + +func (m *MsgPushNewActions) Reset() { *m = MsgPushNewActions{} } +func (m *MsgPushNewActions) String() string { return proto.CompactTextString(m) } +func (*MsgPushNewActions) ProtoMessage() {} +func (*MsgPushNewActions) Descriptor() ([]byte, []int) { + return fileDescriptor_9b52d5e292e8693c, []int{2} +} +func (m *MsgPushNewActions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPushNewActions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPushNewActions.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 *MsgPushNewActions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPushNewActions.Merge(m, src) +} +func (m *MsgPushNewActions) XXX_Size() int { + return m.Size() +} +func (m *MsgPushNewActions) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPushNewActions.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPushNewActions proto.InternalMessageInfo + +func (m *MsgPushNewActions) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgPushNewActions) GetMinaBlockHeight() int64 { + if m != nil { + return m.MinaBlockHeight + } + return 0 +} + +// MsgPushNewActionsResponse defines the MsgPushNewActionsResponse message. +type MsgPushNewActionsResponse struct { +} + +func (m *MsgPushNewActionsResponse) Reset() { *m = MsgPushNewActionsResponse{} } +func (m *MsgPushNewActionsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPushNewActionsResponse) ProtoMessage() {} +func (*MsgPushNewActionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9b52d5e292e8693c, []int{3} +} +func (m *MsgPushNewActionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPushNewActionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPushNewActionsResponse.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 *MsgPushNewActionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPushNewActionsResponse.Merge(m, src) +} +func (m *MsgPushNewActionsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPushNewActionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPushNewActionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPushNewActionsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "pulsarchain.bridge.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "pulsarchain.bridge.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgPushNewActions)(nil), "pulsarchain.bridge.v1.MsgPushNewActions") + proto.RegisterType((*MsgPushNewActionsResponse)(nil), "pulsarchain.bridge.v1.MsgPushNewActionsResponse") +} + +func init() { proto.RegisterFile("pulsarchain/bridge/v1/tx.proto", fileDescriptor_9b52d5e292e8693c) } + +var fileDescriptor_9b52d5e292e8693c = []byte{ + // 461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0xd4, 0x40, + 0x18, 0xdd, 0xb1, 0x58, 0xd9, 0xb1, 0x58, 0x36, 0x54, 0xba, 0x1b, 0x31, 0x96, 0x20, 0xb2, 0x2c, + 0x6c, 0xa6, 0x59, 0x41, 0xa1, 0x27, 0x9b, 0x93, 0x20, 0x2b, 0x25, 0xe2, 0xc5, 0xcb, 0x32, 0x49, + 0xc6, 0xc9, 0xe0, 0x26, 0x13, 0x66, 0x26, 0xb5, 0xbd, 0xa9, 0x47, 0x4f, 0xfe, 0x0c, 0x8f, 0x7b, + 0xf0, 0x27, 0x78, 0xe8, 0xb1, 0x78, 0xf2, 0x24, 0x92, 0x3d, 0xec, 0xdf, 0x90, 0x64, 0x12, 0xda, + 0xc6, 0x96, 0xf6, 0x12, 0x32, 0xef, 0xbd, 0xef, 0x7b, 0xdf, 0x9b, 0x6f, 0xa0, 0x95, 0xe5, 0x73, + 0x89, 0x45, 0x18, 0x63, 0x96, 0xa2, 0x40, 0xb0, 0x88, 0x12, 0x74, 0xe8, 0x22, 0x75, 0xe4, 0x64, + 0x82, 0x2b, 0x6e, 0xdc, 0x3f, 0xc7, 0x3b, 0x9a, 0x77, 0x0e, 0x5d, 0xb3, 0x87, 0x13, 0x96, 0x72, + 0x54, 0x7d, 0xb5, 0xd2, 0xdc, 0x0e, 0xb9, 0x4c, 0xb8, 0x44, 0x89, 0xa4, 0x65, 0x87, 0x44, 0xd2, + 0x9a, 0x18, 0x68, 0x62, 0x56, 0x9d, 0x90, 0x3e, 0xd4, 0xd4, 0x16, 0xe5, 0x94, 0x6b, 0xbc, 0xfc, + 0xab, 0x51, 0xfb, 0xf2, 0x99, 0x32, 0x2c, 0x70, 0x52, 0x57, 0xda, 0x3f, 0x01, 0xdc, 0x9c, 0x4a, + 0xfa, 0x36, 0x8b, 0xb0, 0x22, 0x07, 0x15, 0x63, 0x3c, 0x83, 0x5d, 0x9c, 0xab, 0x98, 0x0b, 0xa6, + 0x8e, 0xfb, 0x60, 0x07, 0x0c, 0xbb, 0x5e, 0xff, 0xd7, 0x8f, 0xf1, 0x56, 0x6d, 0xb9, 0x1f, 0x45, + 0x82, 0x48, 0xf9, 0x46, 0x09, 0x96, 0x52, 0xff, 0x4c, 0x6a, 0xbc, 0x80, 0xeb, 0xba, 0x77, 0xff, + 0xd6, 0x0e, 0x18, 0xde, 0x9d, 0x3c, 0x74, 0x2e, 0x0d, 0xed, 0x68, 0x1b, 0xaf, 0x7b, 0xf2, 0xe7, + 0x51, 0xe7, 0xfb, 0x6a, 0x31, 0x02, 0x7e, 0x5d, 0xb7, 0xf7, 0xfc, 0xcb, 0x6a, 0x31, 0x3a, 0xeb, + 0xf8, 0x75, 0xb5, 0x18, 0x3d, 0x3e, 0x1f, 0xe2, 0xa8, 0x89, 0xd1, 0x1a, 0xd9, 0x1e, 0xc0, 0xed, + 0x16, 0xe4, 0x13, 0x99, 0xf1, 0x54, 0x12, 0xfb, 0x33, 0x80, 0xbd, 0xa9, 0xa4, 0x07, 0xb9, 0x8c, + 0x5f, 0x93, 0x8f, 0xfb, 0xa1, 0x62, 0x3c, 0x95, 0xc6, 0x04, 0xde, 0x09, 0x05, 0xc1, 0x8a, 0x8b, + 0x6b, 0x13, 0x36, 0x42, 0x63, 0x04, 0x7b, 0x09, 0x4b, 0xf1, 0x2c, 0x98, 0xf3, 0xf0, 0xc3, 0x2c, + 0x26, 0x8c, 0xc6, 0xaa, 0x8a, 0xba, 0xe6, 0x6f, 0x96, 0x84, 0x57, 0xe2, 0x2f, 0x2b, 0x78, 0x6f, + 0xa3, 0x4c, 0xd2, 0x54, 0xda, 0x0f, 0xe0, 0xe0, 0xbf, 0x11, 0x9a, 0x01, 0x27, 0x05, 0x80, 0x6b, + 0x53, 0x49, 0x8d, 0xf7, 0x70, 0xe3, 0xc2, 0x1a, 0x9e, 0x5c, 0x71, 0x7d, 0xad, 0xa0, 0xa6, 0x73, + 0x33, 0x5d, 0xe3, 0x67, 0xcc, 0xe1, 0xbd, 0xd6, 0x65, 0x0c, 0xaf, 0xee, 0x70, 0x51, 0x69, 0xee, + 0xde, 0x54, 0xd9, 0xb8, 0x99, 0xb7, 0x3f, 0x95, 0x1b, 0xf6, 0x5e, 0x9d, 0x14, 0x16, 0x38, 0x2d, + 0x2c, 0xf0, 0xb7, 0xb0, 0xc0, 0xb7, 0xa5, 0xd5, 0x39, 0x5d, 0x5a, 0x9d, 0xdf, 0x4b, 0xab, 0xf3, + 0xce, 0xa5, 0x4c, 0xc5, 0x79, 0xe0, 0x84, 0x3c, 0x41, 0x29, 0x8f, 0x88, 0xbb, 0xeb, 0x8e, 0x19, + 0x47, 0xda, 0x67, 0xdc, 0xda, 0xbb, 0x3a, 0xce, 0x88, 0x0c, 0xd6, 0xab, 0xb7, 0xfb, 0xf4, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xbf, 0x19, 0x10, 0x75, 0x03, 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 { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // PushNewActions defines the PushNewActions RPC. + PushNewActions(ctx context.Context, in *MsgPushNewActions, opts ...grpc.CallOption) (*MsgPushNewActionsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/pulsarchain.bridge.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) PushNewActions(ctx context.Context, in *MsgPushNewActions, opts ...grpc.CallOption) (*MsgPushNewActionsResponse, error) { + out := new(MsgPushNewActionsResponse) + err := c.cc.Invoke(ctx, "/pulsarchain.bridge.v1.Msg/PushNewActions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // PushNewActions defines the PushNewActions RPC. + PushNewActions(context.Context, *MsgPushNewActions) (*MsgPushNewActionsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) PushNewActions(ctx context.Context, req *MsgPushNewActions) (*MsgPushNewActionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushNewActions not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pulsarchain.bridge.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_PushNewActions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPushNewActions) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PushNewActions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pulsarchain.bridge.v1.Msg/PushNewActions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PushNewActions(ctx, req.(*MsgPushNewActions)) + } + return interceptor(ctx, in, info, handler) +} + +var Msg_serviceDesc = _Msg_serviceDesc +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pulsarchain.bridge.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "PushNewActions", + Handler: _Msg_PushNewActions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pulsarchain/bridge/v1/tx.proto", +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPushNewActions) 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 *MsgPushNewActions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPushNewActions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinaBlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MinaBlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPushNewActionsResponse) 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 *MsgPushNewActionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPushNewActionsResponse) 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 *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPushNewActions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MinaBlockHeight != 0 { + n += 1 + sovTx(uint64(m.MinaBlockHeight)) + } + return n +} + +func (m *MsgPushNewActionsResponse) 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 *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPushNewActions) 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: MsgPushNewActions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPushNewActions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinaBlockHeight", wireType) + } + m.MinaBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinaBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPushNewActionsResponse) 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: MsgPushNewActionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPushNewActionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/types.go b/x/bridge/types/types.go new file mode 100644 index 00000000..0d3893a2 --- /dev/null +++ b/x/bridge/types/types.go @@ -0,0 +1,7 @@ +package types + +const MINA_HARDFINALITY_BLOCK_DURATION int64 = 32 +const Denom string = "pMina" +const ContractAddress string = "B62qmxfmpgjKrHp31TDzDsSGpNhBEK3To1gVxMGPyBD9BZQi2ctexm4" + +const MerkleListPrefix = "" diff --git a/x/keyregistry/types/tx.pb.go b/x/keyregistry/types/tx.pb.go index b0b00dec..566bdba3 100644 --- a/x/keyregistry/types/tx.pb.go +++ b/x/keyregistry/types/tx.pb.go @@ -388,40 +388,40 @@ var fileDescriptor_235f5fb22cc1f8d8 = []byte{ 0x04, 0x62, 0x37, 0xa9, 0xd4, 0xa1, 0x62, 0x69, 0x04, 0x53, 0x15, 0x29, 0x72, 0x61, 0x61, 0xb1, 0x2e, 0xce, 0xc9, 0x31, 0xa9, 0x7d, 0xd6, 0xdd, 0x39, 0xad, 0x37, 0xc4, 0xc8, 0xc4, 0xc7, 0x60, 0xcc, 0xc0, 0xce, 0xda, 0x09, 0x45, 0x4c, 0x0c, 0x08, 0xa1, 0x64, 0xc8, 0xd7, 0x40, 0x3e, 0xdb, - 0xb1, 0x13, 0x85, 0xa4, 0x54, 0x62, 0xb1, 0x7c, 0xef, 0xfb, 0xdc, 0xf3, 0xbc, 0xef, 0xf3, 0xde, + 0xb1, 0x13, 0x85, 0xa4, 0x54, 0x62, 0xb1, 0x7c, 0xef, 0xfb, 0xdc, 0xf3, 0xbc, 0xef, 0x73, 0xef, 0x1d, 0x78, 0xe4, 0xb8, 0x97, 0x14, 0x12, 0xbd, 0x0b, 0x4d, 0x5b, 0xe9, 0x21, 0x8f, 0x20, 0xc3, 0xa4, 0x8c, 0x78, 0x4a, 0xbf, 0xa6, 0xb0, 0x6b, 0xd9, 0x21, 0x98, 0x61, 0x31, 0x9f, 0x00, 0xc9, 0x09, 0x90, 0xdc, 0xaf, 0xe5, 0xf7, 0xa0, 0x65, 0xda, 0x58, 0xe1, 0xdf, 0x00, 0x9e, 0xcf, 0xea, 0x98, 0x5a, 0x98, 0x2a, 0x16, 0x35, 0x7c, 0x1a, 0x8b, 0x1a, 0x61, 0xe2, 0x20, 0x48, 0x68, 0x7c, - 0xa5, 0x04, 0x8b, 0x30, 0xb5, 0x6f, 0x60, 0x03, 0x07, 0x71, 0xff, 0x2f, 0x8c, 0x3e, 0x59, 0x52, - 0x9d, 0x03, 0x09, 0xb4, 0xa2, 0xed, 0x47, 0x4b, 0x80, 0x3d, 0xe4, 0x69, 0xae, 0xd3, 0x81, 0x0c, - 0x69, 0xcc, 0x73, 0x50, 0xb0, 0xa3, 0xf8, 0x55, 0x00, 0x3b, 0x4d, 0x6a, 0xbc, 0xe6, 0x89, 0x16, - 0xe7, 0x12, 0x4f, 0x40, 0x06, 0xba, 0xac, 0x8b, 0x89, 0xc9, 0xbc, 0x9c, 0x50, 0x10, 0x4a, 0x99, - 0x46, 0xee, 0xdb, 0xe7, 0xea, 0x7e, 0x58, 0xe9, 0x59, 0xa7, 0x43, 0x10, 0xa5, 0x17, 0x8c, 0x98, - 0xb6, 0xa1, 0xc6, 0x50, 0xf1, 0x25, 0xd8, 0x08, 0xaa, 0xc9, 0xa5, 0x0b, 0x42, 0xe9, 0x5e, 0xbd, - 0x28, 0xff, 0xd9, 0x30, 0x39, 0xd0, 0x6a, 0x64, 0x6e, 0x7e, 0x3e, 0x4c, 0x7d, 0x9a, 0x0c, 0x2a, - 0x82, 0x1a, 0x6e, 0x3e, 0x7d, 0xfe, 0x7e, 0x32, 0xa8, 0xc4, 0xb4, 0x1f, 0x26, 0x83, 0x4a, 0x39, - 0xd9, 0xd7, 0xf5, 0x4c, 0x67, 0x73, 0xc5, 0x17, 0x0f, 0x40, 0x76, 0x2e, 0xa4, 0x22, 0xea, 0x60, - 0x9b, 0xa2, 0xe2, 0x97, 0x34, 0xef, 0x55, 0xe5, 0x5b, 0x11, 0x39, 0x47, 0x1e, 0x15, 0xeb, 0xe0, - 0x7f, 0x9d, 0x20, 0xc8, 0x30, 0x59, 0xd9, 0x69, 0x04, 0x14, 0x2b, 0x60, 0x2f, 0x9a, 0xa0, 0xdb, + 0xa5, 0x04, 0x8b, 0x30, 0xb5, 0x6f, 0x60, 0x03, 0x07, 0x71, 0xff, 0x2f, 0x8c, 0x1e, 0x2d, 0xa9, + 0xae, 0x87, 0x3c, 0xcd, 0x75, 0x3a, 0x90, 0x21, 0x8d, 0x79, 0x0e, 0x0a, 0x77, 0x3c, 0x59, 0xb2, + 0xc3, 0x81, 0x04, 0x5a, 0xa1, 0x60, 0xf1, 0xab, 0x00, 0x76, 0x9a, 0xd4, 0x78, 0xcd, 0x19, 0x5a, + 0x3c, 0x23, 0x9e, 0x80, 0x0c, 0x74, 0x59, 0x17, 0x13, 0x93, 0x79, 0x39, 0xa1, 0x20, 0x94, 0x32, + 0x8d, 0xdc, 0xb7, 0xcf, 0xd5, 0xfd, 0xb0, 0xd2, 0xb3, 0x4e, 0x87, 0x20, 0x4a, 0x2f, 0x18, 0x31, + 0x6d, 0x43, 0x8d, 0xa1, 0xe2, 0x4b, 0xb0, 0x11, 0x70, 0xe7, 0xd2, 0x05, 0xa1, 0x74, 0xaf, 0x5e, + 0x94, 0xff, 0x6c, 0x98, 0x1c, 0x68, 0x35, 0x32, 0x37, 0x3f, 0x1f, 0xa6, 0x3e, 0x4d, 0x06, 0x15, + 0x41, 0x0d, 0x37, 0x9f, 0x3e, 0x7f, 0x3f, 0x19, 0x54, 0x62, 0xda, 0x0f, 0x93, 0x41, 0xa5, 0x9c, + 0x6c, 0xe7, 0x7a, 0xa6, 0xa1, 0xb9, 0xe2, 0x8b, 0x07, 0x20, 0x3b, 0x17, 0x52, 0x11, 0x75, 0xb0, + 0x4d, 0x51, 0xf1, 0x4b, 0x9a, 0xf7, 0xaa, 0xf2, 0xad, 0x88, 0x9c, 0x23, 0x8f, 0x8a, 0x75, 0xf0, + 0xbf, 0x4e, 0x10, 0x64, 0x98, 0xac, 0xec, 0x34, 0x02, 0x8a, 0x15, 0xb0, 0x17, 0x9d, 0xa0, 0xdb, 0xbe, 0x34, 0x75, 0xad, 0x87, 0x3c, 0xde, 0xf2, 0xa6, 0xba, 0x13, 0x24, 0x5a, 0x3c, 0x7e, 0x8e, 0x3c, 0xf1, 0x31, 0xd8, 0xb1, 0x4c, 0x1b, 0x26, 0x91, 0x6b, 0x1c, 0xb9, 0xe5, 0x87, 0x63, 0x5c, 0x19, 0xec, 0x86, 0x9c, 0xd4, 0x34, 0x6c, 0xc8, 0x5c, 0x82, 0x72, 0xff, 0x25, 0x29, 0x2f, 0xa2, 0xb0, 0x78, 0x08, 0xb6, 0x39, 0x65, 0x0c, 0x5c, 0x8f, 0x19, 0x63, 0xd8, 0x0b, 0x00, 0xa0, 0xce, - 0x30, 0xe1, 0xd3, 0xce, 0x6d, 0x14, 0x84, 0xd2, 0x76, 0xfd, 0x70, 0xd9, 0x44, 0xce, 0x7c, 0xf4, - 0x2b, 0xcf, 0x41, 0x6a, 0x06, 0x46, 0xbf, 0xa7, 0x9b, 0xfe, 0x30, 0xa2, 0xce, 0x43, 0x73, 0x93, - 0x06, 0x4e, 0xcd, 0x1d, 0xa6, 0xc1, 0xd6, 0xd4, 0xf8, 0x3b, 0x5b, 0xab, 0x80, 0x7d, 0x87, 0xa0, - 0xbe, 0x36, 0xef, 0x59, 0xe0, 0xee, 0x9e, 0x9f, 0x6b, 0xce, 0xf8, 0x56, 0x05, 0xf7, 0x6d, 0x74, - 0xa5, 0x2d, 0xf6, 0x78, 0xd7, 0x46, 0x57, 0xcd, 0xbb, 0xda, 0xfc, 0x0c, 0x88, 0x53, 0xe6, 0x79, - 0xab, 0x23, 0xe2, 0x7f, 0xeb, 0x76, 0x16, 0x3c, 0x98, 0x71, 0x34, 0xf2, 0xba, 0xfe, 0x23, 0x0d, - 0xd6, 0x9a, 0xd4, 0x10, 0x1d, 0xb0, 0x39, 0x73, 0x71, 0x9f, 0x2e, 0x13, 0x9c, 0xbb, 0x15, 0xf9, - 0xe3, 0xbf, 0x00, 0x47, 0xca, 0xbe, 0xe2, 0xcc, 0xf5, 0x59, 0xa5, 0x98, 0x04, 0xaf, 0x54, 0x5c, - 0x74, 0xae, 0xc4, 0xb7, 0x00, 0x24, 0xce, 0x54, 0xf9, 0x56, 0x45, 0x73, 0xb5, 0xda, 0xad, 0xa1, - 0x91, 0x56, 0x7e, 0xfd, 0x9d, 0xff, 0x10, 0x35, 0x5a, 0x37, 0x23, 0x49, 0x18, 0x8e, 0x24, 0xe1, - 0xd7, 0x48, 0x12, 0x3e, 0x8e, 0xa5, 0xd4, 0x70, 0x2c, 0xa5, 0xbe, 0x8f, 0xa5, 0xd4, 0x9b, 0x13, - 0xc3, 0x64, 0x5d, 0xb7, 0x2d, 0xeb, 0xd8, 0x52, 0x6c, 0xdc, 0x41, 0xb5, 0xa3, 0x5a, 0xd5, 0xc4, - 0x4a, 0x20, 0x54, 0x5d, 0xf4, 0x3c, 0xf9, 0xc7, 0x81, 0xb6, 0x37, 0xf8, 0x63, 0x7b, 0xfc, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0x12, 0x10, 0x94, 0x52, 0x67, 0x06, 0x00, 0x00, + 0x30, 0xe1, 0x63, 0x91, 0xdb, 0x28, 0x08, 0xa5, 0xed, 0xfa, 0xe1, 0xb2, 0x13, 0x39, 0xf3, 0xd1, + 0xaf, 0x3c, 0x07, 0xa9, 0x19, 0x18, 0xfd, 0x9e, 0x6e, 0xfa, 0x87, 0x11, 0x75, 0x1e, 0x9a, 0x9b, + 0x34, 0x70, 0x6a, 0xee, 0x30, 0x0d, 0xb6, 0xa6, 0xc6, 0xdf, 0xd9, 0x5a, 0x05, 0xec, 0x3b, 0x04, + 0xf5, 0xb5, 0x79, 0xcf, 0x02, 0x77, 0xf7, 0xfc, 0x5c, 0x73, 0xc6, 0xb7, 0x2a, 0xb8, 0x6f, 0xa3, + 0x2b, 0x6d, 0xb1, 0xc7, 0xbb, 0x36, 0xba, 0x6a, 0xde, 0xd5, 0xe6, 0x67, 0x40, 0x9c, 0x32, 0xcf, + 0x5b, 0x1d, 0x11, 0xff, 0x5b, 0xb7, 0xb3, 0xe0, 0xc1, 0x8c, 0xa3, 0x91, 0xd7, 0xf5, 0x1f, 0x69, + 0xb0, 0xd6, 0xa4, 0x86, 0xe8, 0x80, 0xcd, 0x99, 0x8b, 0xfb, 0x74, 0x99, 0xe0, 0xdc, 0xad, 0xc8, + 0x1f, 0xff, 0x05, 0x38, 0x52, 0xf6, 0x15, 0x67, 0xae, 0xcf, 0x2a, 0xc5, 0x24, 0x78, 0xa5, 0xe2, + 0xa2, 0xb9, 0x12, 0xdf, 0x02, 0x90, 0x98, 0xa9, 0xf2, 0xad, 0x8a, 0xe6, 0x6a, 0xb5, 0x5b, 0x43, + 0x23, 0xad, 0xfc, 0xfa, 0x3b, 0xff, 0x21, 0x6a, 0xb4, 0x6e, 0x46, 0x92, 0x30, 0x1c, 0x49, 0xc2, + 0xaf, 0x91, 0x24, 0x7c, 0x1c, 0x4b, 0xa9, 0xe1, 0x58, 0x4a, 0x7d, 0x1f, 0x4b, 0xa9, 0x37, 0x27, + 0x86, 0xc9, 0xba, 0x6e, 0x5b, 0xd6, 0xb1, 0xa5, 0xd8, 0xb8, 0x83, 0x6a, 0x47, 0xb5, 0xaa, 0x89, + 0x95, 0x40, 0xa8, 0xba, 0xe8, 0x79, 0xf2, 0xc7, 0x81, 0xb6, 0x37, 0xf8, 0x63, 0x7b, 0xfc, 0x3b, + 0x00, 0x00, 0xff, 0xff, 0xa3, 0x9c, 0xc6, 0x6b, 0x67, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.