Skip to content

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
stackman27 committed Jan 14, 2023
1 parent 02ed580 commit c5a1fdc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
3 changes: 2 additions & 1 deletion x/valset-pref/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions x/valset-pref/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
12 changes: 4 additions & 8 deletions x/valset-pref/msg_server_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion x/valset-pref/types/expected_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions x/valset-pref/validator_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down

0 comments on commit c5a1fdc

Please sign in to comment.