-
Notifications
You must be signed in to change notification settings - Fork 95
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
Dang/upgrade handler #200
Merged
Merged
Dang/upgrade handler #200
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ca910e2
add upgrade
GNaD13 d9fd833
nit
GNaD13 e912aa3
Merge remote-tracking branch 'origin/main' into dang/upgrade-handler
GNaD13 00d04e4
v4
GNaD13 dd43d7a
v4
GNaD13 2e30ab6
pfm
GNaD13 fe24249
Merge remote-tracking branch 'origin/main' into dang/upgrade-handler
GNaD13 855e5a2
nit
GNaD13 30c235f
add store loader
GNaD13 ab38d1b
Merge branch 'main' into dang/upgrade-handler
vuong177 9cbec3d
v4 for ratelimit
vuong177 d37b9d0
rate limit store key
GNaD13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,48 @@ | ||
package upgrades | ||
|
||
import ( | ||
types "github.com/cometbft/cometbft/proto/tendermint/types" | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
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/notional-labs/centauri/v3/app/keepers" | ||
) | ||
|
||
// BaseAppParamManager defines an interrace that BaseApp is expected to fullfil | ||
// that allows upgrade handlers to modify BaseApp parameters. | ||
type BaseAppParamManager interface { | ||
GetConsensusParams(ctx sdk.Context) *types.ConsensusParams | ||
StoreConsensusParams(ctx sdk.Context, cp *types.ConsensusParams) | ||
} | ||
|
||
// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal | ||
// must have written, in order for the state migration to go smoothly. | ||
// An upgrade must implement this struct, and then set it in the app.go. | ||
// The app.go will then define the handler. | ||
type Upgrade struct { | ||
// Upgrade version name, for the upgrade handler, e.g. `v7` | ||
UpgradeName string | ||
|
||
// CreateUpgradeHandler defines the function that creates an upgrade handler | ||
CreateUpgradeHandler func(*module.Manager, module.Configurator, BaseAppParamManager, *keepers.AppKeepers) upgradetypes.UpgradeHandler | ||
|
||
// Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed. | ||
StoreUpgrades store.StoreUpgrades | ||
} | ||
|
||
// Fork defines a struct containing the requisite fields for a non-software upgrade proposal | ||
// Hard Fork at a given height to implement. | ||
// There is one time code that can be added for the start of the Fork, in `BeginForkLogic`. | ||
// Any other change in the code should be height-gated, if the goal is to have old and new binaries | ||
// to be compatible prior to the upgrade height. | ||
type Fork struct { | ||
// Upgrade version name, for the upgrade handler, e.g. `v7` | ||
UpgradeName string | ||
// height the upgrade occurs at | ||
UpgradeHeight int64 | ||
|
||
// Function that runs some custom state transition code at the beginning of a fork. | ||
BeginForkLogic func(ctx sdk.Context, keepers *keepers.AppKeepers) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Expression has no effect Warning