Skip to content

Commit

Permalink
fix: do not modify KV store in case of view operations
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiszczatowski committed Mar 15, 2023
1 parent b1af2ba commit bf4d1b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/modules/impl/handler/WasmHandlerApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export class WasmHandlerApi<State> extends AbstractContractHandler<State> {
};
}
} finally {
if (interactionData.interaction.interactionType === 'view') {
// view calls are not allowed to perform any KV modifications
await this.swGlobal.kv.rollback();
}
await this.swGlobal.kv.close();
}
}
Expand Down

0 comments on commit bf4d1b6

Please sign in to comment.