fix: Add Events to TxResponse (#10630)

This commit is contained in:
Aleksandr Bezobchuk 2021-11-30 10:29:09 -05:00 committed by GitHub
parent 4a129832eb
commit c4bedf8a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 183 additions and 117 deletions

View File

@ -59,6 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (deps) [\#10210](https://github.com/cosmos/cosmos-sdk/pull/10210) Bump Tendermint to [v0.35.0](https://github.com/tendermint/tendermint/releases/tag/v0.35.0).
* [\#10486](https://github.com/cosmos/cosmos-sdk/pull/10486) store/cachekv's `Store.Write` conservatively looks up keys, but also uses the [map clearing idiom](https://bencher.orijtech.com/perfclinic/mapclearing/) to reduce the RAM usage, CPU time usage, and garbage collection pressure from clearing maps, instead of allocating new maps.
* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures _all_ events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution.
### API Breaking Changes

3
go.sum
View File

@ -298,7 +298,6 @@ github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFM
github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE=
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk=
github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI=
@ -498,8 +497,6 @@ github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9
github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs=
github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=

View File

@ -39,6 +39,13 @@ message TxResponse {
// the timestamps of the valid votes in the block.LastCommit. For height == 1,
// it's genesis time.
string timestamp = 12;
// Events defines all the events emitted by processing a transaction. Note,
// these events include those emitted by processing all the messages and those
// emitted from the ante handler. Whereas Logs contains the events, with
// additional metadata, emitted only by processing the messages.
//
// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
repeated tendermint.abci.Event events = 13 [(gogoproto.nullable) = false];
}
// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.

View File

@ -57,6 +57,13 @@ type TxResponse struct {
// the timestamps of the valid votes in the block.LastCommit. For height == 1,
// it's genesis time.
Timestamp string `protobuf:"bytes,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// Events defines all the events emitted by processing a transaction. Note,
// these events include those emitted by processing all the messages and those
// emitted from the ante handler. Whereas Logs contains the events, with
// additional metadata, emitted only by processing the messages.
//
// Since: cosmos-sdk 0.45
Events []types1.Event `protobuf:"bytes,13,rep,name=events,proto3" json:"events"`
}
func (m *TxResponse) Reset() { *m = TxResponse{} }
@ -609,62 +616,63 @@ func init() {
}
var fileDescriptor_4e37629bc7eb0df8 = []byte{
// 874 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0xbd, 0x6f, 0xdb, 0x46,
0x14, 0xc0, 0x45, 0x89, 0xa1, 0xcc, 0x27, 0x27, 0x2e, 0x0e, 0x46, 0x42, 0x27, 0xad, 0xa4, 0x2a,
0x29, 0xa0, 0x25, 0x54, 0xe3, 0xb4, 0x45, 0x91, 0xa1, 0x68, 0xe8, 0x7e, 0xc4, 0x40, 0xd2, 0xe1,
0xac, 0xa0, 0x40, 0x17, 0xe1, 0x24, 0x5d, 0x4e, 0x6c, 0x44, 0x9e, 0xc0, 0x3b, 0xda, 0xf4, 0xd6,
0xb1, 0x53, 0xd1, 0x29, 0x43, 0xa7, 0xce, 0xfd, 0x4b, 0x32, 0x7a, 0xcc, 0x50, 0xa8, 0xad, 0xbd,
0xe5, 0xaf, 0x28, 0xee, 0x1d, 0xf5, 0xe1, 0x04, 0xf2, 0xa4, 0xf7, 0x75, 0xef, 0xde, 0xfb, 0xbd,
0xa7, 0x23, 0xdc, 0x1d, 0x49, 0x95, 0x48, 0xd5, 0x1b, 0x32, 0xc5, 0x7b, 0x6c, 0x38, 0x8a, 0x7b,
0xc7, 0x0f, 0x86, 0x5c, 0xb3, 0x07, 0xa8, 0x84, 0xb3, 0x4c, 0x6a, 0x49, 0x02, 0x1b, 0x14, 0x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, 0x3f, 0x00, 0x00,
0xff, 0xff, 0x84, 0x62, 0x26, 0x5f, 0x9b, 0x06, 0x00, 0x00,
// 881 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xbd, 0x8f, 0x1b, 0x45,
0x14, 0xf7, 0xda, 0xce, 0xfa, 0xf6, 0xf9, 0x2e, 0x87, 0x46, 0xa7, 0x64, 0x2f, 0x01, 0xdb, 0x38,
0x41, 0x72, 0x93, 0x35, 0xb9, 0x04, 0x84, 0x28, 0x10, 0xf1, 0xf1, 0x91, 0x93, 0x12, 0x8a, 0x39,
0x47, 0x48, 0x34, 0xd6, 0xd8, 0x9e, 0x8c, 0x97, 0x78, 0x77, 0xac, 0x9d, 0xd9, 0xbb, 0xbd, 0x8e,
0x92, 0x0a, 0x51, 0x51, 0x50, 0x51, 0xf3, 0x97, 0xa4, 0xa0, 0xb8, 0x32, 0x05, 0x32, 0x70, 0xd7,
0xe5, 0xaf, 0x40, 0xf3, 0x66, 0xfc, 0x71, 0x44, 0x8e, 0x44, 0xe5, 0xf7, 0xf1, 0x9b, 0x37, 0xef,
0xf7, 0x7b, 0xcf, 0xb3, 0x70, 0x67, 0x24, 0x55, 0x22, 0x55, 0x77, 0xc8, 0x14, 0xef, 0xb2, 0xe1,
0x28, 0xee, 0x9e, 0xdc, 0x1f, 0x72, 0xcd, 0xee, 0xa3, 0x13, 0xcd, 0x32, 0xa9, 0x25, 0x09, 0x2d,
0x28, 0x32, 0xa0, 0x08, 0xe3, 0x0e, 0x74, 0x6b, 0x4f, 0x48, 0x21, 0x11, 0xd4, 0x35, 0x96, 0xc5,
0xdf, 0xba, 0xad, 0x79, 0x3a, 0xe6, 0x59, 0x12, 0xa7, 0xda, 0xd6, 0xd4, 0x67, 0x33, 0xae, 0x5c,
0x72, 0x5f, 0x48, 0x29, 0xa6, 0xbc, 0x8b, 0xde, 0x30, 0x7f, 0xde, 0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0x4f, 0x5e, 0xb5, 0xb7, 0xfb, 0x7a, 0xde, 0x5c, 0x0f, 0x53, 0x40, 0xe7, 0xd0, 0xd8, 0x66, 0x5f,
0x2c, 0xd6, 0x0e, 0xdb, 0x3a, 0xa6, 0xce, 0x8c, 0x09, 0x3e, 0x48, 0xf3, 0x64, 0xc8, 0x33, 0x7c,
0xfb, 0x5c, 0x9d, 0xb5, 0x30, 0x05, 0xe3, 0x7c, 0x83, 0x36, 0xb9, 0x07, 0xe8, 0x0d, 0xb0, 0x34,
0xbe, 0x89, 0xd5, 0xde, 0xf5, 0xd7, 0xf3, 0xe6, 0x5a, 0x94, 0x06, 0xc6, 0xee, 0x1b, 0xd3, 0x5c,
0x3b, 0x8d, 0x93, 0x58, 0xe3, 0x4b, 0x59, 0xa5, 0xd6, 0x21, 0x1f, 0x43, 0x45, 0x17, 0x2a, 0xf4,
0x51, 0x8e, 0xbb, 0x9b, 0xe5, 0x58, 0xbd, 0xef, 0xd4, 0x1c, 0xb0, 0x82, 0xf4, 0x3e, 0x7f, 0xf5,
0x4f, 0xa3, 0xf4, 0xf2, 0xa2, 0xe1, 0x9d, 0x5f, 0x34, 0xbc, 0xbf, 0x2f, 0x1a, 0xde, 0xcf, 0x97,
0x8d, 0xd2, 0xf9, 0x65, 0xa3, 0xf4, 0xea, 0xb2, 0x51, 0xfa, 0xae, 0x2d, 0x62, 0x3d, 0xc9, 0x87,
0xd1, 0x48, 0x26, 0x5d, 0xf7, 0xbd, 0xb2, 0x3f, 0xf7, 0xd4, 0xf8, 0x85, 0xfd, 0xb8, 0x0c, 0x7d,
0x7c, 0xd8, 0x1e, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xed, 0x2a, 0x80, 0xd1, 0x06, 0x00,
0x00,
}
func (m *TxResponse) Marshal() (dAtA []byte, err error) {
@ -687,6 +695,20 @@ func (m *TxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Events) > 0 {
for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAbci(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6a
}
}
if len(m.Timestamp) > 0 {
i -= len(m.Timestamp)
copy(dAtA[i:], m.Timestamp)
@ -1236,6 +1258,12 @@ func (m *TxResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovAbci(uint64(l))
}
if len(m.Events) > 0 {
for _, e := range m.Events {
l = e.Size()
n += 1 + l + sovAbci(uint64(l))
}
}
return n
}
@ -1872,6 +1900,40 @@ func (m *TxResponse) Unmarshal(dAtA []byte) error {
}
m.Timestamp = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAbci
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAbci
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAbci
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Events = append(m.Events, types1.Event{})
if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipAbci(dAtA[iNdEx:])

View File

@ -3,14 +3,10 @@ package types
import (
"encoding/hex"
"encoding/json"
"fmt"
"math"
"strings"
"github.com/gogo/protobuf/proto"
"sigs.k8s.io/yaml"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/rpc/coretypes"
@ -21,12 +17,12 @@ import (
var cdc = codec.NewLegacyAmino()
func (gi GasInfo) String() string {
bz, _ := yaml.Marshal(gi)
bz, _ := codec.MarshalYAML(codec.NewProtoCodec(nil), &gi)
return string(bz)
}
func (r Result) String() string {
bz, _ := yaml.Marshal(r)
bz, _ := codec.MarshalYAML(codec.NewProtoCodec(nil), &r)
return string(bz)
}
@ -83,6 +79,7 @@ func NewResponseResultTx(res *coretypes.ResultTx, anyTx *codectypes.Any, timesta
GasUsed: res.TxResult.GasUsed,
Tx: anyTx,
Timestamp: timestamp,
Events: res.TxResult.Events,
}
}
@ -123,6 +120,7 @@ func newTxResponseCheckTx(res *coretypes.ResultBroadcastTxCommit) *TxResponse {
Info: res.CheckTx.Info,
GasWanted: res.CheckTx.GasWanted,
GasUsed: res.CheckTx.GasUsed,
Events: res.CheckTx.Events,
}
}
@ -149,6 +147,7 @@ func newTxResponseDeliverTx(res *coretypes.ResultBroadcastTxCommit) *TxResponse
Info: res.DeliverTx.Info,
GasWanted: res.DeliverTx.GasWanted,
GasUsed: res.DeliverTx.GasUsed,
Events: res.DeliverTx.Events,
}
}
@ -171,44 +170,8 @@ func NewResponseFormatBroadcastTx(res *coretypes.ResultBroadcastTx) *TxResponse
}
func (r TxResponse) String() string {
var sb strings.Builder
sb.WriteString("Response:\n")
if r.Height > 0 {
sb.WriteString(fmt.Sprintf(" Height: %d\n", r.Height))
}
if r.TxHash != "" {
sb.WriteString(fmt.Sprintf(" TxHash: %s\n", r.TxHash))
}
if r.Code > 0 {
sb.WriteString(fmt.Sprintf(" Code: %d\n", r.Code))
}
if r.Data != "" {
sb.WriteString(fmt.Sprintf(" Data: %s\n", r.Data))
}
if r.RawLog != "" {
sb.WriteString(fmt.Sprintf(" Raw Log: %s\n", r.RawLog))
}
if r.Logs != nil {
sb.WriteString(fmt.Sprintf(" Logs: %s\n", r.Logs))
}
if r.Info != "" {
sb.WriteString(fmt.Sprintf(" Info: %s\n", r.Info))
}
if r.GasWanted != 0 {
sb.WriteString(fmt.Sprintf(" GasWanted: %d\n", r.GasWanted))
}
if r.GasUsed != 0 {
sb.WriteString(fmt.Sprintf(" GasUsed: %d\n", r.GasUsed))
}
if r.Codespace != "" {
sb.WriteString(fmt.Sprintf(" Codespace: %s\n", r.Codespace))
}
if r.Timestamp != "" {
sb.WriteString(fmt.Sprintf(" Timestamp: %s\n", r.Timestamp))
}
return strings.TrimSpace(sb.String())
bz, _ := codec.MarshalYAML(codec.NewProtoCodec(nil), &r)
return string(bz)
}
// Empty returns true if the response is empty

View File

@ -7,10 +7,8 @@ import (
"testing"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/rpc/coretypes"
@ -101,18 +99,20 @@ func (s *resultTestSuite) TestResponseResultTx() {
s.Require().Equal(want, sdk.NewResponseResultTx(resultTx, nil, "timestamp"))
s.Require().Equal((*sdk.TxResponse)(nil), sdk.NewResponseResultTx(nil, nil, "timestamp"))
s.Require().Equal(`Response:
Height: 10
TxHash: 74657374
Code: 1
Data: 64617461
Raw Log: []
Logs: []
Info: info
GasWanted: 100
GasUsed: 90
Codespace: codespace
Timestamp: timestamp`, sdk.NewResponseResultTx(resultTx, nil, "timestamp").String())
s.Require().Equal(`code: 1
codespace: codespace
data: "64617461"
events: []
gas_used: "90"
gas_wanted: "100"
height: "10"
info: info
logs: []
raw_log: '[]'
timestamp: timestamp
tx: null
txhash: "74657374"
`, sdk.NewResponseResultTx(resultTx, nil, "timestamp").String())
s.Require().True(sdk.TxResponse{}.Empty())
s.Require().False(want.Empty())
@ -154,6 +154,18 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() {
GasWanted: 99,
GasUsed: 100,
Codespace: "codespace",
Events: []abci.Event{
{
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: "action",
Value: "foo",
Index: true,
},
},
},
},
},
}
deliverTxResult := &coretypes.ResultBroadcastTxCommit{
@ -167,6 +179,18 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() {
GasWanted: 99,
GasUsed: 100,
Codespace: "codespace",
Events: []abci.Event{
{
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: "action",
Value: "foo",
Index: true,
},
},
},
},
},
}
want := &sdk.TxResponse{
@ -180,6 +204,18 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() {
Info: "info",
GasWanted: 99,
GasUsed: 100,
Events: []abci.Event{
{
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: "action",
Value: "foo",
Index: true,
},
},
},
},
}
s.Require().Equal(want, sdk.NewResponseFormatBroadcastTxCommit(checkTxResult))