forked from evmos/evmos
-
Notifications
You must be signed in to change notification settings - Fork 0
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 loredana/fee-distribution
* main: misc: changelog and fix test (evmos#460) deps: bump ethermint to v0.13.0 (evmos#458) fix: v3 migration (evmos#446) deps: bump Cosmos SDK to v0.45.2 (evmos#457)
- Loading branch information
Showing
34 changed files
with
4,387 additions
and
2,119 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
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 |
---|---|---|
@@ -1,3 +1,16 @@ | ||
# Evmos Upgrade | ||
# Evmos Upgrades | ||
|
||
- v2 contains code to update the ERC20 EVM hook to `true`. | ||
### Mainnet | ||
|
||
- `v2`: | ||
- updates the ERC20 EVM hook to `true`. | ||
- `v3`: | ||
- moves the `x/feemarket` `BaseFee` from the store to the parameters | ||
- adds the `x/recovery` module | ||
|
||
### Testnet | ||
|
||
- `tv3`: | ||
- moves the `x/feemarket` `BaseFee` from the store to the parameters | ||
- adds claims `AuthorizedChannels` and `EVMChannels` param fields | ||
- adds the `x/recovery` module |
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,63 @@ | ||
package v3 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/client" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
"github.com/cosmos/cosmos-sdk/x/genutil/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
feemarketv010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010" | ||
feemarketv09types "github.com/tharsis/ethermint/x/feemarket/migrations/v09/types" | ||
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types" | ||
) | ||
|
||
const UpgradeName = "v3" | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v3 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
// Refs: | ||
// - https://docs.cosmos.network/master/building-modules/upgrade.html#registering-migrations | ||
// - https://docs.cosmos.network/master/migrations/chain-upgrade-guide-044.html#chain-upgrade | ||
|
||
// migrate fee market module, other modules are left as-is to | ||
// avoid running InitGenesis. | ||
vm[feemarkettypes.ModuleName] = 1 | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} | ||
|
||
// MigrateGenesis migrates exported state from v2 to v3 genesis state. It performs a no-op if the migration errors. | ||
func MigrateGenesis(appState types.AppMap, clientCtx client.Context) types.AppMap { | ||
// Migrate x/feemarket. | ||
if appState[feemarkettypes.ModuleName] == nil { | ||
return appState | ||
} | ||
|
||
// unmarshal relative source genesis application state | ||
var oldFeeMarketState feemarketv09types.GenesisState | ||
if err := clientCtx.Codec.UnmarshalJSON(appState[feemarkettypes.ModuleName], &oldFeeMarketState); err != nil { | ||
return appState | ||
} | ||
|
||
// delete deprecated x/feemarket genesis state | ||
delete(appState, feemarkettypes.ModuleName) | ||
|
||
// Migrate relative source genesis application state and marshal it into | ||
// the respective key. | ||
newFeeMarketState := feemarketv010.MigrateJSON(oldFeeMarketState) | ||
|
||
feeMarketBz, err := clientCtx.Codec.MarshalJSON(&newFeeMarketState) | ||
if err != nil { | ||
return appState | ||
} | ||
|
||
appState[feemarkettypes.ModuleName] = feeMarketBz | ||
|
||
return appState | ||
} |
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,7 @@ | ||
package v3 | ||
|
||
const ( | ||
UpgradeName = "tv3" | ||
UpgradeHeight = 0 | ||
UpgradeInfo = `` | ||
) |
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,85 @@ | ||
package v3 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/client" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
"github.com/cosmos/cosmos-sdk/x/genutil/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
feemarketv010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010" | ||
feemarketv09types "github.com/tharsis/ethermint/x/feemarket/migrations/v09/types" | ||
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types" | ||
v1claims "github.com/tharsis/evmos/v3/x/claims/migrations/v1/types" | ||
v2claims "github.com/tharsis/evmos/v3/x/claims/migrations/v2" | ||
claimstypes "github.com/tharsis/evmos/v3/x/claims/types" | ||
) | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v3 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
// Refs: | ||
// - https://docs.cosmos.network/master/building-modules/upgrade.html#registering-migrations | ||
// - https://docs.cosmos.network/master/migrations/chain-upgrade-guide-044.html#chain-upgrade | ||
|
||
// migrate fee market module and the claims module | ||
// avoid running InitGenesis. | ||
vm[feemarkettypes.ModuleName] = 1 | ||
vm[claimstypes.ModuleName] = 1 | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} | ||
|
||
// MigrateGenesis migrates exported state from v2 to v3 genesis state. It performs a no-op if the migration errors. | ||
func MigrateGenesis(appState types.AppMap, clientCtx client.Context) types.AppMap { | ||
// Migrate x/feemarket. | ||
if appState[feemarkettypes.ModuleName] == nil { | ||
return appState | ||
} | ||
|
||
// unmarshal relative source genesis application state | ||
var oldFeeMarketState feemarketv09types.GenesisState | ||
if err := clientCtx.Codec.UnmarshalJSON(appState[feemarkettypes.ModuleName], &oldFeeMarketState); err != nil { | ||
return appState | ||
} | ||
|
||
// delete deprecated x/feemarket genesis state | ||
delete(appState, feemarkettypes.ModuleName) | ||
|
||
// Migrate relative source genesis application state and marshal it into | ||
// the respective key. | ||
newFeeMarketState := feemarketv010.MigrateJSON(oldFeeMarketState) | ||
|
||
feeMarketBz, err := clientCtx.Codec.MarshalJSON(&newFeeMarketState) | ||
if err != nil { | ||
return appState | ||
} | ||
|
||
appState[feemarkettypes.ModuleName] = feeMarketBz | ||
|
||
// unmarshal relative source genesis application state | ||
var oldClaimsState v1claims.GenesisState | ||
if err := clientCtx.Codec.UnmarshalJSON(appState[claimstypes.ModuleName], &oldClaimsState); err != nil { | ||
return appState | ||
} | ||
|
||
// delete deprecated x/feemarket genesis state | ||
delete(appState, claimstypes.ModuleName) | ||
|
||
// Migrate relative source genesis application state and marshal it into | ||
// the respective key. | ||
newClaimsState := v2claims.MigrateJSON(oldClaimsState) | ||
|
||
claimsBz, err := clientCtx.Codec.MarshalJSON(&newClaimsState) | ||
if err != nil { | ||
return appState | ||
} | ||
|
||
appState[claimstypes.ModuleName] = claimsBz | ||
|
||
return appState | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.