-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: custom upgrade module #82
Conversation
LGTM |
08c05fc
to
93370fb
Compare
1457f2c
to
6a71dd6
Compare
simapp/app.go
Outdated
// set the governance module account as the authority for conducting upgrades | ||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) | ||
// Register the upgrade keeper | ||
upgradeHandler := map[string]upgradetypes.UpgradeHandler{ |
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.
I think it is not proper to write the upgrade handler when new an app.
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.
I added a new handler for restarting the app. if the app is restarted, will execute handlers for upgraded.
If the tx handler want to know whether the current height is after some upgrade, how can them implement? It looks like the context does not have such info yet. |
upgradeName, height := parseDoneKey(iter.Key()) | ||
if height < ctx.BlockHeight() { | ||
f := k.upgradeInitializer[upgradeName] | ||
if f == nil { |
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.
It is possible that f
is nil, let us tolerate with it.
In the original Cosmos SDK, the gov module proposal is used for coordinated upgrades. When the specified upgrade height is reached, if users haven't used the new client, they will remain at the specified height waiting for users to stop the chain and replace the old client with a new one. If you want to automate the upgrade, you can use Cosmovisor. Now you have modified the code to directly write the upgrade logic, which executes the upgrade at the specified height. So I have some questions: Since you're not using the gov module for coordinated upgrades, how do the old clients know about the upcoming upgrade? Because the old clients don't know that an upgrade is needed at a certain height, they will run according to the old logic, which will inevitably lead to consensus errors. How do you solve this? If I understand correctly, you would coordinate offline. All nodes would be required to replace the old client with the latest client before the upgrade, then update the app.toml file and wait for the upgrade. However, if this process is not well-coordinated, for example, if some users haven't used the latest client or have used the latest client but haven't updated the upgrade configuration in app.toml, it would lead to consensus error issues. If an extreme situation occurs, for example, if the upgrade was originally planned for height 100, but when block 100 is reached, nodes with more than 2/3+ of the voting weight are still running the old client. Would the upgrade fail, but due to having more than 2/3+ of the voting weight, would the chain still be able to reach consensus and produce blocks? Additionally, in the example above, it mentions "upgrade config in app.toml". This shouldn't be updating app.toml, right? It's updating the Go code, and the two screenshots are the same. Thank you! |
Description
Customize the upgrade module for BNB Inscription, and delete useless APIs from the original module.
Rationale
The original upgrade module needs to be carried out through the gov module, and the upgrade process cannot be smoothed, which is inconsistent with our needs.
Therefore, modifying this module supports soft upgrades.
Example
app.toml
Changes
Notable changes: