Skip to content

Commit

Permalink
feat(v7): override sdk v47 version check with env variable (#1227)
Browse files Browse the repository at this point in the history
* feat: add env variable to force SDK version

* Make better
  • Loading branch information
joelsmith-2019 authored Aug 21, 2024
1 parent 244599f commit c51068e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
15 changes: 15 additions & 0 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,21 @@ func (tn *ChainNode) RecoverKey(ctx context.Context, keyName, mnemonic string) e
}

func (tn *ChainNode) IsAboveSDK47(ctx context.Context) bool {
// Check container environment variables for the SDK version.
if tn.Chain.Config().Env != nil {
for _, str := range tn.Chain.Config().Env {
if strings.Contains(str, "ICT_ABOVE_SDK_47") {
return strings.Contains(str, "true")
}
}
}

// Check OS environment variables for the SDK version.
env := os.Getenv("ICT_ABOVE_SDK_47")
if env != "" {
return env == "true"
}

// In SDK v47, a new genesis core command was added. This spec has many state breaking features
// so we use this to switch between new and legacy SDK logic.
// https://github.com/cosmos/cosmos-sdk/pull/14149
Expand Down
7 changes: 6 additions & 1 deletion docs/envOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@

- `CONTAINER_LOG_TAIL`: Specifies the number of lines to display from container logs. Defaults to 50 lines.

- `ICS_SPAWN_TIME_WAIT`: A go duration (e.g. 2m) that specifies how long to wait for ICS chains to spawn
- `ICS_SPAWN_TIME_WAIT`: A go duration (e.g. 2m) that specifies how long to wait for ICS chains to spawn

- `ICT_ABOVE_SDK_47`: (Set via `os.Setenv` or within the IBC Chain Config)

- Set to `"true"` to run tests that require SDK version 0.47.0 or higher.
- Set to `"false"` to run tests that require SDK version 0.46.0 or lower.

0 comments on commit c51068e

Please sign in to comment.