feat(dot/rpc): implement RPC method state_queryStorageAt#3185
feat(dot/rpc): implement RPC method state_queryStorageAt#3185edwardmack wants to merge 7 commits intodevelopmentfrom
Conversation
099ce44 to
26cea02
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## development #3185 +/- ##
===============================================
+ Coverage 51.45% 51.52% +0.07%
===============================================
Files 221 221
Lines 28281 28305 +24
===============================================
+ Hits 14551 14584 +33
+ Misses 12410 12404 -6
+ Partials 1320 1317 -3 |
| // StateStorageQueryAtRequest holds json fields | ||
| type StateStorageQueryAtRequest struct { |
There was a problem hiding this comment.
I think StateStorageQueryAtRequest can be unexported
There was a problem hiding this comment.
That would apply to its properties as well.
I don't see any variable of type StateStorageQueryAtRequest getting used by scale. Because scale requires structs and properties to be exported.
There was a problem hiding this comment.
I think they are exported for the encoding/json encoder to work right?
There was a problem hiding this comment.
Yes, they are exported for encoding/json encoder to work.
There was a problem hiding this comment.
Still, is there a reason we keep StateStorageQueryAtRequest exported?
There was a problem hiding this comment.
Yes, we're using Gorilla web toolkit to expose functions through RPC, Gorilla exposes functions with a signature of containing exported structs for request and response. I tried changing StateStorageQueryAtRequest to un-exported and the RPC function was no longer accessible.
26cea02 to
99d0f68
Compare
| // StateStorageQueryAtRequest holds json fields | ||
| type StateStorageQueryAtRequest struct { |
There was a problem hiding this comment.
Still, is there a reason we keep StateStorageQueryAtRequest exported?
| changes[i] = [2]*string{stringPtr(key), hexValue} | ||
| } | ||
|
|
||
| *response = []StorageChangeSetResponse{{ |
There was a problem hiding this comment.
TIL you don't need to initialize the slice pointer which is weird AF
There was a problem hiding this comment.
I think this is because response is initialized since it is a function argument.
Co-authored-by: Diego Romero <diego2737@gmail.com>
|
closed see merged PR #3191 |
Changes
state_queryStorageAtwhich returns storage values for given keys at best block or given block hash ifatparameter is used.rpc: can't find method "state.QueryStorageAt"that occurs when using polkadot.js/api methods inapi.querypackage.Tests
go test github.com/ChainSafe/gossamer/dot/rpc/modules -run ^TestStateModuleQueryStorageAt$ -vIssues
closes: #3182
Primary Reviewer
@timwu20