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

fix(read): return read interaction errors if they fail #58

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

dtfiedler
Copy link
Collaborator

@dtfiedler dtfiedler commented Nov 20, 2023

Some read interactions are failing, and right now we assume the input is incorrect. This modifies the response/error to include the read interaction error messaging, and throw either an EvaluationError or UnknownError depending on what the response from viewState() returns.

Also breaks apart stateRequestMap and readRequestMap into separate objects with proper types from Warp, to make it easier to debug our caching.

Example response:

❯ curl -iL http://localhost:3000/v1/contract/fbU8Y4NMKKzP4rmAYeYj6tDrVDo9XNbdyq5IZPA31WQ/read/priceForInteraction\?interactionName\=buyRecord\&name\=new-name-10\&years\=1\&type\=lease\&contractTxId\=atomic
HTTP/1.1 400 Bad Request
Vary: Origin
Access-Control-Allow-Origin: 
Content-Type: text/plain; charset=utf-8
Content-Length: 43
Date: Mon, 20 Nov 2023 15:11:37 GMT
Connection: keep-alive
Keep-Alive: timeout=5

This name already exists in an active lease% 

@dtfiedler dtfiedler requested a review from a team as a code owner November 20, 2023 14:57
Some read interactions are failing, and right now we assume the input is incorrect. This modifies the response/error to include the read interaction error messaging, and throw either an `EvaluationError` or `UnknownError` depending on what the response from `viewState()` returns.
@dtfiedler dtfiedler force-pushed the PE-5072-read-interaction-errors branch from e714951 to a97a281 Compare November 20, 2023 15:07
@dtfiedler dtfiedler force-pushed the PE-5072-read-interaction-errors branch from a97a281 to c223ee8 Compare November 20, 2023 15:08
@@ -41,7 +41,7 @@ const warp = WarpFactory.forMainnet(
).useStateCache(
new LmdbCache(defaultCacheOptions, {
maxEntriesPerContract: 1000,
minEntriesPerContract: 10,
minEntriesPerContract: 0,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some (most) ANTs won't have interactions when they are first loaded.

@dtfiedler dtfiedler merged commit b263600 into main Nov 20, 2023
6 checks passed
@dtfiedler dtfiedler deleted the PE-5072-read-interaction-errors branch November 20, 2023 15:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants