Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add index field into TxResponse #526

Merged
merged 7 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements

* (refactor) [\#493](https://github.com/line/lbm-sdk/pull/493) restructure x/consortium
* (server/grpc) [\#526](https://github.com/line/lbm-sdk/pull/526) add index field into TxResponse
* (cli) [\#535](https://github.com/line/lbm-sdk/pull/536) updated ostracon to v1.0.5; `unsafe-reset-all` command has been moved to the `ostracon` sub-command.

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21837,6 +21837,10 @@ paths:


Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
index:
type: integer
format: int64
title: The transaction index within block
description: >-
TxResponse defines a structure containing relevant tx data and
metadata. The
Expand Down Expand Up @@ -53950,6 +53954,10 @@ definitions:


Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
index:
type: integer
format: int64
title: The transaction index within block
description: >-
TxResponse defines a structure containing relevant tx data and metadata.
The
Expand Down Expand Up @@ -54426,6 +54434,10 @@ definitions:


Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
index:
type: integer
format: int64
title: The transaction index within block
description: >-
TxResponse defines a structure containing relevant tx data and
metadata. The
Expand Down Expand Up @@ -54799,6 +54811,10 @@ definitions:


Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
index:
type: integer
format: int64
title: The transaction index within block
description: >-
TxResponse defines a structure containing relevant tx data and
metadata. The
Expand Down Expand Up @@ -55124,6 +55140,10 @@ definitions:


Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
index:
type: integer
format: int64
title: The transaction index within block
description: >-
TxResponse defines a structure containing relevant tx data and
metadata. The
Expand Down
1 change: 1 addition & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5075,6 +5075,7 @@ tags are stringified and the log is JSON decoded.
| `events` | [ostracon.abci.Event](#ostracon.abci.Event) | repeated | 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 |
| `index` | [uint32](#uint32) | | The transaction index within block |



Expand Down
2 changes: 2 additions & 0 deletions proto/lbm/base/abci/v1/abci.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ message TxResponse {
//
// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
repeated ostracon.abci.Event events = 13 [(gogoproto.nullable) = false];
// The transaction index within block
uint32 index = 14;
}

// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
Expand Down
146 changes: 88 additions & 58 deletions types/abci.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func NewResponseResultTx(res *ctypes.ResultTx, anyTx *codectypes.Any, timestamp
Tx: anyTx,
Timestamp: timestamp,
Events: res.TxResult.Events,
Index: res.Index,
}
}

Expand Down
3 changes: 3 additions & 0 deletions types/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (s *resultTestSuite) TestResponseResultTx() {
resultTx := &ctypes.ResultTx{
Hash: bytes.HexBytes([]byte("test")),
Height: 10,
Index: 1,
TxResult: deliverTxResult,
}
logs, err := sdk.ParseABCILogs(`[]`)
Expand All @@ -160,6 +161,7 @@ func (s *resultTestSuite) TestResponseResultTx() {
GasUsed: 90,
Tx: nil,
Timestamp: "timestamp",
Index: 1,
}

s.Require().Equal(want, sdk.NewResponseResultTx(resultTx, nil, "timestamp"))
Expand All @@ -171,6 +173,7 @@ events: []
gas_used: "90"
gas_wanted: "100"
height: "10"
index: 1
info: info
logs: []
raw_log: '[]'
Expand Down