-
Notifications
You must be signed in to change notification settings - Fork 61
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
Eventmanager #1714
Eventmanager #1714
Changes from all commits
d96b6c5
f0bfd40
bdcb7f8
69ed530
f02a2ce
0f2350b
36d7589
734351f
64c35bf
5b8762e
d42ef24
de1d993
051b383
8042dbb
4aedb4a
2ba95a7
77314ce
92a5819
62c32ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||||||||||||||||||
package upgrades | ||||||||||||||||||||||
|
||||||||||||||||||||||
import ( | ||||||||||||||||||||||
sdk "github.com/cosmos/cosmos-sdk/types" | ||||||||||||||||||||||
"github.com/cosmos/cosmos-sdk/types/module" | ||||||||||||||||||||||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||||||||||||||||||||||
"github.com/quicksilver-zone/quicksilver/app/keepers" | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
func V010900UpgradeHandler( | ||||||||||||||||||||||
mm *module.Manager, | ||||||||||||||||||||||
configurator module.Configurator, | ||||||||||||||||||||||
appKeepers *keepers.AppKeepers, | ||||||||||||||||||||||
) upgradetypes.UpgradeHandler { | ||||||||||||||||||||||
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||||||||||||||||||||||
return mm.RunMigrations(ctx, configurator, fromVM) | ||||||||||||||||||||||
} | ||||||||||||||||||||||
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for RunMigrations The migration might fail, and it would be helpful to wrap the error with context about which upgrade failed. - return mm.RunMigrations(ctx, configurator, fromVM)
+ newVM, err := mm.RunMigrations(ctx, configurator, fromVM)
+ if err != nil {
+ return nil, fmt.Errorf("failed to run v1.9.0 upgrade migrations: %w", err)
+ }
+ return newVM, nil 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
Comment on lines
+10
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add EventManager migration logic The upgrade handler currently only runs default migrations without initializing or migrating the new EventManager state. Given that this upgrade introduces the EventManager feature (as per PR objectives), consider adding custom migration logic to:
Here's a suggested structure: func V010900UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
+ // Initialize EventManager state
+ if err := initializeEventManager(ctx, appKeepers); err != nil {
+ return nil, err
+ }
+
+ // Migrate existing async operations if needed
+ if err := migrateAsyncOperations(ctx, appKeepers); err != nil {
+ return nil, err
+ }
+
return mm.RunMigrations(ctx, configurator, fromVM)
}
}
|
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.
💡 Codebase verification
Store upgrade handling needs to be implemented for the eventmanager module
The verification reveals that while there's a v1.9.0 upgrade handler, it doesn't include the required store upgrades for the new eventmanager module. For breaking changes involving new store keys:
emtypes.StoreKey
Action items:
eventmanager
to store upgrades in the v1.9.0 upgrade handler🔗 Analysis chain
Verify upgrade handling for the new store key.
The store key addition is correctly placed. However, since adding a new store key is a breaking change:
Let's verify the upgrade handling:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 5486
Script:
Length of output: 5757
Script:
Length of output: 1764