starknet_committer: underlying logic of the new read witnesses and commit endpoint#14001
starknet_committer: underlying logic of the new read witnesses and commit endpoint#14001ArielElp wants to merge 1 commit into
Conversation
97f4dda to
c42c4a2
Compare
a48fffb to
bd02493
Compare
bd02493 to
a600115
Compare
2892fbe to
573c4db
Compare
a600115 to
65906b7
Compare
573c4db to
0ef9967
Compare
65906b7 to
4de5b94
Compare
2f5189a to
d248e3b
Compare
4de5b94 to
58e714d
Compare
334fb68 to
b9d7c24
Compare
38ad4df to
0ef2f36
Compare
b9d7c24 to
a11c9cd
Compare
0ef2f36 to
574e6b3
Compare
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 1 comment and resolved 1 discussion.
Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on yoavGrs).
crates/apollo_committer/src/committer.rs line 626 at r6 (raw file):
Previously, yoavGrs wrote…
This is my suggestion - break it with a
letin the middle.
Done
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 2 files and all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved.
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp dismissed @yoavGrs from a discussion.
Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on yoavGrs).
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs partially reviewed 4 files and all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved.
yoavGrs
left a comment
There was a problem hiding this comment.
Reviewable status: 4 of 5 files reviewed, all discussions resolved.
574e6b3 to
f54eccf
Compare
e18eb18 to
625c60d
Compare
f54eccf to
491609e
Compare
625c60d to
d46842e
Compare
491609e to
6a5093a
Compare
6a5093a to
b5bb2a9
Compare
d46842e to
a573e34
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 5 files and all commit messages, and made 5 comments.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on ArielElp).
crates/apollo_committer/Cargo.toml line 11 at r8 (raw file):
[features] testing = [] os_input = ["apollo_committer_types/os_input", "starknet_committer/os_input"]
this is already in the os-inputs workflow right?
Code quote:
os_input = ["apollo_committer_types/os_input", "starknet_committer/os_input"]crates/apollo_committer/src/committer.rs line 511 at r8 (raw file):
class_hashes.len(), contract_addresses.len() );
it would be nice to log
- state diff "size" (how many diffs in total, classes + storage leaves)
- "read set size"
- height
currently you have height + partial read set size (no state diff size or number of storage leaves needed to be read)
Code quote:
info!(
"read_paths_and_commit_block: block {height} with {} class hashes, {} contract \
addresses",
class_hashes.len(),
contract_addresses.len()
);crates/apollo_committer/src/committer.rs line 532 at r8 (raw file):
} // Flow overview: // 1. Fetch patricia paths for the accessed keys
Suggestion:
// 1. Fetch patricia paths for the accessed keys.crates/apollo_committer/src/committer.rs line 537 at r8 (raw file):
// 3. Fetch patricia paths for the post-commit tries, via running step 1 against a two // layer storage composed from the underlying storage and the modifications from 2. // 4. Merge the two sets of patricia paths and write the result to the storage.
this phase is done in "fact layout" mode, right? if we have two versions of the same node we will want both of them in the result
Code quote:
4. Merge the two sets of patricia paths and write the result to the storage.crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):
}) }) .transpose()
what's this?
Code quote:
.transpose()
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 5 comments and resolved 1 discussion.
Reviewable status: 4 of 7 files reviewed, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).
crates/apollo_committer/Cargo.toml line 11 at r8 (raw file):
Previously, dorimedini-starkware wrote…
this is already in the os-inputs workflow right?
These are, just added apollo_committer too
crates/apollo_committer/src/committer.rs line 511 at r8 (raw file):
Previously, dorimedini-starkware wrote…
it would be nice to log
- state diff "size" (how many diffs in total, classes + storage leaves)
- "read set size"
- height
currently you have height + partial read set size (no state diff size or number of storage leaves needed to be read)
Done.
crates/apollo_committer/src/committer.rs line 537 at r8 (raw file):
Previously, dorimedini-starkware wrote…
this phase is done in "fact layout" mode, right? if we have two versions of the same node we will want both of them in the result
yes, it's a merge of two maps from hash to preimage
crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):
Previously, dorimedini-starkware wrote…
what's this?
Option -->Result
crates/apollo_committer/src/committer.rs line 511 at r9 (raw file):
accumulator }, );
@dorimedini-starkware @yoavGrs the blockifier's accessed keys don't sit too well here, my signatures are induced from fetch_all_patricia_paths/fetch_patricia_paths, so I need another conversion here. I can either extract this to a function or revert to a different style of AccessedKeys.
Code quote:
let class_hashes: Vec<_> = accessed_class_hashes.iter().copied().collect();
let contract_addresses: Vec<_> = accessed_contracts.iter().copied().collect();
let contract_storage_keys = storage_keys.iter().fold(
HashMap::<ContractAddress, Vec<StarknetStorageKey>>::new(),
|mut accumulator, (address, key)| {
accumulator.entry(*address).or_default().push(StarknetStorageKey(*key));
accumulator
},
);
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 1 comment.
Reviewable status: 4 of 7 files reviewed, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).
crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):
Previously, ArielElp wrote…
Option -->Result
`Option<Result<T, E>>` → `Result<Option, E>`
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 1 comment.
Reviewable status: 4 of 7 files reviewed, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).
crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):
Previously, ArielElp wrote…
`Option<Result<T, E>>` → `Result<Option, E>`
`Option<Result<T, E>>` → `Result<Option, E>`
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 3 files and all commit messages, made 2 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on yoavGrs).
crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):
Previously, ArielElp wrote…
`Option<Result<T, E>>` → `Result<Option, E>`
lol
my turn to try
Option<Result<T, E>> → Result<Option<T>, E>
crates/apollo_committer/src/committer.rs line 511 at r9 (raw file):
Previously, ArielElp wrote…
@dorimedini-starkware @yoavGrs the blockifier's accessed keys don't sit too well here, my signatures are induced from fetch_all_patricia_paths/fetch_patricia_paths, so I need another conversion here. I can either extract this to a function or revert to a different style of AccessedKeys.
@yoavGrs is AccessedKeys used anywhere else, other than DB serialization logic? Maybe better to change the types at the source
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp and dorimedini-starkware).
crates/apollo_committer/src/committer.rs line 511 at r9 (raw file):
Previously, dorimedini-starkware wrote…
@yoavGrs is
AccessedKeysused anywhere else, other than DB serialization logic? Maybe better to change the types at the source
It is used in the flow tests.
You can change the type, but a B-tree is sorted and does not allow duplicates.
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp and yoavGrs).
crates/apollo_committer/src/committer.rs line 511 at r9 (raw file):
Previously, yoavGrs wrote…
It is used in the flow tests.
You can change the type, but a B-tree is sorted and does not allow duplicates.
@ArielElp we already talked about using BTrees in the fetch-paths signatures, which will help your sorted-indices struct as well, right?
I suggest leaving the conversions as they are, and migrating to BTrees in a PR at the top of the stack. This will solve it, correct?
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on dorimedini-starkware and yoavGrs).
crates/apollo_committer/src/committer.rs line 511 at r9 (raw file):
Previously, dorimedini-starkware wrote…
@ArielElp we already talked about using BTrees in the fetch-paths signatures, which will help your sorted-indices struct as well, right?
I suggest leaving the conversions as they are, and migrating to BTrees in a PR at the top of the stack. This will solve it, correct?
Looks doable, will add a PR.
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).
dorimedini-starkware
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on ArielElp).

No description provided.