File tree 5 files changed +30
-1
lines changed
5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ Contains all the PRs that improved the code without changing the behaviors.
33
33
- fixed old expirations are not removed
34
34
- fixed not delegate being used in msg open contract
35
35
- fixed the recipient’s IsTransferable field is overwritten to false in MsgClaimThorchain
36
+ - fixed genesis state validation
36
37
37
38
# v1.0.5-Prerelease
38
39
### Added
Original file line number Diff line number Diff line change 41
41
ErrInvariantMaxSupply = errors .Register (ModuleName , 32 , "max supply invariant" )
42
42
ErrInvalidAuthorization = errors .Register (ModuleName , 33 , "invalid authorization" )
43
43
ErrInvalidVersion = errors .Register (ModuleName , 34 , "version cannot be zero or lower" )
44
+ ErrInvalidBlocksPerYear = errors .Register (ModuleName , 37 , "blocks per year cannot be zero or lower" )
45
+ ErrInvalidEmissionCurve = errors .Register (ModuleName , 38 , "emissionCurve set is invalid" )
44
46
)
Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ func TestGenesisState_Validate(t *testing.T) {
20
20
valid : true ,
21
21
},
22
22
{
23
- desc : "valid genesis state" ,
23
+ desc : "valid genesis state" ,
24
24
genState : & types.GenesisState {
25
+ Params : types .DefaultParams (),
25
26
26
27
// this line is used by starport scaffolding # types/genesis/validField
27
28
},
Original file line number Diff line number Diff line change 1
1
package types
2
2
3
3
import (
4
+ "cosmossdk.io/errors"
4
5
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
5
6
"gopkg.in/yaml.v2"
6
7
)
@@ -32,6 +33,14 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
32
33
33
34
// Validate validates the set of params
34
35
func (p Params ) Validate () error {
36
+ if p .BlockPerYear <= 0 {
37
+ return errors .Wrap (ErrInvalidBlocksPerYear , "BlockPerYear must be greater than zero" )
38
+ }
39
+
40
+ if p .EmissionCurve <= 0 {
41
+ return errors .Wrap (ErrInvalidEmissionCurve , "EmissionCurve must be greater than " )
42
+ }
43
+
35
44
return nil
36
45
}
37
46
Original file line number Diff line number Diff line change @@ -66,6 +66,22 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
66
66
67
67
// Validate validates the set of params
68
68
func (p Params ) Validate () error {
69
+ if err := validateClaimDenom (p .ClaimDenom ); err != nil {
70
+ return err
71
+ }
72
+
73
+ if err := validateAirdropStartTime (p .AirdropStartTime ); err != nil {
74
+ return err
75
+ }
76
+
77
+ if err := validateDurationUntilDecay (p .DurationUntilDecay ); err != nil {
78
+ return err
79
+ }
80
+
81
+ if err := validateDurationOfDecay (p .DurationOfDecay ); err != nil {
82
+ return err
83
+ }
84
+
69
85
return nil
70
86
}
71
87
You can’t perform that action at this time.
0 commit comments