This repository was archived by the owner on Nov 15, 2023. It is now read-only.
substrate: return Option in all storage related RPC methods#510
Merged
substrate: return Option in all storage related RPC methods#510
Conversation
|
It looks like @andresilva signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
andresilva
commented
Aug 8, 2018
substrate/client/src/client.rs
Outdated
| pub fn code_at(&self, id: &BlockId<Block>) -> error::Result<Vec<u8>> { | ||
| self.storage(id, &StorageKey(b":code".to_vec())).map(|data| data.0) | ||
| pub fn code_at(&self, id: &BlockId<Block>) -> error::Result<Option<Vec<u8>>> { | ||
| Ok(self.storage(id, &StorageKey(b":code".to_vec()))?.map(|data| data.0)) |
Contributor
Author
There was a problem hiding this comment.
Can we expect this key to always exist? (even if set to empty).
Contributor
There was a problem hiding this comment.
Yeah, definitely. Under this key the code of the runtime is stored.
For example, here is a genesis storage for krummelanke (Key 0x3a636f6465 is actually stands for ":code")
Contributor
Author
There was a problem hiding this comment.
Should I call expect here and return Result<Vec<u8>> instead?
Contributor
There was a problem hiding this comment.
I would answer "yes". Personally, I don't see any legal use-cases for it to be None
tomusdrw
approved these changes
Aug 8, 2018
pepyakin
approved these changes
Aug 8, 2018
dvdplm
added a commit
that referenced
this pull request
Aug 9, 2018
* master: README: fixed typo in docker run command (#518) Merge *_at methods. (#515) New flags to listen to all interfaces (#495) If contract reaches max depth, return Err (#503) Some networking cleanups (#504) Derivable Encode & Decode (#509) substrate: return Option in all storage related RPC methods (#510) Build with locked Cargo.lock on CI (#514) Place call data into a newly allocated pages (#502)
gavofyork
pushed a commit
that referenced
this pull request
Aug 10, 2018
* substrate: return Option in all storage related RPC methods * substrate: remove unused imports * substrate: remove unused NoValueForKey error variant * substrate: don't return Option on code_at since code is always defined
liuchengxu
pushed a commit
to autonomys/substrate
that referenced
this pull request
Jun 3, 2022
Set import granularity for rustfmt
helin6
pushed a commit
to boolnetwork/substrate
that referenced
this pull request
Jul 25, 2023
* add system_health rpc * fmt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #508.