Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add env variable to force SDK version
Browse files Browse the repository at this point in the history
joelsmith-2019 committed Aug 21, 2024
1 parent 244599f commit 0de0a6a
Showing 2 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
@@ -722,6 +722,29 @@ 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") {
if strings.Contains(str, "true") {
return true
} else {
return false
}
}
}
}

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

// 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
7 changes: 6 additions & 1 deletion docs/envOptions.md
Original file line number Diff line number Diff line change
@@ -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 0de0a6a

Please sign in to comment.