forked from ComposableFi/picasso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,285 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package ibctesting_test | ||
|
||
import ( | ||
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" | ||
"github.com/notional-labs/composable/v6/app/ibctesting" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
sdkmath "cosmossdk.io/math" | ||
|
||
"github.com/cosmos/cosmos-sdk/x/staking/types" | ||
) | ||
|
||
func NewTransferPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { | ||
path := ibctesting.NewPath(chainA, chainB) | ||
path.EndpointA.ChannelConfig.PortID = ibctesting.TransferPort | ||
path.EndpointB.ChannelConfig.PortID = ibctesting.TransferPort | ||
path.EndpointA.ChannelConfig.Version = transfertypes.Version | ||
path.EndpointB.ChannelConfig.Version = transfertypes.Version | ||
|
||
return path | ||
} | ||
|
||
func TestChangeValSet(t *testing.T) { | ||
coord := ibctesting.NewCoordinator(t, 2) | ||
chainA := coord.GetChain(ibctesting.GetChainID(1)) | ||
chainB := coord.GetChain(ibctesting.GetChainID(2)) | ||
|
||
path := NewTransferPath(chainA, chainB) | ||
coord.Setup(path) | ||
|
||
amount, ok := sdkmath.NewIntFromString("10000000000000000000") | ||
require.True(t, ok) | ||
amount2, ok := sdkmath.NewIntFromString("30000000000000000000") | ||
require.True(t, ok) | ||
|
||
val, err := chainA.App.GetStakingKeeper().GetValidators(chainA.GetContext(), 4) | ||
require.NoError(t, err) | ||
|
||
chainA.App.GetStakingKeeper().Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(), //nolint:errcheck // ignore error for test | ||
amount, types.Unbonded, val[1], true) | ||
chainA.App.GetStakingKeeper().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) | ||
} |
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.