-
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.
Merge branch 'main' into nguyen/ic-for-ibc-hooks
- Loading branch information
Showing
71 changed files
with
1,294 additions
and
620 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,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
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
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 = 967554 | ||
) | ||
|
||
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) | ||
} |
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,18 @@ | ||
package v4_5_1 | ||
|
||
import "github.com/notional-labs/centauri/v4/app/upgrades" | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name for the Composable v5 upgrade. | ||
UpgradeName = "v4_5_1" | ||
|
||
// UpgradeHeight defines the block height at which the Composable v6 upgrade is | ||
// triggered. | ||
UpgradeHeight = 1127000 | ||
) | ||
|
||
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,28 @@ | ||
package v4_5_1 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/notional-labs/centauri/v4/app/keepers" | ||
rateLimitKeeper "github.com/notional-labs/centauri/v4/x/ratelimit/keeper" | ||
) | ||
|
||
func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { | ||
ctx.Logger().Info("Applying v5 upgrade" + | ||
"Remove Rate Limit", | ||
) | ||
|
||
RemoveRateLimit(ctx, &keepers.RatelimitKeeper) | ||
} | ||
|
||
func RemoveRateLimit(ctx sdk.Context, rlKeeper *rateLimitKeeper.Keeper) { | ||
// Get all current rate limit | ||
rateLimits := rlKeeper.GetAllRateLimits(ctx) | ||
// Remove Rate limit | ||
for _, rateLimit := range rateLimits { | ||
err := rlKeeper.RemoveRateLimit(ctx, rateLimit.Path.Denom, rateLimit.Path.ChannelID) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
} |
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,19 @@ | ||
package v5 | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/notional-labs/centauri/v4/app/upgrades" | ||
) | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name for the Centauri upgrade. | ||
UpgradeName = "v5" | ||
) | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{ | ||
Added: []string{}, | ||
}, | ||
} |
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,20 @@ | ||
package v5 | ||
|
||
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/notional-labs/centauri/v4/app/keepers" | ||
"github.com/notional-labs/centauri/v4/app/upgrades" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
bpm upgrades.BaseAppParamManager, | ||
keepers *keepers.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
Oops, something went wrong.