forked from cosmos/ibc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchain_test.go
43 lines (31 loc) · 1.35 KB
/
chain_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ibctesting_test
import (
"testing"
"github.com/stretchr/testify/require"
sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/x/staking/types"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
)
func TestChangeValSet(t *testing.T) {
coord := ibctesting.NewCoordinator(t, 2)
chainA := coord.GetChain(ibctesting.GetChainID(1))
chainB := coord.GetChain(ibctesting.GetChainID(2))
path := ibctesting.NewPath(chainA, chainB)
path.Setup()
amount, ok := sdkmath.NewIntFromString("10000000000000000000")
require.True(t, ok)
amount2, ok := sdkmath.NewIntFromString("30000000000000000000")
require.True(t, ok)
val, err := chainA.GetSimApp().StakingKeeper.GetValidators(chainA.GetContext(), 4)
require.NoError(t, err)
chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(), //nolint:errcheck // ignore error for test
amount, types.Unbonded, val[1], true)
chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[3].SenderAccount.GetAddress(), //nolint:errcheck // ignore error for test
amount2, types.Unbonded, val[3], true)
coord.CommitBlock(chainA)
// verify that update clients works even after validator update goes into effect
err = path.EndpointB.UpdateClient()
require.NoError(t, err)
err = path.EndpointB.UpdateClient()
require.NoError(t, err)
}