Skip to content

Commit c60275c

Browse files
committed
feat: eip7702
1 parent ee752ec commit c60275c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4158
-535
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4545
* (evm) [#695](https://github.com/crypto-org-chain/ethermint/pull/695) Remove more miner unused methods
4646
* (evm) [#696](https://github.com/crypto-org-chain/ethermint/pull/696) Upgrade golangci-lint to v2 and enhance github workflows
4747
* (evm) [#702](https://github.com/crypto-org-chain/ethermint/pull/702) Add default value of CancunTime and PragueTime in chain config
48+
* (evm) [#690](https://github.com/crypto-org-chain/ethermint/pull/690) Support EIP-7702 transaction type
4849

4950
### Features
5051

ante/eth.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func VerifyEthAccount(
7171
ctx sdk.Context, tx sdk.Tx,
7272
evmKeeper interfaces.EVMKeeper, evmDenom string,
7373
accountGetter AccountGetter,
74+
rules params.Rules,
7475
) error {
7576
if !ctx.IsCheckTx() {
7677
return nil
@@ -92,10 +93,13 @@ func VerifyEthAccount(
9293

9394
// check whether the sender address is EOA
9495
acct := statedb.NewAccountFromSdkAccount(accountGetter(from))
95-
if acct.IsContract() {
96-
fromAddr := common.BytesToAddress(from)
97-
return errorsmod.Wrapf(errortypes.ErrInvalidType,
98-
"the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash)
96+
97+
if !rules.IsPrague {
98+
if acct.IsContract() {
99+
fromAddr := common.BytesToAddress(from)
100+
return errorsmod.Wrapf(errortypes.ErrInvalidType,
101+
"the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash)
102+
}
99103
}
100104

101105
balance := evmKeeper.GetBalance(ctx, from, evmDenom)
@@ -162,7 +166,7 @@ func CheckEthGasConsume(
162166
continue
163167
}
164168

165-
fees, err := keeper.VerifyFee(msgEthTx, evmDenom, baseFee, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai, ctx.IsCheckTx())
169+
fees, err := keeper.VerifyFee(msgEthTx, evmDenom, baseFee, rules, ctx.IsCheckTx())
166170
if err != nil {
167171
return ctx, errorsmod.Wrapf(err, "failed to verify the fees")
168172
}

ante/interfaces/setup.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ func ValidateEthBasic(ctx sdk.Context, tx sdk.Tx, evmParams *evmtypes.Params, ba
125125
"rejected unprotected Ethereum transaction. Please EIP155 sign your transaction to protect it against replay-attacks")
126126
}
127127

128+
// Check that EIP-7702 authorization list signatures are well formed.
129+
if tx.SetCodeAuthorizations() != nil {
130+
if tx.To() == nil {
131+
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "EIP-7702 set code transaction cannot be contract creation (sender %v)", msgEthTx.From)
132+
}
133+
if len(tx.SetCodeAuthorizations()) == 0 {
134+
return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "EIP-7702 authorization list cannot be empty (sender %v)", msgEthTx.From)
135+
}
136+
}
137+
128138
txFee = txFee.Add(sdk.Coin{Denom: evmDenom, Amount: sdkmath.NewIntFromBigInt(msgEthTx.GetFee())})
129139
}
130140

evmd/ante/eth_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ package ante_test
33
import (
44
"errors"
55
"fmt"
6-
"github.com/evmos/ethermint/ante/cache"
76
"math"
87
"math/big"
98

9+
"github.com/evmos/ethermint/ante/cache"
10+
1011
sdk "github.com/cosmos/cosmos-sdk/types"
1112
"github.com/holiman/uint256"
1213
"google.golang.org/protobuf/proto"
1314

1415
storetypes "cosmossdk.io/store/types"
1516
"github.com/ethereum/go-ethereum/core/tracing"
1617
ethtypes "github.com/ethereum/go-ethereum/core/types"
18+
"github.com/ethereum/go-ethereum/params"
1719
"github.com/evmos/ethermint/ante"
1820
"github.com/evmos/ethermint/server/config"
1921
"github.com/evmos/ethermint/tests"
@@ -96,7 +98,10 @@ func (suite *AnteTestSuite) TestNewEthAccountVerificationDecorator() {
9698
suite.Require().NoError(vmdb.Commit())
9799

98100
accountGetter := ante.NewCachedAccountGetter(suite.ctx, suite.app.AccountKeeper)
99-
err := ante.VerifyEthAccount(suite.ctx.WithIsCheckTx(tc.checkTx), tc.tx, suite.app.EvmKeeper, evmtypes.DefaultEVMDenom, accountGetter)
101+
rules := params.Rules{
102+
IsPrague: false,
103+
}
104+
err := ante.VerifyEthAccount(suite.ctx.WithIsCheckTx(tc.checkTx), tc.tx, suite.app.EvmKeeper, evmtypes.DefaultEVMDenom, accountGetter, rules)
100105

101106
if tc.expPass {
102107
suite.Require().NoError(err)

evmd/ante/handler_options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
139139
// it's safe because there's no store branching in the ante handlers.
140140
accountGetter := evmante.NewCachedAccountGetter(ctx, options.AccountKeeper)
141141

142-
if err := evmante.VerifyEthAccount(ctx, tx, options.EvmKeeper, evmDenom, accountGetter); err != nil {
142+
if err := evmante.VerifyEthAccount(ctx, tx, options.EvmKeeper, evmDenom, accountGetter, rules); err != nil {
143143
return ctx, err
144144
}
145145

gomod2nix.toml

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ schema = 3
4444
version = "v1.0.2"
4545
hash = "sha256-ZgO21iLMf6JN740JQizNI0v1mogNUTc77CXrUVSvDcg="
4646
[mod."cosmossdk.io/log"]
47-
version = "v1.5.1"
48-
hash = "sha256-0k5Njvo59BHi923/+frZmPZnzc7ebXaMi0+MpNFLu0A="
47+
version = "v1.6.1"
48+
hash = "sha256-wz5TjyHP+24VL57msJLVepTqNChSE2WMW9Dt33AyPWo="
4949
[mod."cosmossdk.io/math"]
5050
version = "v1.5.3"
5151
hash = "sha256-8jBAGa0D9EYBzn9SxiJNZwj3ChFtX03oow8BEP7dIU4="
@@ -89,14 +89,17 @@ schema = 3
8989
version = "v1.5.7"
9090
hash = "sha256-GlSZOyix7Ct7tOKmSKpGckDjMhTtiYPBTpoWdwGLx5M="
9191
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp"]
92-
version = "v1.27.0"
93-
hash = "sha256-zdT1oaizbstU0ZlAzsV/EmOkkaOoDfX7tXrMYNRD7gI="
92+
version = "v1.29.0"
93+
hash = "sha256-RjFWSVTnRl6VVyvHo0xSdP2N8r/M1uDrMY13QuzuoK8="
9494
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric"]
9595
version = "v0.48.1"
9696
hash = "sha256-hClW3wbw/4yAIxh+Wb8muAuq5W4EF5lF219ShJX4x40="
9797
[mod."github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping"]
9898
version = "v0.48.1"
9999
hash = "sha256-r/Aeb+gQXcko/VEtRJ8eMh6PoC+oWAXCN0PtscvzcPw="
100+
[mod."github.com/Masterminds/semver/v3"]
101+
version = "v3.4.0"
102+
hash = "sha256-75kRraVwYVjYLWZvuSlts4Iu28Eh3SpiF0GHc7vCYHI="
100103
[mod."github.com/Microsoft/go-winio"]
101104
version = "v0.6.2"
102105
hash = "sha256-tVNWDUMILZbJvarcl/E7tpSnkn7urqgSHa2Eaka5vSU="
@@ -143,11 +146,11 @@ schema = 3
143146
version = "v1.1.0"
144147
hash = "sha256-F+EqvufC+KBslZV/vL8ph6MqDoVD5ic5rVaM27reDqo="
145148
[mod."github.com/bytedance/sonic"]
146-
version = "v1.13.2"
147-
hash = "sha256-IF2qmt4IxTwivMWHUJC8sg6d85/ORb2SWvJ54fvoAMI="
149+
version = "v1.14.0"
150+
hash = "sha256-caxXESTGRVGIOMyhgZTVxjVTyoT7LkGdPjQh17H7S7Y="
148151
[mod."github.com/bytedance/sonic/loader"]
149-
version = "v0.2.4"
150-
hash = "sha256-rv9LnePpm4OspSVbfSoVbohXzhu+dxE1BH1gm3mTmTc="
152+
version = "v0.3.0"
153+
hash = "sha256-nYgehtTjd3INGcLqwKKzXEmjIbKYlpeDnYwewH/pskQ="
151154
[mod."github.com/cenkalti/backoff/v4"]
152155
version = "v4.3.0"
153156
hash = "sha256-wfVjNZsGG1WoNC5aL+kdcy6QXPgZo4THAevZ1787md8="
@@ -320,8 +323,8 @@ schema = 3
320323
version = "v0.33.0"
321324
hash = "sha256-pu9akz2POlvlU7ynCSyOKhafByB+jsQm/8uYKJjrtds="
322325
[mod."github.com/go-jose/go-jose/v4"]
323-
version = "v4.0.5"
324-
hash = "sha256-xDbwQfxNiH0gdNMCuxa6qKqiAeOhsnWm8MYSM+KISew="
326+
version = "v4.1.1"
327+
hash = "sha256-G8QU1HforBE7kMVMvVCOaQZ49UA0iTW2mldsBUjw+DY="
325328
[mod."github.com/go-kit/kit"]
326329
version = "v0.13.0"
327330
hash = "sha256-EncDzq0JVtY+NLlW5lD+nbVewNYTTrfzlOxI4PuwREw="
@@ -347,8 +350,8 @@ schema = 3
347350
version = "v3.0.0"
348351
hash = "sha256-vCCw4MXVBm33VNLXcOBccVDD1CSnzDvDdWB6w5FN1cA="
349352
[mod."github.com/go-viper/mapstructure/v2"]
350-
version = "v2.3.0"
351-
hash = "sha256-1aAH3Iqp8ntSFoMT1NrgDBaKJ6UOjw/1/dzePIF2nR4="
353+
version = "v2.4.0"
354+
hash = "sha256-lLfcV9z4n94hDhgyXJlde4bFB0hfzlbh+polqcJCwGE="
352355
[mod."github.com/godbus/dbus"]
353356
version = "v0.0.0-20190726142602-4481cbc300e2"
354357
hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY="
@@ -425,8 +428,8 @@ schema = 3
425428
version = "v0.5.2"
426429
hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ="
427430
[mod."github.com/hashicorp/go-getter"]
428-
version = "v1.7.8"
429-
hash = "sha256-3ISgkCNTZSC8Z6HrmBN0FmYrG08awMO4HSAvRtaIlbw="
431+
version = "v1.7.9"
432+
hash = "sha256-wWMsgh5pxMdSDqUy2A0z6CT+kxmJwypieL0SLnPtBw8="
430433
[mod."github.com/hashicorp/go-hclog"]
431434
version = "v1.6.3"
432435
hash = "sha256-BK2s+SH1tQyUaXCH4kC0/jgqiSu638UFbwamfKjFOYg="
@@ -523,9 +526,6 @@ schema = 3
523526
[mod."github.com/mitchellh/go-homedir"]
524527
version = "v1.1.0"
525528
hash = "sha256-oduBKXHAQG8X6aqLEpqZHs5DOKe84u6WkBwi4W6cv3k="
526-
[mod."github.com/mitchellh/go-testing-interface"]
527-
version = "v1.14.1"
528-
hash = "sha256-TMGi38D13BEVN5cpeKDzKRIgLclm4ErOG+JEyqJrN/c="
529529
[mod."github.com/mitchellh/mapstructure"]
530530
version = "v1.5.0"
531531
hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE="
@@ -548,11 +548,11 @@ schema = 3
548548
version = "v0.0.5"
549549
hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4="
550550
[mod."github.com/onsi/ginkgo/v2"]
551-
version = "v2.23.4"
552-
hash = "sha256-AVq5cBqBhja/BMSMHqeLkXjmYV8+ddTRthiGWt28c38="
551+
version = "v2.25.1"
552+
hash = "sha256-nBIe6GhEBn2g7/BzkzNHynfUf+Dm+b3rkN/yW7WB8vQ="
553553
[mod."github.com/onsi/gomega"]
554-
version = "v1.38.0"
555-
hash = "sha256-96uL3QlcQBpnyjMbKDBO2fgq+28ay/5IQjAEQ4jIGjI="
554+
version = "v1.38.2"
555+
hash = "sha256-chit6Aia8qLfUfn/2stQmXG/nqM13fDN7edfixXBFsM="
556556
[mod."github.com/pelletier/go-toml/v2"]
557557
version = "v2.2.4"
558558
hash = "sha256-8qQIPldbsS5RO8v/FW/se3ZsAyvLzexiivzJCbGRg2Q="
@@ -647,8 +647,8 @@ schema = 3
647647
version = "v0.5.2"
648648
hash = "sha256-VKYxrrFb1nkX6Wu3tE5DoP9+fCttwSl9pgLN6567nck="
649649
[mod."github.com/stretchr/testify"]
650-
version = "v1.10.0"
651-
hash = "sha256-fJ4gnPr0vnrOhjQYQwJ3ARDKPsOtA7d4olQmQWR+wpI="
650+
version = "v1.11.1"
651+
hash = "sha256-sWfjkuKJyDllDEtnM8sb/pdLzPQmUYWYtmeWz/5suUc="
652652
[mod."github.com/subosito/gotenv"]
653653
version = "v1.6.0"
654654
hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A="
@@ -691,8 +691,8 @@ schema = 3
691691
version = "v1.1.0"
692692
hash = "sha256-3YhWBtSwRLGwm7vNwqumphZG3uLBW1vwT9QkQ8JuSjU="
693693
[mod."github.com/ulikunitz/xz"]
694-
version = "v0.5.11"
695-
hash = "sha256-SUyrjc2wyN3cTGKe5JdBEXjtZC1rJySRxJHVUZ59row="
694+
version = "v0.5.14"
695+
hash = "sha256-21oXcIVmFyw+ukGQtflly0wpqaqh1jE0C9hLDSFYR7E="
696696
[mod."github.com/zeebo/errs"]
697697
version = "v1.4.0"
698698
hash = "sha256-vh1b1ns2mFyr5KCECjQd2pf2JKfUfB6oR2O+k/vFda8="
@@ -721,20 +721,20 @@ schema = 3
721721
version = "v0.58.0"
722722
hash = "sha256-iqTPHfR1wXZY/yVTWtRBMjWlZkRxasaBGNhsNWHYxGw="
723723
[mod."go.opentelemetry.io/otel"]
724-
version = "v1.36.0"
725-
hash = "sha256-j8wojdCtKal3LKojanHA8KXXQ0FkbWONpO8tUxpJDko="
724+
version = "v1.37.0"
725+
hash = "sha256-zWpyp9K8/Te86uhNjamchZctTdAnmHhoVw9m4ACfSoo="
726726
[mod."go.opentelemetry.io/otel/metric"]
727-
version = "v1.36.0"
728-
hash = "sha256-z6Uqi4HhUljWIYd58svKK5MqcGbpcac+/M8JeTrUtJ8="
727+
version = "v1.37.0"
728+
hash = "sha256-BWnkdldA3xzGhnaConzMAuQzOnugytIvrP6GjkZVAYg="
729729
[mod."go.opentelemetry.io/otel/sdk"]
730-
version = "v1.36.0"
731-
hash = "sha256-rg8T1fsoU6WTHcfnbWgB8hOxiufXmOhNqXpxlqbJQK4="
730+
version = "v1.37.0"
731+
hash = "sha256-uNFhKuSRhf+SXwVu8mg/qqsVio7KstVN/WyCTxgWHT0="
732732
[mod."go.opentelemetry.io/otel/sdk/metric"]
733-
version = "v1.36.0"
734-
hash = "sha256-kCJXX26+jXz/bFBpnNmFi6r+EusDXsy24tk7FgQbVgA="
733+
version = "v1.37.0"
734+
hash = "sha256-dm6Aa5UDFgQCVexayiWu85A1ir1lpNn5rIN9tj9KVDs="
735735
[mod."go.opentelemetry.io/otel/trace"]
736-
version = "v1.36.0"
737-
hash = "sha256-owWD9x1lp8aIJqYt058BXPUsIMHdk3RI0escso0BxwA="
736+
version = "v1.37.0"
737+
hash = "sha256-FBeLOb5qmIiE9VmbgCf1l/xpndBqHkRiaPt1PvoKrVY="
738738
[mod."go.uber.org/automaxprocs"]
739739
version = "v1.6.0"
740740
hash = "sha256-a/Agm+kM9x+VRo0CYyTL3ipUYv9Glrc4NeGSZJdpobA="
@@ -744,9 +744,12 @@ schema = 3
744744
[mod."go.yaml.in/yaml/v2"]
745745
version = "v2.4.2"
746746
hash = "sha256-oC8RWdf1zbMYCtmR0ATy/kCkhIwPR9UqFZSMOKLVF/A="
747+
[mod."go.yaml.in/yaml/v3"]
748+
version = "v3.0.4"
749+
hash = "sha256-NkGFiDPoCxbr3LFsI6OCygjjkY0rdmg5ggvVVwpyDQ4="
747750
[mod."golang.org/x/arch"]
748-
version = "v0.15.0"
749-
hash = "sha256-EsCsTDmn+j3S8yzV4n2WJyDuYBDwIlj29M9OBxWNMGQ="
751+
version = "v0.17.0"
752+
hash = "sha256-avV63nZlJxuo3/LLBKQ2a96Nn1wflNtc1Dr7GSPbHAs="
750753
[mod."golang.org/x/crypto"]
751754
version = "v0.41.0"
752755
hash = "sha256-o5Di0lsFmYnXl7a5MBTqmN9vXMCRpE9ay71C1Ar8jEY="
@@ -775,26 +778,26 @@ schema = 3
775778
version = "v0.10.0"
776779
hash = "sha256-vnlAME3gDR6R4cbCmSYAlR1Rjc0yUpkufTOPNvCdf6Q="
777780
[mod."golang.org/x/tools"]
778-
version = "v0.35.0"
779-
hash = "sha256-5aTV8oS9e0frUNUE2Pw+yTnPLghmZHryDa01COSyrCM="
781+
version = "v0.36.0"
782+
hash = "sha256-p91Ig5XR7JL0rxIQdCRZBJvK4M8apyoeV/sOLyjOndk="
780783
[mod."google.golang.org/api"]
781784
version = "v0.222.0"
782785
hash = "sha256-n1qxH8dqwl7Drry1H9bpQx7EeysceA98UrgEDxd1XEM="
783786
[mod."google.golang.org/genproto"]
784787
version = "v0.0.0-20241118233622-e639e219e697"
785788
hash = "sha256-QcnHSM6CWo18f0rqeXHSCFaydwFp+nENjE8x/NErgEI="
786789
[mod."google.golang.org/genproto/googleapis/api"]
787-
version = "v0.0.0-20250528174236-200df99c418a"
788-
hash = "sha256-VO7Rko8b/zO2sm6vML7hhxi9laPilt6JEab8xl4qIN8="
790+
version = "v0.0.0-20250707201910-8d1bb00bc6a7"
791+
hash = "sha256-xtTBmzlyynWQa0KtuQpNZ4fzSTB/5ozXclE3SuP3naI="
789792
[mod."google.golang.org/genproto/googleapis/rpc"]
790-
version = "v0.0.0-20250528174236-200df99c418a"
793+
version = "v0.0.0-20250707201910-8d1bb00bc6a7"
791794
hash = "sha256-WK7iDtAhH19NPe3TywTQlGjDawNaDKWnxhFL9PgVUwM="
792795
[mod."google.golang.org/grpc"]
793-
version = "v1.74.2"
794-
hash = "sha256-tvYMdfu/ZQZRPZNmnQI4CZpg46CM8+mD49hw0gFheGs="
796+
version = "v1.75.0"
797+
hash = "sha256-bMJEB2luUeYWwsQWqzuq4Wro2tTKBWGJPuTtzioJcfM="
795798
[mod."google.golang.org/protobuf"]
796-
version = "v1.36.7"
797-
hash = "sha256-6xCU+t2AVPcscMKenVs4etGqutYGPDXCQ3DCD3PpTq4="
799+
version = "v1.36.8"
800+
hash = "sha256-yZN8ZON0b5HjUNUSubHst7zbvnMsOzd81tDPYQRtPgM="
798801
[mod."gopkg.in/yaml.v3"]
799802
version = "v3.0.1"
800803
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU="

nix/testenv.nix

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,25 @@ poetry2nix.mkPoetryEnv {
2121
eth-bloom = [ "setuptools" ];
2222
};
2323
in
24-
lib.mapAttrs (
25-
attr: systems:
24+
(
25+
lib.mapAttrs (
26+
attr: systems:
2627
super.${attr}.overridePythonAttrs (old: {
27-
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
28-
})
29-
) buildSystems
28+
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
29+
})
30+
) buildSystems) // {
31+
# Fix malformed license field in types-requests package
32+
types-requests = super.types-requests.overridePythonAttrs (old: {
33+
postPatch = (old.postPatch or "") + ''
34+
# Fix malformed license field in pyproject.toml
35+
if [ -f pyproject.toml ]; then
36+
# Fix license field format
37+
sed -i 's/license = "Apache-2.0"/license = {text = "Apache-2.0"}/' pyproject.toml
38+
# Remove invalid license-files property from [project] section
39+
sed -i '/^license-files = /d' pyproject.toml
40+
fi
41+
'';
42+
});
43+
}
3044
);
3145
}

0 commit comments

Comments
 (0)