-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: interchain accounts via interchaintest #3308
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e7a9fd1
test: interchain accounts via interchaintest
rootulp 1591170
fix: use rootulp/interchaintest
rootulp a165c5c
fix: organize replace statements
rootulp aeafecd
chore: remove make test-ic
rootulp 1761875
chore: remove GH_COMMIT
rootulp 18746eb
refactor: rename test
rootulp 9717fff
Merge branch 'main' into rp/ica-tests-squashed
rootulp 009cfc0
chore: assert relayer channels
rootulp 08ca4d2
docs: remove RIM
rootulp fb3ca28
fix: remove print statements
rootulp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ go 1.22.2 | |
use ( | ||
. | ||
./test/testground | ||
./test/interchain | ||
) |
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,50 @@ | ||
# Interchain | ||
|
||
This folder contains tests that use [interchaintest](https://github.com/strangelove-ventures/interchaintest) to assert IBC features work as expected. Candidates for testing include: | ||
|
||
1. Interchain Accounts (ICA) | ||
1. Packet Forward Middleware (PFM) | ||
|
||
## Usage | ||
|
||
Run the tests via | ||
|
||
```bash | ||
make test-interchain | ||
``` | ||
|
||
## Contributing | ||
|
||
If you have local modifications that you would like to test via interchaintest, you'll need to create a new Celestia Docker image with your modifications. CI should automatically create a Docker image and publish it to GHCR if you create a PR against celestia-app. If that doesn't work, you can manually create an image via: | ||
|
||
```shell | ||
# make local modifications and commit them | ||
make build-ghcr-docker | ||
make publish-ghcr-docker | ||
``` | ||
|
||
After you have a new Docker image with your modifications, you must update the test to reference the new image (see `chainspec/celestia.go`). | ||
|
||
## Troubleshooting | ||
|
||
`interchaintest` issues can be difficult to debug. Here are a few tips that may help: | ||
|
||
1. You can stop `interchaintest` from cleaning up the Docker containers it created by setting an environment variable: | ||
|
||
```shell | ||
export KEEP_CONTAINERS=true | ||
``` | ||
|
||
See [this PR](https://github.com/strangelove-ventures/interchaintest/pull/725). It wasn't backported to the `v6` branch so if you want to use it, cherry-pick the commit locally and apply it to your local `interchaintest` fork and use Go mod replace to point interchaintest to your local fork. After you have that change, you can run commands on the docker containers to debug them. For example: | ||
|
||
```shell | ||
docker exec -it gaia-val-0-TestICA gaiad tx interchain-accounts controller register connection-0 \ | ||
--chain-id gaia \ | ||
--node http://gaia-val-0-TestICA:26657 \ | ||
--home /var/cosmos-chain/gaia-2 \ | ||
--from TestICA-gaia-pez \ | ||
--keyring-backend test \ | ||
--fees 300000uatom \ | ||
--gas 300000 \ | ||
--yes | ||
``` |
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,72 @@ | ||
package chainspec | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/strangelove-ventures/interchaintest/v6" | ||
"github.com/strangelove-ventures/interchaintest/v6/chain/cosmos" | ||
"github.com/strangelove-ventures/interchaintest/v6/ibc" | ||
"github.com/strangelove-ventures/interchaintest/v6/testutil" | ||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap/zaptest" | ||
) | ||
|
||
const ( | ||
celestiaDockerRepository = "ghcr.io/celestiaorg/celestia-app" | ||
celestiaDockerTag = "pr-3182" | ||
celestiaUidGid = "10001:10001" | ||
) | ||
|
||
// GetCelestia returns a CosmosChain for Celestia. | ||
func GetCelestia(t *testing.T) *cosmos.CosmosChain { | ||
factory := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{celestia}) | ||
chains, err := factory.Chains(t.Name()) | ||
require.NoError(t, err) | ||
return chains[0].(*cosmos.CosmosChain) | ||
} | ||
|
||
var celestia = &interchaintest.ChainSpec{ | ||
Name: "celestia", | ||
ChainConfig: ibc.ChainConfig{ | ||
Type: "cosmos", | ||
Name: "celestia-app", | ||
ChainID: "celestia", | ||
Bin: "celestia-appd", | ||
Bech32Prefix: "celestia", | ||
Denom: "utia", | ||
GasPrices: "0.002utia", | ||
GasAdjustment: *gasAdjustment(), | ||
TrustingPeriod: "336hours", | ||
Images: celestiaDockerImages(), | ||
ConfigFileOverrides: celestiaConfigFileOverrides(), | ||
}, | ||
NumValidators: numValidators(), | ||
NumFullNodes: numFullNodes(), | ||
GasAdjustment: gasAdjustment(), | ||
} | ||
|
||
func celestiaDockerImages() []ibc.DockerImage { | ||
return []ibc.DockerImage{ | ||
{ | ||
Repository: celestiaDockerRepository, | ||
Version: celestiaDockerTag, | ||
UidGid: celestiaUidGid, | ||
}, | ||
} | ||
} | ||
|
||
func celestiaConfigFileOverrides() map[string]any { | ||
txIndex := make(testutil.Toml) | ||
txIndex["indexer"] = "kv" | ||
|
||
storage := make(testutil.Toml) | ||
storage["discard_abci_responses"] = false | ||
|
||
configToml := make(testutil.Toml) | ||
configToml["tx_index"] = txIndex | ||
configToml["storage"] = storage | ||
|
||
result := make(map[string]any) | ||
result["config/config.toml"] = configToml | ||
return result | ||
} |
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,16 @@ | ||
package chainspec | ||
|
||
func numValidators() *int { | ||
nodes := 1 | ||
return &nodes | ||
} | ||
|
||
func numFullNodes() *int { | ||
nodes := 0 | ||
return &nodes | ||
} | ||
|
||
func gasAdjustment() *float64 { | ||
gasAdjustment := 2.0 | ||
return &gasAdjustment | ||
} |
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,60 @@ | ||
package chainspec | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/strangelove-ventures/interchaintest/v6" | ||
"github.com/strangelove-ventures/interchaintest/v6/chain/cosmos" | ||
"github.com/strangelove-ventures/interchaintest/v6/ibc" | ||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap/zaptest" | ||
) | ||
|
||
const ( | ||
// TODO: As of this writing, gaia has no official releases with the ICA | ||
// controller enabled. However, they do have it enabled on `main` so the | ||
// Docker image below is a custom build from `main`. Replace this with an | ||
// official release when available (likely >= 16.0.0). | ||
cosmosDockerRepository = "docker.io/rootulp/gaia" | ||
cosmosDockerVersion = "ica-controller" | ||
cosmosUidGid = "1025:1025" | ||
) | ||
|
||
// GetCosmosHub returns a CosmosChain for the CosmosHub. | ||
func GetCosmosHub(t *testing.T) *cosmos.CosmosChain { | ||
factory := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{cosmosHub}) | ||
chains, err := factory.Chains(t.Name()) | ||
require.NoError(t, err) | ||
return chains[0].(*cosmos.CosmosChain) | ||
} | ||
|
||
var cosmosHub = &interchaintest.ChainSpec{ | ||
Name: "gaia", | ||
ChainConfig: ibc.ChainConfig{ | ||
Name: "gaia", | ||
Type: "cosmos", | ||
ChainID: "gaia", | ||
Bin: "gaiad", | ||
Bech32Prefix: "cosmos", | ||
Denom: "uatom", | ||
GasPrices: "0.01uatom", | ||
GasAdjustment: *gasAdjustment(), | ||
TrustingPeriod: "504hours", | ||
NoHostMount: false, | ||
Images: cosmosDockerImages(), | ||
UsingNewGenesisCommand: true, | ||
}, | ||
NumValidators: numValidators(), | ||
NumFullNodes: numFullNodes(), | ||
rootulp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
GasAdjustment: gasAdjustment(), // the default gas estimation fails to create a client on Cosmos Hub so we need to bump it up. | ||
} | ||
|
||
func cosmosDockerImages() []ibc.DockerImage { | ||
return []ibc.DockerImage{ | ||
{ | ||
Repository: cosmosDockerRepository, | ||
Version: cosmosDockerVersion, | ||
UidGid: cosmosUidGid, | ||
}, | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add this to the CI then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to add it to CI now because this test currently uses a static docker image https://github.com/rootulp/celestia-app/blob/08ca4d2fe7971d69b71a39a1e2c91dbdb50e72ce/test/interchain/chainspec/celestia.go#L16
so even if a PR breaks ICA, we wouldn't get signal by running it in CI unless we update that static docker image to use a Docker image that is created on a per PR basis. Will create a follow up issue to add it to CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #3358