Skip to content
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

fix(local-ic): multiple ics, faster relayer #1235

Merged
merged 14 commits into from
Oct 30, 2024
Merged
Prev Previous commit
Next Next commit
move ICTEST_RELAYER_LOOP_DURATION into cfg.Env
Reecepbcups committed Oct 3, 2024
commit 1b91063c4b0f5d82fc8aebb28385e16ae6f956de
2 changes: 0 additions & 2 deletions docs/envOptions.md
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@

- `ICTEST_HOME`: The folder to use as the home / working directory.

- `ICTEST_RELAYER_LOOP_DURATION`: Override the default 50ms relayer loop check duration. Input is in time format (20ms, 1s, etc.). Extremely fast chains may require as low as 5-10ms.

- `ICTEST_SKIP_FAILURE_CLEANUP`: skip cleanup of the temporary directory on a test failure.

- `KEEP_CONTAINERS`: Prevents testnet cleanup after completion.
20 changes: 18 additions & 2 deletions relayer/rly/cosmos_relayer.go
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import (

"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"go.uber.org/zap"
@@ -83,6 +82,23 @@ func ChainConfigToCosmosRelayerChainConfig(chainConfig ibc.ChainConfig, keyName,
if chainType == "polkadot" || chainType == "parachain" || chainType == "relaychain" {
chainType = "substrate"
}

var err error
var loopDuration = time.Millisecond * 50
for _, env := range chainConfig.Env {
if strings.Contains(env, "ICTEST_RELAYER_LOOP_DURATION") {
e := strings.Split(env, "=")
if len(e) != 2 {
panic(fmt.Sprintf("BUG: failed to parse %s", env))
}

loopDuration, err = time.ParseDuration(e[1])
if err != nil {
panic(fmt.Sprintf("BUG: failed to parse %s: %s", e[1], err))
}
}
}

return CosmosRelayerChainConfig{
Type: chainType,
Value: CosmosRelayerChainConfigValue{
@@ -98,7 +114,7 @@ func ChainConfigToCosmosRelayerChainConfig(chainConfig ibc.ChainConfig, keyName,
Timeout: "10s",
OutputFormat: "json",
SignMode: "direct",
MinLoopDuration: dockerutil.GetTimeFromEnv("ICTEST_RELAYER_LOOP_DURATION", time.Millisecond*50),
MinLoopDuration: loopDuration,
},
}
}