Skip to content

Commit

Permalink
CNS-931: small PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-lava committed May 2, 2024
1 parent 81bf3d5 commit 88b007b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
6 changes: 3 additions & 3 deletions x/dualstaking/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestReDelegateToProvider(t *testing.T) {

_, err = ts.TxDualstakingRedelegate(delegator.Addr.String(),
dualstakingtypes.EMPTY_PROVIDER,
acc.Addr.String(),
operator,
dualstakingtypes.EMPTY_PROVIDER_CHAINID,
entry.Chain,
sdk.NewCoin(ts.TokenDenom(), amount))
Expand All @@ -149,12 +149,12 @@ func TestReDelegateToProvider(t *testing.T) {

providersRes1, err = ts.QueryDualstakingDelegatorProviders(delegator.Addr.String(), true)
require.NoError(t, err)
require.Equal(t, acc.Addr.String(), providersRes1.Delegations[0].Provider)
require.Equal(t, operator, providersRes1.Delegations[0].Provider)

ts.AdvanceEpoch()

epoch = ts.EpochStart()
entry, found = ts.Keepers.Epochstorage.GetStakeEntryForProviderEpoch(ts.Ctx, ts.spec.Index, acc.Addr.String(), epoch)
entry, found = ts.Keepers.Epochstorage.GetStakeEntryForProviderEpoch(ts.Ctx, ts.spec.Index, operator, epoch)
require.True(t, found)
require.Equal(t, amount, entry.DelegateTotal.Amount)
require.Equal(t, amount, entry.Stake.Amount)
Expand Down
14 changes: 7 additions & 7 deletions x/pairing/keeper/msg_server_stake_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,13 +1051,13 @@ func TestVaultOperatorModifyStakeEntry(t *testing.T) {
require.True(t, found)

// consts for stake entry changes
var (
STAKE = 1
ENDPOINTS_GEOLOCATION = 2
MONIKER = 3
DELEGATE_LIMIT = 4
DELEGATE_COMMISSION = 5
OPERATOR = 6
const (
STAKE = iota + 1
ENDPOINTS_GEOLOCATION
MONIKER
DELEGATE_LIMIT
DELEGATE_COMMISSION
OPERATOR
)

tests := []struct {
Expand Down
11 changes: 3 additions & 8 deletions x/pairing/keeper/unstaking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,17 @@ func TestVaultOperatorUnstakeAndSlashProposal(t *testing.T) {
tests := []struct {
name string
creator string
valid bool
}{
{"vault unstakes", vault, true},
{"operator unstakes", operator, true},
{"vault unstakes", vault},
{"operator unstakes", operator},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := testutils.SimulateUnstakeProposal(ts.Ctx, ts.Keepers.Pairing, []types.ProviderUnstakeInfo{{
Provider: tt.creator, ChainId: ts.spec.Index,
}}, []types.DelegatorSlashing{{}})
if tt.valid {
require.NoError(t, err)
} else {
require.Error(t, err)
}
require.NoError(t, err)
})
}
}
1 change: 0 additions & 1 deletion x/rewards/keeper/grpc_query_iprpc_provider_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func (k Keeper) IprpcProviderRewardEstimation(goCtx context.Context, req *types.
providerIprpcCu := uint64(0)
totalIprpcCu := uint64(0)

// if input is operator, switch to vault
stakeEntry, found := k.epochstorage.GetStakeEntryByAddressCurrent(ctx, specFund.Spec, req.Provider)
if !found {
continue
Expand Down

0 comments on commit 88b007b

Please sign in to comment.