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

refactor: Refactor TxSearch #14758

Merged
merged 41 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ae3e190
updates
alexanderbez Jan 24, 2023
a47cfb7
updates
alexanderbez Jan 24, 2023
8df20c4
updates
alexanderbez Jan 24, 2023
82dc102
updates
alexanderbez Jan 25, 2023
f743d0b
updates
alexanderbez Jan 25, 2023
0df2abd
updates
alexanderbez Jan 25, 2023
20579ab
updates
alexanderbez Jan 25, 2023
3bdab1f
updates
alexanderbez Jan 25, 2023
756f722
updates
alexanderbez Jan 25, 2023
0afa78f
updates
alexanderbez Jan 25, 2023
97989b0
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Jan 25, 2023
bee3970
updates
alexanderbez Jan 25, 2023
a96463f
updates
alexanderbez Jan 26, 2023
a933e22
updates
alexanderbez Jan 26, 2023
62652ee
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Jan 26, 2023
ae2e900
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Jan 26, 2023
0f1025a
Merge branch 'main' into bez/14727-refactor-tx-search
tac0turtle Feb 20, 2023
76a2a03
fix merge
tac0turtle Feb 20, 2023
f938b7d
address comments
tac0turtle Feb 20, 2023
bcabf4b
Merge branch 'main' into bez/14727-refactor-tx-search
tac0turtle Feb 20, 2023
b88decb
revert internal flags
tac0turtle Feb 20, 2023
5ff6d30
delete extra lines
tac0turtle Feb 20, 2023
5c83612
Merge branch 'main' into bez/14727-refactor-tx-search
tac0turtle Feb 20, 2023
573fe32
Merge branch 'main' into bez/14727-refactor-tx-search
tac0turtle Feb 21, 2023
eb4de62
remove unneeded testcase
tac0turtle Feb 21, 2023
6c3c2d0
Merge branch 'main' into bez/14727-refactor-tx-search
tac0turtle Feb 21, 2023
7977997
Merge branch 'main' into bez/14727-refactor-tx-search
julienrbrt Feb 23, 2023
1b7d3b9
surface issue by remove cometbft replace
julienrbrt Feb 23, 2023
81c63c7
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Feb 23, 2023
2cab281
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Feb 23, 2023
3a6dc4d
updates
alexanderbez Feb 23, 2023
c08fdf0
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Feb 23, 2023
bf69105
updates
alexanderbez Feb 23, 2023
e86ea5e
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Feb 23, 2023
e4d15e6
Merge branch 'main' into bez/14727-refactor-tx-search
alexanderbez Feb 24, 2023
afbaf98
updates
julienrbrt Feb 24, 2023
ec5d9e1
Merge branch 'main' into bez/14727-refactor-tx-search
julienrbrt Feb 24, 2023
4187baf
updates
julienrbrt Feb 24, 2023
4180ed1
same pagination
julienrbrt Feb 24, 2023
7cdec41
updates
julienrbrt Feb 24, 2023
79a989a
Merge branch 'main' into bez/14727-refactor-tx-search
julienrbrt Feb 24, 2023
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (x/auth) [#14758](https://github.com/cosmos/cosmos-sdk/pull/14758) Allow transaction event queries to directly passed to Tendermint, which will allow for full query operator support, e.g. `>`.
* (x/evidence) [#14757](https://github.com/cosmos/cosmos-sdk/pull/14757) Evidence messages do not need to implement a `.Type()` anymore.
* (x/auth/tx) [#14751](https://github.com/cosmos/cosmos-sdk/pull/14751) Remove `.Type()` and `Route()` methods from all msgs and `legacytx.LegacyMsg` interface.
* [#14691](https://github.com/cosmos/cosmos-sdk/pull/14691) Change behavior of `sdk.StringifyEvents` to not flatten events attributes by events type.
Expand Down Expand Up @@ -168,6 +169,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking Changes

* (x/auth) [#14758](https://github.com/cosmos/cosmos-sdk/pull/14758) Refactor transaction searching:
* Refactor `QueryTxsByEvents` to accept a `query` of type `string` instead of `events` of type `[]string`
* Pass `prove=false` to Tendermint's `TxSearch` RPC method
* Refactor CLI methods to accept `--query` flag instead of `--events`
* (x/gov) [#14782](https://github.com/cosmos/cosmos-sdk/pull/14782) Move the `metadata` argument in `govv1.NewProposal` alongside `title` and `summary`.
* (store) [#14746](https://github.com/cosmos/cosmos-sdk/pull/14746) Extract Store in its own go.mod and rename the package to `cosmossdk.io/store`.
* (x/simulation) [#14751](https://github.com/cosmos/cosmos-sdk/pull/14751) Remove the `MsgType` field from `simulation.OperationInput` struct.
Expand Down
495 changes: 288 additions & 207 deletions api/cosmos/tx/v1beta1/service.pulsar.go

Large diffs are not rendered by default.

32 changes: 23 additions & 9 deletions proto/cosmos/tx/v1beta1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ service Service {
// GetBlockWithTxs fetches a block with decoded txs.
//
// Since: cosmos-sdk 0.45.2
rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) {
rpc GetBlockWithTxs(GetBlockWithTxsRequest)
returns (GetBlockWithTxsResponse) {
option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}";
}
// TxDecode decodes the transaction.
Expand Down Expand Up @@ -82,22 +83,33 @@ service Service {
// RPC method.
message GetTxsEventRequest {
// events is the list of transaction event type.
// Deprecated post v0.47.x: use query instead, which should contain a valid
// events query.
repeated string events = 1;
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved

// pagination defines a pagination for the request.
// Deprecated post v0.46.x: use page and limit instead.
cosmos.base.query.v1beta1.PageRequest pagination = 2 [deprecated = true];

OrderBy order_by = 3;
// page is the page number to query, starts at 1. If not provided, will default to first page.

// page is the page number to query, starts at 1. If not provided, will
// default to first page.
uint64 page = 4;

// limit is the total number of results to be returned in the result page.
// If left empty it will default to a value to be set by each app.
uint64 limit = 5;

// query defines the transaction event query that is proxied to Tendermint's
// TxSearch RPC method. The query must be valid.
string query = 6;
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}

// OrderBy defines the sorting order
enum OrderBy {
// ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case.
// ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults
// to ASC in this case.
ORDER_BY_UNSPECIFIED = 0;
// ORDER_BY_ASC defines ascending order
ORDER_BY_ASC = 1;
Expand Down Expand Up @@ -127,18 +139,19 @@ message BroadcastTxRequest {
BroadcastMode mode = 2;
}

// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method.
// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC
// method.
enum BroadcastMode {
// zero-value for mode ordering
BROADCAST_MODE_UNSPECIFIED = 0;
// DEPRECATED: use BROADCAST_MODE_SYNC instead,
// BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards.
BROADCAST_MODE_BLOCK = 1 [deprecated = true];
// BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for
// a CheckTx execution response only.
// BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits
// for a CheckTx execution response only.
BROADCAST_MODE_SYNC = 2;
// BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns
// immediately.
// BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client
// returns immediately.
BROADCAST_MODE_ASYNC = 3;
}

Expand Down Expand Up @@ -196,7 +209,8 @@ message GetBlockWithTxsRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method.
// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs
// method.
//
// Since: cosmos-sdk 0.45.2
message GetBlockWithTxsResponse {
Expand Down
2 changes: 1 addition & 1 deletion server/grpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (s *IntegrationTestSuite) TestGRPCServer_GetTxsEvent() {
_, err := txServiceClient.GetTxsEvent(
context.Background(),
&txtypes.GetTxsEventRequest{
Events: []string{"message.action='send'"},
Query: "message.action='send'",
},
)
s.Require().NoError(err)
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/auth/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import (
"testing"

"cosmossdk.io/simapp"

"github.com/cosmos/cosmos-sdk/testutil/network"

"github.com/stretchr/testify/suite"
)

Expand Down
12 changes: 8 additions & 4 deletions tests/e2e/auth/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,17 +708,21 @@ func (s *E2ETestSuite) TestCLIQueryTxsCmdByEvents() {
{
"fee event happy case",
[]string{
fmt.Sprintf("--events=tx.fee=%s",
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
fmt.Sprintf(
"--query=tx.fee='%s'",
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String(),
),
fmt.Sprintf("--%s=json", flags.FlagOutput),
},
false,
},
{
"no matching fee event",
[]string{
fmt.Sprintf("--events=tx.fee=%s",
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(0))).String()),
fmt.Sprintf(
"--query=tx.fee='%s'",
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(0))).String(),
),
fmt.Sprintf("--%s=json", flags.FlagOutput),
},
true,
Expand Down
Loading