-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: allow for hardcoded upgrade schedules (#2583)
This PR implements the protocol work behind ADR018. After several iterations I have come across a design which I think best meets our requirements. I will need to update the ADR afterwards. This still relies on a hardcoded upgrade schedule but rather than simply upgrading at that height through `EndBlocker`, a proposer will modify the proposed block of the height before with a message indicating a version change. Nodes will vote on that version change in `ProcessProposal`. If 2/3+ support that app version then the proposal will pass and the block be committed. In the following height the upgraded nodes will perform the state migration if any and propose a block corresponding to that new app version. Nodes that don't support that app version will panic in `DeliverTx`. --------- Co-authored-by: Rootul P <[email protected]>
- Loading branch information
Showing
28 changed files
with
1,216 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/celestiaorg/celestia-app/x/upgrade" | ||
abci "github.com/tendermint/tendermint/abci/types" | ||
) | ||
|
||
func (app *App) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx { | ||
sdkTx, err := app.txConfig.TxDecoder()(req.Tx) | ||
if err == nil { | ||
if appVersion, ok := upgrade.IsUpgradeMsg(sdkTx.GetMsgs()); ok { | ||
if !IsSupported(appVersion) { | ||
panic(fmt.Sprintf("network has upgraded to version %d which is not supported by this node. Please upgrade and restart", appVersion)) | ||
} | ||
app.UpgradeKeeper.PrepareUpgradeAtEndBlock(appVersion) | ||
// TODO: we may want to emit an event for this | ||
return abci.ResponseDeliverTx{Code: abci.CodeTypeOK} | ||
} | ||
} | ||
return app.BaseApp.DeliverTx(req) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.