Skip to content

Commit

Permalink
release: v3.0.0-beta1 (#459)
Browse files Browse the repository at this point in the history
* docs: governance (#431)

* docs: governance

* docs updates

* revert

* revert

* fix: docs build (#434)

* add UML diagrams

* rm tx flow

* build(deps): bump github.com/onsi/gomega from 1.18.1 to 1.19.0 (#438)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.18.1 to 1.19.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.18.1...v1.19.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* imp: remove unnecesary unpack public key (#440)

* docs: update testnet docs (#442)

* ENG-109 - impr(claims): remove claims merge/migrate cases where sender already completed an action as they are never reached (#443)

* impr(claims): remove claims merge/migrate cases where sender alreayd completed an action as they are never reached

* add CHANGELOG

* fix changelog

* impr(claims): address PR comments

* docs: add warnings for `keyring-backend test` (#444)

* docs: add warnings for keyring-backend test

* fix lint

* deps: bump ethermint to v0.12.1 (#445)

* impr(init.sh): remove increased blocktime (#447)

* audit(recovery): api and state machine (#439)

* audit(recovery): improve comments and move GetIBCDenomDestinationIdentifiers method

* audit(recovery): refactor ibc_callback to use recipient where sender == recipient

* audit(recovery): remove pubkey nil check

* cleanup

* dont redeclare err

* impr(claims): address PR comments

* impr(claims): address PR comments

* impr(claims): address PR comments

* go mod tidy

Co-authored-by: ramacarlucho <ramirocarlucho@gmail.com>

* imp: recovery fail transfer tests (#450)

* audit(recovery): improve comments and move GetIBCDenomDestinationIdentifiers method

* audit(recovery): refactor ibc_callback to use recipient where sender == recipient

* audit(recovery): remove pubkey nil check

* cleanup

* dont redeclare err

* Add fail transfer cases

* add case

* delete comment

Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>

* tests(recovery): add genesis and partial recovery tests (#451)

* add partial recovery test

* tests(recovery): add genesis_test

* build(deps): bump github.com/tharsis/ethermint from 0.12.1 to 0.12.2 (#452)

* integration(recovery): add behaviour driven tests (#453)

* add bdd test structure

* start replacing tests

* refactor 3 chain cases

* add claims no merge case and clean up

* address comments

* deps: bump Cosmos SDK to v0.45.2 (#457)

* deps: bump Cosmos SDK to v0.45.2

* changelog

* fix

* fix: v3 migration (#446)

* fix: v3 migration

* fix

* fix

* fix 2

* fix empty basefee

* upgrade ethermint

* dont force migration

* [ENG-139] add v3testnet migrator (#456)

* add v3testnet migrator

* fix lint

* address comments

* set store loader

* add constants

* forced upgrade code

* Update app/forks.go

Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* changelog

* fix comment

* remove existing modules from upgrade

* rm TODO

Co-authored-by: Ramiro Carlucho <ramirocarlucho@gmail.com>

* deps: bump ethermint to v0.13.0 (#458)

* deps: bump ethermint to v0.13.0

* changelog

* fix

* changelog

* fix lint

* fix

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
Co-authored-by: ramacarlucho <ramirocarlucho@gmail.com>
  • Loading branch information
4 people committed Apr 5, 2022
1 parent 2e886b2 commit 7710992
Show file tree
Hide file tree
Showing 71 changed files with 7,892 additions and 2,570 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [v3.0.0] - 2022-03-25
## [v3.0.0] - 2022-04-05

### State Machine Breaking

Expand All @@ -54,14 +54,18 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

- (deps) [\#427](https://github.com/tharsis/evmos/pull/427) Bump Ethermint to [`v0.12.0`](https://github.com/tharsis/ethermint/releases/tag/v0.12.0)
- (deps) [\#458](https://github.com/tharsis/evmos/pull/458) Bump Ethermint to [`v0.13.0`](https://github.com/tharsis/ethermint/releases/tag/v0.13.0)
- (deps) [\#457](https://github.com/tharsis/evmos/pull/457) Bump Cosmos SDK to [`v0.45.2`](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.2)
- (cmd) [\#446](https://github.com/tharsis/evmos/pull/446) Update `migrate` command to migrate Evmos, Ethermint and Cosmos SDK modules.
- (app) [\#446](https://github.com/tharsis/evmos/pull/446) Refactor upgrade code.
- (ibc) [\#412](https://github.com/tharsis/evmos/pull/412) Introduce boilerplate struct for IBC applications.
- (deps) [\#402](https://github.com/tharsis/evmos/pull/402) Bump IBC go to [`v3.0.0`](https://github.com/cosmos/ibc-go/releases/tag/v3.0.0)
- (ibctesting) [\#388](https://github.com/tharsis/evmos/pull/388) Support Cosmos and EVM chains in IBC testing `Coordinator`.
- (claims) [\#385](https://github.com/tharsis/evmos/pull/385) Add claims invariant.
- (inflation) [\#383](https://github.com/tharsis/evmos/pull/383) Add gRPC endpoints for inflation rate and total supply
- (inflation) [\#369](https://github.com/tharsis/evmos/pull/369) Add `enableInflation` parameter.
- (claims) [\#432](https://github.com/tharsis/evmos/pull/432) Add IBC trigger amount to claims merge/migrate IBC callbacks.
- (claims) [\#442](https://github.com/tharsis/evmos/pull/443) Remove claims merge/migrate cases where sender already completed an action as they are never reached

## [v2.0.1] - 2022-03-06

Expand Down
51 changes: 49 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
Expand Down Expand Up @@ -100,13 +101,14 @@ import (
evmrest "github.com/tharsis/ethermint/x/evm/client/rest"
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
evmtypes "github.com/tharsis/ethermint/x/evm/types"

"github.com/tharsis/ethermint/x/feemarket"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"

"github.com/tharsis/evmos/v3/app/ante"
v2 "github.com/tharsis/evmos/v3/app/upgrades/v2"
v2 "github.com/tharsis/evmos/v3/app/upgrades/mainnet/v2"
v3 "github.com/tharsis/evmos/v3/app/upgrades/mainnet/v3"
tv3 "github.com/tharsis/evmos/v3/app/upgrades/testnet/v3"
"github.com/tharsis/evmos/v3/x/claims"
claimskeeper "github.com/tharsis/evmos/v3/x/claims/keeper"
claimstypes "github.com/tharsis/evmos/v3/x/claims/types"
Expand Down Expand Up @@ -147,6 +149,10 @@ func init() {
const (
// Name defines the application binary name
Name = "evmosd"
// MainnetChainID defines the Evmos EIP155 chain ID for mainnet
MainnetChainID = "evmos_9001"
// TestnetChainID defines the Evmos EIP155 chain ID for testnet
TestnetChainID = "evmos_9000"
)

var (
Expand Down Expand Up @@ -803,7 +809,9 @@ func (app *Evmos) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.R
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}

app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())

return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down Expand Up @@ -1002,4 +1010,43 @@ func (app *Evmos) setupUpgradeHandlers() {
v2.UpgradeName,
v2.CreateUpgradeHandler(app.mm, app.configurator),
)
// v3 handler upgrade is
app.UpgradeKeeper.SetUpgradeHandler(
v3.UpgradeName,
v3.CreateUpgradeHandler(app.mm, app.configurator),
)

// testnet v3 handler upgrade is
app.UpgradeKeeper.SetUpgradeHandler(
tv3.UpgradeName,
tv3.CreateUpgradeHandler(app.mm, app.configurator),
)

// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
// This will read that value, and execute the preparations for the upgrade.
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

var storeUpgrades *storetypes.StoreUpgrades

switch {
case upgradeInfo.Name == v3.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
// prepare store for v3
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{recoverytypes.ModuleName},
}
case upgradeInfo.Name == tv3.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
// prepare store for testnet v3
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{recoverytypes.ModuleName},
}
}

if storeUpgrades != nil {
// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
}
}
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestEvmosExport(t *testing.T) {
// Initialize the chain
app.InitChain(
abci.RequestInitChain{
ChainId: "evmos_9001-1",
ChainId: MainnetChainID + "-1",
Validators: []abci.ValidatorUpdate{},
AppStateBytes: stateBytes,
},
Expand Down
29 changes: 26 additions & 3 deletions app/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

v2 "github.com/tharsis/evmos/v3/app/upgrades/v2"
v2 "github.com/tharsis/evmos/v3/app/upgrades/mainnet/v2"
tv3 "github.com/tharsis/evmos/v3/app/upgrades/testnet/v3"
)

// BeginBlockForks executes any necessary fork logic based upon the current block height.
func BeginBlockForks(ctx sdk.Context, app *Evmos) {
switch ctx.BlockHeight() {
case v2.UpgradeHeight:
// NOTE: only run for mainnet
if !strings.HasPrefix(ctx.ChainID(), "evmos_9001-") {
if !strings.HasPrefix(ctx.ChainID(), MainnetChainID) {
return
}

Expand All @@ -23,7 +24,29 @@ func BeginBlockForks(ctx sdk.Context, app *Evmos) {
Info: v2.UpgradeInfo,
Height: v2.UpgradeHeight,
}
err := app.UpgradeKeeper.ScheduleUpgradeNoHeightCheck(ctx, upgradePlan)

// FIXME: upstream no validation logic
err := app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan)
if err != nil {
panic(err)
}

// NOTE: THIS UPGRADE PLAN SHOULD BE ADDED TO VERSION 1.0.0-beta1
// This will create the upgrade plan on the defined height
// and will stop the chain once the height is reached.
// The new version should have the upgrade migration logic under the upgradeName
case tv3.UpgradeHeight:
// NOTE: only run for testnet
if !strings.HasPrefix(ctx.ChainID(), TestnetChainID) {
return
}

upgradePlan := upgradetypes.Plan{
Name: tv3.UpgradeName,
Info: tv3.UpgradeInfo,
Height: tv3.UpgradeHeight + 1,
}
err := app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Setup(
// Initialize the chain
app.InitChain(
abci.RequestInitChain{
ChainId: "evmos_9001-1",
ChainId: MainnetChainID + "-1",
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
Expand Down
17 changes: 15 additions & 2 deletions app/upgrades/README.md
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.
63 changes: 63 additions & 0 deletions app/upgrades/mainnet/v3/upgrades.go
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
}
7 changes: 7 additions & 0 deletions app/upgrades/testnet/v3/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package v3

const (
UpgradeName = "tv3"
UpgradeHeight = 0
UpgradeInfo = ``
)
85 changes: 85 additions & 0 deletions app/upgrades/testnet/v3/upgrades.go
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
}
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit 7710992

Please sign in to comment.