Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (evm) [#695](https://github.com/crypto-org-chain/ethermint/pull/695) Remove more miner unused methods
* (evm) [#696](https://github.com/crypto-org-chain/ethermint/pull/696) Upgrade golangci-lint to v2 and enhance github workflows
* (evm) [#702](https://github.com/crypto-org-chain/ethermint/pull/702) Add default value of CancunTime and PragueTime in chain config
* (evm) [#690](https://github.com/crypto-org-chain/ethermint/pull/690) Support EIP-7702 transaction type

### Features

Expand Down
14 changes: 9 additions & 5 deletions ante/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func VerifyEthAccount(
ctx sdk.Context, tx sdk.Tx,
evmKeeper interfaces.EVMKeeper, evmDenom string,
accountGetter AccountGetter,
rules params.Rules,
) error {
if !ctx.IsCheckTx() {
return nil
Expand All @@ -92,10 +93,13 @@ func VerifyEthAccount(

// check whether the sender address is EOA
acct := statedb.NewAccountFromSdkAccount(accountGetter(from))
if acct.IsContract() {
fromAddr := common.BytesToAddress(from)
return errorsmod.Wrapf(errortypes.ErrInvalidType,
"the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash)

if !rules.IsPrague {
if acct.IsContract() {
fromAddr := common.BytesToAddress(from)
return errorsmod.Wrapf(errortypes.ErrInvalidType,
"the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash)
}
}

balance := evmKeeper.GetBalance(ctx, from, evmDenom)
Expand Down Expand Up @@ -162,7 +166,7 @@ func CheckEthGasConsume(
continue
}

fees, err := keeper.VerifyFee(msgEthTx, evmDenom, baseFee, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai, ctx.IsCheckTx())
fees, err := keeper.VerifyFee(msgEthTx, evmDenom, baseFee, rules, ctx.IsCheckTx())
if err != nil {
return ctx, errorsmod.Wrapf(err, "failed to verify the fees")
}
Expand Down
10 changes: 10 additions & 0 deletions ante/interfaces/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ func ValidateEthBasic(ctx sdk.Context, tx sdk.Tx, evmParams *evmtypes.Params, ba
"rejected unprotected Ethereum transaction. Please EIP155 sign your transaction to protect it against replay-attacks")
}

// Check that EIP-7702 authorization list signatures are well formed.
if tx.SetCodeAuthorizations() != nil {
if tx.To() == nil {
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "EIP-7702 set code transaction cannot be contract creation (sender %v)", msgEthTx.From)
}
if len(tx.SetCodeAuthorizations()) == 0 {
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "EIP-7702 authorization list cannot be empty (sender %v)", msgEthTx.From)
}
}

txFee = txFee.Add(sdk.Coin{Denom: evmDenom, Amount: sdkmath.NewIntFromBigInt(msgEthTx.GetFee())})
}

Expand Down
9 changes: 7 additions & 2 deletions evmd/ante/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ package ante_test
import (
"errors"
"fmt"
"github.com/evmos/ethermint/ante/cache"
"math"
"math/big"

"github.com/evmos/ethermint/ante/cache"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/holiman/uint256"
"google.golang.org/protobuf/proto"

storetypes "cosmossdk.io/store/types"
"github.com/ethereum/go-ethereum/core/tracing"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/evmos/ethermint/ante"
"github.com/evmos/ethermint/server/config"
"github.com/evmos/ethermint/tests"
Expand Down Expand Up @@ -96,7 +98,10 @@ func (suite *AnteTestSuite) TestNewEthAccountVerificationDecorator() {
suite.Require().NoError(vmdb.Commit())

accountGetter := ante.NewCachedAccountGetter(suite.ctx, suite.app.AccountKeeper)
err := ante.VerifyEthAccount(suite.ctx.WithIsCheckTx(tc.checkTx), tc.tx, suite.app.EvmKeeper, evmtypes.DefaultEVMDenom, accountGetter)
rules := params.Rules{
IsPrague: false,
}
err := ante.VerifyEthAccount(suite.ctx.WithIsCheckTx(tc.checkTx), tc.tx, suite.app.EvmKeeper, evmtypes.DefaultEVMDenom, accountGetter, rules)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion evmd/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
// it's safe because there's no store branching in the ante handlers.
accountGetter := evmante.NewCachedAccountGetter(ctx, options.AccountKeeper)

if err := evmante.VerifyEthAccount(ctx, tx, options.EvmKeeper, evmDenom, accountGetter); err != nil {
if err := evmante.VerifyEthAccount(ctx, tx, options.EvmKeeper, evmDenom, accountGetter, rules); err != nil {
return ctx, err
}

Expand Down
95 changes: 49 additions & 46 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ schema = 3
version = "v1.0.2"
hash = "sha256-ZgO21iLMf6JN740JQizNI0v1mogNUTc77CXrUVSvDcg="
[mod."cosmossdk.io/log"]
version = "v1.5.1"
hash = "sha256-0k5Njvo59BHi923/+frZmPZnzc7ebXaMi0+MpNFLu0A="
version = "v1.6.1"
hash = "sha256-wz5TjyHP+24VL57msJLVepTqNChSE2WMW9Dt33AyPWo="
[mod."cosmossdk.io/math"]
version = "v1.5.3"
hash = "sha256-8jBAGa0D9EYBzn9SxiJNZwj3ChFtX03oow8BEP7dIU4="
Expand Down Expand Up @@ -89,14 +89,17 @@ schema = 3
version = "v1.5.7"
hash = "sha256-GlSZOyix7Ct7tOKmSKpGckDjMhTtiYPBTpoWdwGLx5M="
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp"]
version = "v1.27.0"
hash = "sha256-zdT1oaizbstU0ZlAzsV/EmOkkaOoDfX7tXrMYNRD7gI="
version = "v1.29.0"
hash = "sha256-RjFWSVTnRl6VVyvHo0xSdP2N8r/M1uDrMY13QuzuoK8="
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric"]
version = "v0.48.1"
hash = "sha256-hClW3wbw/4yAIxh+Wb8muAuq5W4EF5lF219ShJX4x40="
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping"]
version = "v0.48.1"
hash = "sha256-r/Aeb+gQXcko/VEtRJ8eMh6PoC+oWAXCN0PtscvzcPw="
[mod."github.com/Masterminds/semver/v3"]
version = "v3.4.0"
hash = "sha256-75kRraVwYVjYLWZvuSlts4Iu28Eh3SpiF0GHc7vCYHI="
[mod."github.com/Microsoft/go-winio"]
version = "v0.6.2"
hash = "sha256-tVNWDUMILZbJvarcl/E7tpSnkn7urqgSHa2Eaka5vSU="
Expand Down Expand Up @@ -143,11 +146,11 @@ schema = 3
version = "v1.1.0"
hash = "sha256-F+EqvufC+KBslZV/vL8ph6MqDoVD5ic5rVaM27reDqo="
[mod."github.com/bytedance/sonic"]
version = "v1.13.2"
hash = "sha256-IF2qmt4IxTwivMWHUJC8sg6d85/ORb2SWvJ54fvoAMI="
version = "v1.14.0"
hash = "sha256-caxXESTGRVGIOMyhgZTVxjVTyoT7LkGdPjQh17H7S7Y="
[mod."github.com/bytedance/sonic/loader"]
version = "v0.2.4"
hash = "sha256-rv9LnePpm4OspSVbfSoVbohXzhu+dxE1BH1gm3mTmTc="
version = "v0.3.0"
hash = "sha256-nYgehtTjd3INGcLqwKKzXEmjIbKYlpeDnYwewH/pskQ="
[mod."github.com/cenkalti/backoff/v4"]
version = "v4.3.0"
hash = "sha256-wfVjNZsGG1WoNC5aL+kdcy6QXPgZo4THAevZ1787md8="
Expand Down Expand Up @@ -320,8 +323,8 @@ schema = 3
version = "v0.33.0"
hash = "sha256-pu9akz2POlvlU7ynCSyOKhafByB+jsQm/8uYKJjrtds="
[mod."github.com/go-jose/go-jose/v4"]
version = "v4.0.5"
hash = "sha256-xDbwQfxNiH0gdNMCuxa6qKqiAeOhsnWm8MYSM+KISew="
version = "v4.1.1"
hash = "sha256-G8QU1HforBE7kMVMvVCOaQZ49UA0iTW2mldsBUjw+DY="
[mod."github.com/go-kit/kit"]
version = "v0.13.0"
hash = "sha256-EncDzq0JVtY+NLlW5lD+nbVewNYTTrfzlOxI4PuwREw="
Expand All @@ -347,8 +350,8 @@ schema = 3
version = "v3.0.0"
hash = "sha256-vCCw4MXVBm33VNLXcOBccVDD1CSnzDvDdWB6w5FN1cA="
[mod."github.com/go-viper/mapstructure/v2"]
version = "v2.3.0"
hash = "sha256-1aAH3Iqp8ntSFoMT1NrgDBaKJ6UOjw/1/dzePIF2nR4="
version = "v2.4.0"
hash = "sha256-lLfcV9z4n94hDhgyXJlde4bFB0hfzlbh+polqcJCwGE="
[mod."github.com/godbus/dbus"]
version = "v0.0.0-20190726142602-4481cbc300e2"
hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY="
Expand Down Expand Up @@ -425,8 +428,8 @@ schema = 3
version = "v0.5.2"
hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ="
[mod."github.com/hashicorp/go-getter"]
version = "v1.7.8"
hash = "sha256-3ISgkCNTZSC8Z6HrmBN0FmYrG08awMO4HSAvRtaIlbw="
version = "v1.7.9"
hash = "sha256-wWMsgh5pxMdSDqUy2A0z6CT+kxmJwypieL0SLnPtBw8="
[mod."github.com/hashicorp/go-hclog"]
version = "v1.6.3"
hash = "sha256-BK2s+SH1tQyUaXCH4kC0/jgqiSu638UFbwamfKjFOYg="
Expand Down Expand Up @@ -523,9 +526,6 @@ schema = 3
[mod."github.com/mitchellh/go-homedir"]
version = "v1.1.0"
hash = "sha256-oduBKXHAQG8X6aqLEpqZHs5DOKe84u6WkBwi4W6cv3k="
[mod."github.com/mitchellh/go-testing-interface"]
version = "v1.14.1"
hash = "sha256-TMGi38D13BEVN5cpeKDzKRIgLclm4ErOG+JEyqJrN/c="
[mod."github.com/mitchellh/mapstructure"]
version = "v1.5.0"
hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE="
Expand All @@ -548,11 +548,11 @@ schema = 3
version = "v0.0.5"
hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4="
[mod."github.com/onsi/ginkgo/v2"]
version = "v2.23.4"
hash = "sha256-AVq5cBqBhja/BMSMHqeLkXjmYV8+ddTRthiGWt28c38="
version = "v2.25.1"
hash = "sha256-nBIe6GhEBn2g7/BzkzNHynfUf+Dm+b3rkN/yW7WB8vQ="
[mod."github.com/onsi/gomega"]
version = "v1.38.0"
hash = "sha256-96uL3QlcQBpnyjMbKDBO2fgq+28ay/5IQjAEQ4jIGjI="
version = "v1.38.2"
hash = "sha256-chit6Aia8qLfUfn/2stQmXG/nqM13fDN7edfixXBFsM="
[mod."github.com/pelletier/go-toml/v2"]
version = "v2.2.4"
hash = "sha256-8qQIPldbsS5RO8v/FW/se3ZsAyvLzexiivzJCbGRg2Q="
Expand Down Expand Up @@ -647,8 +647,8 @@ schema = 3
version = "v0.5.2"
hash = "sha256-VKYxrrFb1nkX6Wu3tE5DoP9+fCttwSl9pgLN6567nck="
[mod."github.com/stretchr/testify"]
version = "v1.10.0"
hash = "sha256-fJ4gnPr0vnrOhjQYQwJ3ARDKPsOtA7d4olQmQWR+wpI="
version = "v1.11.1"
hash = "sha256-sWfjkuKJyDllDEtnM8sb/pdLzPQmUYWYtmeWz/5suUc="
[mod."github.com/subosito/gotenv"]
version = "v1.6.0"
hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A="
Expand Down Expand Up @@ -691,8 +691,8 @@ schema = 3
version = "v1.1.0"
hash = "sha256-3YhWBtSwRLGwm7vNwqumphZG3uLBW1vwT9QkQ8JuSjU="
[mod."github.com/ulikunitz/xz"]
version = "v0.5.11"
hash = "sha256-SUyrjc2wyN3cTGKe5JdBEXjtZC1rJySRxJHVUZ59row="
version = "v0.5.14"
hash = "sha256-21oXcIVmFyw+ukGQtflly0wpqaqh1jE0C9hLDSFYR7E="
[mod."github.com/zeebo/errs"]
version = "v1.4.0"
hash = "sha256-vh1b1ns2mFyr5KCECjQd2pf2JKfUfB6oR2O+k/vFda8="
Expand Down Expand Up @@ -721,20 +721,20 @@ schema = 3
version = "v0.58.0"
hash = "sha256-iqTPHfR1wXZY/yVTWtRBMjWlZkRxasaBGNhsNWHYxGw="
[mod."go.opentelemetry.io/otel"]
version = "v1.36.0"
hash = "sha256-j8wojdCtKal3LKojanHA8KXXQ0FkbWONpO8tUxpJDko="
version = "v1.37.0"
hash = "sha256-zWpyp9K8/Te86uhNjamchZctTdAnmHhoVw9m4ACfSoo="
[mod."go.opentelemetry.io/otel/metric"]
version = "v1.36.0"
hash = "sha256-z6Uqi4HhUljWIYd58svKK5MqcGbpcac+/M8JeTrUtJ8="
version = "v1.37.0"
hash = "sha256-BWnkdldA3xzGhnaConzMAuQzOnugytIvrP6GjkZVAYg="
[mod."go.opentelemetry.io/otel/sdk"]
version = "v1.36.0"
hash = "sha256-rg8T1fsoU6WTHcfnbWgB8hOxiufXmOhNqXpxlqbJQK4="
version = "v1.37.0"
hash = "sha256-uNFhKuSRhf+SXwVu8mg/qqsVio7KstVN/WyCTxgWHT0="
[mod."go.opentelemetry.io/otel/sdk/metric"]
version = "v1.36.0"
hash = "sha256-kCJXX26+jXz/bFBpnNmFi6r+EusDXsy24tk7FgQbVgA="
version = "v1.37.0"
hash = "sha256-dm6Aa5UDFgQCVexayiWu85A1ir1lpNn5rIN9tj9KVDs="
[mod."go.opentelemetry.io/otel/trace"]
version = "v1.36.0"
hash = "sha256-owWD9x1lp8aIJqYt058BXPUsIMHdk3RI0escso0BxwA="
version = "v1.37.0"
hash = "sha256-FBeLOb5qmIiE9VmbgCf1l/xpndBqHkRiaPt1PvoKrVY="
[mod."go.uber.org/automaxprocs"]
version = "v1.6.0"
hash = "sha256-a/Agm+kM9x+VRo0CYyTL3ipUYv9Glrc4NeGSZJdpobA="
Expand All @@ -744,9 +744,12 @@ schema = 3
[mod."go.yaml.in/yaml/v2"]
version = "v2.4.2"
hash = "sha256-oC8RWdf1zbMYCtmR0ATy/kCkhIwPR9UqFZSMOKLVF/A="
[mod."go.yaml.in/yaml/v3"]
version = "v3.0.4"
hash = "sha256-NkGFiDPoCxbr3LFsI6OCygjjkY0rdmg5ggvVVwpyDQ4="
[mod."golang.org/x/arch"]
version = "v0.15.0"
hash = "sha256-EsCsTDmn+j3S8yzV4n2WJyDuYBDwIlj29M9OBxWNMGQ="
version = "v0.17.0"
hash = "sha256-avV63nZlJxuo3/LLBKQ2a96Nn1wflNtc1Dr7GSPbHAs="
[mod."golang.org/x/crypto"]
version = "v0.41.0"
hash = "sha256-o5Di0lsFmYnXl7a5MBTqmN9vXMCRpE9ay71C1Ar8jEY="
Expand Down Expand Up @@ -775,26 +778,26 @@ schema = 3
version = "v0.10.0"
hash = "sha256-vnlAME3gDR6R4cbCmSYAlR1Rjc0yUpkufTOPNvCdf6Q="
[mod."golang.org/x/tools"]
version = "v0.35.0"
hash = "sha256-5aTV8oS9e0frUNUE2Pw+yTnPLghmZHryDa01COSyrCM="
version = "v0.36.0"
hash = "sha256-p91Ig5XR7JL0rxIQdCRZBJvK4M8apyoeV/sOLyjOndk="
[mod."google.golang.org/api"]
version = "v0.222.0"
hash = "sha256-n1qxH8dqwl7Drry1H9bpQx7EeysceA98UrgEDxd1XEM="
[mod."google.golang.org/genproto"]
version = "v0.0.0-20241118233622-e639e219e697"
hash = "sha256-QcnHSM6CWo18f0rqeXHSCFaydwFp+nENjE8x/NErgEI="
[mod."google.golang.org/genproto/googleapis/api"]
version = "v0.0.0-20250528174236-200df99c418a"
hash = "sha256-VO7Rko8b/zO2sm6vML7hhxi9laPilt6JEab8xl4qIN8="
version = "v0.0.0-20250707201910-8d1bb00bc6a7"
hash = "sha256-xtTBmzlyynWQa0KtuQpNZ4fzSTB/5ozXclE3SuP3naI="
[mod."google.golang.org/genproto/googleapis/rpc"]
version = "v0.0.0-20250528174236-200df99c418a"
version = "v0.0.0-20250707201910-8d1bb00bc6a7"
hash = "sha256-WK7iDtAhH19NPe3TywTQlGjDawNaDKWnxhFL9PgVUwM="
[mod."google.golang.org/grpc"]
version = "v1.74.2"
hash = "sha256-tvYMdfu/ZQZRPZNmnQI4CZpg46CM8+mD49hw0gFheGs="
version = "v1.75.0"
hash = "sha256-bMJEB2luUeYWwsQWqzuq4Wro2tTKBWGJPuTtzioJcfM="
[mod."google.golang.org/protobuf"]
version = "v1.36.7"
hash = "sha256-6xCU+t2AVPcscMKenVs4etGqutYGPDXCQ3DCD3PpTq4="
version = "v1.36.8"
hash = "sha256-yZN8ZON0b5HjUNUSubHst7zbvnMsOzd81tDPYQRtPgM="
[mod."gopkg.in/yaml.v3"]
version = "v3.0.1"
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU="
Expand Down
24 changes: 19 additions & 5 deletions nix/testenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,25 @@ poetry2nix.mkPoetryEnv {
eth-bloom = [ "setuptools" ];
};
in
lib.mapAttrs (
attr: systems:
(
lib.mapAttrs (
attr: systems:
super.${attr}.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
) buildSystems
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
) buildSystems) // {
# Fix malformed license field in types-requests package
types-requests = super.types-requests.overridePythonAttrs (old: {
postPatch = (old.postPatch or "") + ''
# Fix malformed license field in pyproject.toml
if [ -f pyproject.toml ]; then
# Fix license field format
sed -i 's/license = "Apache-2.0"/license = {text = "Apache-2.0"}/' pyproject.toml
# Remove invalid license-files property from [project] section
sed -i '/^license-files = /d' pyproject.toml
fi
'';
});
}
);
}
Loading
Loading