diff --git a/src/chains/ethereum/ethereum/package-lock.json b/src/chains/ethereum/ethereum/package-lock.json index f5ffbdffd3..fe4e52e7f2 100644 --- a/src/chains/ethereum/ethereum/package-lock.json +++ b/src/chains/ethereum/ethereum/package-lock.json @@ -838,9 +838,9 @@ "dev": true }, "@trufflesuite/uws-js-unofficial": { - "version": "20.4.0-unofficial.3", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.3.tgz", - "integrity": "sha512-RvEMJ3SWrBekUhZobGHmUU1hZPeuUMOQd3pPEauU/EauqJNv/KCKJdvfuX++CpSM246I0Qun9wBHoUh1xxWqUg==", + "version": "20.4.0-unofficial.4", + "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.4.tgz", + "integrity": "sha512-XTfdNdgp2X4ryXOg7Ofva/r0WXrQeiH+kV+v+FmQv4Sauf9g5RVv/7TPEmo7xvc9sz74Jb+C7vcmcxXcS8D5Wg==", "dev": true, "requires": { "bufferutil": "4.0.5", diff --git a/src/chains/ethereum/ethereum/package.json b/src/chains/ethereum/ethereum/package.json index 17cacf0468..ce4f986c25 100644 --- a/src/chains/ethereum/ethereum/package.json +++ b/src/chains/ethereum/ethereum/package.json @@ -86,7 +86,7 @@ "ws": "8.2.3" }, "devDependencies": { - "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3", + "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.4", "@types/encoding-down": "5.0.0", "@types/fs-extra": "9.0.2", "@types/keccak": "3.0.1", diff --git a/src/chains/filecoin/filecoin/package-lock.json b/src/chains/filecoin/filecoin/package-lock.json index b2be52c6b7..def80c7487 100644 --- a/src/chains/filecoin/filecoin/package-lock.json +++ b/src/chains/filecoin/filecoin/package-lock.json @@ -845,9 +845,9 @@ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" }, "@trufflesuite/uws-js-unofficial": { - "version": "20.4.0-unofficial.3", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.3.tgz", - "integrity": "sha512-RvEMJ3SWrBekUhZobGHmUU1hZPeuUMOQd3pPEauU/EauqJNv/KCKJdvfuX++CpSM246I0Qun9wBHoUh1xxWqUg==", + "version": "20.4.0-unofficial.4", + "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.4.tgz", + "integrity": "sha512-XTfdNdgp2X4ryXOg7Ofva/r0WXrQeiH+kV+v+FmQv4Sauf9g5RVv/7TPEmo7xvc9sz74Jb+C7vcmcxXcS8D5Wg==", "dev": true, "requires": { "bufferutil": "4.0.5", diff --git a/src/chains/filecoin/filecoin/package.json b/src/chains/filecoin/filecoin/package.json index 2b8a8ccacd..ebca84cd47 100644 --- a/src/chains/filecoin/filecoin/package.json +++ b/src/chains/filecoin/filecoin/package.json @@ -59,7 +59,7 @@ "@filecoin-shipyard/lotus-client-schema": "2.0.0", "@ganache/filecoin-options": "0.1.4", "@ganache/utils": "0.1.4", - "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3", + "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.4", "@types/bn.js": "5.1.0", "@types/deep-equal": "1.0.1", "@types/levelup": "4.3.0", diff --git a/src/chains/tezos/tezos/package-lock.json b/src/chains/tezos/tezos/package-lock.json index 4882a68589..ab1ef77a51 100644 --- a/src/chains/tezos/tezos/package-lock.json +++ b/src/chains/tezos/tezos/package-lock.json @@ -35,9 +35,9 @@ "dev": true }, "@trufflesuite/uws-js-unofficial": { - "version": "20.4.0-unofficial.3", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.3.tgz", - "integrity": "sha512-RvEMJ3SWrBekUhZobGHmUU1hZPeuUMOQd3pPEauU/EauqJNv/KCKJdvfuX++CpSM246I0Qun9wBHoUh1xxWqUg==", + "version": "20.4.0-unofficial.4", + "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.4.tgz", + "integrity": "sha512-XTfdNdgp2X4ryXOg7Ofva/r0WXrQeiH+kV+v+FmQv4Sauf9g5RVv/7TPEmo7xvc9sz74Jb+C7vcmcxXcS8D5Wg==", "dev": true, "requires": { "bufferutil": "4.0.5", diff --git a/src/chains/tezos/tezos/package.json b/src/chains/tezos/tezos/package.json index 01df0c99b1..9ae63bf12a 100644 --- a/src/chains/tezos/tezos/package.json +++ b/src/chains/tezos/tezos/package.json @@ -47,7 +47,7 @@ "emittery": "0.10.0" }, "devDependencies": { - "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3", + "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.4", "@types/mocha": "9.0.0", "cheerio": "1.0.0-rc.3", "cross-env": "7.0.3", diff --git a/src/packages/core/package-lock.json b/src/packages/core/package-lock.json index 757c9635d4..cc753e7cab 100644 --- a/src/packages/core/package-lock.json +++ b/src/packages/core/package-lock.json @@ -436,9 +436,9 @@ "dev": true }, "@trufflesuite/uws-js-unofficial": { - "version": "20.4.0-unofficial.3", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.3.tgz", - "integrity": "sha512-RvEMJ3SWrBekUhZobGHmUU1hZPeuUMOQd3pPEauU/EauqJNv/KCKJdvfuX++CpSM246I0Qun9wBHoUh1xxWqUg==", + "version": "20.4.0-unofficial.4", + "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.4.tgz", + "integrity": "sha512-XTfdNdgp2X4ryXOg7Ofva/r0WXrQeiH+kV+v+FmQv4Sauf9g5RVv/7TPEmo7xvc9sz74Jb+C7vcmcxXcS8D5Wg==", "requires": { "bufferutil": "4.0.5", "utf-8-validate": "5.0.7", diff --git a/src/packages/core/package.json b/src/packages/core/package.json index 5c7d677f2b..a361765077 100644 --- a/src/packages/core/package.json +++ b/src/packages/core/package.json @@ -53,7 +53,7 @@ "@ganache/options": "0.1.4", "@ganache/tezos": "0.1.4", "@ganache/utils": "0.1.4", - "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3", + "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.4", "aggregate-error": "3.1.0", "emittery": "0.10.0", "promise.allsettled": "1.0.4" diff --git a/src/packages/core/tests/server.test.ts b/src/packages/core/tests/server.test.ts index 8c1836dd9f..c84fef36e1 100644 --- a/src/packages/core/tests/server.test.ts +++ b/src/packages/core/tests/server.test.ts @@ -393,7 +393,7 @@ describe("server", () => { } }); - it("closes even if an http connection with keep-alive is open", async () => { + it("closes even if a persistent http connection is open", async () => { const agent = new http.Agent({ keepAlive: true }); @@ -410,12 +410,46 @@ describe("server", () => { // open the http connection await post("localhost", port, jsonRpcJson, agent); - s.close(); + await s.close(); // a request is required in order to actually close the connection await post("localhost", port, jsonRpcJson, agent); // connection has now closed, allowing ganache to close - await assert.rejects(post("localhost", port, jsonRpcJson, agent)); + await assert.rejects(post("localhost", port, jsonRpcJson, agent), { + code: "ECONNREFUSED" + }); + } finally { + teardown(); + } + }); + + it("refuses new connections when waiting on persistent connections to close", async () => { + const agent = new http.Agent({ + keepAlive: true + }); + + await setup(); + const jsonRpcJson: any = { + jsonrpc: "2.0", + id: "1", + method: "eth_block_number", + params: [] + }; + + try { + // open the http connection + await post("localhost", port, jsonRpcJson, agent); + + await s.close(); + + // this connection is on a different connection, so should fail + await assert.rejects(post("localhost", port, jsonRpcJson), { + code: "ECONNREFUSED" + }); + + // a request is required in order to actually close the connection + await post("localhost", port, jsonRpcJson, agent); + } finally { teardown(); } diff --git a/src/packages/utils/package-lock.json b/src/packages/utils/package-lock.json index 101bdefdb6..44c9de319a 100644 --- a/src/packages/utils/package-lock.json +++ b/src/packages/utils/package-lock.json @@ -72,9 +72,9 @@ } }, "@trufflesuite/uws-js-unofficial": { - "version": "20.4.0-unofficial.3", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.3.tgz", - "integrity": "sha512-RvEMJ3SWrBekUhZobGHmUU1hZPeuUMOQd3pPEauU/EauqJNv/KCKJdvfuX++CpSM246I0Qun9wBHoUh1xxWqUg==", + "version": "20.4.0-unofficial.4", + "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.4.0-unofficial.4.tgz", + "integrity": "sha512-XTfdNdgp2X4ryXOg7Ofva/r0WXrQeiH+kV+v+FmQv4Sauf9g5RVv/7TPEmo7xvc9sz74Jb+C7vcmcxXcS8D5Wg==", "dev": true, "requires": { "bufferutil": "4.0.5", diff --git a/src/packages/utils/package.json b/src/packages/utils/package.json index 3965f02e70..2feea19a4d 100644 --- a/src/packages/utils/package.json +++ b/src/packages/utils/package.json @@ -52,7 +52,7 @@ "seedrandom": "3.0.5" }, "devDependencies": { - "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3", + "@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.4", "@types/mocha": "9.0.0", "@types/seedrandom": "3.0.1", "cross-env": "7.0.3",