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;
|
||||
let baseState = isFirstEvaluation ? executionContext.contractDefinition.initState : cachedState.cachedValue.state;
|
||||
const baseValidity = isFirstEvaluation ? {} : cachedState.cachedValue.validity;
|
||||
const baseErrorMessages = isFirstEvaluation ? {} : cachedState.cachedValue.errorMessages;
|
||||
const baseValidity = isFirstEvaluation ? {} : cachedState.cachedValue.validity || {};
|
||||
const baseErrorMessages = isFirstEvaluation ? {} : cachedState.cachedValue.errorMessages || {};
|
||||
|
||||
if (isFirstEvaluation) {
|
||||
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.
|
||||
return await this.doReadState(
|
||||
missingInteractions,
|
||||
new EvalStateResult(baseState, baseValidity, baseErrorMessages || {}),
|
||||
new EvalStateResult(baseState, baseValidity, baseErrorMessages),
|
||||
executionContext
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user