Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
fix(warp): bump warp sdk, remove fallback batch read
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Jan 9, 2024
1 parent e40991b commit 8e82419
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 2 additions & 10 deletions src/api/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 8e82419

Please sign in to comment.