-
Notifications
You must be signed in to change notification settings - Fork 41
Fix storage read #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix storage read #522
Conversation
Signed-off-by: kamilsa <[email protected]>
Signed-off-by: kamilsa <[email protected]>
| auto [value_ptr, value_size] = runtime::WasmResult(value_out); | ||
|
|
||
| auto key = memory_->loadN(key_ptr, key_size); | ||
| boost::optional<uint32_t> res{boost::none}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It initializes with none in ctor by def, i suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but making it explicit improves readability I suppose
| auto encoded_opt_val_size = | ||
| kagome::scale::encode(boost::make_optional(value.length)).value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_OUTCOME_TRUE(encoded_opt_val_size, kagome::scale::encode(boost::make_optional(value.length)));Signed-off-by: kamilsa <[email protected]>
|
As far as I can tell from the code, the return value is neither to spec (data written), nor what substrate does (value size in storage) or claims to do (value size at offset), but the length of the buffer passed into the function, which the caller knows anyway. After a bit of discussion, we settled for returning the amount of data in store at that offset (option 3) and Parity implemented a fix accordingly in paritytech/substrate#7084. We will update the spec as well and track all progress, including progress on adding the |
|
Thanks! We will fix accordingly |
* Fix storage read Signed-off-by: kamilsa <[email protected]>
Signed-off-by: kamilsa [email protected]
Referenced issues
Fixes #520
Description of the Change
Fixes problem of wronlgy returned valur from ext_storage_read
Benefits
Conformance
Possible Drawbacks
None
Usage Examples or Tests
StorageExtensionTest