-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Sprint of improvements for stkxprt / liquidstake (#700)
* fix: linting * feat: unit test coverage for x/liquidstake * chore: re-gen proto * feat: added missing autocompouding fee params and fee account * fix: addressed PR issues, lint issues, fee issue Changed LP contract API integration * fix: go versions and go linter in CI --------- Co-authored-by: Puneet <[email protected]>
- Loading branch information
1 parent
198a701
commit ceddb78
Showing
38 changed files
with
3,255 additions
and
193 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ linters: | |
- gosimple | ||
- govet | ||
- ineffassign | ||
- interfacer | ||
- maligned | ||
- misspell | ||
- nakedret | ||
|
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,68 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"cosmossdk.io/math" | ||
_ "github.com/stretchr/testify/suite" | ||
|
||
"github.com/persistenceOne/pstake-native/v2/x/liquidstake/types" | ||
) | ||
|
||
func (s *KeeperTestSuite) TestInitGenesis() { | ||
genState := *types.DefaultGenesisState() | ||
s.keeper.InitGenesis(s.ctx, genState) | ||
got := s.keeper.ExportGenesis(s.ctx) | ||
s.Require().Equal(genState, *got) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestImportExportGenesis() { | ||
k, ctx := s.keeper, s.ctx | ||
_, valOpers, _ := s.CreateValidators([]int64{1000000, 1000000, 1000000}) | ||
params := k.GetParams(ctx) | ||
|
||
params.WhitelistedValidators = []types.WhitelistedValidator{ | ||
{ValidatorAddress: valOpers[0].String(), TargetWeight: math.NewInt(10)}, | ||
{ValidatorAddress: valOpers[1].String(), TargetWeight: math.NewInt(10)}, | ||
} | ||
k.SetParams(ctx, params) | ||
k.UpdateLiquidValidatorSet(ctx) | ||
|
||
stakingAmt := math.NewInt(100000000) | ||
s.Require().NoError(s.liquidStaking(s.delAddrs[0], stakingAmt)) | ||
lvs := k.GetAllLiquidValidators(ctx) | ||
s.Require().Len(lvs, 2) | ||
|
||
lvStates := k.GetAllLiquidValidatorStates(ctx) | ||
genState := k.ExportGenesis(ctx) | ||
|
||
bz := s.app.AppCodec().MustMarshalJSON(genState) | ||
|
||
var genState2 types.GenesisState | ||
s.app.AppCodec().MustUnmarshalJSON(bz, &genState2) | ||
k.InitGenesis(ctx, genState2) | ||
genState3 := k.ExportGenesis(ctx) | ||
|
||
s.Require().Equal(*genState, genState2) | ||
s.Require().Equal(genState2, *genState3) | ||
|
||
lvs = k.GetAllLiquidValidators(ctx) | ||
s.Require().Len(lvs, 2) | ||
|
||
lvStates3 := k.GetAllLiquidValidatorStates(ctx) | ||
s.Require().EqualValues(lvStates, lvStates3) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestImportExportGenesisEmpty() { | ||
k, ctx := s.keeper, s.ctx | ||
k.SetParams(ctx, types.DefaultParams()) | ||
k.UpdateLiquidValidatorSet(ctx) | ||
genState := k.ExportGenesis(ctx) | ||
|
||
var genState2 types.GenesisState | ||
bz := s.app.AppCodec().MustMarshalJSON(genState) | ||
s.app.AppCodec().MustUnmarshalJSON(bz, &genState2) | ||
k.InitGenesis(ctx, genState2) | ||
|
||
genState3 := k.ExportGenesis(ctx) | ||
s.Require().Equal(*genState, genState2) | ||
s.Require().Equal(genState2, *genState3) | ||
} |
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.