qdrvm / kagome

Kagome - C++20 implementation of Polkadot Host
https://kagome.readthedocs.io
Apache License 2.0
158 stars 33 forks source link

Add processing of 0 kind of offchain storage #2191

Closed kamilsa closed 1 month ago

kamilsa commented 1 month ago

[//]: # ( Copyright Quadrivium LLC All Rights Reserved SPDX-License-Identifier: Apache-2.0 )

Referenced issues

None

Description of the Change

It turns out https://github.com/qdrvm/kagome/blob/c1c957515c7bbe91bd23c68f1ec7e5dff8b7eed1/core/host_api/impl/offchain_extension.cpp#L192-L193 can actually receive 0 as a storage kind. This is probably a bug from the runtime. So we should treat this as Persistent storage as it was checked that in Polkadot-SDK the same host api always receives persistent storage kind. Without this fix KAGOME throws an error

Possible Drawbacks

A bit dirty(

Checklist Before Opening a PR

Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item:

  1. Code is formatted: Have you run your code through clang-format to ensure it adheres to the project's coding standards? Yes
  2. Code is documented: Have you added comments and documentation to your code according to the guidelines in the project's contributing guidelines? Yes
  3. Self-review: Have you reviewed your own code to ensure it is free of typos, syntax errors, logical errors, and unresolved TODOs or FIXME without linking to an issue? Yes
  4. Zombienet Tests: Have you ensured that the zombienet tests are passing? Zombienet is a network simulation and testing tool used in this project. It's important to ensure that these tests pass to maintain the stability and reliability of the project. Yes