-
Notifications
You must be signed in to change notification settings - Fork 6
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
refactor(rpc-server): Tweaks and clean up around query.call_function method implementation #258
Conversation
09624a0
to
2f04337
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.
Grate! Thank you! I've left a few requests to make it better.
validators: HashMap<near_primitives::types::AccountId, near_primitives::types::Balance>, | ||
data_count: u64, | ||
is_optimistic: bool, | ||
prefetched_data: |
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.
This is already deleted in #259. Observations have shown that it is not efficient to request the whole stack. Therefore, this functionality was removed.
} | ||
|
||
fn get_state_key_data(&self, key: &[u8]) -> readnode_primitives::StateValue { | ||
if let Some(prefetched_data) = &self.prefetched_data { |
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 is not needed according to the comment above.
|
||
// TODO: Refactor this part. It's a temporary solution to fetch state keys from DB for the poolv1.near contracts | ||
// https://github.com/near/read-rpc/issues/150 | ||
let contract_state = if account_id.to_string().ends_with("poolv1.near") { |
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 is not needed according to the comment above.
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.
This is a great improvement! Thank you!
3d45641
to
358814c
Compare
* fix(near-state-indexer): Fix the TypeError in communication with Redis leading to spam of warnings (#254) * (rpc_server): metrics refactoring and improvements (#255) * merics reffactoring and imrovements * metrics improvements according pr comments * improvement tracing instrument logs (#257) * (database): Implement metrics to count requests for each table (#259) * Implement metrics to count request for each database table * remove logic to fetch all state before contract call * add issue to implement metrics for postgres * rename mentric DATABASE_QUERIES to DATABASE_READ_QUERIES * refactor(rpc-server): Tweaks and clean up around query.call_function method implementation (#258) * refactor(rpc-server): Tweaks and clean up around query.call_function method implementation * Follow the clippy suggestion * Drop redundant pieces of code * fix tx different results (#261) * Metrics(rpc-server): Extend metrics (#263) * extend metrics to collect block category * fmt * code improvement according git comments * Revert "fix tx different results" (#265) This reverts commit 2e4dc30. * feat: added `view_receipt_record` rpc endpoint (#266) * feat: added `view_receipt_record` rpc endpoint * chore: removed leftovers * feat: used appropriate metrics * feat: added proper response structure * docs(view_receipt_record): added new custom method * hook for poolv1.near (#267) * chore: relese v0.2.9 (#268) * proxy next_light_client_block to regular rpc (#269) * fix changelog.md (#270) --------- Co-authored-by: Bohdan Khorolets <[email protected]> Co-authored-by: Ivan Frolov <[email protected]>
I am thoroughly reviewing the logic around
query.call_function
method implementation to find a way to improve the usage of ScyllaDB here. This work is related to the #236While I am here and noticing some areas for improvement, I am also implementing them (Boy Scout Rule in action).
High-level changes
contract_runner
within thequery
oneblock_reference
forfetch_block_from_cache_or_get
function (this actually went a bit beyond thequery
module tbh)query:: function_call
(dropped two similar functions, moved the code to thefunction_call
body, it seems like it belongs there to me)