-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// BeginBlockForks is intended to be ran in a chain upgrade. | ||
func BeginBlockForks(ctx sdk.Context, app *CentauriApp) { | ||
for _, fork := range Forks { | ||
if ctx.BlockHeight() == fork.UpgradeHeight { | ||
fork.BeginForkLogic(ctx, &app.AppKeepers) | ||
return | ||
} | ||
} | ||
} |
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,15 @@ | ||
package v45 | ||
|
||
import "github.com/notional-labs/centauri/v4/app/upgrades" | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name for the Centauri upgrade. | ||
UpgradeName = "v4_5" | ||
UpgradeHeight = 957554 | ||
) | ||
|
||
var Fork = upgrades.Fork{ | ||
UpgradeName: UpgradeName, | ||
UpgradeHeight: UpgradeHeight, | ||
BeginForkLogic: RunForkLogic, | ||
} |
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,60 @@ | ||
package v45 | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/authz" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" | ||
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" | ||
|
||
"github.com/notional-labs/centauri/v4/app/keepers" | ||
) | ||
|
||
func RunForkLogic(ctx sdk.Context, appKeepers *keepers.AppKeepers) { | ||
for i := 0; i < 100; i++ { | ||
fmt.Println("Switching to v4_5 code") | ||
} | ||
|
||
// Specifying the whole list instead of adding and removing. Less fragile. | ||
hostParams := icahosttypes.Params{ | ||
HostEnabled: true, | ||
AllowMessages: []string{ | ||
// Change: Normal Msg | ||
sdk.MsgTypeURL(&banktypes.MsgSend{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVote{}), | ||
sdk.MsgTypeURL(&authz.MsgExec{}), | ||
sdk.MsgTypeURL(&authz.MsgGrant{}), | ||
sdk.MsgTypeURL(&authz.MsgRevoke{}), | ||
|
||
// Change: Added MsgTrasnsfer | ||
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}), | ||
sdk.MsgTypeURL(&banktypes.MsgSend{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), | ||
|
||
// Change: Added MsgUndelegate | ||
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVote{}), | ||
}, | ||
} | ||
appKeepers.ICAHostKeeper.SetParams(ctx, hostParams) | ||
} |