8000 sweat: update prefetcher for record_batch_for_hold by nagisa · Pull Request #11338 · near/nearcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 div id="repo-content-pjax-container" class="repository-content " >

sweat: update prefetcher for record_batch_for_hold #11338

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

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions runtime/runtime/src/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
//! in the prefetcher. Implementation details for most limits are in
//! `core/store/src/trie/prefetching_trie_storage.rs`

use borsh::BorshSerialize as _;
use near_o11y::metrics::prometheus;
use near_o11y::metrics::prometheus::core::GenericCounter;
use near_primitives::receipt::{Receipt, ReceiptEnum};
Expand Down Expand Up @@ -306,16 +307,14 @@ impl TriePrefetcher {
return Ok(());
};
for tuple in list.iter() {
let Some(tuple) = tuple.as_array() else {
continue;
};
let Some(user_account) = tuple.first().and_then(|a| a.as_str()) else {
continue;
};
// Unique prefix of underlying data structure.
let mut key = vec![0, 64, 0, 0, 0];
key.extend(user_account.as_bytes());
let trie_key = TrieKey::ContractData { account_id: account_id.clone(), key };
let Some(tuple) = tuple.as_array() else { continue };
let Some(user_account) = tuple.first().and_then(|a| a.as_str()) else { continue };
let mut account_data_key = Vec::with_capacity(4 + 8 + user_account.len());
// (branch v2) StorageKey::Accounts = 4u8
let Ok(()) = 4u8.serialize(&mut account_data_key) else { continue };
let Ok(()) = user_account.serialize(&mut account_data_key) else { continue };
let trie_key =
TrieKey::ContractData { account_id: account_id.clone(), key: account_data_key };
near_o11y::io_trace!(count: "prefetch");
self.prefetch_trie_key(trie_key)?;
}
Expand Down
Loading
0