-
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.
Attribute param store addition (#1927)
* switch to using module store instead of param space * add param tests * Add migration handler for attribute values * add upgrades test, add remove todos, fix param space * fix logging test, fix lint issue with delegation logging * remove param space, fix param query, add changelog, fix migration method
- Loading branch information
1 parent
14908f1
commit 94add0f
Showing
10 changed files
with
117 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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/attribute/types" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type ParamTestSuite struct { | ||
suite.Suite | ||
|
||
app *app.App | ||
ctx sdk.Context | ||
|
||
startBlockTime time.Time | ||
} | ||
|
||
func (s *ParamTestSuite) SetupTest() { | ||
s.app = simapp.Setup(s.T()) | ||
s.startBlockTime = time.Now() | ||
s.ctx = s.app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: s.startBlockTime}) | ||
} | ||
|
||
func TestParamTestSuite(t *testing.T) { | ||
suite.Run(t, new(ParamTestSuite)) | ||
} | ||
|
||
func (s *ParamTestSuite) TestGetSetParams() { | ||
defaultParams := s.app.AttributeKeeper.GetParams(s.ctx) | ||
s.Require().Equal(int(types.DefaultMaxValueLength), int(defaultParams.MaxValueLength), "GetParams() Default max value length should match") | ||
|
||
defaultValueLength := s.app.AttributeKeeper.GetMaxValueLength(s.ctx) | ||
s.Require().Equal(int(types.DefaultMaxValueLength), int(defaultValueLength), "GetMaxValueLength() Default max value length should match") | ||
|
||
newMaxValueLength := uint32(2048) | ||
newParams := types.Params{ | ||
MaxValueLength: newMaxValueLength, | ||
} | ||
s.app.AttributeKeeper.SetParams(s.ctx, newParams) | ||
|
||
updatedParams := s.app.AttributeKeeper.GetParams(s.ctx) | ||
s.Require().Equal(int(newMaxValueLength), int(updatedParams.MaxValueLength), "GetParams() Updated max value length should match") | ||
|
||
updatedValueLength := s.app.AttributeKeeper.GetMaxValueLength(s.ctx) | ||
s.Require().Equal(int(newMaxValueLength), int(updatedValueLength), "GetMaxValueLength() Updated max value length 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