diff --git a/x/valset-pref/export_test.go b/x/valset-pref/export_test.go index cd1abdd2ec2..493449c7d40 100644 --- a/x/valset-pref/export_test.go +++ b/x/valset-pref/export_test.go @@ -2,7 +2,8 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - lockuptypes "github.com/osmosis-labs/osmosis/v13/x/lockup/types" + + lockuptypes "github.com/osmosis-labs/osmosis/v14/x/lockup/types" ) func (k Keeper) ValidateLockForForceUnlock(ctx sdk.Context, lockID uint64, delegatorAddr string) (*lockuptypes.PeriodLock, sdk.Int, error) { diff --git a/x/valset-pref/msg_server.go b/x/valset-pref/msg_server.go index f0929ba01d4..d6a08a07367 100644 --- a/x/valset-pref/msg_server.go +++ b/x/valset-pref/msg_server.go @@ -108,8 +108,8 @@ func (server msgServer) DelegateBondedTokens(goCtx context.Context, msg *types.M ctx := sdk.UnwrapSDKContext(goCtx) // get the existing validator set preference from store - _, found := server.keeper.GetValidatorSetPreference(ctx, msg.Delegator) - if !found { + _, err := server.keeper.GetDelegationPreferences(ctx, msg.Delegator) + if err != nil { return nil, fmt.Errorf("user %s doesn't have validator set", msg.Delegator) } diff --git a/x/valset-pref/msg_server_test.go b/x/valset-pref/msg_server_test.go index abc944d43f5..f19c602c6df 100644 --- a/x/valset-pref/msg_server_test.go +++ b/x/valset-pref/msg_server_test.go @@ -1,8 +1,6 @@ package keeper_test import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" appParams "github.com/osmosis-labs/osmosis/v14/app/params" @@ -740,13 +738,14 @@ func (suite *KeeperTestSuite) TestDelegateBondedTokens() { suite.Require().NoError(err) } - balance := suite.App.BankKeeper.GetBalance(suite.Ctx, test.delegator, appParams.BaseCoinUnit) - fmt.Println(balance) - _, err := msgServer.DelegateBondedTokens(c, types.NewMsgDelegateBondedTokens(test.delegator, test.lockId)) if test.expectPass { suite.Require().NoError(err) + // check that the lock has been successfully unlocked + balance := suite.App.BankKeeper.GetBalance(suite.Ctx, test.delegator, appParams.BaseCoinUnit) + suite.Require().Equal(balance, test.expectedUnlockedOsmo) + // check if delegation has been done by checking if expectedDelegations matches after delegation for i, val := range preferences { valAddr, err := sdk.ValAddressFromBech32(val.ValOperAddress) @@ -758,9 +757,6 @@ func (suite *KeeperTestSuite) TestDelegateBondedTokens() { } } else { suite.Require().Error(err) - - balance := suite.App.BankKeeper.GetBalance(suite.Ctx, test.delegator, appParams.BaseCoinUnit) - suite.Require().Equal(balance, sdk.NewInt(50_000_000)) // balance delegator has after creating all the locks } }) } diff --git a/x/valset-pref/types/expected_interfaces.go b/x/valset-pref/types/expected_interfaces.go index 9df700b0896..a5523e4a796 100644 --- a/x/valset-pref/types/expected_interfaces.go +++ b/x/valset-pref/types/expected_interfaces.go @@ -5,7 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - lockuptypes "github.com/osmosis-labs/osmosis/v13/x/lockup/types" + + lockuptypes "github.com/osmosis-labs/osmosis/v14/x/lockup/types" ) // StakingInterface expected staking keeper. diff --git a/x/valset-pref/validator_set.go b/x/valset-pref/validator_set.go index 47acd04c1df..f7fe68c95dd 100644 --- a/x/valset-pref/validator_set.go +++ b/x/valset-pref/validator_set.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - appParams "github.com/osmosis-labs/osmosis/v14/app/params" - "github.com/osmosis-labs/osmosis/osmomath" + appParams "github.com/osmosis-labs/osmosis/v14/app/params" + lockuptypes "github.com/osmosis-labs/osmosis/v14/x/lockup/types" "github.com/osmosis-labs/osmosis/v14/x/valset-pref/types" )