chore: reduce default inflation (#20606)
This commit is contained in:
parent
4fa658e687
commit
76a28ad4d0
@ -35,7 +35,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() {
|
||||
&types.QueryTotalSupplyResponse{
|
||||
Supply: sdk.NewCoins(
|
||||
sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), s.cfg.AccountTokens),
|
||||
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(10))),
|
||||
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(3))),
|
||||
),
|
||||
Pagination: &query.PageResponse{
|
||||
Total: 2,
|
||||
@ -50,7 +50,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() {
|
||||
},
|
||||
&types.QuerySupplyOfResponse{},
|
||||
&types.QuerySupplyOfResponse{
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(10))),
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(3))),
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -61,7 +61,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() {
|
||||
},
|
||||
&types.QuerySupplyOfResponse{},
|
||||
&types.QuerySupplyOfResponse{
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(20))),
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(6))),
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -72,7 +72,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() {
|
||||
},
|
||||
&types.QuerySupplyOfResponse{},
|
||||
&types.QuerySupplyOfResponse{
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(10))),
|
||||
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(math.NewInt(3))),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ func (s *GRPCQueryTestSuite) TestQueryOutstandingRewardsGRPC() {
|
||||
val := s.network.GetValidators()[0]
|
||||
baseURL := val.GetAPIAddress()
|
||||
|
||||
rewards, err := sdk.ParseDecCoins("19.6stake")
|
||||
rewards, err := sdk.ParseDecCoins("5.88stake")
|
||||
s.Require().NoError(err)
|
||||
|
||||
testCases := []struct {
|
||||
@ -170,7 +170,7 @@ func (s *GRPCQueryTestSuite) TestQueryValidatorCommissionGRPC() {
|
||||
val := s.network.GetValidators()[0]
|
||||
baseURL := val.GetAPIAddress()
|
||||
|
||||
commission, err := sdk.ParseDecCoins("9.8stake")
|
||||
commission, err := sdk.ParseDecCoins("2.94stake")
|
||||
s.Require().NoError(err)
|
||||
|
||||
testCases := []struct {
|
||||
@ -283,7 +283,7 @@ func (s *GRPCQueryTestSuite) TestQueryDelegatorRewardsGRPC() {
|
||||
val := s.network.GetValidators()[0]
|
||||
baseURL := val.GetAPIAddress()
|
||||
|
||||
rewards, err := sdk.ParseDecCoins("9.8stake")
|
||||
rewards, err := sdk.ParseDecCoins("2.94stake")
|
||||
s.Require().NoError(err)
|
||||
|
||||
testCases := []struct {
|
||||
|
||||
@ -95,8 +95,7 @@ type InflationCalculationFn func(ctx sdk.Context, minter Minter, params Params,
|
||||
The target annual inflation rate is recalculated each block.
|
||||
The inflation is also subject to a rate change (positive or negative)
|
||||
depending on the distance from the desired ratio (67%). The maximum rate change
|
||||
possible is defined to be 13% per year, however, the annual inflation is capped
|
||||
as between 7% and 20%.
|
||||
possible is defined to be 5% per year, however, the annual inflation is capped between 0% and 5%.
|
||||
|
||||
```go
|
||||
NextInflationRate(params Params, bondedRatio math.LegacyDec) (inflation math.LegacyDec) {
|
||||
|
||||
@ -23,31 +23,31 @@ func TestNextInflation(t *testing.T) {
|
||||
bondedRatio, setInflation, expChange math.LegacyDec
|
||||
}{
|
||||
// with 0% bonded atom supply the inflation should increase by InflationRateChange
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(7, 2), params.InflationRateChange.Quo(blocksPerYr)},
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(0, 2), params.InflationRateChange.Quo(blocksPerYr)},
|
||||
|
||||
// 100% bonded, starting at 20% inflation and being reduced
|
||||
// (1 - (1/0.67))*(0.13/8667)
|
||||
{
|
||||
math.LegacyOneDec(), math.LegacyNewDecWithPrec(20, 2),
|
||||
math.LegacyOneDec(), math.LegacyNewDecWithPrec(5, 2),
|
||||
math.LegacyOneDec().Sub(math.LegacyOneDec().Quo(params.GoalBonded)).Mul(params.InflationRateChange).Quo(blocksPerYr),
|
||||
},
|
||||
|
||||
// 50% bonded, starting at 10% inflation and being increased
|
||||
{
|
||||
math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(10, 2),
|
||||
math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(2, 2),
|
||||
math.LegacyOneDec().Sub(math.LegacyNewDecWithPrec(5, 1).Quo(params.GoalBonded)).Mul(params.InflationRateChange).Quo(blocksPerYr),
|
||||
},
|
||||
|
||||
// test 7% minimum stop (testing with 100% bonded)
|
||||
{math.LegacyOneDec(), math.LegacyNewDecWithPrec(7, 2), math.LegacyZeroDec()},
|
||||
{math.LegacyOneDec(), math.LegacyNewDecWithPrec(700000001, 10), math.LegacyNewDecWithPrec(-1, 10)},
|
||||
// test 0% minimum stop (testing with 100% bonded)
|
||||
{math.LegacyOneDec(), math.LegacyNewDecWithPrec(0, 2), math.LegacyZeroDec()},
|
||||
{math.LegacyOneDec(), math.LegacyNewDecWithPrec(1, 10), math.LegacyNewDecWithPrec(-1, 10)},
|
||||
|
||||
// test 20% maximum stop (testing with 0% bonded)
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(20, 2), math.LegacyZeroDec()},
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(1999999999, 10), math.LegacyNewDecWithPrec(1, 10)},
|
||||
// test 5% maximum stop (testing with 0% bonded)
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(5, 2), math.LegacyZeroDec()},
|
||||
{math.LegacyZeroDec(), math.LegacyNewDecWithPrec(499999999, 10), math.LegacyNewDecWithPrec(1, 10)},
|
||||
|
||||
// perfect balance shouldn't change inflation
|
||||
{math.LegacyNewDecWithPrec(67, 2), math.LegacyNewDecWithPrec(15, 2), math.LegacyZeroDec()},
|
||||
{math.LegacyNewDecWithPrec(67, 2), math.LegacyNewDecWithPrec(5, 2), math.LegacyZeroDec()},
|
||||
}
|
||||
for i, tc := range tests {
|
||||
minter.Inflation = tc.setInflation
|
||||
|
||||
@ -28,8 +28,8 @@ func DefaultParams() Params {
|
||||
return Params{
|
||||
MintDenom: sdk.DefaultBondDenom,
|
||||
InflationRateChange: math.LegacyNewDecWithPrec(13, 2),
|
||||
InflationMax: math.LegacyNewDecWithPrec(20, 2),
|
||||
InflationMin: math.LegacyNewDecWithPrec(7, 2),
|
||||
InflationMax: math.LegacyNewDecWithPrec(5, 2),
|
||||
InflationMin: math.LegacyNewDecWithPrec(0, 2),
|
||||
GoalBonded: math.LegacyNewDecWithPrec(67, 2),
|
||||
BlocksPerYear: uint64(60 * 60 * 8766 / 5), // assuming 5 second block times
|
||||
MaxSupply: math.ZeroInt(), // assuming zero is infinite
|
||||
|
||||
Loading…
Reference in New Issue
Block a user