Closed dtfiedler closed 1 year ago
Hmm, we already have evaluation time limit for each interaction (https://github.com/warp-contracts/warp/blob/main/src/core/modules/StateEvaluator.ts#L122), not sure if we want to add a 'global' limit, since it's more of an 'external' client feature (the one, that is using warp) and we're trying to avoid 'feature creep' in the SDK...
Also - not sure if AbortController is the best solution here...IMO a better one could be creating a separate Worker that evaluates the contract code - and calling worker.teminate
after some specific timeout...but again - it's kinda 'external' feature to the SDK itself...anyway, we will discuss this internally..
Is your feature request related to a problem? Please describe. Sometimes contract states can be huge, and dApps running in the browser (or lean services) may want to abort evaluating contract state if it's evaluation time is too long or consuming too much memory.
Describe the solution you'd like It would be nice to be able to provide a node
AbortController
signal when evaluating contract state to cancel in inflight request, similar to thenode:fetch
API.Example:
Describe alternatives you've considered You can achieve this by wrapping
readState
in asetTimeout()
call, or usingPromise.race
with asetTimeout
but it would be nice ifreadState()
natively supported abort controllers to follow existing asyncAbortController
patterns.e.g.
Additional context Some details on AbortController