-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add v6.0.0 upgrade handler #1620
Conversation
Important Review skippedReview was skipped as selected files did not have any reviewable changes. Files selected but had no reviewable changes (1)
You can disable this status message by setting the WalkthroughThe upgrade involves transitioning the protocol's app package from version 5.0.0 to 6.0.0. It updates import paths, constants, and dependencies, and introduces new test functions and configurations to support the upgrade. Additionally, it modifies the Changes
Poem
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 Configration 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- protocol/app/upgrades.go (2 hunks)
- protocol/app/upgrades/v6.0.0/constants.go (1 hunks)
- protocol/app/upgrades/v6.0.0/upgrade.go (1 hunks)
Files skipped from review due to trivial changes (1)
- protocol/app/upgrades/v6.0.0/constants.go
Additional comments not posted (3)
protocol/app/upgrades/v6.0.0/upgrade.go (1)
12-20
: The implementation ofCreateUpgradeHandler
looks correct and aligns with the intended upgrade process.protocol/app/upgrades.go (2)
17-17
: The addition ofv6_0_0.Upgrade
to theUpgrades
slice is correctly implemented.
25-30
: The setup of the upgrade handler for v6.0.0 is correctly implemented. Ensure that the duplicate handler check is robust.Verification successful
The search across the entire codebase confirms that there is only one instance of
app.UpgradeKeeper.SetUpgradeHandler
, ensuring that the duplicate handler check is robust and functioning as intended.
- : The setup of the upgrade handler for v6.0.0 is correctly implemented, and the duplicate handler check is robust. No multiple registrations of the same upgrade handler were found.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the duplicate handler check is functioning as intended. # Test: Search for multiple registrations of the same upgrade handler. Expect: No multiple registrations. rg --type go $'app.UpgradeKeeper.SetUpgradeHandler' protocol/app/upgrades.goLength of output: 113
Script:
#!/bin/bash # Description: Verify that the duplicate handler check is functioning as intended across the entire codebase. # Test: Search for multiple registrations of the same upgrade handler. Expect: No multiple registrations. rg --type go 'app.UpgradeKeeper.SetUpgradeHandler' -g '*.go'Length of output: 123
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/testing/containertest/testnet.go (1 hunks)
Additional comments not posted (1)
protocol/testing/containertest/testnet.go (1)
28-28
: Update toUpgradeToVersion
constant is correct as per upgrade requirements.#!/bin/bash # Description: Verify that the `UpgradeToVersion` constant is correctly used throughout the codebase. # Test: Search for the constant usage. Expect: Only occurances of the new version. rg --type go $'UpgradeToVersion'
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: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/app/upgrades/v6.0.0/upgrade_container_test.go (1 hunks)
Additional comments not posted (1)
protocol/app/upgrades/v6.0.0/upgrade_container_test.go (1)
52-187
: The implementation ofplaceOrders
looks robust and well-handled.Good use of constants and error handling ensures that the function is both readable and reliable.
func TestStateUpgrade(t *testing.T) { | ||
testnet, err := containertest.NewTestnetWithPreupgradeGenesis() | ||
require.NoError(t, err, "failed to create testnet - is docker daemon running?") | ||
err = testnet.Start() | ||
require.NoError(t, err) | ||
defer testnet.MustCleanUp() | ||
node := testnet.Nodes["alice"] | ||
nodeAddress := constants.AliceAccAddress.String() | ||
|
||
preUpgradeSetups(node, t) | ||
preUpgradeChecks(node, t) | ||
|
||
err = containertest.UpgradeTestnet(nodeAddress, t, node, v_6_0_0.UpgradeName) | ||
require.NoError(t, err) | ||
|
||
postUpgradeChecks(node, t) | ||
} |
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.
Consider adding more detailed checks in preUpgradeChecks
and postUpgradeChecks
.
It's crucial to ensure that the upgrade does not introduce or miss any critical changes. Detailed checks will help verify the integrity and success of the upgrade process.
func postUpgradeChecks(node *containertest.Node, t *testing.T) { | ||
// Add test for your upgrade handler logic below | ||
} |
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.
Implement necessary checks in postUpgradeChecks
.
Post-upgrade checks are essential to verify that the upgrade has been applied correctly and that the system behaves as expected. I can help with defining these checks if needed.
func preUpgradeSetups(node *containertest.Node, t *testing.T) { | ||
placeOrders(node, t) | ||
} |
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.
Consider expanding the setup procedures in preUpgradeSetups
.
Depending on the scope of the upgrade, you might need to prepare more aspects of the system to ensure a comprehensive test environment.
func preUpgradeChecks(node *containertest.Node, t *testing.T) { | ||
// Add test for your upgrade handler logic below | ||
} |
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.
Implement necessary checks in preUpgradeChecks
.
This function is crucial for ensuring the system's state before the upgrade. If you need help with what checks to implement, I can assist with suggestions or examples.
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: 0
Outside diff range and nitpick comments (2)
protocol/testing/containertest/containertest.sh (2)
Line range hint
110-110
: Ensure variables are properly quoted to prevent globbing and word splitting.- dydxprotocold add-genesis-account "$acct" 100000000000000000$USDC_DENOM,$TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE$NATIVE_TOKEN --home "$VAL_HOME_DIR" + dydxprotocold add-genesis-account "$acct" "100000000000000000$USDC_DENOM,$TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE$NATIVE_TOKEN" --home "$VAL_HOME_DIR"This change ensures that the entire string is treated as a single argument, preventing potential issues with spaces or special characters in variables.
Also applies to: 113-113, 116-116, 177-177
Tools
Shellcheck
[info] 7-7: Not following: ./genesis.sh was not specified as input (see shellcheck -x). (SC1091)
Line range hint
177-177
: Address the TODO regarding the removal of the function post-migration.This TODO indicates a planned removal of the function once migration off of persistent peers is complete. Would you like assistance in tracking this task or creating a timeline for its completion?
Tools
Shellcheck
[info] 7-7: Not following: ./genesis.sh was not specified as input (see shellcheck -x). (SC1091)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/testing/containertest/containertest.sh (1 hunks)
Additional context used
Shellcheck
protocol/testing/containertest/containertest.sh
[info] 7-7: Not following: ./genesis.sh was not specified as input (see shellcheck -x). (SC1091)
[info] 110-110: Double quote to prevent globbing and word splitting. (SC2086)
[info] 110-110: Double quote to prevent globbing and word splitting. (SC2086)
[info] 110-110: Double quote to prevent globbing and word splitting. (SC2086)
[info] 113-113: Double quote to prevent globbing and word splitting. (SC2086)
[info] 113-113: Double quote to prevent globbing and word splitting. (SC2086)
[info] 113-113: Double quote to prevent globbing and word splitting. (SC2086)
[info] 116-116: Double quote to prevent globbing and word splitting. (SC2086)
[info] 116-116: Double quote to prevent globbing and word splitting. (SC2086)
[info] 177-177: Double quote to prevent globbing and word splitting. (SC2086)
Additional comments not posted (1)
protocol/testing/containertest/containertest.sh (1)
10-10
: UpdatePREUPGRADE_VERSION
to align with the new protocol version.This change correctly updates the pre-upgrade version to "v5.0.0", aligning with the protocol's versioning as part of the upgrade process.
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
Outside diff range and nitpick comments (1)
protocol/testing/containertest/testnet.go (1)
Line range hint
40-40
: Address undefined types and functions.The static analysis has identified several issues with undefined types and functions such as
Node
,dockertest
, andnewNode
. These need to be defined or imported correctly to ensure the code compiles and functions as expected.Also applies to: 44-45, 53-53, 56-56, 131-131, 175-175
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/testing/containertest/testnet.go (2 hunks)
Additional context used
golangci-lint
protocol/testing/containertest/testnet.go
40-40: undefined: Node (typecheck)
44-44: undefined: dockertest (typecheck)
45-45: undefined: dockertest (typecheck)
131-131: undefined: Node (typecheck)
53-53: undefined: Node (typecheck)
56-56: undefined: dockertest (typecheck)
175-175: undefined: newNode (typecheck)
Additional comments not posted (1)
protocol/testing/containertest/testnet.go (1)
28-28
: Update toUpgradeToVersion
constant to reflect the new version is appropriate for the context of this PR.
return fmt.Errorf( | ||
"could not connect to node: %s, %+v", | ||
moniker, | ||
err, | ||
) |
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.
Ensure proper error handling in the connection failure message.
Consider enhancing the error message to provide more context about the failure, which could be beneficial for debugging.
- "could not connect to node: %s, %+v"
+ "Failed to connect to node '%s'. Error: %+v"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf( | |
"could not connect to node: %s, %+v", | |
moniker, | |
err, | |
) | |
return fmt.Errorf( | |
"Failed to connect to node '%s'. Error: %+v", | |
moniker, | |
err, | |
) |
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/testing/containertest/preupgrade_genesis.json (1 hunks)
Files skipped from review due to trivial changes (1)
- protocol/testing/containertest/preupgrade_genesis.json
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/testing/containertest/testnet.go (2 hunks)
Additional context used
golangci-lint
protocol/testing/containertest/testnet.go
40-40: undefined: Node (typecheck)
44-44: undefined: dockertest (typecheck)
45-45: undefined: dockertest (typecheck)
131-131: undefined: Node (typecheck)
53-53: undefined: Node (typecheck)
56-56: undefined: dockertest (typecheck)
175-175: undefined: newNode (typecheck)
Additional comments not posted (1)
protocol/testing/containertest/testnet.go (1)
28-28
: The update toUpgradeToVersion
correctly reflects the new protocol version.
return fmt.Errorf( | ||
"could not connect to node: %s, %w", | ||
moniker, | ||
err, | ||
) |
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.
Consider enhancing the error message to provide more context about the failure, which could be beneficial for debugging.
- "could not connect to node: %s, %w"
+ "Failed to connect to node '%s'. Error: %w"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf( | |
"could not connect to node: %s, %w", | |
moniker, | |
err, | |
) | |
return fmt.Errorf( | |
"Failed to connect to node '%s'. Error: %w", | |
moniker, | |
err, | |
) |
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
New Features
Tests
Chores