Skip to content

Commit

Permalink
Merge branch 'evmos:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups authored Nov 17, 2022
2 parents 833c4bf + eeb4e1f commit 5e6431a
Show file tree
Hide file tree
Showing 100 changed files with 2,815 additions and 837 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
**/**.go
go.mod
go.sum
- uses: golangci/[email protected].0
- uses: golangci/[email protected].1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

* (ante) [#1054](https://github.com/evmos/evmos/pull/1054) Remove validator commission `AnteHandler` decorator and replace it with the new `MinCommissionRate` staking parameter.
- (ante) [#1054](https://github.com/evmos/evmos/pull/1054) Remove validator commission `AnteHandler` decorator and replace it with the new `MinCommissionRate` staking parameter.
- (deps) [\#1041](https://github.com/evmos/evmos/pull/1041) Add ics23 dragonberry replace in go.mod as mentioned in the [Cosmos SDK release](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.4)
- (deps) [\#1037](https://github.com/evmos/evmos/pull/1037) Bump Ethermint version to [`v0.20.0-rc2`](https://github.com/evmos/ethermint/releases/tag/v0.20.0-rc2)
- (feat) [\#1070](https://github.com/evmos/evmos/pull/1070) Add amino support to the vesting module, it enables signing the module messages using EIP-712.

### API Breaking

Expand All @@ -58,6 +59,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (docs) [\#980](https://github.com/evmos/evmos/pull/980) Fix documentation links to cosmos-sdk docs.
- (cmd) [\#974](https://github.com/evmos/evmos/pull/974) Add `prune` command.
- (cmd) [\#1027](https://github.com/evmos/evmos/pull/1027) Apply Google CLI Syntax for required and optional args.
- (ibc) [\#1081](https://github.com/evmos/evmos/pull/1081) Added utils functions for ibc denoms.
- (ibc/erc20) [\#1085](https://github.com/evmos/evmos/pull/1085) Added wrapper for ibc transfer to automatically convert erc20 tokens to cosmos coins.
- (vesting) [\#1087](https://github.com/evmos/evmos/pull/1087) Add new `MsgUpdateVestingFunder` that updates the `Funder` field of a given clawback vesting account
- (docs) [\#1090](https://github.com/evmos/evmos/pull/1090) Add audits page to documentation.


## [v9.1.0] - 2022-10-25

Expand Down
6 changes: 3 additions & 3 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ante

import (
sdkerrors "cosmossdk.io/errors"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -33,7 +33,7 @@ func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
// handle as normal Cosmos SDK tx, except signature is checked for EIP712 representation
anteHandler = newCosmosAnteHandlerEip712(options)
default:
return ctx, sdkerrors.Wrapf(
return ctx, errorsmod.Wrapf(
errortypes.ErrUnknownExtensionOptions,
"rejecting tx with unsupported extension option: %s", typeURL,
)
Expand All @@ -48,7 +48,7 @@ func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
case sdk.Tx:
anteHandler = newCosmosAnteHandler(options)
default:
return ctx, sdkerrors.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
}

return anteHandler(ctx, tx, sim)
Expand Down
14 changes: 7 additions & 7 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ante

import (
sdkerrors "cosmossdk.io/errors"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -39,22 +39,22 @@ type HandlerOptions struct {
// Validate checks if the keepers are defined
func (options HandlerOptions) Validate() error {
if options.AccountKeeper == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "account keeper is required for AnteHandler")
return errorsmod.Wrap(errortypes.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "bank keeper is required for AnteHandler")
return errorsmod.Wrap(errortypes.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.StakingKeeper == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "staking keeper is required for AnteHandler")
return errorsmod.Wrap(errortypes.ErrLogic, "staking keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "sign mode handler is required for ante builder")
return errorsmod.Wrap(errortypes.ErrLogic, "sign mode handler is required for ante builder")
}
if options.FeeMarketKeeper == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "fee market keeper is required for AnteHandler")
return errorsmod.Wrap(errortypes.ErrLogic, "fee market keeper is required for AnteHandler")
}
if options.EvmKeeper == nil {
return sdkerrors.Wrap(errortypes.ErrLogic, "evm keeper is required for AnteHandler")
return errorsmod.Wrap(errortypes.ErrLogic, "evm keeper is required for AnteHandler")
}
return nil
}
Expand Down
18 changes: 9 additions & 9 deletions app/ante/vesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

sdkerrors "cosmossdk.io/errors"
errorsmod "cosmossdk.io/errors"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/authz"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -37,14 +37,14 @@ func (vtd EthVestingTransactionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx,
for _, msg := range tx.GetMsgs() {
msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx)
if !ok {
return ctx, sdkerrors.Wrapf(errortypes.ErrUnknownRequest,
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest,
"invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil),
)
}

acc := vtd.ak.GetAccount(ctx, msgEthTx.GetFrom())
if acc == nil {
return ctx, sdkerrors.Wrapf(errortypes.ErrUnknownAddress,
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownAddress,
"account %s does not exist", acc)
}

Expand All @@ -59,15 +59,15 @@ func (vtd EthVestingTransactionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx,
// grant while there are already vested coins on the account.
vested := clawbackAccount.GetVestedCoins(ctx.BlockTime())
if len(vested) == 0 {
return ctx, sdkerrors.Wrapf(vestingtypes.ErrInsufficientVestedCoins,
return ctx, errorsmod.Wrapf(vestingtypes.ErrInsufficientVestedCoins,
"cannot perform Ethereum tx with clawback vesting account, that has no vested coins: %s", vested,
)
}

// Error if account has locked coins (before surpassing all lockup periods)
islocked := clawbackAccount.HasLockedCoins(ctx.BlockTime())
if islocked {
return ctx, sdkerrors.Wrapf(vestingtypes.ErrVestingLockup,
return ctx, errorsmod.Wrapf(vestingtypes.ErrVestingLockup,
"cannot perform Ethereum tx with clawback vesting account, that has locked coins: %s", vested,
)
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func (vdd VestingDelegationDecorator) validateAuthz(ctx sdk.Context, execMsg *au
for _, v := range execMsg.Msgs {
var innerMsg sdk.Msg
if err := vdd.cdc.UnpackAny(v, &innerMsg); err != nil {
return sdkerrors.Wrap(err, "cannot unmarshal authz exec msgs")
return errorsmod.Wrap(err, "cannot unmarshal authz exec msgs")
}

if err := vdd.validateMsg(ctx, innerMsg); err != nil {
Expand All @@ -141,7 +141,7 @@ func (vdd VestingDelegationDecorator) validateMsg(ctx sdk.Context, msg sdk.Msg)
for _, addr := range msg.GetSigners() {
acc := vdd.ak.GetAccount(ctx, addr)
if acc == nil {
return sdkerrors.Wrapf(
return errorsmod.Wrapf(
errortypes.ErrUnknownAddress,
"account %s does not exist", addr,
)
Expand All @@ -157,15 +157,15 @@ func (vdd VestingDelegationDecorator) validateMsg(ctx sdk.Context, msg sdk.Msg)
bondDenom := vdd.sk.BondDenom(ctx)
coins := clawbackAccount.GetVestedOnly(ctx.BlockTime())
if coins == nil || coins.Empty() {
return sdkerrors.Wrap(
return errorsmod.Wrap(
vestingtypes.ErrInsufficientVestedCoins,
"account has no vested coins",
)
}

vested := coins.AmountOf(bondDenom)
if vested.LT(delegateMsg.Amount.Amount) {
return sdkerrors.Wrapf(
return errorsmod.Wrapf(
vestingtypes.ErrInsufficientVestedCoins,
"cannot delegate unvested coins. coins vested < delegation amount (%s < %s)",
vested, delegateMsg.Amount.Amount,
Expand Down
30 changes: 20 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types"

"github.com/cosmos/ibc-go/v5/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper"
ibctransfer "github.com/cosmos/ibc-go/v5/modules/apps/transfer"
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v5/modules/core"
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
Expand Down Expand Up @@ -118,6 +117,7 @@ import (
v82 "github.com/evmos/evmos/v10/app/upgrades/v8_2"
v9 "github.com/evmos/evmos/v10/app/upgrades/v9"
v91 "github.com/evmos/evmos/v10/app/upgrades/v9_1"
evmostypes "github.com/evmos/evmos/v10/types"
"github.com/evmos/evmos/v10/x/claims"
claimskeeper "github.com/evmos/evmos/v10/x/claims/keeper"
claimstypes "github.com/evmos/evmos/v10/x/claims/types"
Expand All @@ -144,6 +144,10 @@ import (
"github.com/evmos/evmos/v10/x/vesting"
vestingkeeper "github.com/evmos/evmos/v10/x/vesting/keeper"
vestingtypes "github.com/evmos/evmos/v10/x/vesting/types"

// NOTE: override ICS20 keeper to support IBC transfers of ERC20 tokens
"github.com/evmos/evmos/v10/x/ibc/transfer"
transferkeeper "github.com/evmos/evmos/v10/x/ibc/transfer/keeper"
)

func init() {
Expand All @@ -161,6 +165,9 @@ func init() {
feemarkettypes.DefaultMinGasMultiplier = MainnetMinGasMultiplier
// modify default min commission to 5%
stakingtypes.DefaultMinCommissionRate = sdk.NewDecWithPrec(5, 2)

// Include the possibility to use an ERC-20 contract address as coin Denom
sdk.SetCoinDenomRegex(evmostypes.EvmosCoinDenomRegex)
}

// Name defines the application binary name
Expand Down Expand Up @@ -197,7 +204,7 @@ var (
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
transfer.AppModuleBasic{AppModuleBasic: &ibctransfer.AppModuleBasic{}},
vesting.AppModuleBasic{},
evm.AppModuleBasic{},
feemarket.AppModuleBasic{},
Expand Down Expand Up @@ -271,7 +278,7 @@ type Evmos struct {
AuthzKeeper authzkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
TransferKeeper transferkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -518,11 +525,12 @@ func NewEvmos(
// RecvPacket, message that originates from core IBC and goes down to app, the flow is the otherway
// channel.RecvPacket -> recovery.OnRecvPacket -> claim.OnRecvPacket -> transfer.OnRecvPacket

app.TransferKeeper = ibctransferkeeper.NewKeeper(
app.TransferKeeper = transferkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.ClaimsKeeper, // ICS4 Wrapper: claims IBC middleware
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper,
app.Erc20Keeper, // Add ERC20 Keeper for ERC20 transfers
)

app.RecoveryKeeper = recoverykeeper.NewKeeper(
Expand All @@ -534,19 +542,21 @@ func NewEvmos(
app.ClaimsKeeper,
)

// Set the ICS4 wrappers for claims and recovery middlewares
// NOTE: app.Erc20Keeper is already initialized elsewhere

// Set the ICS4 wrappers for custom module middlewares
app.RecoveryKeeper.SetICS4Wrapper(app.IBCKeeper.ChannelKeeper)
app.ClaimsKeeper.SetICS4Wrapper(app.RecoveryKeeper)
// NOTE: ICS4 wrapper for Transfer Keeper already set

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

// transfer stack contains (from top to bottom):
// transfer stack contains (from bottom to top):
// - Recovery Middleware
// - Airdrop Claims Middleware
// - Transfer
// - IBC Transfer

// create IBC module from bottom to top of stack
// create IBC module from top to bottom of stack
var transferStack porttypes.IBCModule

transferStack = transfer.NewIBCModule(app.TransferKeeper)
Expand Down
6 changes: 3 additions & 3 deletions app/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"fmt"

sdkerrors "cosmossdk.io/errors"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -44,7 +44,7 @@ func SigVerificationGasConsumer(
case *ed25519.PubKey:
// Validator keys
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519")
return sdkerrors.Wrap(errortypes.ErrInvalidPubKey, "ED25519 public keys are unsupported")
return errorsmod.Wrap(errortypes.ErrInvalidPubKey, "ED25519 public keys are unsupported")

case multisig.PubKey:
// Multisig keys
Expand All @@ -55,7 +55,7 @@ func SigVerificationGasConsumer(
return ConsumeMultisignatureVerificationGas(meter, multisignature, pubkey, params, sig.Sequence)

default:
return sdkerrors.Wrapf(errortypes.ErrInvalidPubKey, "unrecognized/unsupported public key type: %T", pubkey)
return errorsmod.Wrapf(errortypes.ErrInvalidPubKey, "unrecognized/unsupported public key type: %T", pubkey)
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit 5e6431a

Please sign in to comment.