Skip to content

Commit

Permalink
Add processing of 0 kind of offchain storage (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsa authored Aug 26, 2024
1 parent 1e73fb8 commit 565921f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/host_api/impl/offchain_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ namespace kagome::host_api {
auto &memory = memory_provider_->getCurrentMemory()->get();

StorageType storage_type = StorageType::Undefined;
if (kind == 1) {
if (kind == 1 || kind == 0) { // 0 is needed due to the bug in the runtime
// that sends 0 instead of 1
storage_type = StorageType::Persistent;
} else if (kind == 2) {
storage_type = StorageType::Local;
Expand All @@ -129,7 +130,8 @@ namespace kagome::host_api {
auto &memory = memory_provider_->getCurrentMemory()->get();

StorageType storage_type = StorageType::Undefined;
if (kind == 1) {
if (kind == 1 || kind == 0) { // 0 is needed due to the bug in the runtime
// that sends 0 instead of 1
storage_type = StorageType::Persistent;
} else if (kind == 2) {
storage_type = StorageType::Local;
Expand All @@ -154,7 +156,8 @@ namespace kagome::host_api {
auto &memory = memory_provider_->getCurrentMemory()->get();

StorageType storage_type = StorageType::Undefined;
if (kind == 1) {
if (kind == 1 || kind == 0) { // 0 is needed due to the bug in the runtime
// that sends 0 instead of 1
storage_type = StorageType::Persistent;
} else if (kind == 2) {
storage_type = StorageType::Local;
Expand Down Expand Up @@ -192,7 +195,8 @@ namespace kagome::host_api {
auto &memory = memory_provider_->getCurrentMemory()->get();

StorageType storage_type = StorageType::Undefined;
if (kind == 1) {
if (kind == 1 || kind == 0) { // 0 is needed due to the bug in the runtime
// that sends 0 instead of 1
storage_type = StorageType::Persistent;
} else if (kind == 2) {
storage_type = StorageType::Local;
Expand Down

0 comments on commit 565921f

Please sign in to comment.