From a5ec8351cd57da667371a532ec61dd0480fc3e6a Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Mon, 10 Jun 2024 16:11:01 -0700 Subject: [PATCH 1/4] added keepalive=false in createRequest --- packages/taquito-http-utils/src/taquito-http-utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/taquito-http-utils/src/taquito-http-utils.ts b/packages/taquito-http-utils/src/taquito-http-utils.ts index 1d41bd0e9d..293520e3da 100644 --- a/packages/taquito-http-utils/src/taquito-http-utils.ts +++ b/packages/taquito-http-utils/src/taquito-http-utils.ts @@ -91,6 +91,7 @@ export class HttpBackend { try { const response = await fetch(urlWithQuery, { + keepalive: false, method, headers, body: JSON.stringify(data), From 4f6be5f798e1ca16a9c7a3df8c033ada329e46ac Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 11 Jun 2024 09:59:33 -0700 Subject: [PATCH 2/4] added comment --- packages/taquito-http-utils/src/taquito-http-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taquito-http-utils/src/taquito-http-utils.ts b/packages/taquito-http-utils/src/taquito-http-utils.ts index 293520e3da..5e4c9a1b3f 100644 --- a/packages/taquito-http-utils/src/taquito-http-utils.ts +++ b/packages/taquito-http-utils/src/taquito-http-utils.ts @@ -91,7 +91,7 @@ export class HttpBackend { try { const response = await fetch(urlWithQuery, { - keepalive: false, + keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20) method, headers, body: JSON.stringify(data), From 742e79860f74b18f214e4109a427af9db97f8b11 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 11 Jun 2024 12:51:09 -0700 Subject: [PATCH 3/4] updated some estimate values --- .../contract/estimation-tests.spec.ts | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index 810cee8c96..d167dc228e 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -41,11 +41,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 0.019 }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(186); + expect(estimate.suggestedFeeMutez).toEqual(188); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(166); - expect(estimate.totalCost).toEqual(166); - expect(estimate.usingBaseFeeMutez).toEqual(166); + expect(estimate.minimalFeeMutez).toEqual(168); + expect(estimate.totalCost).toEqual(168); + expect(estimate.usingBaseFeeMutez).toEqual(168); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -53,11 +53,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 0.017 }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(277); - expect(estimate.suggestedFeeMutez).toEqual(186); + expect(estimate.suggestedFeeMutez).toEqual(188); expect(estimate.burnFeeMutez).toEqual(69250); - expect(estimate.minimalFeeMutez).toEqual(166); - expect(estimate.totalCost).toEqual(69416); - expect(estimate.usingBaseFeeMutez).toEqual(166); + expect(estimate.minimalFeeMutez).toEqual(168); + expect(estimate.totalCost).toEqual(69418); + expect(estimate.usingBaseFeeMutez).toEqual(168); expect(estimate.consumedMilligas).toEqual(100040); }); @@ -69,11 +69,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(677); expect(estimate.storageLimit).toEqual(591); - expect(estimate.suggestedFeeMutez).toEqual(535); + expect(estimate.suggestedFeeMutez).toEqual(537); expect(estimate.burnFeeMutez).toEqual(147750); - expect(estimate.minimalFeeMutez).toEqual(515); - expect(estimate.totalCost).toEqual(148265); - expect(estimate.usingBaseFeeMutez).toEqual(515); + expect(estimate.minimalFeeMutez).toEqual(517); + expect(estimate.totalCost).toEqual(148267); + expect(estimate.usingBaseFeeMutez).toEqual(517); expect(estimate.consumedMilligas).toEqual(676402); }); @@ -84,11 +84,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { }); expect(estimate.gasLimit).toEqual(100); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(181); + expect(estimate.suggestedFeeMutez).toEqual(183); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(161); - expect(estimate.totalCost).toEqual(161); - expect(estimate.usingBaseFeeMutez).toEqual(161); + expect(estimate.minimalFeeMutez).toEqual(163); + expect(estimate.totalCost).toEqual(163); + expect(estimate.usingBaseFeeMutez).toEqual(163); expect(estimate.consumedMilligas).toEqual(100000); }); @@ -97,12 +97,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1457); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(394); + expect(estimate.suggestedFeeMutez).toEqual(396); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(374); - expect(estimate.totalCost).toEqual(374); - expect(estimate.usingBaseFeeMutez).toEqual(374); - expect(estimate.consumedMilligas).toEqual(1456056); + expect(estimate.minimalFeeMutez).toEqual(376); + expect(estimate.totalCost).toEqual(376); + expect(estimate.usingBaseFeeMutez).toEqual(376); + expect(estimate.consumedMilligas).toEqual(1456142); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -114,12 +114,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1571); expect(estimate.storageLimit).toEqual(534); - expect(estimate.suggestedFeeMutez).toEqual(465); + expect(estimate.suggestedFeeMutez).toEqual(467); expect(estimate.burnFeeMutez).toEqual(133500); - expect(estimate.minimalFeeMutez).toEqual(445); - expect(estimate.totalCost).toEqual((133945)); - expect(estimate.usingBaseFeeMutez).toEqual(445); - expect(estimate.consumedMilligas).toEqual(1570585); + expect(estimate.minimalFeeMutez).toEqual(447); + expect(estimate.totalCost).toEqual(133947); + expect(estimate.usingBaseFeeMutez).toEqual(447); + expect(estimate.consumedMilligas).toEqual(1570671); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -127,12 +127,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(1867); expect(estimate.storageLimit).toEqual(337); - expect(estimate.suggestedFeeMutez).toEqual(441); + expect(estimate.suggestedFeeMutez).toEqual(443); expect(estimate.burnFeeMutez).toEqual(84250); - expect(estimate.minimalFeeMutez).toEqual(421); - expect(estimate.totalCost).toEqual(84671); - expect(estimate.usingBaseFeeMutez).toEqual(421); - expect(estimate.consumedMilligas).toEqual(1866680); + expect(estimate.minimalFeeMutez).toEqual(423); + expect(estimate.totalCost).toEqual(84673); + expect(estimate.usingBaseFeeMutez).toEqual(423); + expect(estimate.consumedMilligas).toEqual(1866766); }); it('Verify .estimate.transfer for multiple internal originations', async () => { @@ -140,12 +140,12 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { const estimate = await LowAmountTez.estimate.transfer(tx); expect(estimate.gasLimit).toEqual(2392); expect(estimate.storageLimit).toEqual(654); - expect(estimate.suggestedFeeMutez).toEqual(559); + expect(estimate.suggestedFeeMutez).toEqual(561); expect(estimate.burnFeeMutez).toEqual(163500); - expect(estimate.minimalFeeMutez).toEqual(539); - expect(estimate.totalCost).toEqual(164039); - expect(estimate.usingBaseFeeMutez).toEqual(539); - expect(estimate.consumedMilligas).toEqual(2391833); + expect(estimate.minimalFeeMutez).toEqual(541); + expect(estimate.totalCost).toEqual(164041); + expect(estimate.usingBaseFeeMutez).toEqual(541); + expect(estimate.consumedMilligas).toEqual(2391919); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); @@ -176,11 +176,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + getRevealFee(await LowAmountTez.signer.publicKeyHash())) }); expect(estimate.gasLimit).toEqual(101); expect(estimate.storageLimit).toEqual(0); - expect(estimate.suggestedFeeMutez).toEqual(185); + expect(estimate.suggestedFeeMutez).toEqual(187); expect(estimate.burnFeeMutez).toEqual(0); - expect(estimate.minimalFeeMutez).toEqual(165); - expect(estimate.totalCost).toEqual(165); - expect(estimate.usingBaseFeeMutez).toEqual(165); + expect(estimate.minimalFeeMutez).toEqual(167); + expect(estimate.totalCost).toEqual(167); + expect(estimate.usingBaseFeeMutez).toEqual(167); expect(estimate.consumedMilligas).toEqual(100040); }); From 163b0868fa71c1521b222242aeafc97fb8f5f7b7 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 11 Jun 2024 14:16:59 -0700 Subject: [PATCH 4/4] updated example doc --- docs/cancel_http_requests.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cancel_http_requests.md b/docs/cancel_http_requests.md index 78b9187bf0..79a6c3c143 100644 --- a/docs/cancel_http_requests.md +++ b/docs/cancel_http_requests.md @@ -43,6 +43,7 @@ class CancellableHttpBackend extends HttpBackend { try { const response = await fetch(urlWithQuery, { + keepalive: false, // generally only for Node 19 and above method, headers, body: JSON.stringify(data),