diff --git a/docs/proto/mint.md b/docs/proto/mint.md index c28ba227..b894697a 100644 --- a/docs/proto/mint.md +++ b/docs/proto/mint.md @@ -74,6 +74,8 @@ Params defines the parameters for the mint module. | `mint_denom` | [string](#string) | | Denomination of the coin to be minted. | | `inflation_coef` | [string](#string) | | Annual inflation coefficient, influencing the inflation rate based on the bonded ratio. Values range from 0 to 1, with higher values indicating higher inflation. | | `blocks_per_year` | [uint64](#uint64) | | Estimated number of blocks per year. | +| `inflation_max` | [string](#string) | | Maximum annual inflation rate. | +| `inflation_min` | [string](#string) | | Minimum annual inflation rate. | [//]: # (end messages) diff --git a/proto/mint/v1beta1/mint.proto b/proto/mint/v1beta1/mint.proto index 6cb1d292..d01acacf 100644 --- a/proto/mint/v1beta1/mint.proto +++ b/proto/mint/v1beta1/mint.proto @@ -37,6 +37,21 @@ message Params { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + // Estimated number of blocks per year. uint64 blocks_per_year = 3; + + // Maximum annual inflation rate. + string inflation_max = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = true + ]; + + // Minimum annual inflation rate. + string inflation_min = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = true + ]; } diff --git a/x/mint/abci.go b/x/mint/abci.go index 3f069e9e..5657fbd1 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -28,7 +28,7 @@ func BeginBlocker(ctx context.Context, k keeper.Keeper) error { return err } - minter, err := types.NewMinterWithInflationCoef(params.InflationCoef, bondedRatio, totalSupply) + minter, err := types.NewMinterWithInflationCoef(params.InflationCoef, bondedRatio, params.InflationMin, params.InflationMax, totalSupply) if err != nil { panic(err) } diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index c4aa3508..b6d1fa0c 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -75,6 +75,10 @@ type Params struct { InflationCoef cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=inflation_coef,json=inflationCoef,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_coef"` // Estimated number of blocks per year. BlocksPerYear uint64 `protobuf:"varint,3,opt,name=blocks_per_year,json=blocksPerYear,proto3" json:"blocks_per_year,omitempty"` + // Maximum annual inflation rate. + InflationMax *cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=inflation_max,json=inflationMax,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_max,omitempty"` + // Minimum annual inflation rate. + InflationMin *cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=inflation_min,json=inflationMin,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_min,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -131,29 +135,31 @@ func init() { func init() { proto.RegisterFile("mint/v1beta1/mint.proto", fileDescriptor_06339c129491fd39) } var fileDescriptor_06339c129491fd39 = []byte{ - // 344 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x3f, 0x4f, 0x3a, 0x31, - 0x18, 0xc7, 0xaf, 0xbf, 0x1f, 0x21, 0xa1, 0x11, 0xff, 0x5c, 0x4c, 0x44, 0x8c, 0x07, 0x61, 0x30, - 0x2c, 0x5e, 0x43, 0x74, 0x32, 0x4e, 0xc8, 0xa8, 0x91, 0x30, 0xa9, 0x83, 0x97, 0x5e, 0x29, 0x47, - 0x03, 0xd7, 0xe7, 0xd2, 0x16, 0x22, 0xef, 0xc2, 0xd1, 0xd1, 0x77, 0xe0, 0xe2, 0xe2, 0x3b, 0x60, - 0x24, 0x4e, 0xc6, 0x81, 0x18, 0x78, 0x23, 0xe6, 0xae, 0x04, 0x77, 0x96, 0xe6, 0x79, 0x3e, 0x4f, - 0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xd2, 0xff, 0x2a, 0xaa, 0xe7, 0x3a, 0x45, 0x8b, 0xdb, 0x5c, - 0xdd, 0x73, 0xaa, 0x2e, 0x72, 0x2f, 0xaf, 0x15, 0xa7, 0x79, 0x39, 0x5d, 0x78, 0x68, 0xb6, 0xf0, - 0xd0, 0xcf, 0xc2, 0x43, 0xcf, 0x4b, 0xcf, 0x99, 0x2d, 0x3d, 0xe7, 0x6b, 0xe9, 0x39, 0x0f, 0xb5, - 0x48, 0x98, 0xfe, 0x28, 0xf4, 0x19, 0xc4, 0x04, 0x06, 0xc9, 0x79, 0x76, 0x74, 0xc9, 0x53, 0xb6, - 0x6a, 0x62, 0x26, 0x09, 0xd7, 0x61, 0x3e, 0x5b, 0xd9, 0xd9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x12, 0xd6, 0x6f, 0xe4, 0x0c, 0x02, 0x00, 0x00, + // 376 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xcf, 0x4e, 0xea, 0x40, + 0x14, 0x87, 0x3b, 0x5c, 0x2e, 0x09, 0x13, 0xb8, 0x7f, 0x1a, 0x13, 0x2b, 0xc6, 0x42, 0x58, 0x18, + 0x36, 0xb6, 0x21, 0xba, 0x32, 0xae, 0x90, 0xa5, 0x44, 0xc2, 0xc2, 0xa8, 0x0b, 0x9b, 0x69, 0x19, + 0xca, 0x04, 0x3a, 0xa7, 0xe9, 0x0c, 0x04, 0xde, 0xc2, 0xa5, 0x4b, 0x1f, 0xc2, 0x8d, 0x6f, 0xc0, + 0x92, 0xb8, 0x32, 0x2e, 0xd0, 0xc0, 0x8b, 0x98, 0x76, 0x48, 0x49, 0xdc, 0x49, 0xdc, 0x34, 0xe7, + 0xfc, 0x4e, 0xe7, 0x9b, 0x2f, 0x93, 0x83, 0x77, 0x03, 0xc6, 0xa5, 0x3d, 0xae, 0xbb, 0x54, 0x92, + 0xba, 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57, 0x78, 0x73, 0xd0, 0x09, 0xc8, 0xc4, 0xc8, + 0xa6, 0x02, 0xe8, 0x7b, 0x02, 0x85, 0x94, 0xd3, 0x22, 0x93, 0x2f, 0x5c, 0xc6, 0x8d, 0xdf, 0x3f, + 0xc0, 0x65, 0xfc, 0x34, 0xfb, 0xf0, 0x58, 0xd6, 0x1a, 0x67, 0xb3, 0xa5, 0x89, 0xe6, 0x4b, 0x13, + 0x7d, 0x2c, 0x4d, 0x74, 0xbf, 0x32, 0xb5, 0xf9, 0xca, 0xd4, 0x5e, 0x57, 0xa6, 0x76, 0x5b, 0xf5, + 0x99, 0xec, 0x8f, 0x5c, 0xcb, 0x83, 0xc0, 0x86, 0x41, 0x78, 0x92, 0x7c, 0xba, 0xf6, 0x24, 0x59, + 0x4d, 0x5b, 0x4e, 0x43, 0x2a, 0xdc, 0x5c, 0xb2, 0x62, 0xc7, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x96, 0x4c, 0xd7, 0xc6, 0xbc, 0x02, 0x00, 0x00, } func (m *Minter) Marshal() (dAtA []byte, err error) { @@ -219,6 +225,30 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.InflationMin != nil { + { + size := m.InflationMin.Size() + i -= size + if _, err := m.InflationMin.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.InflationMax != nil { + { + size := m.InflationMax.Size() + i -= size + if _, err := m.InflationMax.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if m.BlocksPerYear != 0 { i = encodeVarintMint(dAtA, i, uint64(m.BlocksPerYear)) i-- @@ -283,6 +313,14 @@ func (m *Params) Size() (n int) { if m.BlocksPerYear != 0 { n += 1 + sovMint(uint64(m.BlocksPerYear)) } + if m.InflationMax != nil { + l = m.InflationMax.Size() + n += 1 + l + sovMint(uint64(l)) + } + if m.InflationMin != nil { + l = m.InflationMin.Size() + n += 1 + l + sovMint(uint64(l)) + } return n } @@ -524,6 +562,78 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationMax", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.LegacyDec + m.InflationMax = &v + if err := m.InflationMax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationMin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.LegacyDec + m.InflationMin = &v + if err := m.InflationMin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMint(dAtA[iNdEx:]) diff --git a/x/mint/types/minter.go b/x/mint/types/minter.go index a920f4bd..bf8b8526 100644 --- a/x/mint/types/minter.go +++ b/x/mint/types/minter.go @@ -26,8 +26,8 @@ func NewMinterWithInitialInflation(inflation math.LegacyDec) Minter { } // NewMinterWithInflationCoef returns a new Minter with updated inflation and annual provisions values. -func NewMinterWithInflationCoef(inflationCoef math.LegacyDec, bondedRatio math.LegacyDec, totalSupply math.Int) (Minter, error) { - inflationRate, err := inflationRate(inflationCoef, bondedRatio) +func NewMinterWithInflationCoef(inflationCoef, bondedRatio math.LegacyDec, minBound, maxBound *math.LegacyDec, totalSupply math.Int) (Minter, error) { + inflationRate, err := inflationRate(inflationCoef, bondedRatio, minBound, maxBound) if err != nil { return Minter{}, err } @@ -55,12 +55,20 @@ func (m Minter) Validate() error { // inflationRate returns the inflation rate computed from the current bonded ratio // and the inflation parameter. -func inflationRate(inflationCoef math.LegacyDec, bondedRatio math.LegacyDec) (math.LegacyDec, error) { +func inflationRate(inflationCoef, bondedRatio math.LegacyDec, minBound, maxBound *math.LegacyDec) (math.LegacyDec, error) { if bondedRatio.IsZero() { return math.LegacyZeroDec(), ErrBondedRatioIsZero } - return inflationCoef.Quo(bondedRatio), nil + rate := inflationCoef.Quo(bondedRatio) + if minBound != nil { + rate = math.LegacyMaxDec(rate, *minBound) + } + if maxBound != nil { + rate = math.LegacyMinDec(rate, *maxBound) + } + + return rate, nil } // BlockProvision returns the provisions for a block based on the annual diff --git a/x/mint/types/minter_test.go b/x/mint/types/minter_test.go index 3752e8db..ad6c5417 100644 --- a/x/mint/types/minter_test.go +++ b/x/mint/types/minter_test.go @@ -12,11 +12,16 @@ import ( ) func TestNextInflation(t *testing.T) { + infMin := math.LegacyNewDecWithPrec(7, 2) + infMax := math.LegacyNewDecWithPrec(10, 2) + Convey("Given a test cases", t, func() { cases := []struct { name string inflationRatio math.LegacyDec bondedRatio math.LegacyDec + minBound *math.LegacyDec + maxBound *math.LegacyDec totalSupply math.Int expectedInflation math.LegacyDec expectedAnnualProvisions math.LegacyDec @@ -26,6 +31,8 @@ func TestNextInflation(t *testing.T) { name: "inflation ratio is 0", inflationRatio: math.LegacyNewDec(0), bondedRatio: math.LegacyNewDecWithPrec(20, 2), + minBound: nil, + maxBound: nil, totalSupply: math.NewInt(1000), expectedInflation: math.LegacyNewDec(0), expectedAnnualProvisions: math.LegacyNewDec(0), @@ -34,14 +41,38 @@ func TestNextInflation(t *testing.T) { name: "inflation ratio is 0.03", inflationRatio: math.LegacyNewDecWithPrec(3, 2), bondedRatio: math.LegacyNewDecWithPrec(2, 1), + minBound: nil, + maxBound: nil, totalSupply: math.NewInt(1000), expectedInflation: math.LegacyNewDecWithPrec(15, 2), expectedAnnualProvisions: math.LegacyNewDec(150), }, + { + name: "inflation max is 0.1", + inflationRatio: math.LegacyNewDecWithPrec(3, 2), + bondedRatio: math.LegacyNewDecWithPrec(2, 1), + minBound: nil, + maxBound: &infMax, + totalSupply: math.NewInt(1000), + expectedInflation: math.LegacyNewDecWithPrec(10, 2), + expectedAnnualProvisions: math.LegacyNewDec(100), + }, + { + name: "inflation min is 0.07", + inflationRatio: math.LegacyNewDecWithPrec(3, 2), + bondedRatio: math.LegacyNewDecWithPrec(7, 1), + minBound: &infMin, + maxBound: &infMax, + totalSupply: math.NewInt(1000), + expectedInflation: math.LegacyNewDecWithPrec(7, 2), + expectedAnnualProvisions: math.LegacyNewDec(70), + }, { name: "bonded ratio is 0", inflationRatio: math.LegacyNewDecWithPrec(3, 2), bondedRatio: math.LegacyNewDec(0), + minBound: nil, + maxBound: nil, totalSupply: math.NewInt(1000), expectedErr: fmt.Errorf("bonded ratio is zero"), }, @@ -49,6 +80,8 @@ func TestNextInflation(t *testing.T) { name: "negative inflation ratio", inflationRatio: math.LegacyNewDecWithPrec(3, 2), bondedRatio: math.LegacyNewDecWithPrec(-2, 1), + minBound: nil, + maxBound: nil, totalSupply: math.NewInt(1000), expectedErr: fmt.Errorf("mint parameter Inflation should be positive, is -0.150000000000000000"), }, @@ -58,7 +91,7 @@ func TestNextInflation(t *testing.T) { Convey( fmt.Sprintf("Given test case #%d: %v", nc, tc.name), func() { Convey("when calling NewMinterWithInflationCoef function", func() { - minter, err := NewMinterWithInflationCoef(tc.inflationRatio, tc.bondedRatio, tc.totalSupply) + minter, err := NewMinterWithInflationCoef(tc.inflationRatio, tc.bondedRatio, tc.minBound, tc.maxBound, tc.totalSupply) if tc.expectedErr != nil { Convey("then an error should occur", func() { So(err, ShouldNotBeNil) @@ -109,7 +142,7 @@ func BenchmarkNextInflation(b *testing.B) { // run the NextInflationRate function b.N times for n := 0; n < b.N; n++ { - _, err := NewMinterWithInflationCoef(params.InflationCoef, bondedRatio, totalSupply) + _, err := NewMinterWithInflationCoef(params.InflationCoef, bondedRatio, nil, nil, totalSupply) if err != nil { panic(err) } diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 0fa51c6b..26921e12 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -25,10 +25,13 @@ func NewParams( // DefaultParams returns a default set of parameters. func DefaultParams() Params { + infMax := math.LegacyNewDecWithPrec(20, 2) return Params{ MintDenom: sdk.DefaultBondDenom, InflationCoef: math.LegacyNewDecWithPrec(3, 2), BlocksPerYear: uint64(60 * 60 * 8766 / 5), // assuming 5-second block times + InflationMax: &infMax, + InflationMin: nil, } } @@ -40,6 +43,9 @@ func (p Params) Validate() error { if err := validateInflationCoef(p.InflationCoef); err != nil { return err } + if err := validateBounds(p.InflationMin, p.InflationMax); err != nil { + return err + } return validateBlocksPerYear(p.BlocksPerYear) } @@ -81,6 +87,29 @@ func validateInflationCoef(i interface{}) error { return nil } +func validateBounds(min, max interface{}) error { + vmin, ok := min.(*math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", min) + } + vmax, ok := max.(*math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", max) + } + + for _, v := range []*math.LegacyDec{vmin, vmax} { + if v != nil && v.IsNegative() { + return fmt.Errorf("inflation bound cannot be negative: %s", v) + } + } + + if vmin != nil && vmax != nil && vmin.GT(*vmax) { + return fmt.Errorf("inflation min cannot greater than inflation max") + } + + return nil +} + func validateBlocksPerYear(i interface{}) error { v, ok := i.(uint64) if !ok {