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

Turn staking power reduction into an on-chain param #8505

Merged
merged 30 commits into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fec543d
power reduction as on-chain param
xbuidler Jan 26, 2021
4f476d6
on-chain power reduction param conversion basic work
xbuidler Jan 27, 2021
cb17fed
use on-chain params on tests + fix tests + add new tests for power re…
xbuidler Jan 28, 2021
86844b2
comment update
xbuidler Jan 28, 2021
60c6c0a
legacy genesis migration test and feedbacks
xbuidler Feb 1, 2021
7b5cf61
remove dependency between min deposit tokens and power reduction
xbuidler Feb 1, 2021
1c1e67f
Less function to not use default power reduction
xbuidler Feb 2, 2021
5acdc07
reduce power reduction var name
xbuidler Feb 3, 2021
2ce6d4b
increase gas limit for redelegation only
xbuidler Feb 3, 2021
cc4ef50
Merge cosmos-sdk master
xbuidler Feb 3, 2021
0e6b9a6
Merge branch 'master' into issue#8365/staking_power_reduction_chain_p…
xbuidler Feb 3, 2021
7130544
regen staking.pb.go
xbuidler Feb 3, 2021
36bc29a
golang-ci lint
xbuidler Feb 3, 2021
2a43a2d
reduce legacy code
xbuidler Feb 3, 2021
2c1ef71
Merge pull request #65 from psaradev/issue#8365/staking_power_reducti…
sunnya97 Feb 3, 2021
1f99aa3
merged in master
sunnya97 Mar 21, 2021
be27ec1
started fixing merge conflicts
sunnya97 Mar 21, 2021
ca9bfbd
fix merge conflicts
sunnya97 Mar 21, 2021
83efad3
fixing merge conflicts
sunnya97 Mar 21, 2021
b54e276
simply default power reduction definition
sunnya97 Mar 22, 2021
babe920
added CHANGELOG
sunnya97 Mar 22, 2021
05e2e45
merged in master
sunnya97 Apr 6, 2021
ca34808
merged master
sunnya97 Apr 7, 2021
aee3ca8
fix merge conflict
sunnya97 Apr 7, 2021
61b608f
Merge branch 'master' into powerreduction_param
sunnya97 Apr 7, 2021
04e483d
fixed migrations
sunnya97 Apr 7, 2021
8cf5fe0
add nolint to pb.go files
sunnya97 Apr 8, 2021
cd8186e
fix rosetta-test
sunnya97 Apr 9, 2021
10b2b08
Merge branch 'master' into powerreduction_param
sunnya97 Apr 10, 2021
4b778ab
merged master
sunnya97 Apr 10, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/bank) [\#8656](https://github.com/cosmos/cosmos-sdk/pull/8656) balance and supply are now correctly tracked via `coin_spent`, `coin_received`, `coinbase` and `burn` events.
* (x/bank) [\#8517](https://github.com/cosmos/cosmos-sdk/pull/8517) Supply is now stored and tracked as `sdk.Coins`
* (store) [\#8790](https://github.com/cosmos/cosmos-sdk/pull/8790) Reduce gas costs by 10x for transient store operations.
<<<<<<< HEAD
* (x/staking) [\#8505](https://github.com/cosmos/cosmos-sdk/pull/8505) Convert staking power reduction into an on-chain parameter rather than a hardcoded in-code variable.
=======
sunnya97 marked this conversation as resolved.
Show resolved Hide resolved
* (x/bank) [\#9051](https://github.com/cosmos/cosmos-sdk/pull/9051) Supply value is stored as `sdk.Int` rather than `string`.
>>>>>>> master

### Improvements

Expand Down
7 changes: 7 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,11 @@ QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |





Expand All @@ -1885,6 +1890,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `supply` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | supply is the supply of the coins |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |



Expand Down Expand Up @@ -6402,6 +6408,7 @@ Params defines the parameters for the staking module.
| `max_entries` | [uint32](#uint32) | | max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). |
| `historical_entries` | [uint32](#uint32) | | historical_entries is the number of historical entries to persist. |
| `bond_denom` | [string](#string) | | bond_denom defines the bondable coin denomination. |
| `power_reduction` | [string](#string) | | power_reduction is the amount of staking tokens required for 1 unit of consensus-engine power |



Expand Down
6 changes: 6 additions & 0 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ message Params {
uint32 historical_entries = 4 [(gogoproto.moretags) = "yaml:\"historical_entries\""];
// bond_denom defines the bondable coin denomination.
string bond_denom = 5 [(gogoproto.moretags) = "yaml:\"bond_denom\""];
// power_reduction is the amount of staking tokens required for 1 unit of consensus-engine power
string power_reduction = 6 [
(gogoproto.moretags) = "yaml:\"power_reduction\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

// DelegationResponse is equivalent to Delegation except that it contains a
Expand Down
152 changes: 76 additions & 76 deletions server/grpc/reflection/v2alpha1/reflection.pb.go

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

6 changes: 3 additions & 3 deletions simapp/simd/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ func InitTestnet(
return err
}

accTokens := sdk.TokensFromConsensusPower(1000)
accStakingTokens := sdk.TokensFromConsensusPower(500)
accTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction)
accStakingTokens := sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction)
coins := sdk.Coins{
sdk.NewCoin(fmt.Sprintf("%stoken", nodeDirName), accTokens),
sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens),
Expand All @@ -206,7 +206,7 @@ func InitTestnet(
genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()})
genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0))

valTokens := sdk.TokensFromConsensusPower(100)
valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction)
createValMsg, err := stakingtypes.NewMsgCreateValidator(
sdk.ValAddress(addr),
valPubKeys[i],
Expand Down
6 changes: 3 additions & 3 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ func DefaultConfig() Config {
NumValidators: 4,
BondDenom: sdk.DefaultBondDenom,
MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom),
AccountTokens: sdk.TokensFromConsensusPower(1000),
StakingTokens: sdk.TokensFromConsensusPower(500),
BondedTokens: sdk.TokensFromConsensusPower(100),
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
PruningStrategy: storetypes.PruningOptionNothing,
CleanupDir: true,
SigningAlgo: string(hd.Secp256k1Type),
Expand Down
Loading