From 8e82419941bb6216b499b20920deaa918a3dca21 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Mon, 8 Jan 2024 22:18:44 -0700 Subject: [PATCH] fix(warp): bump warp sdk, remove fallback batch read --- package.json | 2 +- src/api/warp.ts | 12 ++---------- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 8d16389..b311c97 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "koa2-swagger-ui": "^5.10.0", "lodash": "^4.17.21", "prom-client": "^14.2.0", - "warp-contracts": "^1.4.31", + "warp-contracts": "^1.4.32", "warp-contracts-sqlite": "^1.0.2", "winston": "^3.8.2", "yaml": "^2.3.1" diff --git a/src/api/warp.ts b/src/api/warp.ts index 41fcba4..13d2ba1 100644 --- a/src/api/warp.ts +++ b/src/api/warp.ts @@ -221,8 +221,7 @@ async function readThroughToContractState( }); const readStatePromise = doBatchRead - ? // NOTE: there is a bug in warp where `readStateBatch` returns null when a contract does not have any interactions on it. we handle it below by falling back to read state if we get `null` - contract.readStateBatch(DEFAULT_PAGES_PER_BATCH, providedSortKey, signal) + ? contract.readStateBatch(DEFAULT_PAGES_PER_BATCH, providedSortKey, signal) : contract.readState(providedBlockHeight, undefined, signal); // set cached value for multiple requests during initial promise @@ -245,14 +244,7 @@ async function readThroughToContractState( }); // await the response - const stateEvaluationResult = - (await stateRequestMap.get(cacheId)) ?? - // the temporary workaround for warp bug where it doesn't return a result for the readStateBatch when a contract has no interactions - (await contract.readState( - providedSortKey || providedBlockHeight, - undefined, - signal, - )); + const stateEvaluationResult = await stateRequestMap.get(cacheId); if (!stateEvaluationResult) { logger?.error('Contract state did not return a result!', { contractTxId, diff --git a/yarn.lock b/yarn.lock index 063bb0b..47dd6e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6996,10 +6996,10 @@ warp-contracts-sqlite@^1.0.2: better-sqlite3 "^8.3.0" safe-stable-stringify "^2.4.3" -warp-contracts@^1.4.31: - version "1.4.31" - resolved "https://registry.yarnpkg.com/warp-contracts/-/warp-contracts-1.4.31.tgz#b8d4b14f976d2e8955f745500746da4e65e777e2" - integrity sha512-ep8LsbKkjvbPnWJUdlItI6fg5NqIQi/EDe4xRJgMFzFv2dvafeF7/7V0jul6kuuiMTcqHt2cXErnZIFL7Ne9Ew== +warp-contracts@^1.4.32: + version "1.4.32" + resolved "https://registry.yarnpkg.com/warp-contracts/-/warp-contracts-1.4.32.tgz#3d5c1ce973dde9d481618b1e060fac2de2870049" + integrity sha512-33OGr5xmarXFAfdmnJvAOrFLIT/Z6mp5BJEXw3dfaffM7mOGDsegWMDxNRoqWC2LFQFvvqnmuxq/FhEC6QRNgg== dependencies: archiver "^5.3.0" arweave "1.13.7"