Savings module params (#1190)

* module files

* proto types

* types and generated proto types

* keeper

* client scaffold

* add savings module to app

* remove placeholder types file

* implement rest and add to module

* update proto types

* validation for supported denoms

* generate updates proto types

* update comments

* update comments

* remove unused imports from proto files

* regenerate proto files

* remove abci

* remove refs to other modules

* remove endblocker call

* genesis init test for module account

* update genesis test with params

* add get/set params test
This commit is contained in:
Denali Marsh 2022-03-23 14:27:54 +01:00 committed by GitHub
parent 8540a5c06f
commit 451bc05f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 210 additions and 54 deletions

View File

@ -10,6 +10,6 @@ option (gogoproto.verbose_equal_all) = true;
// GenesisState defines the savings module's genesis state. // GenesisState defines the savings module's genesis state.
message GenesisState { message GenesisState {
// params defines all the paramaters of the module. // params defines all the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false]; Params params = 1 [(gogoproto.nullable) = false];
} }

View File

@ -8,4 +8,6 @@ option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true; option (gogoproto.verbose_equal_all) = true;
// Params defines the parameters for the savings module. // Params defines the parameters for the savings module.
message Params {} message Params {
repeated string supported_denoms = 1;
}

View File

@ -37,7 +37,9 @@ func (suite *GenesisTestSuite) SetupTest() {
} }
func (suite *GenesisTestSuite) TestInitGenesis() { func (suite *GenesisTestSuite) TestInitGenesis() {
params := types.NewParams() params := types.NewParams(
[]string{"btc", "ukava", "bnb"},
)
savingsGenesis := types.NewGenesisState(params) savingsGenesis := types.NewGenesisState(params)
suite.NotPanics( suite.NotPanics(

View File

@ -0,0 +1,44 @@
package keeper_test
import (
"testing"
"github.com/stretchr/testify/suite"
sdk "github.com/cosmos/cosmos-sdk/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/x/savings/keeper"
)
// Test suite used for all keeper tests
type KeeperTestSuite struct {
suite.Suite
keeper keeper.Keeper
app app.TestApp
ctx sdk.Context
addrs []sdk.AccAddress
}
// The default state used by each test
func (suite *KeeperTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
tApp := app.NewTestApp()
ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
tApp.InitializeFromGenesisStates()
_, addrs := app.GeneratePrivKeyAddressPairs(1)
keeper := tApp.GetSavingsKeeper()
suite.app = tApp
suite.ctx = ctx
suite.keeper = keeper
suite.addrs = addrs
}
func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(KeeperTestSuite))
}

View File

@ -0,0 +1,19 @@
package keeper_test
import (
"github.com/kava-labs/kava/x/savings/types"
)
func (suite *KeeperTestSuite) TestGetSetParams() {
params := suite.keeper.GetParams(suite.ctx)
suite.Require().Equal(
types.Params{SupportedDenoms: []string(nil)},
params,
)
newParams := types.NewParams([]string{"btc", "test"})
suite.keeper.SetParams(suite.ctx, newParams)
fetchedParams := suite.keeper.GetParams(suite.ctx)
suite.Require().Equal(newParams, fetchedParams)
}

View File

@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the savings module's genesis state. // GenesisState defines the savings module's genesis state.
type GenesisState struct { type GenesisState struct {
// params defines all the paramaters of the module. // params defines all the parameters of the module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
} }

View File

@ -1,20 +1,27 @@
package types package types
import ( import (
"fmt"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
) )
// Parameter keys // Parameter keys
var () var (
KeySupportedDenoms = []byte("SupportedDenoms")
DefaultSupportedDenoms = []string{}
)
// NewParams creates a new Params object // NewParams creates a new Params object
func NewParams() Params { func NewParams(supportedDenoms []string) Params {
return Params{} return Params{
SupportedDenoms: supportedDenoms,
}
} }
// DefaultParams default params for savings // DefaultParams default params for savings
func DefaultParams() Params { func DefaultParams() Params {
return NewParams() return NewParams(DefaultSupportedDenoms)
} }
// ParamKeyTable Key declaration for parameters // ParamKeyTable Key declaration for parameters
@ -25,10 +32,28 @@ func ParamKeyTable() paramtypes.KeyTable {
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs // ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
// pairs of savings module's parameters. // pairs of savings module's parameters.
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{} return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeySupportedDenoms, &p.SupportedDenoms, validateSupportedDenoms),
}
} }
// Validate ensure that params have valid values // Validate ensure that params have valid values
func (p Params) Validate() error { func (p Params) Validate() error {
return validateSupportedDenoms(p.SupportedDenoms)
}
func validateSupportedDenoms(i interface{}) error {
supportedDenoms, ok := i.([]string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
seenDenoms := make(map[string]bool)
for _, denom := range supportedDenoms {
if seenDenoms[denom] {
return fmt.Errorf("duplicated denom %s", denom)
}
seenDenoms[denom] = true
}
return nil return nil
} }

View File

@ -13,7 +13,6 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
@ -115,27 +114,26 @@ func init() {
func init() { proto.RegisterFile("kava/savings/v1beta1/query.proto", fileDescriptor_f78c91efc5db144f) } func init() { proto.RegisterFile("kava/savings/v1beta1/query.proto", fileDescriptor_f78c91efc5db144f) }
var fileDescriptor_f78c91efc5db144f = []byte{ var fileDescriptor_f78c91efc5db144f = []byte{
// 316 bytes of a gzipped FileDescriptorProto // 299 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0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x05, 0x05, 0xdc, 0xd4, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x90, 0x1a, 0x03, 0x02, 0x00,
0x8b, 0xb4, 0xcb, 0xbc, 0xfd, 0x49, 0x35, 0x2b, 0xc5, 0x75, 0xd4, 0xb6, 0x27, 0x3d, 0xfe, 0x0e, 0x00, 0xff, 0xff, 0xf2, 0xbe, 0x68, 0x26, 0xe2, 0x01, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xde, 0xe3, 0xfa, 0xae, 0x03, 0x02, 0x00, 0x00,
} }
func (this *QueryParamsRequest) VerboseEqual(that interface{}) error { func (this *QueryParamsRequest) VerboseEqual(that interface{}) error {

View File

@ -5,10 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
@ -27,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters for the savings module. // Params defines the parameters for the savings module.
type Params struct { type Params struct {
SupportedDenoms []string `protobuf:"bytes,1,rep,name=supported_denoms,json=supportedDenoms,proto3" json:"supported_denoms,omitempty"`
} }
func (m *Params) Reset() { *m = Params{} } func (m *Params) Reset() { *m = Params{} }
@ -62,6 +61,13 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetSupportedDenoms() []string {
if m != nil {
return m.SupportedDenoms
}
return nil
}
func init() { func init() {
proto.RegisterType((*Params)(nil), "kava.savings.v1beta1.Params") proto.RegisterType((*Params)(nil), "kava.savings.v1beta1.Params")
} }
@ -69,20 +75,20 @@ func init() {
func init() { proto.RegisterFile("kava/savings/v1beta1/store.proto", fileDescriptor_f7110366fa182786) } func init() { proto.RegisterFile("kava/savings/v1beta1/store.proto", fileDescriptor_f7110366fa182786) }
var fileDescriptor_f7110366fa182786 = []byte{ var fileDescriptor_f7110366fa182786 = []byte{
// 202 bytes of a gzipped FileDescriptorProto // 196 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b,
0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
0xd4, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0xa9, 0xd4, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0xa9,
0xd0, 0x83, 0xaa, 0xd0, 0x83, 0xaa, 0x90, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07, 0xd0, 0x83, 0xaa, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd0, 0x07,
0xab, 0xd1, 0x87, 0x70, 0x20, 0x1a, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0xe2, 0x20, 0x16, 0xb1, 0x20, 0x6a, 0x95, 0x8c, 0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xcc, 0xd2, 0xaf, 0x6b, 0x74, 0x73, 0x12, 0x93, 0x8a, 0xc1, 0x2c, 0xfd, 0x0a, 0xb8, 0xdb, 0x4b, 0x2a, 0x0b, 0x52,
0x80, 0x7b, 0xa6, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0xba, 0x31, 0x20, 0x00, 0x00, 0x8b, 0x93, 0xd8, 0xc0, 0x0e, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x0f, 0x9d, 0xba,
0xff, 0xff, 0x87, 0x90, 0xfa, 0x64, 0xe9, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00,
} }
func (this *Params) VerboseEqual(that interface{}) error { func (this *Params) VerboseEqual(that interface{}) error {
@ -110,6 +116,14 @@ func (this *Params) VerboseEqual(that interface{}) error {
} else if this == nil { } else if this == nil {
return fmt.Errorf("that is type *Params but is not nil && this == nil") return fmt.Errorf("that is type *Params but is not nil && this == nil")
} }
if len(this.SupportedDenoms) != len(that1.SupportedDenoms) {
return fmt.Errorf("SupportedDenoms this(%v) Not Equal that(%v)", len(this.SupportedDenoms), len(that1.SupportedDenoms))
}
for i := range this.SupportedDenoms {
if this.SupportedDenoms[i] != that1.SupportedDenoms[i] {
return fmt.Errorf("SupportedDenoms this[%v](%v) Not Equal that[%v](%v)", i, this.SupportedDenoms[i], i, that1.SupportedDenoms[i])
}
}
return nil return nil
} }
func (this *Params) Equal(that interface{}) bool { func (this *Params) Equal(that interface{}) bool {
@ -131,6 +145,14 @@ func (this *Params) Equal(that interface{}) bool {
} else if this == nil { } else if this == nil {
return false return false
} }
if len(this.SupportedDenoms) != len(that1.SupportedDenoms) {
return false
}
for i := range this.SupportedDenoms {
if this.SupportedDenoms[i] != that1.SupportedDenoms[i] {
return false
}
}
return true return true
} }
func (m *Params) Marshal() (dAtA []byte, err error) { func (m *Params) Marshal() (dAtA []byte, err error) {
@ -153,6 +175,15 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.SupportedDenoms) > 0 {
for iNdEx := len(m.SupportedDenoms) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.SupportedDenoms[iNdEx])
copy(dAtA[i:], m.SupportedDenoms[iNdEx])
i = encodeVarintStore(dAtA, i, uint64(len(m.SupportedDenoms[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -173,6 +204,12 @@ func (m *Params) Size() (n int) {
} }
var l int var l int
_ = l _ = l
if len(m.SupportedDenoms) > 0 {
for _, s := range m.SupportedDenoms {
l = len(s)
n += 1 + l + sovStore(uint64(l))
}
}
return n return n
} }
@ -211,6 +248,38 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SupportedDenoms", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowStore
}
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 ErrInvalidLengthStore
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthStore
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SupportedDenoms = append(m.SupportedDenoms, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipStore(dAtA[iNdEx:]) skippy, err := skipStore(dAtA[iNdEx:])

View File

@ -10,7 +10,6 @@ import (
grpc1 "github.com/gogo/protobuf/grpc" grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
_ "google.golang.org/protobuf/types/known/timestamppb"
math "math" math "math"
) )
@ -28,19 +27,17 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("kava/savings/v1beta1/tx.proto", fileDescriptor_c0bf8679b144267a) } func init() { proto.RegisterFile("kava/savings/v1beta1/tx.proto", fileDescriptor_c0bf8679b144267a) }
var fileDescriptor_c0bf8679b144267a = []byte{ var fileDescriptor_c0bf8679b144267a = []byte{
// 183 bytes of a gzipped FileDescriptorProto // 157 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4e, 0x2c, 0x4b, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4e, 0x2c, 0x4b,
0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0x49, 0xeb, 0x41, 0xa5, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0x49, 0xeb, 0x41, 0xa5,
0xf5, 0xa0, 0xd2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x05, 0xfa, 0x20, 0x16, 0x44, 0xad, 0xf5, 0xa0, 0xd2, 0x52, 0x22, 0xe9, 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49, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0x50, 0x1f, 0x14, 0xa7, 0x00, 0x00, 0x00,
0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x68, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5a,
0xee, 0x09, 0x21, 0xc8, 0x00, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.