Skip to content

Commit

Permalink
chore: add v7 hard fork
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM committed Dec 19, 2024
1 parent e5e618e commit ed8281a
Show file tree
Hide file tree
Showing 302 changed files with 745 additions and 669 deletions.
2 changes: 1 addition & 1 deletion ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante"
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"

milkywayerrors "github.com/milkyway-labs/milkyway/v6/types/errors"
milkywayerrors "github.com/milkyway-labs/milkyway/v7/types/errors"

ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
Expand Down
6 changes: 3 additions & 3 deletions api/milkyway/restaking/v1/query.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/milkyway/rewards/v1/messages.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/milkyway/rewards/v1/models.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/abci/abci_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

oraclepreblock "github.com/skip-mev/connect/v2/abci/preblock/oracle"

"github.com/milkyway-labs/milkyway/v6/app/keepers"
"github.com/milkyway-labs/milkyway/v7/app/keepers"
)

type SetupData struct {
Expand Down
33 changes: 26 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,25 @@ import (
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
"github.com/spf13/cast"

milkywayante "github.com/milkyway-labs/milkyway/v6/ante"
milkywayabci "github.com/milkyway-labs/milkyway/v6/app/abci"
"github.com/milkyway-labs/milkyway/v6/app/keepers"
"github.com/milkyway-labs/milkyway/v6/app/upgrades"
v6 "github.com/milkyway-labs/milkyway/v6/app/upgrades/v6"
_ "github.com/milkyway-labs/milkyway/v6/client/docs/statik"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/types"
milkywayante "github.com/milkyway-labs/milkyway/v7/ante"
milkywayabci "github.com/milkyway-labs/milkyway/v7/app/abci"
"github.com/milkyway-labs/milkyway/v7/app/forks"
v7 "github.com/milkyway-labs/milkyway/v7/app/forks/v7"
"github.com/milkyway-labs/milkyway/v7/app/keepers"
"github.com/milkyway-labs/milkyway/v7/app/upgrades"
v6 "github.com/milkyway-labs/milkyway/v7/app/upgrades/v6"
_ "github.com/milkyway-labs/milkyway/v7/client/docs/statik"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/types"
)

var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Forks = []forks.Fork{
v7.Fork,
}

Upgrades = []upgrades.Upgrade{
v6.Upgrade,
}
Expand Down Expand Up @@ -354,6 +360,7 @@ func NewMilkyWayApp(

app.setupUpgradeHandlers()
app.setupUpgradeStoreLoaders()
app.setupForksPreBlockers()

// At startup, after all modules have been registered, check that all prot
// annotations are correct.
Expand Down Expand Up @@ -547,6 +554,18 @@ func (app *MilkyWayApp) setupUpgradeHandlers() {
}
}

func (app *MilkyWayApp) setupForksPreBlockers() {
for _, fork := range Forks {
currentPreBlocker := app.PreBlocker()
app.SetPreBlocker(func(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
if req.Height == fork.ForkHeight {
fork.BeginForkLogic(ctx, &app.AppKeepers)
}
return currentPreBlocker(ctx, req)
})
}
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(rtr *mux.Router) {
statikFS, err := fs.New()
Expand Down
6 changes: 3 additions & 3 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkywayhelpers "github.com/milkyway-labs/milkyway/v6/app/helpers"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/types"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
milkywayhelpers "github.com/milkyway-labs/milkyway/v7/app/helpers"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/types"
)

func TestMilkyWayApp_BlockedModuleAccountAddrs(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/std"

"github.com/milkyway-labs/milkyway/v6/app/keepers"
"github.com/milkyway-labs/milkyway/v6/app/params"
"github.com/milkyway-labs/milkyway/v7/app/keepers"
"github.com/milkyway-labs/milkyway/v7/app/params"
)

// MakeEncodingConfig creates an EncodingConfig.
Expand Down
20 changes: 20 additions & 0 deletions app/forks/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package forks

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/milkyway-labs/milkyway/v7/app/keepers"
)

// 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 {
// ForkHeight represents the height the upgrade occurs at
ForkHeight int64

// Function that runs some custom state transition code at the beginning of a fork.
BeginForkLogic func(ctx sdk.Context, keepers *keepers.AppKeepers)
}
10 changes: 10 additions & 0 deletions app/forks/v7/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package v7

import (
"github.com/milkyway-labs/milkyway/v7/app/forks"
)

var Fork = forks.Fork{
ForkHeight: 251150,
BeginForkLogic: BeginFork,
}
28 changes: 28 additions & 0 deletions app/forks/v7/fork.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package v7

import (
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/milkyway-labs/milkyway/v7/app/keepers"
)

func BeginFork(ctx sdk.Context, keepers *keepers.AppKeepers) {
ctx.Logger().Info(`
===================================================================================================
==== Forking chain state
===================================================================================================
`)

// Set the restaking cap to zero
params, err := keepers.RestakingKeeper.GetParams(ctx)
if err != nil {
panic(err)
}
params.RestakingCap = sdkmath.LegacyNewDec(0)

err = keepers.RestakingKeeper.SetParams(ctx, params)
if err != nil {
panic(err)
}
}
2 changes: 1 addition & 1 deletion app/genesis_account_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

fuzz "github.com/google/gofuzz"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

func TestFuzzGenesisAccountValidate(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"
"github.com/stretchr/testify/require"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

func TestNewDefaultGenesisState(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

// SimAppChainID hardcoded chainID for simulation
Expand Down
30 changes: 15 additions & 15 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ import (
icsprovider "github.com/cosmos/interchain-security/v6/x/ccv/provider"
icsproviderkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper"

assetskeeper "github.com/milkyway-labs/milkyway/v6/x/assets/keeper"
assetstypes "github.com/milkyway-labs/milkyway/v6/x/assets/types"
"github.com/milkyway-labs/milkyway/v6/x/liquidvesting"
liquidvestingkeeper "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/keeper"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/types"
operatorskeeper "github.com/milkyway-labs/milkyway/v6/x/operators/keeper"
operatorstypes "github.com/milkyway-labs/milkyway/v6/x/operators/types"
poolskeeper "github.com/milkyway-labs/milkyway/v6/x/pools/keeper"
poolstypes "github.com/milkyway-labs/milkyway/v6/x/pools/types"
restakingkeeper "github.com/milkyway-labs/milkyway/v6/x/restaking/keeper"
restakingtypes "github.com/milkyway-labs/milkyway/v6/x/restaking/types"
rewardskeeper "github.com/milkyway-labs/milkyway/v6/x/rewards/keeper"
rewardstypes "github.com/milkyway-labs/milkyway/v6/x/rewards/types"
serviceskeeper "github.com/milkyway-labs/milkyway/v6/x/services/keeper"
servicestypes "github.com/milkyway-labs/milkyway/v6/x/services/types"
assetskeeper "github.com/milkyway-labs/milkyway/v7/x/assets/keeper"
assetstypes "github.com/milkyway-labs/milkyway/v7/x/assets/types"
"github.com/milkyway-labs/milkyway/v7/x/liquidvesting"
liquidvestingkeeper "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/keeper"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/types"
operatorskeeper "github.com/milkyway-labs/milkyway/v7/x/operators/keeper"
operatorstypes "github.com/milkyway-labs/milkyway/v7/x/operators/types"
poolskeeper "github.com/milkyway-labs/milkyway/v7/x/pools/keeper"
poolstypes "github.com/milkyway-labs/milkyway/v7/x/pools/types"
restakingkeeper "github.com/milkyway-labs/milkyway/v7/x/restaking/keeper"
restakingtypes "github.com/milkyway-labs/milkyway/v7/x/restaking/types"
rewardskeeper "github.com/milkyway-labs/milkyway/v7/x/rewards/keeper"
rewardstypes "github.com/milkyway-labs/milkyway/v7/x/rewards/types"
serviceskeeper "github.com/milkyway-labs/milkyway/v7/x/services/keeper"
servicestypes "github.com/milkyway-labs/milkyway/v7/x/services/types"
)

type AppKeepers struct {
Expand Down
14 changes: 7 additions & 7 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import (

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

assetstypes "github.com/milkyway-labs/milkyway/v6/x/assets/types"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/types"
operatorstypes "github.com/milkyway-labs/milkyway/v6/x/operators/types"
poolstypes "github.com/milkyway-labs/milkyway/v6/x/pools/types"
restakingtypes "github.com/milkyway-labs/milkyway/v6/x/restaking/types"
rewardstypes "github.com/milkyway-labs/milkyway/v6/x/rewards/types"
servicestypes "github.com/milkyway-labs/milkyway/v6/x/services/types"
assetstypes "github.com/milkyway-labs/milkyway/v7/x/assets/types"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/types"
operatorstypes "github.com/milkyway-labs/milkyway/v7/x/operators/types"
poolstypes "github.com/milkyway-labs/milkyway/v7/x/pools/types"
restakingtypes "github.com/milkyway-labs/milkyway/v7/x/restaking/types"
rewardstypes "github.com/milkyway-labs/milkyway/v7/x/rewards/types"
servicestypes "github.com/milkyway-labs/milkyway/v7/x/services/types"
)

func (appKeepers *AppKeepers) GenerateKeys() {
Expand Down
14 changes: 7 additions & 7 deletions app/keepers/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import (
"github.com/skip-mev/connect/v2/x/oracle"
"github.com/skip-mev/feemarket/x/feemarket"

"github.com/milkyway-labs/milkyway/v6/x/assets"
"github.com/milkyway-labs/milkyway/v6/x/liquidvesting"
"github.com/milkyway-labs/milkyway/v6/x/operators"
"github.com/milkyway-labs/milkyway/v6/x/pools"
"github.com/milkyway-labs/milkyway/v6/x/restaking"
"github.com/milkyway-labs/milkyway/v6/x/rewards"
"github.com/milkyway-labs/milkyway/v6/x/services"
"github.com/milkyway-labs/milkyway/v7/x/assets"
"github.com/milkyway-labs/milkyway/v7/x/liquidvesting"
"github.com/milkyway-labs/milkyway/v7/x/operators"
"github.com/milkyway-labs/milkyway/v7/x/pools"
"github.com/milkyway-labs/milkyway/v7/x/restaking"
"github.com/milkyway-labs/milkyway/v7/x/rewards"
"github.com/milkyway-labs/milkyway/v7/x/services"
)

var AppModuleBasics = module.NewBasicManager(
Expand Down
28 changes: 14 additions & 14 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/milkyway-labs/milkyway/v6/x/assets"
assetstypes "github.com/milkyway-labs/milkyway/v6/x/assets/types"
"github.com/milkyway-labs/milkyway/v6/x/liquidvesting"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v6/x/liquidvesting/types"
"github.com/milkyway-labs/milkyway/v6/x/operators"
operatorstypes "github.com/milkyway-labs/milkyway/v6/x/operators/types"
"github.com/milkyway-labs/milkyway/v6/x/pools"
poolstypes "github.com/milkyway-labs/milkyway/v6/x/pools/types"
"github.com/milkyway-labs/milkyway/v6/x/restaking"
restakingtypes "github.com/milkyway-labs/milkyway/v6/x/restaking/types"
"github.com/milkyway-labs/milkyway/v6/x/rewards"
rewardstypes "github.com/milkyway-labs/milkyway/v6/x/rewards/types"
"github.com/milkyway-labs/milkyway/v6/x/services"
servicestypes "github.com/milkyway-labs/milkyway/v6/x/services/types"
"github.com/milkyway-labs/milkyway/v7/x/assets"
assetstypes "github.com/milkyway-labs/milkyway/v7/x/assets/types"
"github.com/milkyway-labs/milkyway/v7/x/liquidvesting"
liquidvestingtypes "github.com/milkyway-labs/milkyway/v7/x/liquidvesting/types"
"github.com/milkyway-labs/milkyway/v7/x/operators"
operatorstypes "github.com/milkyway-labs/milkyway/v7/x/operators/types"
"github.com/milkyway-labs/milkyway/v7/x/pools"
poolstypes "github.com/milkyway-labs/milkyway/v7/x/pools/types"
"github.com/milkyway-labs/milkyway/v7/x/restaking"
restakingtypes "github.com/milkyway-labs/milkyway/v7/x/restaking/types"
"github.com/milkyway-labs/milkyway/v7/x/rewards"
rewardstypes "github.com/milkyway-labs/milkyway/v7/x/rewards/types"
"github.com/milkyway-labs/milkyway/v7/x/services"
servicestypes "github.com/milkyway-labs/milkyway/v7/x/services/types"
)

var MaccPerms = map[string][]string{
Expand Down
2 changes: 1 addition & 1 deletion app/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

"github.com/milkyway-labs/milkyway/v6/ante"
"github.com/milkyway-labs/milkyway/v7/ante"
)

// PostHandlerOptions are the options required for constructing a FeeMarket PostHandler.
Expand Down
2 changes: 1 addition & 1 deletion app/sim/sim_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

// Simulation parameter constants
Expand Down
2 changes: 1 addition & 1 deletion app/sim/sim_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

// SimulationOperations retrieves the simulation params from the provided file path
Expand Down
6 changes: 3 additions & 3 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/simulation"
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"

"github.com/milkyway-labs/milkyway/v6/ante"
"github.com/milkyway-labs/milkyway/v6/app/sim"
"github.com/milkyway-labs/milkyway/v7/ante"
"github.com/milkyway-labs/milkyway/v7/app/sim"

milkyway "github.com/milkyway-labs/milkyway/v6/app"
milkyway "github.com/milkyway-labs/milkyway/v7/app"
)

// AppChainID hardcoded chainID for simulation
Expand Down
3 changes: 1 addition & 2 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package upgrades
import (
store "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/milkyway-labs/milkyway/v6/app/keepers"
"github.com/milkyway-labs/milkyway/v7/app/keepers"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v6/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v6
import (
storetypes "cosmossdk.io/store/types"

"github.com/milkyway-labs/milkyway/v6/app/upgrades"
"github.com/milkyway-labs/milkyway/v7/app/upgrades"
)

const UpgradeName = "v6"
Expand Down
Loading

0 comments on commit ed8281a

Please sign in to comment.