baseapp: Enhance Tx Message Data (#6384)
* Enhance tx message data * Fix allocation * cl++ * Fix lint
This commit is contained in:
parent
6740d27b55
commit
c0aff2e1f5
|
@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||
|
||||
### Client Breaking
|
||||
|
||||
* (baseapp) [\#6384](https://github.com/cosmos/cosmos-sdk/pull/6384) The `Result.Data` is now a Protocol Buffer encoded binary blob of type `TxData`. The `TxData` contains `Data` which contains a list of Protocol Buffer encoded message data and the corresponding message type.
|
||||
* (x/gov) [#6295](https://github.com/cosmos/cosmos-sdk/pull/6295) Fix typo in querying governance params.
|
||||
* (x/auth) [\#6054](https://github.com/cosmos/cosmos-sdk/pull/6054) Remove custom JSON marshaling for base accounts as multsigs cannot be bech32 decoded.
|
||||
* (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) The `/bank/balances/{address}` endpoint now returns all account
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/grpc"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
|
@ -605,8 +606,10 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (gInfo sdk.
|
|||
// Result is returned. The caller must not commit state if an error is returned.
|
||||
func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*sdk.Result, error) {
|
||||
msgLogs := make(sdk.ABCIMessageLogs, 0, len(msgs))
|
||||
data := make([]byte, 0, len(msgs))
|
||||
events := sdk.EmptyEvents()
|
||||
txData := &sdk.TxData{
|
||||
Data: make([]*sdk.MsgData, 0, len(msgs)),
|
||||
}
|
||||
|
||||
// NOTE: GasWanted is determined by the AnteHandler and GasUsed by the GasMeter.
|
||||
for i, msg := range msgs {
|
||||
|
@ -638,10 +641,15 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s
|
|||
// separate each result.
|
||||
events = events.AppendEvents(msgEvents)
|
||||
|
||||
data = append(data, msgResult.Data...)
|
||||
txData.Data = append(txData.Data, &sdk.MsgData{MsgType: msg.Type(), Data: msgResult.Data})
|
||||
msgLogs = append(msgLogs, sdk.NewABCIMessageLog(uint16(i), msgResult.Log, msgEvents))
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(txData)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "failed to marshal tx data")
|
||||
}
|
||||
|
||||
return &sdk.Result{
|
||||
Data: data,
|
||||
Log: strings.TrimSpace(msgLogs.String()),
|
||||
|
|
|
@ -384,6 +384,103 @@ func (m *SimulationResponse) GetResult() *Result {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MsgData defines the data returned in a Result object during message execution.
|
||||
type MsgData struct {
|
||||
MsgType string `protobuf:"bytes,1,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`
|
||||
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgData) Reset() { *m = MsgData{} }
|
||||
func (*MsgData) ProtoMessage() {}
|
||||
func (*MsgData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2c0f90c600ad7e2e, []int{8}
|
||||
}
|
||||
func (m *MsgData) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgData.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 *MsgData) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgData.Merge(m, src)
|
||||
}
|
||||
func (m *MsgData) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgData) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgData.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgData proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgData) GetMsgType() string {
|
||||
if m != nil {
|
||||
return m.MsgType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgData) GetData() []byte {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TxData defines a list of MsgData. A transaction will have a MsgData object for
|
||||
// each message.
|
||||
type TxData struct {
|
||||
Data []*MsgData `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TxData) Reset() { *m = TxData{} }
|
||||
func (*TxData) ProtoMessage() {}
|
||||
func (*TxData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2c0f90c600ad7e2e, []int{9}
|
||||
}
|
||||
func (m *TxData) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TxData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_TxData.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 *TxData) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TxData.Merge(m, src)
|
||||
}
|
||||
func (m *TxData) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TxData) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TxData.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TxData proto.InternalMessageInfo
|
||||
|
||||
func (m *TxData) GetData() []*MsgData {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Coin)(nil), "cosmos_sdk.v1.Coin")
|
||||
proto.RegisterType((*DecCoin)(nil), "cosmos_sdk.v1.DecCoin")
|
||||
|
@ -393,46 +490,51 @@ func init() {
|
|||
proto.RegisterType((*GasInfo)(nil), "cosmos_sdk.v1.GasInfo")
|
||||
proto.RegisterType((*Result)(nil), "cosmos_sdk.v1.Result")
|
||||
proto.RegisterType((*SimulationResponse)(nil), "cosmos_sdk.v1.SimulationResponse")
|
||||
proto.RegisterType((*MsgData)(nil), "cosmos_sdk.v1.MsgData")
|
||||
proto.RegisterType((*TxData)(nil), "cosmos_sdk.v1.TxData")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("types/types.proto", fileDescriptor_2c0f90c600ad7e2e) }
|
||||
|
||||
var fileDescriptor_2c0f90c600ad7e2e = []byte{
|
||||
// 534 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4f, 0x6f, 0xd3, 0x4e,
|
||||
0x10, 0xb5, 0x7f, 0xf6, 0x2f, 0x7f, 0x36, 0xe1, 0x4f, 0x17, 0x8a, 0xa2, 0x0a, 0xec, 0xc8, 0x48,
|
||||
0x28, 0x48, 0xd4, 0x16, 0x29, 0xa7, 0x70, 0xc2, 0x04, 0x55, 0xe1, 0x84, 0x16, 0x01, 0x12, 0x97,
|
||||
0x68, 0xe3, 0xdd, 0xba, 0x56, 0xe3, 0xdd, 0xc8, 0xbb, 0x29, 0xca, 0x2d, 0x47, 0x8e, 0x7c, 0x84,
|
||||
0x7e, 0x9c, 0x1e, 0x73, 0xac, 0x10, 0xb2, 0x20, 0xb9, 0x70, 0xee, 0x91, 0x13, 0xda, 0xb5, 0xc1,
|
||||
0x6a, 0x7a, 0xe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5e,
|
||||
0xa1, 0xd5, 0xbf, 0xe7, 0x5f, 0xf1, 0xa9, 0x5f, 0x0a, 0x13, 0x36, 0x14, 0xe9, 0x2a, 0x77, 0x4d,
|
||||
0x7d, 0x85, 0xd6, 0x6a, 0x1f, 0xd4, 0x32, 0x7d, 0x85, 0x5e, 0xb5, 0xd5, 0xdf, 0xdd, 0x6a, 0x2d,
|
||||
0x4e, 0x44, 0x25, 0x28, 0x1c, 0x5e, 0xfc, 0x70, 0x8c, 0xe5, 0xda, 0x31, 0xce, 0xd7, 0x8e, 0xb9,
|
||||
0x5a, 0x3b, 0xe6, 0xf7, 0xb5, 0x63, 0x7e, 0xd9, 0x38, 0xc6, 0x6a, 0xe3, 0x18, 0x17, 0x1b, 0xc7,
|
||||
0xf8, 0xe8, 0xc5, 0x89, 0x3c, 0x9e, 0x4f, 0xfc, 0x88, 0xa7, 0x41, 0x41, 0x55, 0xfe, 0xed, 0x0b,
|
||||
0x72, 0x52, 0x18, 0x7c, 0x52, 0xd3, 0x0e, 0x3f, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xe8,
|
||||
0xc3, 0x0c, 0x62, 0x03, 0x00, 0x00,
|
||||
// 586 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
|
||||
0x10, 0xb5, 0x6b, 0xe3, 0xa4, 0x9b, 0xf2, 0xd1, 0x85, 0xa2, 0x50, 0x81, 0x1d, 0x19, 0x09, 0x15,
|
||||
0x44, 0x6d, 0xd1, 0x72, 0x32, 0x12, 0x12, 0x26, 0xa8, 0x2a, 0x12, 0x12, 0x32, 0x05, 0x24, 0x2e,
|
||||
0xd1, 0xc6, 0xde, 0xba, 0x56, 0xe3, 0x5d, 0xcb, 0xbb, 0x29, 0xe4, 0x96, 0x23, 0x47, 0x7e, 0x42,
|
||||
0x7f, 0x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x92,
|
||||
0x0e, 0x07, 0x88, 0x27, 0x94, 0x04, 0x98, 0x65, 0x94, 0x30, 0x0c, 0x9f, 0x94, 0x8d, 0x27, 0x64,
|
||||
0x9f, 0xca, 0x16, 0x5a, 0x5b, 0x37, 0x9d, 0x73, 0x7b, 0xea, 0x54, 0xc2, 0xf8, 0x4d, 0x41, 0x3a,
|
||||
0x29, 0x2c, 0x55, 0x4e, 0x21, 0xb5, 0xda, 0x04, 0x46, 0x2e, 0xa7, 0x90, 0xad, 0xb6, 0xb6, 0xd6,
|
||||
0x16, 0x52, 0xcb, 0x11, 0x83, 0x0a, 0x64, 0x3f, 0x05, 0x8d, 0x57, 0x2c, 0xee, 0x8a, 0x09, 0x6f,
|
||||
0x81, 0x66, 0xca, 0xe2, 0x9e, 0x68, 0xba, 0x5a, 0xa7, 0x46, 0xca, 0xe2, 0xbd, 0x51, 0x86, 0xe7,
|
||||
0x82, 0x2c, 0xd5, 0x82, 0x54, 0xb7, 0xe4, 0x01, 0x63, 0xef, 0x93, 0x4c, 0x7f, 0x30, 0x17, 0x4d,
|
||||
0xfb, 0x47, 0xc7, 0x55, 0x91, 0xbf, 0x73, 0xfd, 0xee, 0xe9, 0x0f, 0x53, 0x19, 0x4f, 0x4d, 0xe5,
|
||||
0x64, 0x6a, 0xaa, 0x93, 0xa9, 0xa9, 0x7e, 0x9f, 0x9a, 0xea, 0x97, 0x99, 0xa9, 0x4c, 0x66, 0xa6,
|
||||
0x72, 0x3a, 0x33, 0x95, 0x0f, 0x76, 0x9c, 0xf0, 0x83, 0x61, 0xdf, 0x09, 0x69, 0xea, 0x96, 0x7c,
|
||||
0xd5, 0x6f, 0x93, 0x45, 0x87, 0xe5, 0xe3, 0xea, 0x1b, 0xf2, 0x75, 0x6d, 0xff, 0x0e, 0x00, 0x00,
|
||||
0xff, 0xff, 0xb6, 0xfc, 0xcd, 0xf8, 0xde, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Coin) Equal(that interface{}) bool {
|
||||
|
@ -796,6 +898,80 @@ func (m *SimulationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgData) 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 *MsgData) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Data) > 0 {
|
||||
i -= len(m.Data)
|
||||
copy(dAtA[i:], m.Data)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.Data)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.MsgType) > 0 {
|
||||
i -= len(m.MsgType)
|
||||
copy(dAtA[i:], m.MsgType)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.MsgType)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *TxData) 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 *TxData) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TxData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Data) > 0 {
|
||||
for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTypes(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTypes(v)
|
||||
base := offset
|
||||
|
@ -927,6 +1103,38 @@ func (m *SimulationResponse) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *MsgData) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.MsgType)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
l = len(m.Data)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TxData) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Data) > 0 {
|
||||
for _, e := range m.Data {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTypes(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
|
@ -943,6 +1151,32 @@ func (this *ValAddresses) String() string {
|
|||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *MsgData) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&MsgData{`,
|
||||
`MsgType:` + fmt.Sprintf("%v", this.MsgType) + `,`,
|
||||
`Data:` + fmt.Sprintf("%v", this.Data) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *TxData) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
repeatedStringForData := "[]*MsgData{"
|
||||
for _, f := range this.Data {
|
||||
repeatedStringForData += strings.Replace(f.String(), "MsgData", "MsgData", 1) + ","
|
||||
}
|
||||
repeatedStringForData += "}"
|
||||
s := strings.Join([]string{`&TxData{`,
|
||||
`Data:` + repeatedStringForData + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringTypes(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
|
@ -1814,6 +2048,212 @@ func (m *SimulationResponse) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgData) 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 ErrIntOverflowTypes
|
||||
}
|
||||
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: MsgData: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgData: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
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 ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.MsgType = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Data == nil {
|
||||
m.Data = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTypes(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TxData) 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 ErrIntOverflowTypes
|
||||
}
|
||||
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: TxData: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TxData: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Data = append(m.Data, &MsgData{})
|
||||
if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTypes(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTypes(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -78,3 +78,19 @@ message SimulationResponse {
|
|||
GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
Result result = 2;
|
||||
}
|
||||
|
||||
// MsgData defines the data returned in a Result object during message execution.
|
||||
message MsgData {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
string msg_type = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
// TxData defines a list of MsgData. A transaction will have a MsgData object for
|
||||
// each message.
|
||||
message TxData {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
repeated MsgData data = 1;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ var _ = math.Inf
|
|||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// QueryBalanceRequest is the request type for the Query.Balance RPC method
|
||||
// QueryBalanceRequest is the request type for the Query/Balance RPC method
|
||||
type QueryBalanceRequest struct {
|
||||
// address is the address to query balances for
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
|
@ -85,7 +85,7 @@ func (m *QueryBalanceRequest) GetDenom() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// QueryBalanceResponse is the response type for the Query.Balance RPC method
|
||||
// QueryBalanceResponse is the response type for the Query/Balance RPC method
|
||||
type QueryBalanceResponse struct {
|
||||
// balance is the balance of the coin
|
||||
Balance *types.Coin `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
|
||||
|
@ -131,7 +131,7 @@ func (m *QueryBalanceResponse) GetBalance() *types.Coin {
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryBalanceRequest is the request type for the Query.AllBalances RPC method
|
||||
// QueryBalanceRequest is the request type for the Query/AllBalances RPC method
|
||||
type QueryAllBalancesRequest struct {
|
||||
// address is the address to query balances for
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
|
@ -177,7 +177,7 @@ func (m *QueryAllBalancesRequest) GetAddress() github_com_cosmos_cosmos_sdk_type
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryAllBalancesResponse is the response type for the Query.AllBalances RPC method
|
||||
// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC method
|
||||
type QueryAllBalancesResponse struct {
|
||||
// balances is the balances of the coins
|
||||
Balances github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balances"`
|
||||
|
@ -223,7 +223,7 @@ func (m *QueryAllBalancesResponse) GetBalances() github_com_cosmos_cosmos_sdk_ty
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryTotalSupplyRequest is the request type for the Query.TotalSupply RPC method
|
||||
// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method
|
||||
type QueryTotalSupplyRequest struct {
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo
|
||||
|
||||
// QueryTotalSupplyResponse is the response type for the Query.TotalSupply RPC method
|
||||
// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method
|
||||
type QueryTotalSupplyResponse struct {
|
||||
// supply is the supply of the coins
|
||||
Supply github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supply"`
|
||||
|
@ -306,7 +306,7 @@ func (m *QueryTotalSupplyResponse) GetSupply() github_com_cosmos_cosmos_sdk_type
|
|||
return nil
|
||||
}
|
||||
|
||||
// QuerySupplyOfRequest is the request type for the Query.SupplyOf RPC method
|
||||
// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method
|
||||
type QuerySupplyOfRequest struct {
|
||||
Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ func (m *QuerySupplyOfRequest) GetDenom() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// QuerySupplyOfResponse is the response type for the Query.SupplyOf RPC method
|
||||
// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method
|
||||
type QuerySupplyOfResponse struct {
|
||||
// amount is the supply of the coin
|
||||
Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"`
|
||||
|
|
Loading…
Reference in New Issue