-
Notifications
You must be signed in to change notification settings - Fork 683
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
view_state: add include_proof argument to view state request #7603
Changes from 14 commits
76fc9a6
ae07bc4
137a93f
d3924e3
2e593c6
42364af
c573db6
109b558
8e36200
41ec39b
56ce897
b9007df
6b456d3
3669831
767249f
5391bbd
04b65a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,16 @@ | |
Instead of it aggregate `near_peer_message_received_by_type_total` metric. | ||
For example, to get total rate of received messages use | ||
`sum(rate(near_peer_message_received_by_type_total{...}[5m]))`. | ||
* Few changes to `view_state` JSON RPC query: | ||
- The requset has now an optional `include_proof` argument. When set to | ||
`true`, response’s `proof` will be populated. | ||
- The `proof` within each value in `values` list of a `view_state` response is | ||
now deprecated and will be removed in the future. Client code should ignore | ||
the field. | ||
Comment on lines
+30
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we link some docs explaining how to verify the proof? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those docs currently don’t exist. It is on my TODO to add them. It’s possible that this might need to go into nomicon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Process-wise, I would slightly worrying about merging this without docs: docs seem like a phase where we can easily discover some design issues or what not. I don't think this is blocking, but I would prefer if we did docs before "stabilizing" things. |
||
- The `proof` field directly within `view_state` response is currently always | ||
sent even if proof has not been requested. In the future the field will be | ||
skipped in those cases. Clients should accept responses with this field | ||
missing (unless they set `include_proof`). | ||
matklad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Backtraces on panics are enabled by default, so you no longer need to set | ||
`RUST_BACKTRACE=1` environmental variable. To disable backtraces, set | ||
`RUST_BACKTRACE=0`. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,6 +274,8 @@ pub enum QueryRequest { | |
account_id: AccountId, | ||
#[serde(rename = "prefix_base64", with = "base64_format")] | ||
prefix: StoreKey, | ||
#[serde(default, skip_serializing_if = "is_false")] | ||
include_proof: bool, | ||
Comment on lines
+280
to
+281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this defaults to a
Now, I was going to say it is unfortunate that we’re setting ourselves up for an inevitable breaking change, but from what I can tell the reason this disclaimer is there is because something about let mut iter = state_update.trie().iter()?;
iter.remember_visited_nodes(false); results in I would say that it would be safer to change this default to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
ViewAccessKey { | ||
account_id: AccountId, | ||
|
@@ -290,6 +292,10 @@ pub enum QueryRequest { | |
}, | ||
} | ||
|
||
fn is_false(v: &bool) -> bool { | ||
!*v | ||
} | ||
|
||
#[cfg_attr(feature = "deepsize_feature", derive(deepsize::DeepSizeOf))] | ||
#[derive(Debug, PartialEq, Eq, Clone)] | ||
pub struct QueryResponse { | ||
|
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.
Just to verify my own understanding, populating the
proof
field isn’t a change made specifically in this PR, correct?state_viewer/mod.rs
seems to have had all of the relevant code in it already, and the relevant change is the inclusion of the argument.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.
Correct. We’ve added proof recently in #7593. Priori to that commit (that is, up to and including current testnet release) we’ve always sent empty proof. With #7593 we’re always populating proof. In this PR I want to introduce include_proof filed in the request so that users who don’t care about proofs don’t induce unnecessary load on RPC node.