Skip to content
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

Danwt/fix upgrade conflicts #1442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@ It's encouraged to add golang and cosmos utilities and shared code to [dymension

2. Do not reuse protobuf field numbers when updating protos. When in doubt, reserve the old number and use a new one.

#### Docstrings

Do not worry about making the first word of the docstring on a public object the same as the object. Feel free to disable any linters/highlighters that pick up on it.

In other words, we are fine with the first version here:

```go

// bla bla
type Foo struct{ }

// Foo bla bla
type Foo struct{ }
```

### References

- https://github.com/dymensionxyz/sdk-utils : Dymension golang and SDK utils library
Expand Down
3 changes: 1 addition & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

"github.com/dymensionxyz/dymension/v3/app/keepers"
"github.com/dymensionxyz/dymension/v3/app/upgrades"
v3 "github.com/dymensionxyz/dymension/v3/app/upgrades/v3"
v4 "github.com/dymensionxyz/dymension/v3/app/upgrades/v4"

Check failure on line 21 in app/app.go

View workflow job for this annotation

GitHub Actions / golangci-lint

could not import github.com/dymensionxyz/dymension/v3/app/upgrades/v4 (-: # github.com/dymensionxyz/dymension/v3/app/upgrades/v4

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
Expand Down Expand Up @@ -84,7 +83,7 @@
DefaultNodeHome string

// Upgrades contains the upgrade handlers for the application
Upgrades = []upgrades.Upgrade{v3.Upgrade, v4.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade}
)

func init() {
Expand Down
20 changes: 0 additions & 20 deletions app/upgrades/v3/constants.go

This file was deleted.

47 changes: 0 additions & 47 deletions app/upgrades/v3/upgrade.go

This file was deleted.

130 changes: 0 additions & 130 deletions app/upgrades/v3/upgrade_test.go

This file was deleted.

9 changes: 9 additions & 0 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
grouptypes "github.com/cosmos/cosmos-sdk/x/group"

"github.com/dymensionxyz/dymension/v3/app/upgrades"
dymnstypes "github.com/dymensionxyz/dymension/v3/x/dymns/types"
irotypes "github.com/dymensionxyz/dymension/v3/x/iro/types"
lightclienttypes "github.com/dymensionxyz/dymension/v3/x/lightclient/types"
sponsorshiptypes "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"
)

const (
Expand All @@ -20,6 +25,10 @@ var Upgrade = upgrades.Upgrade{
consensustypes.ModuleName,
crisistypes.ModuleName,
lightclienttypes.ModuleName,
sponsorshiptypes.ModuleName,
dymnstypes.ModuleName,
irotypes.ModuleName,
grouptypes.ModuleName,
},
},
}
18 changes: 18 additions & 0 deletions app/upgrades/v4/delayedack_params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v4

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

delayedackkeeper "github.com/dymensionxyz/dymension/v3/x/delayedack/keeper"
delayedacktypes "github.com/dymensionxyz/dymension/v3/x/delayedack/types"
)

func migrateDelayedAckParams(ctx sdk.Context, delayedAckKeeper delayedackkeeper.Keeper) {
// overwrite params for rollapp module due to proto change
params := delayedacktypes.DefaultParams()

// EpochIdentifier is the only one that hasn't changed
params.EpochIdentifier = delayedAckKeeper.GetParams(ctx).EpochIdentifier

delayedAckKeeper.SetParams(ctx, params)
}
82 changes: 82 additions & 0 deletions app/upgrades/v4/old_rollapps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package v4

import (
"cosmossdk.io/math"

rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types"
)

// Genesis info data is from https://www.notion.so/dymension/Rollapp-Specific-Migration-Data-136a4a51f86a8017be93d774a576d0ce.
// Rollapp IDs are from https://dym.fyi/rollapps.

var (
nimRollappID = "nim_1122-1"
nimGenesisInfo = rollapptypes.GenesisInfo{
GenesisChecksum: "cbff2650625cb02240757e76b3c00a0f04ff9347e51ec69eaddbc2b40f2c2335",
Bech32Prefix: "nim",
NativeDenom: rollapptypes.DenomMetadata{
Display: "NIM",
Base: "anim",
Exponent: 18,
},
InitialSupply: math.NewIntWithDecimal(1, 27), // 1|000_000_000|000_000_000|000_000_000
Sealed: true,
GenesisAccounts: nil,
}
nimDenoms = []string{
"ibc/FF6C2E86490C1C4FBBD24F55032831D2415B9D7882F85C3CC9C2401D79362BEA", // STRD
"ibc/F46BA5EDCA6DAA5F7EFD3838430E03647CDC786BB1B89BC9FDD1CBE16B099645", // stTIA
"ibc/F428C5D24BEF8CA22EE74810A583422C12F02865ADAC185678C73015A88227B3", // milkTIA
"ibc/E3AB0DFDE9E782262B770C32DF94AC2A92B93DC4825376D6F6C874D3C877864E", // WETH
"ibc/D934516FBE457F3A98AFABD87E0EFF7F95A15325C191EA8CDD7763C702FDDEC2", // AXL
"ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", // ATOM
"ibc/BEE9A8F835D60717548FFE9AC9E90F18AB8096574EB1211F88074CB3511B7860", // WBTC
"ibc/B72B5B3F7AD44783584921DC33354BCE07C8EB0A7F0349247C3DAD38C3B6E6A5", // USDT
"ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4", // USDC
"ibc/B22B4DD21586965DAEF42A7600BA371EA77C02E90FC8A7F2330BF9F9DE129B07", // KUJI
"ibc/AB30D2F9C131AE1EFA8449C74490326BD5ACC40EF69A2D8563994AA05CE0B258", // stDYM
"ibc/5C58CC109FB067073F1B80481EE9C3A8484330FECB35D2591B28E7E1A6FCF64C", // ARCH
"ibc/5A26C8DC8DA66F4DD94326E67F94510188F5F7AFE2DB3933A0C823670E56EABF", // MANDE
"ibc/5620289B0E1106C8A2421F212FEC4EB19E3CBA964662DB61754CCDE8FAAC29FF", // Dr.BE
"ibc/45D6B52CAD911A15BD9C2F5FFDA80E26AFCB05C7CD520070790ABC86D2B24229", // TIA
"ibc/2F2F132E47342479A8B7A8DB241F276609C53A1478CEB9A57411A910C9B061DB", // NTRN
"ibc/27A5DE18D796A595123D97078F9AB9EAEFC23540724384F219EACED2BD5511F5", // SCRT
"ibc/13B2C536BB057AC79D5616B8EA1B9540EC1F2170718CAFF6F0083C966FFFED0B", // OSMO
"ibc/04E01477A69DF1E5EE99F85C15B66D68D23292275357CAA44B2E0527310A405E", // EVMOS
}

mandeRollappID = "mande_18071918-1"
mandeGenesisInfo = rollapptypes.GenesisInfo{
GenesisChecksum: "7f64188a70c2b67230f6af826b33fe35f2a46c63c4838216c3ac50b8ab148632",
Bech32Prefix: "mande",
NativeDenom: rollapptypes.DenomMetadata{
Display: "MANDE",
Base: "amand",
Exponent: 18,
},
InitialSupply: math.NewIntWithDecimal(2, 25), // 20_000_000|000_000_000|000_000_000
Sealed: true,
GenesisAccounts: nil,
}
mandeDenoms = []string{
"ibc/FF6C2E86490C1C4FBBD24F55032831D2415B9D7882F85C3CC9C2401D79362BEA", // STRD
"ibc/FB53D1684F155CBB86D9CE917807E42B59209EBE3AD3A92E15EF66586C073942", // NIM
"ibc/F46BA5EDCA6DAA5F7EFD3838430E03647CDC786BB1B89BC9FDD1CBE16B099645", // stTIA
"ibc/F428C5D24BEF8CA22EE74810A583422C12F02865ADAC185678C73015A88227B3", // milkTIA
"ibc/E3AB0DFDE9E782262B770C32DF94AC2A92B93DC4825376D6F6C874D3C877864E", // WETH
"ibc/D934516FBE457F3A98AFABD87E0EFF7F95A15325C191EA8CDD7763C702FDDEC2", // AXL
"ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", // ATOM
"ibc/BEE9A8F835D60717548FFE9AC9E90F18AB8096574EB1211F88074CB3511B7860", // WBTC
"ibc/B72B5B3F7AD44783584921DC33354BCE07C8EB0A7F0349247C3DAD38C3B6E6A5", // USDT
"ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4", // USDC
"ibc/B22B4DD21586965DAEF42A7600BA371EA77C02E90FC8A7F2330BF9F9DE129B07", // KUJI
"ibc/AB30D2F9C131AE1EFA8449C74490326BD5ACC40EF69A2D8563994AA05CE0B258", // stDYM
"ibc/5C58CC109FB067073F1B80481EE9C3A8484330FECB35D2591B28E7E1A6FCF64C", // ARCH
"ibc/5620289B0E1106C8A2421F212FEC4EB19E3CBA964662DB61754CCDE8FAAC29FF", // Dr.BE
"ibc/45D6B52CAD911A15BD9C2F5FFDA80E26AFCB05C7CD520070790ABC86D2B24229", // TIA
"ibc/2F2F132E47342479A8B7A8DB241F276609C53A1478CEB9A57411A910C9B061DB", // NTRN
"ibc/27A5DE18D796A595123D97078F9AB9EAEFC23540724384F219EACED2BD5511F5", // SCRT
"ibc/13B2C536BB057AC79D5616B8EA1B9540EC1F2170718CAFF6F0083C966FFFED0B", // OSMO
"ibc/04E01477A69DF1E5EE99F85C15B66D68D23292275357CAA44B2E0527310A405E", // EVMOS
}
)
17 changes: 17 additions & 0 deletions app/upgrades/v4/rollapp_params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package v4

import (
sdk "github.com/cosmos/cosmos-sdk/types"
rollappkeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper"
rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types"
)

func migrateRollappParams(ctx sdk.Context, rollappkeeper *rollappkeeper.Keeper) {
// overwrite params for rollapp module due to proto change
params := rollapptypes.DefaultParams()

// Dispute period is the only one that hasn't changed
params.DisputePeriodInBlocks = rollappkeeper.DisputePeriodInBlocks(ctx)

rollappkeeper.SetParams(ctx, params)
}
Loading
Loading