Merge PR #4230: Minor cleanup in tx tags and response format
This commit is contained in:
parent
5344e8d768
commit
f0f7b7dab7
|
@ -0,0 +1 @@
|
|||
#4230 Change the type of ABCIMessageLog#MsgIndex to uint16 for proper serialization.
|
|
@ -0,0 +1 @@
|
|||
#4230 Properly set and display the message index through the TxResponse.
|
|
@ -698,7 +698,7 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (re
|
|||
tags = append(tags, sdk.MakeTag(sdk.TagAction, msg.Type()))
|
||||
tags = append(tags, msgResult.Tags...)
|
||||
|
||||
idxLog := sdk.ABCIMessageLog{MsgIndex: msgIdx, Log: msgResult.Log}
|
||||
idxLog := sdk.ABCIMessageLog{MsgIndex: uint16(msgIdx), Log: msgResult.Log}
|
||||
|
||||
// stop execution and return on first failed message
|
||||
if !msgResult.IsOK() {
|
||||
|
|
|
@ -45,7 +45,7 @@ type ABCIMessageLogs []ABCIMessageLog
|
|||
|
||||
// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
|
||||
type ABCIMessageLog struct {
|
||||
MsgIndex int `json:"msg_index"`
|
||||
MsgIndex uint16 `json:"msg_index"`
|
||||
Success bool `json:"success"`
|
||||
Log string `json:"log"`
|
||||
}
|
||||
|
@ -229,10 +229,6 @@ func (r TxResponse) String() string {
|
|||
sb.WriteString(fmt.Sprintf(" GasUsed: %d\n", r.GasUsed))
|
||||
}
|
||||
|
||||
if len(r.Tags) > 0 {
|
||||
sb.WriteString(fmt.Sprintf(" Tags: \n%s\n", r.Tags.String()))
|
||||
}
|
||||
|
||||
if r.Codespace != "" {
|
||||
sb.WriteString(fmt.Sprintf(" Codespace: %s\n", r.Codespace))
|
||||
}
|
||||
|
@ -241,6 +237,10 @@ func (r TxResponse) String() string {
|
|||
sb.WriteString(fmt.Sprintf(" Timestamp: %s\n", r.Timestamp))
|
||||
}
|
||||
|
||||
if len(r.Tags) > 0 {
|
||||
sb.WriteString(fmt.Sprintf(" Tags: \n%s\n", r.Tags.String()))
|
||||
}
|
||||
|
||||
return strings.TrimSpace(sb.String())
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,6 @@ func TestParseABCILog(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Len(t, res, 1)
|
||||
require.Equal(t, res[0].Log, "")
|
||||
require.Equal(t, res[0].MsgIndex, 1)
|
||||
require.Equal(t, res[0].MsgIndex, uint16(1))
|
||||
require.True(t, res[0].Success)
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ func (st StringTags) String() string {
|
|||
for _, t := range st {
|
||||
sb.WriteString(fmt.Sprintf(" - %s\n", t.String()))
|
||||
}
|
||||
return sb.String()
|
||||
|
||||
return strings.TrimRight(sb.String(), "\n")
|
||||
}
|
||||
|
||||
// Conversion function from a []byte tag to a string tag
|
||||
|
|
Loading…
Reference in New Issue