diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ada108b604..aa88288119 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,4 +29,4 @@ jobs: .sum - run: | make build - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF diff --git a/.github/workflows/deploy-contract.yml b/.github/workflows/deploy-contract.yml index 41edf6330d..cfbb67e7a5 100644 --- a/.github/workflows/deploy-contract.yml +++ b/.github/workflows/deploy-contract.yml @@ -35,4 +35,4 @@ jobs: run: | sudo make contract-tools sudo make test-contract - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bebcbe3aea..3f677b263e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: - name: test-importer run: | make test-import - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF test-solidity: runs-on: ubuntu-latest @@ -100,7 +100,7 @@ jobs: - name: test-solidity run: | ./scripts/run-solidity-tests.sh --batch=${{ matrix.batch }} - if: "env.GIT_DIFF != ''" + if: env.GIT_DIFF liveness-test: runs-on: ubuntu-latest @@ -150,3 +150,23 @@ jobs: run: | make test-rpc if: env.GIT_DIFF + + test-e2e: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/setup-go@v2.1.4 + with: + go-version: 1.17 + - uses: actions/checkout@v2.4.0 + - uses: technote-space/get-diff-action@v6.0.1 + with: + PATTERNS: | + **/**.sol + **/**.go + go.mod + go.sum + - name: Test e2e + run: | + make test-integration + if: env.GIT_DIFF \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ba9c6676c..a6e096ae4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [tharsis#871](https://github.com/tharsis/ethermint/pull/871) Set correct nonce in `EthCall` and `EstimateGas` grpc query. * (rpc) [tharsis#878](https://github.com/tharsis/ethermint/pull/878) Workaround to make GetBlock RPC api report correct block gas used. * (rpc) [tharsis#900](https://github.com/tharsis/ethermint/pull/900) newPendingTransactions filter return ethereum tx hash. +* (rpc) [tharsis#933](https://github.com/tharsis/ethermint/pull/933) Fix newPendingTransactions subscription deadlock when a Websocket client exits without unsubscribing and the node errors. ## [v0.9.0] - 2021-12-01 diff --git a/Makefile b/Makefile index 6580ad6ab4..de98980e4b 100755 --- a/Makefile +++ b/Makefile @@ -324,6 +324,9 @@ test-import: test-rpc: ./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true" +test-integration: + ./scripts/integration-test-all.sh -t "integration" -q 1 -z 1 -s 2 -m "integration" -r "true" + test-rpc-pending: ./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true" diff --git a/app/ante/eth.go b/app/ante/eth.go index 4ed65a644b..4255fb9820 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -154,7 +154,6 @@ func NewEthGasConsumeDecorator( // of data supplied with the transaction. // // This AnteHandler decorator will fail if: -// - the transaction contains more than one message // - the message is not a MsgEthereumTx // - sender account cannot be found // - transaction's gas limit is lower than the intrinsic gas diff --git a/go.mod b/go.mod index 3718227f43..ca31a74b3f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce - github.com/cosmos/cosmos-sdk v0.45.0 + github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go/v2 v2.0.2 github.com/davecgh/go-spew v1.1.1 @@ -37,7 +37,7 @@ require ( go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 87ebf72b59..efd6fcd419 100644 --- a/go.sum +++ b/go.sum @@ -228,8 +228,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-sdk v0.44.5/go.mod h1:maUA6m2TBxOJZkbwl0eRtEBgTX37kcaiOWU5t1HEGaY= -github.com/cosmos/cosmos-sdk v0.45.0 h1:DHD+CIRZ+cYgiLXuTEUL/aprnfPsWSwaww/fIZEsZlk= -github.com/cosmos/cosmos-sdk v0.45.0/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= +github.com/cosmos/cosmos-sdk v0.45.1 h1:PY79YxPea5qlRLExRnzg8/rT1Scc8GGgRs22p7DX99Q= +github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= diff --git a/rpc/websockets.go b/rpc/websockets.go index 86629e3488..76b5c489c7 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -712,8 +712,16 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn) (rpc.ID, erro api.logger.Debug("error writing header, will drop peer", "error", err.Error()) try(func() { + // Release the initial read lock in .RUnlock() before + // invoking .Lock() to avoid the deadlock in + // https://github.com/tharsis/ethermint/issues/821#issuecomment-1033959984 + // and as documented at https://pkg.go.dev/sync#RWMutex + api.filtersMu.RUnlock() api.filtersMu.Lock() - defer api.filtersMu.Unlock() + defer func() { + api.filtersMu.Unlock() + api.filtersMu.RLock() + }() if err != websocket.ErrCloseSent { _ = wsSub.wsConn.Close() diff --git a/scripts/integration-test-all.sh b/scripts/integration-test-all.sh index 421684b1d3..1522f219af 100755 --- a/scripts/integration-test-all.sh +++ b/scripts/integration-test-all.sh @@ -139,8 +139,18 @@ echo "done sleeping" set +e -if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then +if [[ -z $TEST || $TEST == "integration" ]] ; then + time_out=300s + for i in $(seq 1 "$TEST_QTD"); do + HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i" + echo "going to test ethermint node $HOST_RPC ..." + MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=$time_out -v -short + TEST_FAIL=$? + done +fi + +if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then time_out=300s if [[ $TEST == "pending" ]]; then time_out=60m0s @@ -149,10 +159,9 @@ if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then for i in $(seq 1 "$TEST_QTD"); do HOST_RPC=http://$IP_ADDR:$RPC_PORT"$i" echo "going to test ethermint node $HOST_RPC ..." - MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=$time_out -v -short MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=$time_out -v -short - RPC_FAIL=$? + TEST_FAIL=$? done fi @@ -175,8 +184,8 @@ for i in "${arr[@]}"; do stop_func "$i" done -if [[ (-z $TEST || $TEST == "rpc") && $RPC_FAIL -ne 0 ]]; then - exit $RPC_FAIL +if [[ (-z $TEST || $TEST == "rpc" || $TEST == "integration" ) && $TEST_FAIL -ne 0 ]]; then + exit $TEST_FAIL else exit 0 fi diff --git a/scripts/start.sh b/scripts/start.sh index 285ebda4af..c05bff709e 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -127,7 +127,7 @@ if [[ -z $TEST || $TEST == "rpc" ]]; then MODE=$MODE HOST=$HOST_RPC go test ./tests/e2e/... -timeout=300s -v -short MODE=$MODE HOST=$HOST_RPC go test ./tests/rpc/... -timeout=300s -v -short - RPC_FAIL=$? + TEST_FAIL=$? done fi @@ -150,8 +150,8 @@ for i in "${arr[@]}"; do stop_func "$i" done -if [[ (-z $TEST || $TEST == "rpc") && $RPC_FAIL -ne 0 ]]; then - exit $RPC_FAIL +if [[ (-z $TEST || $TEST == "rpc") && $TEST_FAIL -ne 0 ]]; then + exit $TEST_FAIL else exit 0 fi diff --git a/tests/e2e/integration_test.go b/tests/e2e/integration_test.go index 773f95acc0..3c09b86002 100644 --- a/tests/e2e/integration_test.go +++ b/tests/e2e/integration_test.go @@ -4,11 +4,12 @@ import ( "bytes" "context" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - evmtypes "github.com/tharsis/ethermint/x/evm/types" "math/big" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" + evmtypes "github.com/tharsis/ethermint/x/evm/types" + // . "github.com/onsi/ginkgo" // . "github.com/onsi/gomega" @@ -392,6 +393,7 @@ func (s *IntegrationTestSuite) TestGetLogs() { common.HexToHash("0x000000000000000000000000" + fmt.Sprintf("%x", common.BytesToAddress(s.network.Validators[0].Address))), common.HexToHash("0x000000000000000000000000378c50d9264c63f3f92b806d4ee56e9d86ffb3ec"), } + s.Require().Equal(expectedTopics, logs[0].Topics) } diff --git a/tests/solidity/yarn.lock b/tests/solidity/yarn.lock index 52b52aac59..cd486800da 100644 --- a/tests/solidity/yarn.lock +++ b/tests/solidity/yarn.lock @@ -13788,9 +13788,9 @@ simple-concat@^1.0.0: integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== simple-get@^2.7.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" - integrity sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw== + version "2.8.2" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz#5708fb0919d440657326cd5fe7d2599d07705019" + integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== dependencies: decompress-response "^3.3.0" once "^1.3.1" diff --git a/x/evm/spec/08_params.md b/x/evm/spec/08_params.md index 22487d0f5c..213e36cca0 100644 --- a/x/evm/spec/08_params.md +++ b/x/evm/spec/08_params.md @@ -76,6 +76,5 @@ By default, all block configuration fields but `ConstantinopleBlock`, are enable | IstanbulBlock | 0 | | MuirGlacierBlock | 0 | | BerlinBlock | 0 | -| CatalystBlock | `nil` | | LondonBlock | 0 |