-
Notifications
You must be signed in to change notification settings - Fork 134
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: fix e2e compatiblity tests #2055
Conversation
@@ -359,20 +359,6 @@ func CompatibilityTestConfig(providerVersion, consumerVersion string) TestConfig | |||
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + | |||
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", | |||
} | |||
} else if semver.Compare(consumerVersion, "v5.0.0-alpha1") < 0 { // TODO: change this to first published v5 release - once it's out |
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.
not needed anymore as default config matches the one use by v5.x
WalkthroughWalkthroughThe recent changes in Changes
Sequence Diagram(s)The changes are primarily updates to configuration logic and do not include new features or significant modifications to control flow, so a sequence diagram is not necessary. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
} else if semver.Compare(semver.MajorMinor(providerVersion), "v5.0.0") < 0 { | ||
fmt.Println("Using provider chain config for v4.x.x") | ||
providerConfig = ChainConfig{ | ||
ChainId: ChainID("provi"), | ||
AccountPrefix: ProviderAccountPrefix, | ||
BinaryName: "interchain-security-pd", | ||
IpPrefix: "7.7.7", | ||
VotingWaitTime: 20, | ||
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + | ||
// Custom slashing parameters for testing validator downtime functionality | ||
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking | ||
".app_state.slashing.params.signed_blocks_window = \"10\" | " + | ||
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + | ||
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + | ||
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + | ||
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling | ||
".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + | ||
".app_state.provider.params.blocks_per_epoch = 3", | ||
} |
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.
Refactor suggestion for version handling in configuration setup
The block handling provider chain configuration for versions below "v5.0.0" has been added. This block sets various parameters such as voting period, slashing parameters, and provider params. The logic appears correct, but it can be optimized by reducing redundancy and improving readability.
- if !semver.IsValid(providerVersion) {
- fmt.Printf("Invalid sem-version '%s' for provider. Using default provider chain config\n", providerVersion)
- providerConfig = testCfg.chainConfigs[ChainID("provi")]
- } else if semver.Compare(providerVersion, "v3.0.0") < 0 {
- fmt.Println("Using provider chain config for v2.x.x")
- providerConfig = ChainConfig{
- // configuration details...
- }
- } else if semver.Compare(providerVersion, "v4.0.0") <= 0 {
- fmt.Println("Using provider chain config for v3.x.x")
- providerConfig = ChainConfig{
- // configuration details...
- }
- } else if semver.Compare(semver.MajorMinor(providerVersion), "v4.3.0") >= 0 && strings.HasSuffix(providerVersion, "-lsm") {
- // configuration details...
- } else if semver.Compare(semver.MajorMinor(providerVersion), "v5.0.0") < 0 {
- fmt.Println("Using provider chain config for v4.x.x")
- providerConfig = ChainConfig{
- // configuration details...
- }
- } else {
- fmt.Println("Using default provider chain config")
- providerConfig = testCfg.chainConfigs[ChainID("provi")]
- }
+ // Simplified version handling
+ switch {
+ case !semver.IsValid(providerVersion):
+ fmt.Printf("Invalid sem-version '%s' for provider. Using default provider chain config\n", providerVersion)
+ case semver.Compare(providerVersion, "v5.0.0") < 0:
+ fmt.Printf("Using provider chain config for version %s\n", providerVersion)
+ providerConfig = getProviderConfigByVersion(providerVersion)
+ default:
+ fmt.Println("Using default provider chain config")
+ providerConfig = testCfg.chainConfigs[ChainID("provi")]
+ }
This refactoring introduces a function getProviderConfigByVersion
that encapsulates the version-specific logic, making the main function cleaner and easier to maintain.
Committable suggestion was skipped due to low confidence.
fix e2e compatiblity tests (cherry picked from commit 31b5d99)
test: fix e2e compatiblity tests (#2055) fix e2e compatiblity tests (cherry picked from commit 31b5d99) Co-authored-by: bernd-m <[email protected]>
Description
Closes: #XXXX
Fix e2e compatibility tests for version v4.4.x
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Summary by CodeRabbit