Skip to content

Commit

Permalink
chore: remove claims mod & migrate EVMChannels param to evm params (#…
Browse files Browse the repository at this point in the history
…2084)

* add params to evm

* gen proto

* chore: migrate claims params to evm

* add changelog entry

* fix test

* remove unused functions

* address go.mod warning

* remove deprecated authorized channels param

* add evm store migration

* make format

* Revert "remove unused functions"

This reverts commit 96b5389.

* fix lint issues

* update exp gas values

* fix type registration

* add IsEVMChannel func

* remove claims module

* update changelog

* remove claims proto

* update lic

* address review comments

---------

Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 29, 2023
1 parent c58a849 commit 6080ed9
Show file tree
Hide file tree
Showing 81 changed files with 4,530 additions and 13,887 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

- (evm) [#2084](https://github.com/evmos/evmos/pull/2084) Remove `x/claims` params and migrate the `EVMChannels` param to the `x/evm` module params.
- (recovery) [#2087](https://github.com/evmos/evmos/pull/2087) Remove `x/recovery` module.
- (incentives) [#2070](https://github.com/evmos/evmos/pull/2070) Remove `x/incentives` module and burn incentives pool balance.

Expand Down
33 changes: 4 additions & 29 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ import (
"github.com/evmos/evmos/v15/precompiles/common"
srvflags "github.com/evmos/evmos/v15/server/flags"
evmostypes "github.com/evmos/evmos/v15/types"
"github.com/evmos/evmos/v15/x/claims"
claimskeeper "github.com/evmos/evmos/v15/x/claims/keeper"
claimstypes "github.com/evmos/evmos/v15/x/claims/types"
"github.com/evmos/evmos/v15/x/epochs"
epochskeeper "github.com/evmos/evmos/v15/x/epochs/keeper"
epochstypes "github.com/evmos/evmos/v15/x/epochs/types"
Expand Down Expand Up @@ -238,7 +235,6 @@ var (
inflation.AppModuleBasic{},
erc20.AppModuleBasic{},
epochs.AppModuleBasic{},
claims.AppModuleBasic{},
revenue.AppModuleBasic{},
consensus.AppModuleBasic{},
)
Expand All @@ -255,7 +251,6 @@ var (
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
inflationtypes.ModuleName: {authtypes.Minter},
erc20types.ModuleName: {authtypes.Minter, authtypes.Burner},
claimstypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -311,7 +306,6 @@ type Evmos struct {

// Evmos keepers
InflationKeeper inflationkeeper.Keeper
ClaimsKeeper *claimskeeper.Keeper
Erc20Keeper erc20keeper.Keeper
EpochsKeeper epochskeeper.Keeper
VestingKeeper vestingkeeper.Keeper
Expand Down Expand Up @@ -485,19 +479,13 @@ func NewEvmos(
authtypes.FeeCollectorName,
)

app.ClaimsKeeper = claimskeeper.NewKeeper(
appCodec, keys[claimstypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, stakingKeeper, app.DistrKeeper, app.IBCKeeper.ChannelKeeper,
)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
// NOTE: Distr, Slashing and Claim must be created before calling the Hooks method to avoid returning a Keeper without its table generated
stakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(
app.DistrKeeper.Hooks(),
app.SlashingKeeper.Hooks(),
app.ClaimsKeeper.Hooks(),
),
)

Expand All @@ -510,7 +498,7 @@ func NewEvmos(

app.Erc20Keeper = erc20keeper.NewKeeper(
keys[erc20types.StoreKey], appCodec, authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.EvmKeeper, app.StakingKeeper, app.ClaimsKeeper,
app.AccountKeeper, app.BankKeeper, app.EvmKeeper, app.StakingKeeper,
app.AuthzKeeper, &app.TransferKeeper,
)

Expand All @@ -522,7 +510,7 @@ func NewEvmos(

app.TransferKeeper = transferkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.ClaimsKeeper, // ICS4 Wrapper: claims IBC middleware
app.IBCKeeper.ChannelKeeper, // ICS4 Wrapper: claims IBC middleware
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper,
app.Erc20Keeper, // Add ERC20 Keeper for ERC20 transfers
Expand Down Expand Up @@ -552,7 +540,6 @@ func NewEvmos(

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
app.ClaimsKeeper.Hooks(),
app.VestingKeeper.Hooks(),
),
)
Expand All @@ -561,23 +548,19 @@ func NewEvmos(
evmkeeper.NewMultiEvmHooks(
app.Erc20Keeper.Hooks(),
app.RevenueKeeper.Hooks(),
app.ClaimsKeeper.Hooks(),
),
)

// NOTE: app.Erc20Keeper is already initialized elsewhere

// Set the ICS4 wrappers for custom module middlewares
app.ClaimsKeeper.SetICS4Wrapper(app.IBCKeeper.ChannelKeeper)

// Override the ICS20 app module
transferModule := transfer.NewAppModule(app.TransferKeeper)

// Create the app.ICAHostKeeper
app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec, app.keys[icahosttypes.StoreKey],
app.GetSubspace(icahosttypes.SubModuleName),
app.ClaimsKeeper,
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
Expand Down Expand Up @@ -608,7 +591,6 @@ func NewEvmos(
var transferStack porttypes.IBCModule

transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = claims.NewIBCMiddleware(*app.ClaimsKeeper, transferStack)
transferStack = erc20.NewIBCMiddleware(app.Erc20Keeper, transferStack)

// Create static IBC router, add transfer route, then set and seal it
Expand Down Expand Up @@ -663,8 +645,6 @@ func NewEvmos(
erc20.NewAppModule(app.Erc20Keeper, app.AccountKeeper,
app.GetSubspace(erc20types.ModuleName)),
epochs.NewAppModule(appCodec, app.EpochsKeeper),
claims.NewAppModule(appCodec, *app.ClaimsKeeper,
app.GetSubspace(claimstypes.ModuleName)),
vesting.NewAppModule(app.VestingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
revenue.NewAppModule(app.RevenueKeeper, app.AccountKeeper,
app.GetSubspace(revenuetypes.ModuleName)),
Expand Down Expand Up @@ -701,7 +681,6 @@ func NewEvmos(
vestingtypes.ModuleName,
inflationtypes.ModuleName,
erc20types.ModuleName,
claimstypes.ModuleName,
revenuetypes.ModuleName,
consensusparamtypes.ModuleName,
)
Expand All @@ -714,7 +693,6 @@ func NewEvmos(
feemarkettypes.ModuleName,
// Note: epochs' endblock should be "real" end of epochs, we keep epochs endblock at the end
epochstypes.ModuleName,
claimstypes.ModuleName,
// no-op modules
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -749,8 +727,6 @@ func NewEvmos(
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
// NOTE: staking requires the claiming hook
claimstypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
govtypes.ModuleName,
Expand Down Expand Up @@ -1157,7 +1133,6 @@ func initParamsKeeper(
// evmos subspaces
paramsKeeper.Subspace(inflationtypes.ModuleName)
paramsKeeper.Subspace(erc20types.ModuleName)
paramsKeeper.Subspace(claimstypes.ModuleName)
paramsKeeper.Subspace(revenuetypes.ModuleName)
return paramsKeeper
}
Expand Down Expand Up @@ -1344,7 +1319,7 @@ func (app *Evmos) setupUpgradeHandlers() {
case v16.UpgradeName:
// recovery and incentives modules are deprecated in v16
storeUpgrades = &storetypes.StoreUpgrades{
Deleted: []string{"recoveryv1", "incentives"},
Deleted: []string{"recoveryv1", "incentives", "claims"},
}
}

Expand Down
3 changes: 1 addition & 2 deletions app/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
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"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
claimstypes "github.com/evmos/evmos/v15/x/claims/types"
epochstypes "github.com/evmos/evmos/v15/x/epochs/types"
erc20types "github.com/evmos/evmos/v15/x/erc20/types"
evmtypes "github.com/evmos/evmos/v15/x/evm/types"
Expand Down Expand Up @@ -54,7 +53,7 @@ func StoreKeys() (
evmtypes.StoreKey, feemarkettypes.StoreKey,
// evmos keys
inflationtypes.StoreKey, erc20types.StoreKey,
epochstypes.StoreKey, claimstypes.StoreKey, vestingtypes.StoreKey,
epochstypes.StoreKey, vestingtypes.StoreKey,
revenuetypes.StoreKey,
}

Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v16/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func CreateUpgradeHandler(
// recovery module is deprecated
logger.Debug("deleting recovery module from version map...")
delete(vm, "recovery")
logger.Debug("deleting claims module from version map...")
delete(vm, "claims")
logger.Debug("deleting incentives module from version map...")
delete(vm, "incentives")

Expand Down
15 changes: 0 additions & 15 deletions ibc/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ibc
import (
"testing"

"github.com/evmos/evmos/v15/x/claims/types"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -201,20 +200,6 @@ func TestGetTransferAmount(t *testing.T) {
"10000",
false,
},
{
"valid - IBCTriggerAmt",
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Receiver: "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v",
Amount: types.IBCTriggerAmt,
},
),
},
types.IBCTriggerAmt,
false,
},
}

for _, tc := range testCases {
Expand Down
2 changes: 2 additions & 0 deletions proto/ethermint/evm/v1/evm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ message Params {
// active_precompiles defines the slice of hex addresses of the precompiled
// contracts that are active
repeated string active_precompiles = 7;
// evm_channels is the list of channel identifiers from EVM compatible chains
repeated string evm_channels = 8 [(gogoproto.customname) = "EVMChannels"];
}

// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values
Expand Down
58 changes: 0 additions & 58 deletions proto/evmos/claims/v1/claims.proto

This file was deleted.

38 changes: 0 additions & 38 deletions proto/evmos/claims/v1/genesis.proto

This file was deleted.

0 comments on commit 6080ed9

Please sign in to comment.