-
Notifications
You must be signed in to change notification settings - Fork 131
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
feat(dot/rpc): implement RPC method state_queryStorageAt #3185
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think StateStorageQueryAtRequest
can be unexported
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are exported for the encoding/json encoder to work right?
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, they are exported for encoding/json encoder to work.
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.
Still, is there a reason we keep StateStorageQueryAtRequest
exported?
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, 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
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.
lgtm!
// StateStorageQueryAtRequest holds json fields | ||
type StateStorageQueryAtRequest struct { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL you don't need to initialize the slice pointer which is weird AF
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.
I think this is because response
is initialized since it is a function argument.
Co-authored-by: Diego Romero <[email protected]>
closed see merged PR #3191 |
Changes
state_queryStorageAt
which returns storage values for given keys at best block or given block hash ifat
parameter is used.rpc: can't find method "state.QueryStorageAt"
that occurs when using polkadot.js/api methods inapi.query
package.Tests
go test github.com/ChainSafe/gossamer/dot/rpc/modules -run ^TestStateModuleQueryStorageAt$ -v
Issues
closes: #3182
Primary Reviewer
@timwu20