diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47a3a619..6149e30b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: with: go-version: 1.19 check-latest: true - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 460c7d73..b38061c7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.sol diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index c7f3aa8a..8ab944a1 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -14,7 +14,7 @@ jobs: check-latest: true - name: "Checkout Repository" uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.go diff --git a/.github/workflows/deploy-contract.yml b/.github/workflows/deploy-contract.yml index 469fb6a4..dcd0bbb7 100644 --- a/.github/workflows/deploy-contract.yml +++ b/.github/workflows/deploy-contract.yml @@ -23,7 +23,7 @@ jobs: node-version: '12.x' - name: Install dependencies run: npm install - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f9c1d988..ef645f40 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: go-version: 1.19 check-latest: true - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.go @@ -39,7 +39,7 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | docs/**/*.md @@ -61,7 +61,7 @@ jobs: - uses: cachix/cachix-action@v12 with: name: ethermint - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.py @@ -77,7 +77,7 @@ jobs: - uses: cachix/cachix-action@v12 with: name: ethermint - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.py diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml index 1d50faaa..ace2bbee 100644 --- a/.github/workflows/markdown-links.yml +++ b/.github/workflows/markdown-links.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index b32d6ff0..c0541dd7 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -17,7 +17,7 @@ jobs: - name: Checkout Source uses: actions/checkout@v3 - name: Get Diff - uses: technote-space/get-diff-action@v6.1.1 + uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/*.go diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 716f0abb..d7f65d40 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -22,7 +22,7 @@ jobs: run: git config --global --add safe.directory /__w/ethermint/ethermint - uses: actions/checkout@v3 - name: Get Diff - uses: technote-space/get-diff-action@v6.1.1 + uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/*.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4510e5e5..125ec778 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: go-version: 1.19 check-latest: true - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.sol @@ -49,7 +49,7 @@ jobs: go-version: 1.19 check-latest: true - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | @@ -70,7 +70,7 @@ jobs: go-version: 1.19 check-latest: true - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.sol @@ -91,7 +91,7 @@ jobs: with: name: ethermint signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - - uses: technote-space/get-diff-action@v6.1.1 + - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.sol diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d28f95e..b622f918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog -## [v0.20.0-rc3] - 2022-12-02 +## [v0.20.0-rc4] - 2022-12-09 ### State Machine Breaking @@ -90,6 +90,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (eip712) [#1543](https://github.com/evmos/ethermint/pull/1543) Improve error handling for EIP-712 encoding config initialization. * (app) [#1505](https://github.com/evmos/ethermint/pull/1505) Setup gRPC node service with the application. * (server) [#1497](https://github.com/evmos/ethermint/pull/1497) Fix telemetry server setup for observability * (rpc) [#1442](https://github.com/evmos/ethermint/pull/1442) Fix decoding of `finalized` block number. diff --git a/app/ante/utils_test.go b/app/ante/utils_test.go index cc682c11..838ad63f 100644 --- a/app/ante/utils_test.go +++ b/app/ante/utils_test.go @@ -568,7 +568,7 @@ func (suite *AnteTestSuite) generateSingleSignature(signMode signing.SignMode, p msg = signDocBytes if signType == "EIP-712" { - msg, err = eip712.GetEIP712HashForMsg(signDocBytes) + msg, err = eip712.GetEIP712BytesForMsg(signDocBytes) suite.Require().NoError(err) } diff --git a/app/app.go b/app/app.go index 2e0e265c..e2fc73ca 100644 --- a/app/app.go +++ b/app/app.go @@ -104,6 +104,7 @@ import ( _ "github.com/evmos/ethermint/client/docs/statik" "github.com/evmos/ethermint/app/ante" + "github.com/evmos/ethermint/ethereum/eip712" srvflags "github.com/evmos/ethermint/server/flags" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm" @@ -252,6 +253,8 @@ func NewEthermintApp( cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry + eip712.SetEncodingConfig(encodingConfig) + // NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx bApp := baseapp.NewBaseApp( appName, diff --git a/crypto/ethsecp256k1/ethsecp256k1.go b/crypto/ethsecp256k1/ethsecp256k1.go index 2dad73dc..379f8bd4 100644 --- a/crypto/ethsecp256k1/ethsecp256k1.go +++ b/crypto/ethsecp256k1/ethsecp256k1.go @@ -213,15 +213,15 @@ func (pubKey PubKey) VerifySignature(msg, sig []byte) bool { } // Verifies the signature as an EIP-712 signature by first converting the message payload -// to an EIP-712 hashed object, performing ECDSA verification on the hash. This is to support +// to EIP-712 object bytes, then performing ECDSA verification on the hash. This is to support // signing a Cosmos payload using EIP-712. func (pubKey PubKey) verifySignatureAsEIP712(msg, sig []byte) bool { - eip712Hash, err := eip712.GetEIP712HashForMsg(msg) + eip712Bytes, err := eip712.GetEIP712BytesForMsg(msg) if err != nil { return false } - return pubKey.verifySignatureECDSA(eip712Hash, sig) + return pubKey.verifySignatureECDSA(eip712Bytes, sig) } // Perform standard ECDSA signature verification for the given raw bytes and signature. diff --git a/ethereum/eip712/eip712_test.go b/ethereum/eip712/eip712_test.go index 46b906e3..8d78c4d9 100644 --- a/ethereum/eip712/eip712_test.go +++ b/ethereum/eip712/eip712_test.go @@ -400,18 +400,17 @@ func (suite *EIP712TestSuite) TestEIP712SignatureVerification() { // Verify that the payload passes signature verification if signed as its EIP-712 representation. func (suite *EIP712TestSuite) verifyEIP712SignatureVerification(expectedSuccess bool, privKey ethsecp256k1.PrivKey, pubKey ethsecp256k1.PubKey, signBytes []byte) { - // Convert to EIP712 hash and sign - eip712Hash, err := eip712.GetEIP712HashForMsg(signBytes) + // Convert to EIP712 bytes and sign + eip712Bytes, err := eip712.GetEIP712BytesForMsg(signBytes) if !expectedSuccess { - // Expect failure generating EIP-712 hash + // Expect failure generating EIP-712 bytes suite.Require().Error(err) return } suite.Require().NoError(err) - sigHash := crypto.Keccak256Hash(eip712Hash) - sig, err := privKey.Sign(sigHash.Bytes()) + sig, err := privKey.Sign(eip712Bytes) suite.Require().NoError(err) // Verify against original payload bytes. This should pass, even though it is not @@ -420,7 +419,7 @@ func (suite *EIP712TestSuite) verifyEIP712SignatureVerification(expectedSuccess suite.Require().True(res) // Verify against the signed EIP-712 bytes. This should pass, since it is the message signed. - res = pubKey.VerifySignature(eip712Hash, sig) + res = pubKey.VerifySignature(eip712Bytes, sig) suite.Require().True(res) // Verify against random bytes to ensure it does not pass unexpectedly (sanity check). diff --git a/ethereum/eip712/encoding.go b/ethereum/eip712/encoding.go index fa744ad7..f07add38 100644 --- a/ethereum/eip712/encoding.go +++ b/ethereum/eip712/encoding.go @@ -36,27 +36,21 @@ func SetEncodingConfig(cfg params.EncodingConfig) { protoCodec = codec.NewProtoCodec(cfg.InterfaceRegistry) } -// Get the EIP-712 object hash for the given SignDoc bytes by first decoding the bytes into +// Get the EIP-712 object bytes for the given SignDoc bytes by first decoding the bytes into // an EIP-712 object, then hashing the EIP-712 object to create the bytes to be signed. // See https://eips.ethereum.org/EIPS/eip-712 for more. -func GetEIP712HashForMsg(signDocBytes []byte) ([]byte, error) { +func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error) { typedData, err := GetEIP712TypedDataForMsg(signDocBytes) if err != nil { return nil, err } - domainSeparator, err := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) + _, rawData, err := apitypes.TypedDataAndHash(typedData) if err != nil { - return nil, fmt.Errorf("could not hash EIP-712 domain: %w", err) + return nil, fmt.Errorf("could not get EIP-712 object bytes: %w", err) } - typedDataHash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message) - if err != nil { - return nil, fmt.Errorf("could not hash EIP-712 primary type: %w", err) - } - rawData := []byte(fmt.Sprintf("\x19\x01%s%s", string(domainSeparator), string(typedDataHash))) - - return rawData, nil + return []byte(rawData), nil } // GetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either @@ -85,6 +79,11 @@ func isValidEIP712Payload(typedData apitypes.TypedData) bool { // decodeAminoSignDoc attempts to decode the provided sign doc (bytes) as an Amino payload // and returns a signable EIP-712 TypedData object. func decodeAminoSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { + // Ensure codecs have been initialized + if err := validateCodecInit(); err != nil { + return apitypes.TypedData{}, err + } + var aminoDoc legacytx.StdSignDoc if err := aminoCodec.UnmarshalJSON(signDocBytes, &aminoDoc); err != nil { return apitypes.TypedData{}, err @@ -140,6 +139,11 @@ func decodeAminoSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { // decodeProtobufSignDoc attempts to decode the provided sign doc (bytes) as a Protobuf payload // and returns a signable EIP-712 TypedData object. func decodeProtobufSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { + // Ensure codecs have been initialized + if err := validateCodecInit(); err != nil { + return apitypes.TypedData{}, err + } + signDoc := &txTypes.SignDoc{} if err := signDoc.Unmarshal(signDocBytes); err != nil { return apitypes.TypedData{}, err @@ -226,6 +230,16 @@ func decodeProtobufSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { return typedData, nil } +// validateCodecInit ensures that both Amino and Protobuf encoding codecs have been set on app init, +// so the module does not panic if either codec is not found. +func validateCodecInit() error { + if aminoCodec == nil || protoCodec == nil { + return errors.New("missing codec: codecs have not been properly initialized using SetEncodingConfig") + } + + return nil +} + // validatePayloadMessages ensures that the transaction messages can be represented in an EIP-712 // encoding by checking that messages exist, are of the same type, and share a single signer. func validatePayloadMessages(msgs []sdk.Msg) error { diff --git a/go.mod b/go.mod index 16e4a358..dbd34a20 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/cosmos/gogoproto v1.4.3 github.com/cosmos/ibc-go/v5 v5.1.0 github.com/davecgh/go-spew v1.1.1 - github.com/ethereum/go-ethereum v1.10.25 + github.com/ethereum/go-ethereum v1.10.26 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 @@ -36,8 +36,8 @@ require ( github.com/tendermint/tendermint v0.34.23 github.com/tendermint/tm-db v0.6.7 github.com/tyler-smith/go-bip39 v1.1.0 - golang.org/x/net v0.2.0 - golang.org/x/text v0.4.0 + golang.org/x/net v0.4.0 + golang.org/x/text v0.5.0 google.golang.org/genproto v0.0.0-20221116193143-41c2ba794472 google.golang.org/grpc v1.51.0 sigs.k8s.io/yaml v1.3.0 @@ -177,8 +177,8 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/term v0.2.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/term v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.102.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 710f7af4..3366bfab 100644 --- a/go.sum +++ b/go.sum @@ -325,8 +325,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.10.25 h1:5dFrKJDnYf8L6/5o42abCE6a9yJm9cs4EJVRyYMr55s= -github.com/ethereum/go-ethereum v1.10.25/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= +github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= @@ -1187,8 +1187,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1300,13 +1300,13 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1316,8 +1316,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/gomod2nix.toml b/gomod2nix.toml index f09b5bae..7689bb32 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -163,8 +163,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-k1DYvCqO3BKNcGEve/nMW0RxzMkK2tGfXbUbycqcVSo=" [mod."github.com/ethereum/go-ethereum"] - version = "v1.10.25" - hash = "sha256-tNlI2XyuTXjGuBoe5vlYDcaGN2Sub7yltVtI6TeLLSc=" + version = "v1.10.26" + hash = "sha256-gkMEwJ4rOgn12amD4QpZ4th/10uyTTeoFmpseuKDQPs=" [mod."github.com/felixge/httpsnoop"] version = "v1.0.1" hash = "sha256-TNXnnC/ZGNY9lInAcES1cBGqIdEljKuh5LH/khVFjVk=" @@ -512,8 +512,8 @@ schema = 3 version = "v0.2.0" hash = "sha256-azcllZ0o/9TurqX9udaJ0o9yxqSoI0/bSJsvQQLYIQc=" [mod."golang.org/x/text"] - version = "v0.4.0" - hash = "sha256-JvyMygdmTvWg7xhbnUB9MMk6WcYXJt8DAj4DYl82Pys=" + version = "v0.5.0" + hash = "sha256-ztH+xQyM/clOcQl+y/UEPcfNKbc3xApMbEPDDZ9up0o=" [mod."golang.org/x/xerrors"] version = "v0.0.0-20220907171357-04be3eba64a2" hash = "sha256-6+zueutgefIYmgXinOflz8qGDDDj0Zhv+2OkGhBTKno=" diff --git a/tests/integration_tests/poetry.lock b/tests/integration_tests/poetry.lock index a49969c2..4384edb5 100644 --- a/tests/integration_tests/poetry.lock +++ b/tests/integration_tests/poetry.lock @@ -57,7 +57,7 @@ python-versions = ">=3.5" dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] +tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] [[package]] name = "base58" @@ -110,7 +110,7 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2022.9.24" +version = "2022.12.7" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false @@ -125,7 +125,7 @@ optional = false python-versions = ">=3.6.0" [package.extras] -unicode_backport = ["unicodedata2"] +unicode-backport = ["unicodedata2"] [[package]] name = "click" @@ -509,9 +509,9 @@ python-versions = ">=3.6.1,<4.0" [package.extras] colors = ["colorama (>=0.4.3,<0.5.0)"] -pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +pipfile-deprecated-finder = ["pipreqs", "requirementslib"] plugins = ["setuptools"] -requirements_deprecated_finder = ["pip-api", "pipreqs"] +requirements-deprecated-finder = ["pip-api", "pipreqs"] [[package]] name = "jsonmerge" @@ -786,7 +786,7 @@ tomlkit = "^0.7.0" type = "git" url = "https://github.com/crypto-com/pystarport.git" reference = "main" -resolved_reference = "c3028081386e8489171607e0aed6e68d1ff87d43" +resolved_reference = "ff645505d5052e11ecc56b6933af8f5f2a6b4373" [[package]] name = "pytest" @@ -889,7 +889,7 @@ urllib3 = ">=1.21.1,<1.27" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "rlp" @@ -1307,8 +1307,8 @@ black = [ {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, ] certifi = [ - {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, - {file = "certifi-2022.9.24.tar.gz", hash = "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"}, + {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, + {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, ] charset-normalizer = [ {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, @@ -1810,6 +1810,7 @@ pycryptodome = [ {file = "pycryptodome-3.15.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:7c9ed8aa31c146bef65d89a1b655f5f4eab5e1120f55fc297713c89c9e56ff0b"}, {file = "pycryptodome-3.15.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:5099c9ca345b2f252f0c28e96904643153bae9258647585e5e6f649bb7a1844a"}, {file = "pycryptodome-3.15.0-cp27-cp27m-manylinux2014_aarch64.whl", hash = "sha256:2ec709b0a58b539a4f9d33fb8508264c3678d7edb33a68b8906ba914f71e8c13"}, + {file = "pycryptodome-3.15.0-cp27-cp27m-musllinux_1_1_aarch64.whl", hash = "sha256:2ae53125de5b0d2c95194d957db9bb2681da8c24d0fb0fe3b056de2bcaf5d837"}, {file = "pycryptodome-3.15.0-cp27-cp27m-win32.whl", hash = "sha256:fd2184aae6ee2a944aaa49113e6f5787cdc5e4db1eb8edb1aea914bd75f33a0c"}, {file = "pycryptodome-3.15.0-cp27-cp27m-win_amd64.whl", hash = "sha256:7e3a8f6ee405b3bd1c4da371b93c31f7027944b2bcce0697022801db93120d83"}, {file = "pycryptodome-3.15.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:b9c5b1a1977491533dfd31e01550ee36ae0249d78aae7f632590db833a5012b8"}, @@ -1817,12 +1818,14 @@ pycryptodome = [ {file = "pycryptodome-3.15.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:2aa55aae81f935a08d5a3c2042eb81741a43e044bd8a81ea7239448ad751f763"}, {file = "pycryptodome-3.15.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:c3640deff4197fa064295aaac10ab49a0d55ef3d6a54ae1499c40d646655c89f"}, {file = "pycryptodome-3.15.0-cp27-cp27mu-manylinux2014_aarch64.whl", hash = "sha256:045d75527241d17e6ef13636d845a12e54660aa82e823b3b3341bcf5af03fa79"}, + {file = "pycryptodome-3.15.0-cp27-cp27mu-musllinux_1_1_aarch64.whl", hash = "sha256:eb6fce570869e70cc8ebe68eaa1c26bed56d40ad0f93431ee61d400525433c54"}, {file = "pycryptodome-3.15.0-cp35-abi3-macosx_10_9_x86_64.whl", hash = "sha256:9ee40e2168f1348ae476676a2e938ca80a2f57b14a249d8fe0d3cdf803e5a676"}, {file = "pycryptodome-3.15.0-cp35-abi3-manylinux1_i686.whl", hash = "sha256:4c3ccad74eeb7b001f3538643c4225eac398c77d617ebb3e57571a897943c667"}, {file = "pycryptodome-3.15.0-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:1b22bcd9ec55e9c74927f6b1f69843cb256fb5a465088ce62837f793d9ffea88"}, {file = "pycryptodome-3.15.0-cp35-abi3-manylinux2010_i686.whl", hash = "sha256:57f565acd2f0cf6fb3e1ba553d0cb1f33405ec1f9c5ded9b9a0a5320f2c0bd3d"}, {file = "pycryptodome-3.15.0-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:4b52cb18b0ad46087caeb37a15e08040f3b4c2d444d58371b6f5d786d95534c2"}, {file = "pycryptodome-3.15.0-cp35-abi3-manylinux2014_aarch64.whl", hash = "sha256:092a26e78b73f2530b8bd6b3898e7453ab2f36e42fd85097d705d6aba2ec3e5e"}, + {file = "pycryptodome-3.15.0-cp35-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:50ca7e587b8e541eb6c192acf92449d95377d1f88908c0a32ac5ac2703ebe28b"}, {file = "pycryptodome-3.15.0-cp35-abi3-win32.whl", hash = "sha256:e244ab85c422260de91cda6379e8e986405b4f13dc97d2876497178707f87fc1"}, {file = "pycryptodome-3.15.0-cp35-abi3-win_amd64.whl", hash = "sha256:c77126899c4b9c9827ddf50565e93955cb3996813c18900c16b2ea0474e130e9"}, {file = "pycryptodome-3.15.0-pp27-pypy_73-macosx_10_9_x86_64.whl", hash = "sha256:9eaadc058106344a566dc51d3d3a758ab07f8edde013712bc8d22032a86b264f"}, diff --git a/tests/integration_tests/test_gas.py b/tests/integration_tests/test_gas.py index e35ae96c..5589f951 100644 --- a/tests/integration_tests/test_gas.py +++ b/tests/integration_tests/test_gas.py @@ -102,5 +102,4 @@ def test_block_gas_limit(ethermint): ) (ethermint.w3.eth.wait_for_transaction_receipt(ethermint_txhash)) - return diff --git a/tests/integration_tests/test_grpc_only.py b/tests/integration_tests/test_grpc_only.py index 7dfa6645..64d17268 100644 --- a/tests/integration_tests/test_grpc_only.py +++ b/tests/integration_tests/test_grpc_only.py @@ -45,6 +45,9 @@ def grpc_eth_call(port: int, args: dict, chain_id=None, proposer_address=None): ).json() +@pytest.mark.skip( + reason="undeterministic test - https://github.com/evmos/ethermint/issues/1530" +) def test_grpc_mode(custom_ethermint): """ - restart a fullnode in grpc-only mode diff --git a/tests/solidity/yarn.lock b/tests/solidity/yarn.lock index 9d311442..d46d81c7 100644 --- a/tests/solidity/yarn.lock +++ b/tests/solidity/yarn.lock @@ -13713,7 +13713,7 @@ qs@6.10.3: dependencies: side-channel "^1.0.4" -qs@6.11.0: +qs@6.11.0, qs@^6.7.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== @@ -13725,17 +13725,10 @@ qs@6.7.0: resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== -qs@^6.7.0: - version "6.10.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a" - integrity sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg== - dependencies: - side-channel "^1.0.4" - qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + version "6.5.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" + integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== query-string@^5.0.1: version "5.1.1" diff --git a/x/feemarket/spec/01_concepts.md b/x/feemarket/spec/01_concepts.md index 2d9c963b..865221de 100644 --- a/x/feemarket/spec/01_concepts.md +++ b/x/feemarket/spec/01_concepts.md @@ -14,7 +14,9 @@ Before EIP-1559 the transaction fee is calculated with fee = gasPrice * gasLimit ``` -, where `gasPrice` is the price per gas and `gasLimit` describes the amount of gas required to perform the transaction. The more complex operations a transaction requires, the higher the gasLimit (See [Executing EVM bytecode](https://docs.evmos.org/modules/evm/01_concepts.html#executing-evm-bytecode)). To submit a transaction, the signer needs to specify the `gasPrice`. +where `gasPrice` is the price per gas and `gasLimit` describes the amount of gas required to perform the transaction. +The more complex operations a transaction requires, the higher the gasLimit (See [Executing EVM bytecode](https://docs.evmos.org/modules/evm/01_concepts.html#executing-evm-bytecode)). +To submit a transaction, the signer needs to specify the `gasPrice`. With EIP-1559 enabled, the transaction fee is calculated with @@ -22,10 +24,16 @@ With EIP-1559 enabled, the transaction fee is calculated with fee = (baseFee + priorityTip) * gasLimit ``` -, where `baseFee` is the fixed-per-block network fee per gas and `priorityTip` is an additional fee per gas that can be set optionally. Note, that both the base fee and the priority tip are a gas prices. To submit a transaction with EIP-1559, the signer needs to specify the `gasFeeCap` a maximum fee per gas they are willing to pay total and optionally the `priorityTip` , which covers both the priority fee and the block's network fee per gas (aka: base fee). +where `baseFee` is the fixed-per-block network fee per gas and `priorityTip` is an additional fee per gas that can be set optionally. +Note, that both the base fee and the priority tip are gas prices. +To submit a transaction with EIP-1559, the signer needs to specify the `gasFeeCap`, which is the maximum fee per gas they are willing to pay in total. +Optionally, the `priorityTip` can be specified, which covers both the priority fee and the block's network fee per gas (aka: base fee). ::: tip -The Cosmos SDK uses a different terminology for `gas` than Ethereum. What is called `gasLimit` on Ethereum is called `gasWanted` on Cosmos. You might encounter both terminologies on Evmos since it builds Ethereum on top of the SDK, e.g. when using different wallets like Keplr for Cosmos and Metamask for Ethereum. +The Cosmos SDK uses a different terminology for `gas` than Ethereum. +What is called `gasLimit` on Ethereum is called `gasWanted` on Cosmos. +You might encounter both terminologies on Evmos since it builds Ethereum on top of the SDK, +e.g. when using different wallets like Keplr for Cosmos and Metamask for Ethereum. ::: ## Base Fee @@ -39,13 +47,17 @@ Instead of burning the base fee (as implemented on Ethereum), the `feemarket` mo ## Priority Tip -In EIP-1559, the `max_priority_fee_per_gas`, often referred to as `tip`, is an additional gas price that can be added to the `baseFee` in order to incentive transaction prioritization. The higher the tip, the more likely the transaction is included in the block. +In EIP-1559, the `max_priority_fee_per_gas`, often referred to as `tip`, +is an additional gas price that can be added to the `baseFee` in order to incentivize transaction prioritization. +The higher the tip, the more likely the transaction is included in the block. -Until the Cosmos SDK version v0.46, however, there is no notion of transaction prioritization. Thus the tip for an EIP-1559 transaction on Ethermint should be zero (`MaxPriorityFeePerGas` JSON-RPC endpoint returns `0`). Have a look at [ADR 067](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-067-mempool-refactor.md) to read about future plans on transaction prioritization in the Cosmos SDK. +Until the Cosmos SDK version v0.46, however, there is no notion of transaction prioritization. +Thus, the tip for an EIP-1559 transaction on Ethermint should be zero (`MaxPriorityFeePerGas` JSON-RPC endpoint returns `0`). +Have a look at the [mempool](https://docs.evmos.org/validators/setup/mempool.html) docs to read more about how to leverage transaction prioritization. ## Effective Gas price -For EIP-1559 transactions (dynamic fee transactions) the effective gas price descibes the maximum gas price that a transaction is willing to provide. It is derived from the transaction arguments and the base fee parameter. Depending on which one is smaller, the effective gas price is either the `baseFee + tip` or the `gasFeeCap` +For EIP-1559 transactions (dynamic fee transactions) the effective gas price describes the maximum gas price that a transaction is willing to provide. It is derived from the transaction arguments and the base fee parameter. Depending on which one is smaller, the effective gas price is either the `baseFee + tip` or the `gasFeeCap` ``` min(baseFee + gasTipCap, gasFeeCap)