-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove param store, convert params to using module's store * rename default value variable, add params tests * add migration method, add remove todos * update comment for marker key, add migration log tests * add method calls to upgrades * change key name for each module
- Loading branch information
1 parent
0a8592c
commit 5aaecbd
Showing
17 changed files
with
145 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/provenance-io/provenance/app" | ||
simapp "github.com/provenance-io/provenance/app" | ||
"github.com/provenance-io/provenance/x/name/types" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type NameParamTestSuite struct { | ||
suite.Suite | ||
|
||
app *app.App | ||
ctx sdk.Context | ||
} | ||
|
||
func (s *NameParamTestSuite) SetupTest() { | ||
s.app = simapp.Setup(s.T()) | ||
s.ctx = s.app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: time.Now()}) | ||
} | ||
|
||
func TestNameParamTestSuite(t *testing.T) { | ||
suite.Run(t, new(NameParamTestSuite)) | ||
} | ||
|
||
func (s *NameParamTestSuite) TestGetSetParams() { | ||
defaultParams := s.app.NameKeeper.GetParams(s.ctx) | ||
s.Require().Equal(types.DefaultMaxNameLevels, defaultParams.MaxNameLevels, "Default MaxNameLevels should match") | ||
s.Require().Equal(types.DefaultMaxSegmentLength, defaultParams.MaxSegmentLength, "Default MaxSegmentLength should match") | ||
s.Require().Equal(types.DefaultMinSegmentLength, defaultParams.MinSegmentLength, "Default MinSegmentLength should match") | ||
s.Require().Equal(types.DefaultAllowUnrestrictedNames, defaultParams.AllowUnrestrictedNames, "Default AllowUnrestrictedNames should match") | ||
|
||
newMaxNameLevels := uint32(10) | ||
newMaxSegmentLength := uint32(15) | ||
newMinSegmentLength := uint32(2) | ||
newAllowUnrestrictedNames := false | ||
|
||
newParams := types.Params{ | ||
MaxNameLevels: newMaxNameLevels, | ||
MaxSegmentLength: newMaxSegmentLength, | ||
MinSegmentLength: newMinSegmentLength, | ||
AllowUnrestrictedNames: newAllowUnrestrictedNames, | ||
} | ||
|
||
s.app.NameKeeper.SetParams(s.ctx, newParams) | ||
|
||
updatedParams := s.app.NameKeeper.GetParams(s.ctx) | ||
s.Require().Equal(newMaxNameLevels, updatedParams.MaxNameLevels, "Updated MaxNameLevels should match") | ||
s.Require().Equal(newMaxSegmentLength, updatedParams.MaxSegmentLength, "Updated MaxSegmentLength should match") | ||
s.Require().Equal(newMinSegmentLength, updatedParams.MinSegmentLength, "Updated MinSegmentLength should match") | ||
s.Require().Equal(newAllowUnrestrictedNames, updatedParams.AllowUnrestrictedNames, "Updated AllowUnrestrictedNames should match") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.