starknet_committer: define fetch_contract_storage_paths_concurrently#14282
Conversation
9c26b8a to
a4fcb4e
Compare
5d66469 to
3dd02d1
Compare
PR SummaryLow Risk Overview Extracts The new entry points are Reviewed by Cursor Bugbot for commit 72f6809. Bugbot is set up for automated code reviews on this repo. Configure here. |
a4fcb4e to
2cabcf1
Compare
3dd02d1 to
1bb4a46
Compare
1bb4a46 to
c0762db
Compare
98cfa3b to
f629d46
Compare
c0762db to
74043bf
Compare
f629d46 to
6475f21
Compare
227a428 to
9950a6c
Compare
6475f21 to
7b965ad
Compare
f36ecf8 to
0f499ff
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).
crates/starknet_committer/src/db/trie_traversal.rs line 1001 at r1 (raw file):
.await?; contracts_trie_storage_proofs.insert(contract_address, proof); }
Now I see that it's not new code.
Code quote:
let mut contracts_trie_storage_proofs =
HashMap::with_capacity(contract_storage_sorted_leaf_indices.len());
for (idx, sorted_leaf_indices) in contract_storage_sorted_leaf_indices {
let contract_address = try_node_index_into_contract_address(idx).unwrap_or_else(|_| {
panic!(
"Converting leaf NodeIndex to ContractAddress should succeed; failed to convert \
{idx:?}."
)
});
// The contract address might not exist in the contracts trie in the following cases:
// 1. We are looking at the previous tree and the contract is new.
// 2. We are looking at the new tree and the contract is deleted (revert).
// In either case, the storage trie of this contract is empty, so there is nothing to
// prove regarding the contract storage.
let Some(storage_root_hash) =
contract_leaves.get(idx).map(|leaf| leaf.as_ref().storage_root_hash)
else {
continue;
};
let leaves = None;
let proof = fetch_patricia_paths::<StorageLayout::DbLeaf, StorageLayout>(
storage,
storage_root_hash,
*sorted_leaf_indices,
leaves,
&contract_address,
)
.await?;
contracts_trie_storage_proofs.insert(contract_address, proof);
}
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArielElp).
crates/starknet_committer/src/db/trie_traversal.rs line 1000 at r1 (raw file):
) .await?; contracts_trie_storage_proofs.insert(contract_address, proof);
Share code with impl StorageTask for StoragePathsReadTask.
Code quote:
let leaves = None;
let proof = fetch_patricia_paths::<StorageLayout::DbLeaf, StorageLayout>(
storage,
storage_root_hash,
*sorted_leaf_indices,
leaves,
&contract_address,
)
.await?;
contracts_trie_storage_proofs.insert(contract_address, proof);
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 1 file.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArielElp).
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on yoavGrs).
crates/starknet_committer/src/db/trie_traversal.rs line 1000 at r1 (raw file):
Previously, yoavGrs wrote…
Share code with
impl StorageTask for StoragePathsReadTask.
There isn't much code to share, it only ends up increasing LOC. StoragePathsReadTask just calls fetch_patricia_paths, this function loops + does some input preparation.
0f499ff to
7403c44
Compare
b1d7747 to
101a813
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 file and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArielElp and yoavGrs).
crates/starknet_committer/src/db/trie_traversal.rs line 1001 at r1 (raw file):
Previously, yoavGrs wrote…
Now I see that it's not new code.
where is it from?
crates/starknet_committer/src/db/trie_traversal.rs line 989 at r1 (raw file):
else { continue; };
to reduce boilerplate and keep the same docstring in one place, extract to a function and use twice
Suggestion:
let Some((contract_address, storage_root_hash)) = get_address_and_storage_root(
idx, contract_leaves
) else {
continue;
};
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArielElp and yoavGrs).
crates/starknet_committer/src/db/trie_traversal.rs line 1001 at r1 (raw file):
Previously, dorimedini-starkware wrote…
where is it from?
ah, from fetch_all_patricia_paths?
7403c44 to
d0cde67
Compare
101a813 to
376f97c
Compare
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 2 comments.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).
crates/starknet_committer/src/db/trie_traversal.rs line 989 at r1 (raw file):
Previously, dorimedini-starkware wrote…
to reduce boilerplate and keep the same docstring in one place, extract to a function and use twice
Done.
crates/starknet_committer/src/db/trie_traversal.rs line 1001 at r1 (raw file):
Previously, dorimedini-starkware wrote…
ah, from
fetch_all_patricia_paths?
Ah now I see what you meant, this logic is changed a bit in the next PR anyway (I accidentally "fixed" it in this one, doesn't matter much)
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 2 files and all commit messages, and resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).
376f97c to
8f1abbf
Compare
d0cde67 to
437c43d
Compare
Merge activity
|
dorimedini-starkware
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on ArielElp).
8f1abbf to
3cbe5fb
Compare
437c43d to
e0b7076
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).
3cbe5fb to
72f6809
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).

No description provided.