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

add pagination for stakerinfos query, format #257

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions .protolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lint:
add:
- FIELD_NAMES_LOWER_SNAKE_CASE
- MESSAGE_NAMES_UPPER_CAMEL_CASE
- MAX_LINE_LENGTH
# - MAX_LINE_LENGTH
MaxMustermann2 marked this conversation as resolved.
Show resolved Hide resolved
- INDENT
# - SERVICE_NAMES_END_WITH
- FIELD_NAMES_EXCLUDE_PREPOSITIONS
Expand Down Expand Up @@ -69,9 +69,9 @@ lint:
# Linter rules option.
rules_option:
# MAX_LINE_LENGTH rule option.
max_line_length:
# max_line_length:
# Enforces a maximum line length
max_chars: 120
# max_chars: 120
# Specifies the character count for tab characters
tab_chars: 2

Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,11 @@ lint-fix-contracts:

.PHONY: lint lint-fix

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs gofumpt -w -l
golang-format:
@echo "formating golang files"
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' -not -name '*.pb.gw.go'| xargs gofumpt -w -l

format: golang-format proto-format

.PHONY: format

Expand Down Expand Up @@ -410,7 +413,7 @@ proto-swagger-gen:

proto-format:
@echo "Formatting Protobuf files"
$(protoImage) find ./ -name *.proto -exec clang-format -i {} \;
$(protoImage) buf format --write

proto-lint:
@echo "Linting Protobuf files"
Expand Down
2 changes: 1 addition & 1 deletion proto/evmos/erc20/v1/erc20.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

syntax = "proto3";
package evmos.erc20.v1;

import "cosmos/bank/v1beta1/bank.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/evmos/evmos/v16/x/erc20/types";

// Owner enumerates the ownership of a ERC20 contract.
Expand Down
22 changes: 15 additions & 7 deletions proto/evmos/incentives/v1/incentives.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

syntax = "proto3";
package evmos.incentives.v1;

import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/evmos/evmos/v16/x/incentives/types";

// Incentive defines an instance that organizes distribution conditions for a
Expand All @@ -13,15 +13,21 @@ message Incentive {
// contract address of the smart contract to be incentivized
string contract = 1;
// allocations is a slice of denoms and percentages of rewards to be allocated
repeated cosmos.base.v1beta1.DecCoin allocations = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
repeated cosmos.base.v1beta1.DecCoin allocations = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
];
// epochs defines the number of remaining epochs for the incentive
uint32 epochs = 3;
// start_time of the incentive distribution
google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp start_time = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
// total_gas is the cumulative gas spent by all gas meters of the incentive during the epoch
uint64 total_gas = 5;
}

// GasMeter tracks the cumulative gas spent per participant in one epoch
message GasMeter {
// contract is the hex address of the incentivized smart contract
Expand All @@ -42,8 +48,10 @@ message RegisterIncentiveProposal {
// contract address to be registered
string contract = 3;
// allocations defines the denoms and percentage of rewards to be allocated
repeated cosmos.base.v1beta1.DecCoin allocations = 4
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
repeated cosmos.base.v1beta1.DecCoin allocations = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
];
// epochs is the number of remaining epochs for the incentive
uint32 epochs = 5;
}
Expand All @@ -57,4 +65,4 @@ message CancelIncentiveProposal {
string description = 2;
// contract address of the incentivized smart contract
string contract = 3;
}
}
38 changes: 23 additions & 15 deletions proto/exocore/appchain/common/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message SubscriberParams {
// blocks_per_distribution_transmission is the number of blocks after which the minted
// reward is sent to the coordinator.
int64 blocks_per_distribution_transmission = 3;
// subscriber_redistribution_fraction is the %age of the rewards that the subscriber
// subscriber_redistribution_fraction is the %age of the rewards that the subscriber
// should send out. For example, "0.75" means 75% of the rewards are sent out.
string subscriber_redistribution_fraction = 4;
// reward_denom is the denomination of the reward. For now, this is not
Expand All @@ -44,20 +44,26 @@ message SubscriberParams {

// ibc_timeout_period is the timeout period used for IBC packets (excluding transfers)
// Such a timeout is enforced by IBC itself and not by either of the chains.
google.protobuf.Duration ibc_timeout_period = 6
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true,
(gogoproto.customname) = "IBCTimeoutPeriod" ];
google.protobuf.Duration ibc_timeout_period = 6 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.customname) = "IBCTimeoutPeriod"
];
// transfer_timeout_period is the timeout period used for IBC transfers.
google.protobuf.Duration transfer_timeout_period = 7
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
google.protobuf.Duration transfer_timeout_period = 7 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true
];

// Params relevant to chain operation
// unbonding_duration is the subscriber chain's unbonding duration.
// for now, we don't support the subscriber chain using x/epochs as a unit of time; however,
// when we do, this duration should be the best approximation of that mechanism, with
// 1 epoch added to account for the current epoch. (TODO)
google.protobuf.Duration unbonding_period = 8
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
google.protobuf.Duration unbonding_period = 8 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true
];
// HistoricalEntries is the number of historical entries to persist in the
// historical stats module. It is the same as that defined in the staking module,
// however, we use the signed version so that negative values can be caught.
Expand All @@ -78,8 +84,11 @@ message SubscriberParams {
string slash_fraction_downtime = 15;
// downtime_jail_duration is the duration of the jail period for a validator
// after they have been found to be offline for too long.
google.protobuf.Duration downtime_jail_duration = 16
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdduration) = true];
google.protobuf.Duration downtime_jail_duration = 16 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.stdduration) = true
];
// slash_fraction_double_sign is the fraction of the stake that is slashed
// when a validator is found to have double signed.
string slash_fraction_double_sign = 17;
Expand All @@ -91,17 +100,16 @@ message SubscriberGenesisState {
// params is the parameters of the subscriber module, as generated.
SubscriberParams params = 1 [(gogoproto.nullable) = false];
// coordinator is the coordinator information for the subscriber.
CoordinatorInfo coordinator = 2 [ (gogoproto.nullable) = false ];
CoordinatorInfo coordinator = 2 [(gogoproto.nullable) = false];
}

// CoordinatorInfo is the information about the coordinator chain that is
// CoordinatorInfo is the information about the coordinator chain that is
// stored within the subscriber chain's subscriber module.
message CoordinatorInfo {
// client_state is the client state of the coordinator chain.
ibc.lightclients.tendermint.v1.ClientState client_state = 1;
// consensus_state is the consensus state of the coordinator chain.
ibc.lightclients.tendermint.v1.ConsensusState consensus_state = 2;
// initial_val_set is the initial validator set of the coordinator chain.
repeated .tendermint.abci.ValidatorUpdate initial_val_set = 3
[ (gogoproto.nullable) = false ];
}
repeated .tendermint.abci.ValidatorUpdate initial_val_set = 3 [(gogoproto.nullable) = false];
}
4 changes: 1 addition & 3 deletions proto/exocore/appchain/coordinator/v1/coordinator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/appchain/coordinator/ty
// subscriber chain requests that are pending activation.
message PendingSubscriberChainRequests {
// list is the list of subscriber chain requests that are pending activation.
repeated .exocore.appchain.coordinator.v1.RegisterSubscriberChainRequest list = 1
[(gogoproto.nullable) = false];
repeated .exocore.appchain.coordinator.v1.RegisterSubscriberChainRequest list = 1 [(gogoproto.nullable) = false];
}

// ChainIDs is a helper structure to store a list of chain IDs.
message ChainIDs {
// list is the list of chain IDs.
repeated string list = 1;
}

19 changes: 11 additions & 8 deletions proto/exocore/appchain/coordinator/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ message Params {
// system is largely created with epochs as a unit of time (and not
// standard durations), this is an exception since it is used directly
// by the IBC codebase.
google.protobuf.Duration ibc_timeout_period = 3
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true,
(gogoproto.customname) = "IBCTimeoutPeriod" ];
google.protobuf.Duration ibc_timeout_period = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.customname) = "IBCTimeoutPeriod"
];
// init_timeout_period is the period within which the subscriber chain
// must make a connection with the coordinator, after being spawned.
exocore.epochs.v1.Epoch init_timeout_period = 4
[ (gogoproto.nullable) = false ];
// vsc_timeout_period is the period within which the subscriber chain
exocore.epochs.v1.Epoch init_timeout_period = 4 [(gogoproto.nullable) = false];
// vsc_timeout_period is the period within which the subscriber chain
// must respond to a VSC request, after it is sent.
exocore.epochs.v1.Epoch vsc_timeout_period = 5
[ (gogoproto.nullable) = false, (gogoproto.customname) = "VSCTimeoutPeriod" ];
exocore.epochs.v1.Epoch vsc_timeout_period = 5 [
(gogoproto.nullable) = false,
(gogoproto.customname) = "VSCTimeoutPeriod"
];
}
13 changes: 4 additions & 9 deletions proto/exocore/appchain/coordinator/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/appchain/coordinator/ty
service Query {
// QueryParams returns the appchain coordinator module parameters.
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http) = {
get: "/appchain/coordinator/params"
};
option (google.api.http) = {get: "/appchain/coordinator/params"};
}
// QuerySubscriberGenesis returns the genesis state for a subscriber chain.
rpc QuerySubscriberGenesis(QuerySubscriberGenesisRequest) returns (QuerySubscriberGenesisResponse) {
option (google.api.http) = {
get: "/exocore/appchain/coordinator/v1/subscriber_genesis/{chain}"
};
option (google.api.http) = {get: "/exocore/appchain/coordinator/v1/subscriber_genesis/{chain}"};
}
}

Expand All @@ -44,6 +40,5 @@ message QuerySubscriberGenesisRequest {
// QuerySubscriberGenesisResponse is the response type for the Query.QuerySubscriberGenesis RPC method.
message QuerySubscriberGenesisResponse {
// subscriber_genesis is the genesis state for the subscriber chain.
exocore.appchain.common.v1.SubscriberGenesisState subscriber_genesis = 1
[ (gogoproto.nullable) = false ];
}
exocore.appchain.common.v1.SubscriberGenesisState subscriber_genesis = 1 [(gogoproto.nullable) = false];
}
8 changes: 3 additions & 5 deletions proto/exocore/appchain/coordinator/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/appchain/coordinator/ty
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// RegisterSubscriberChain registers a subscriber chain with the coordinator.
// RegisterSubscriberChain registers a subscriber chain with the coordinator.
// By default, it is activated at the next epoch.
rpc RegisterSubscriberChain(
RegisterSubscriberChainRequest
) returns (RegisterSubscriberChainResponse) {
rpc RegisterSubscriberChain(RegisterSubscriberChainRequest) returns (RegisterSubscriberChainResponse) {
option (google.api.http).post = "/exocore/appchain/coordinator/v1/tx/RegisterSubscriberChain";
}
}
Expand Down Expand Up @@ -54,4 +52,4 @@ message RegisterSubscriberChainRequest {

// RegisterSubscriberChainResponse defines the response structure for executing a
// RegisterSubscriberChain message.
message RegisterSubscriberChainResponse {}
message RegisterSubscriberChainResponse {}
6 changes: 2 additions & 4 deletions proto/exocore/appchain/subscriber/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/appchain/subscriber/typ
service Query {
// QueryParams returns the appchain subscriber module parameters.
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http) = {
get: "/appchain/subscriber/params"
};
option (google.api.http) = {get: "/appchain/subscriber/params"};
}
}

Expand All @@ -25,4 +23,4 @@ message QueryParamsRequest {}
message QueryParamsResponse {
// params is the parameters for the appchain subscriber module.
exocore.appchain.common.v1.SubscriberParams params = 1 [(gogoproto.nullable) = false];
}
}
2 changes: 1 addition & 1 deletion proto/exocore/appchain/subscriber/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package exocore.appchain.subscriber.v1;
option go_package = "github.com/ExocoreNetwork/exocore/x/appchain/subscriber/types";

// Msg defines the Msg service.
service Msg {}
service Msg {}
7 changes: 3 additions & 4 deletions proto/exocore/assets/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ message GenesisState {
// It is used to store the operator and its assets state.
message AssetsByOperator {
// operator is the address of the operator,its type should be a sdk.AccAddress
string operator = 1
[(cosmos_proto.scalar) = "cosmos.AddressString"];
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// assets_state is the list of assets state, indexed by the asset id.
// The struct is the `OperatorAssetInfo`
repeated AssetByID assets_state = 2 [(gogoproto.nullable) = false];
Expand Down Expand Up @@ -71,9 +70,9 @@ message DepositsByStaker {
// and the amount currently unbonding.
// It is named DepositByAsset (since it is indexed by the assetID)
// and not Deposit to prevent conflict with CrossChainOpType.
message DepositByAsset {
message DepositByAsset {
// asset_id is the id of the asset.
string asset_id = 1 [(gogoproto.customname) = "AssetID"];
// info is the asset info.
StakerAssetInfo info = 2 [(gogoproto.nullable) = false];
}
}
Loading
Loading