fix: additionally provide an empty object for validity if the cache returns undefined
This commit is contained in:
@@ -52,8 +52,8 @@ export class CacheableStateEvaluator extends DefaultStateEvaluator {
|
|||||||
|
|
||||||
const isFirstEvaluation = cachedState == null;
|
const isFirstEvaluation = cachedState == null;
|
||||||
let baseState = isFirstEvaluation ? executionContext.contractDefinition.initState : cachedState.cachedValue.state;
|
let baseState = isFirstEvaluation ? executionContext.contractDefinition.initState : cachedState.cachedValue.state;
|
||||||
const baseValidity = isFirstEvaluation ? {} : cachedState.cachedValue.validity;
|
const baseValidity = isFirstEvaluation ? {} : cachedState.cachedValue.validity || {};
|
||||||
const baseErrorMessages = isFirstEvaluation ? {} : cachedState.cachedValue.errorMessages;
|
const baseErrorMessages = isFirstEvaluation ? {} : cachedState.cachedValue.errorMessages || {};
|
||||||
|
|
||||||
if (isFirstEvaluation) {
|
if (isFirstEvaluation) {
|
||||||
baseState = await executionContext.handler.maybeCallStateConstructor(
|
baseState = await executionContext.handler.maybeCallStateConstructor(
|
||||||
@@ -81,7 +81,7 @@ export class CacheableStateEvaluator extends DefaultStateEvaluator {
|
|||||||
// eval state for the missing transactions - starting from the latest value from cache.
|
// eval state for the missing transactions - starting from the latest value from cache.
|
||||||
return await this.doReadState(
|
return await this.doReadState(
|
||||||
missingInteractions,
|
missingInteractions,
|
||||||
new EvalStateResult(baseState, baseValidity, baseErrorMessages || {}),
|
new EvalStateResult(baseState, baseValidity, baseErrorMessages),
|
||||||
executionContext
|
executionContext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user