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: Integrate tendermint Block endpoints into the cli #14659

Merged
merged 66 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
7365588
idiot check
cipherzzz Jan 17, 2023
ddc0edd
cleaned up
cipherzzz Jan 17, 2023
38a6468
updated BlockResponse proto and got the BlockSearch working
cipherzzz Jan 20, 2023
bdd2ba7
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 21, 2023
7d0330c
merged latest
cipherzzz Jan 21, 2023
9842706
fixing int overflow? and some proto issues
cipherzzz Jan 21, 2023
252f354
fixing int overflow paging calculation
cipherzzz Jan 22, 2023
639120d
gofumpt
cipherzzz Jan 22, 2023
f492408
added tests
cipherzzz Jan 23, 2023
e04a843
fixed merge
cipherzzz Jan 23, 2023
73aad2d
gofumpt and lint
cipherzzz Jan 23, 2023
2218ef7
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Jan 23, 2023
ad78cde
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Jan 25, 2023
89eb164
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Jan 25, 2023
984b252
fixes per review
cipherzzz Jan 26, 2023
7b1d4b6
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 26, 2023
25091e2
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Jan 26, 2023
261ff39
refactor based on pr feedback
cipherzzz Jan 26, 2023
24aea0f
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 26, 2023
1c30838
fix test
cipherzzz Jan 26, 2023
89314ab
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Jan 27, 2023
ff7b290
fix test
cipherzzz Jan 27, 2023
cffd5c2
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 27, 2023
0bdf087
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Jan 27, 2023
012164a
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Jan 30, 2023
58c65ba
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 30, 2023
2b21718
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Jan 30, 2023
22544c3
moved block query from auth module to tendermint server
cipherzzz Jan 30, 2023
ec412d4
fixes per PR
cipherzzz Jan 31, 2023
1845a21
extracted to method
cipherzzz Jan 31, 2023
85d1b54
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 31, 2023
5488e94
fixes per pr feedback
cipherzzz Jan 31, 2023
5bcad2a
pass query directly to Tendermint
cipherzzz Jan 31, 2023
adae794
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Jan 31, 2023
8288c38
fumpt
cipherzzz Jan 31, 2023
4fbcb12
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Feb 1, 2023
b197b7b
Update client/rpc/block.go
cipherzzz Feb 2, 2023
589de79
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Feb 2, 2023
1833618
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Feb 2, 2023
ead688e
fixed merge
cipherzzz Feb 3, 2023
266803e
changes per PR feedback
cipherzzz Feb 3, 2023
63634aa
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Feb 4, 2023
8c4e000
Update client/rpc/block.go
cipherzzz Feb 4, 2023
4c27245
differentiate errors
cipherzzz Feb 4, 2023
8d1ace4
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Feb 4, 2023
e514413
fixed merge
cipherzzz Feb 4, 2023
d8d5136
changes per PR review
cipherzzz Feb 7, 2023
80d4071
fixed merge
cipherzzz Feb 7, 2023
cbff045
fixed test
cipherzzz Feb 7, 2023
763119e
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Feb 9, 2023
4bea8b3
Update types/result.go
cipherzzz Feb 9, 2023
4310491
Update client/rpc/block.go
cipherzzz Feb 9, 2023
bedce2d
Update server/cmt_cmds.go
cipherzzz Feb 9, 2023
01bdbe3
Update server/cmt_cmds.go
cipherzzz Feb 9, 2023
4af5760
Update server/cmt_cmds.go
cipherzzz Feb 9, 2023
fb5857d
Update server/cmt_cmds.go
cipherzzz Feb 9, 2023
1b3eb73
updates per pr feedback
cipherzzz Feb 9, 2023
1e1cf9d
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Feb 9, 2023
35669ab
updates per PR feedback
cipherzzz Feb 9, 2023
7b2fb55
Merge branch 'main' into cipherz/13703-query-block-event
JeancarloBarrios Feb 9, 2023
0a34801
Merge branch 'main' into cipherz/13703-query-block-event
cipherzzz Feb 13, 2023
f178e0f
Merge branch 'main' into cipherz/13703-query-block-event
alexanderbez Feb 13, 2023
35f605f
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Feb 14, 2023
12d51da
implemented PR change requests
cipherzzz Feb 14, 2023
1cc27a3
Merge branch 'main' of github.com:cosmos/cosmos-sdk into cipherz/1370…
cipherzzz Feb 14, 2023
39c9179
Merge branch 'cipherz/13703-query-block-event' of github.com:cipherzz…
cipherzzz Feb 14, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* (cli) [#14659](https://github.com/cosmos/cosmos-sdk/pull/14659) Added ability to query blocks by either height/hash `simd q block --type=height|hash <height|hash>`. Also added ability to query blocks by events similar to the existing tx query `simd q blocks --events 'message.sender=cosmos...' --page 1 --limit 30`
* (x/auth) [#14650](https://github.com/cosmos/cosmos-sdk/pull/14650) Add Textual SignModeHandler. It is however **NOT** enabled by default, and should only be used for **TESTING** purposes until `SIGN_MODE_TEXTUAL` is fully released.
* (cli) [#14655](https://github.com/cosmos/cosmos-sdk/pull/14655) Add a new command to list supported algos.
* (x/crisis) [#14588](https://github.com/cosmos/cosmos-sdk/pull/14588) Use CacheContext() in AssertInvariants()
Expand Down Expand Up @@ -247,6 +248,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf

### CLI Breaking Changes

* (cli) [#14659](https://github.com/cosmos/cosmos-sdk/pull/14659) `simd q block <height>` is removed as it just output json. The new command allows either height/hash and is `simd q block --type=height|hash <height|hash>`.
* (grpc-web) [#14652](https://github.com/cosmos/cosmos-sdk/pull/14652) Remove `grpc-web.address` flag.
* (client) [#14342](https://github.com/cosmos/cosmos-sdk/pull/14342) `simd config` command is now a sub-command. Use `simd config --help` to learn more.
* (x/genutil) [#13535](https://github.com/cosmos/cosmos-sdk/pull/13535) Replace in `simd init`, the `--staking-bond-denom` flag with `--default-denom` which is used for all default denomination in the genesis, instead of only staking.
Expand Down
1,100 changes: 974 additions & 126 deletions api/cosmos/base/abci/v1beta1/abci.pulsar.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion api/cosmos/staking/v1beta1/tx.pulsar.go

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

7 changes: 7 additions & 0 deletions client/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type TendermintRPC interface {
Validators(ctx context.Context, height *int64, page, perPage *int) (*coretypes.ResultValidators, error)
Status(context.Context) (*coretypes.ResultStatus, error)
Block(ctx context.Context, height *int64) (*coretypes.ResultBlock, error)
BlockByHash(ctx context.Context, hash []byte) (*coretypes.ResultBlock, error)
cipherzzz marked this conversation as resolved.
Show resolved Hide resolved
BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error)
Commit(ctx context.Context, height *int64) (*coretypes.ResultCommit, error)
Tx(ctx context.Context, hash []byte, prove bool) (*coretypes.ResultTx, error)
Expand All @@ -25,4 +26,10 @@ type TendermintRPC interface {
page, perPage *int,
orderBy string,
) (*coretypes.ResultTxSearch, error)
BlockSearch(
ctx context.Context,
query string,
page, perPage *int,
orderBy string,
) (*coretypes.ResultBlockSearch, error)
}
1 change: 0 additions & 1 deletion proto/cosmos/bank/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ message QuerySpendableBalanceByDenomResponse {
cosmos.base.v1beta1.Coin balance = 1;
}


// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
// method.
message QueryTotalSupplyRequest {
Expand Down
19 changes: 19 additions & 0 deletions proto/cosmos/base/abci/v1beta1/abci.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cosmos.base.abci.v1beta1;

import "gogoproto/gogo.proto";
import "tendermint/abci/types.proto";
import "tendermint/types/block.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types";
Expand Down Expand Up @@ -156,3 +157,21 @@ message SearchTxsResult {
// List of txs in current page
repeated TxResponse txs = 6;
}

// SearchBlocksResult defines a structure for querying blocks pageable
message SearchBlocksResult {
option (gogoproto.stringer) = true;

// Count of all blocks
int64 total_count = 1;
// Count of blocks in current page
int64 count = 2;
// Index of current page, start from 1
int64 page_number = 3;
// Count of total pages
int64 page_total = 4;
// Max count blocks per page
int64 limit = 5;
// List of blocks in current page
repeated tendermint.types.Block blocks = 6;
}
37 changes: 14 additions & 23 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package cosmos.distribution.v1beta1;

option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types";
option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types";
cipherzzz marked this conversation as resolved.
Show resolved Hide resolved
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";
Expand All @@ -17,23 +17,19 @@ service Msg {

// SetWithdrawAddress defines a method to change the withdraw address
// for a delegator (or validator self-delegation).
rpc SetWithdrawAddress(MsgSetWithdrawAddress)
returns (MsgSetWithdrawAddressResponse);
rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse);

// WithdrawDelegatorReward defines a method to withdraw rewards of delegator
// from a single validator.
rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward)
returns (MsgWithdrawDelegatorRewardResponse);
rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse);

// WithdrawValidatorCommission defines a method to withdraw the
// full commission to the validator address.
rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission)
returns (MsgWithdrawValidatorCommissionResponse);
rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse);

// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool)
returns (MsgFundCommunityPoolResponse);
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);

// UpdateParams defines a governance operation for updating the x/distribution
// module parameters. The authority is defined in the keeper.
Expand All @@ -47,15 +43,13 @@ service Msg {
// keeper.
//
// Since: cosmos-sdk 0.47
rpc CommunityPoolSpend(MsgCommunityPoolSpend)
returns (MsgCommunityPoolSpendResponse);
rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse);

// DepositValidatorRewardsPool defines a method to provide additional rewards
// to delegators to a specific validator.
//
// Since: cosmos-sdk 0.48
rpc DepositValidatorRewardsPool(MsgDepositValidatorRewardsPool)
returns (MsgDepositValidatorRewardsPoolResponse);
rpc DepositValidatorRewardsPool(MsgDepositValidatorRewardsPool) returns (MsgDepositValidatorRewardsPoolResponse);
}

// MsgSetWithdrawAddress sets the withdraw address for
Expand Down Expand Up @@ -155,8 +149,7 @@ message MsgUpdateParams {
// params defines the x/distribution parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// MsgUpdateParamsResponse defines the response structure for executing a
Expand All @@ -175,8 +168,8 @@ message MsgCommunityPoolSpend {
option (amino.name) = "cosmos-sdk/distr/MsgCommunityPoolSpend";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
Expand All @@ -200,12 +193,10 @@ message MsgDepositValidatorRewardsPool {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

// MsgDepositValidatorRewardsPoolResponse defines the response to executing a
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/gov/v1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ message Params {
//
// Since: cosmos-sdk 0.48
string proposal_cancel_ratio = 8 [(cosmos_proto.scalar) = "cosmos.Dec"];

// The address which will receive (proposal_cancel_ratio * deposit) proposal deposits.
// If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned.
//
Expand Down
3 changes: 2 additions & 1 deletion proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ message MsgCreateValidator {
(gogoproto.nullable) = false
];
// Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated.
// The validator address bytes and delegator address bytes refer to the same account while creating validator (defer only in bech32 notation).
// The validator address bytes and delegator address bytes refer to the same account while creating validator (defer
// only in bech32 notation).
string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", deprecated = true];
string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/upgrade/v1beta1/upgrade.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ message SoftwareUpgradeProposal {
option (gogoproto.equal) = true;

// title of the proposal
string title = 1;
string title = 1;
cipherzzz marked this conversation as resolved.
Show resolved Hide resolved

// description of the proposal
string description = 2;

// plan of the proposal
Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software
Expand All @@ -74,7 +74,7 @@ message CancelSoftwareUpgradeProposal {
option (gogoproto.equal) = true;

// title of the proposal
string title = 1;
string title = 1;

// description of the proposal
string description = 2;
Expand Down
Loading