starknet_committer: extract commit plan to commit_or_load#13999
Conversation
de52d79 to
c3b74da
Compare
26338f3 to
5337544
Compare
c3b74da to
7eb2f0e
Compare
110f567 to
c65f356
Compare
82e9411 to
ff1915d
Compare
c65f356 to
79c4633
Compare
ff1915d to
1a13989
Compare
22b07fe to
85fb96f
Compare
1a13989 to
1fd4ef8
Compare
8111fe7 to
d8145ef
Compare
6bcc7c0 to
57671ad
Compare
d8145ef to
051f86a
Compare
57671ad to
b5ab234
Compare
051f86a to
07c4218
Compare
b5ab234 to
a2756a6
Compare
07c4218 to
2110c62
Compare
a2756a6 to
d645ed9
Compare
2110c62 to
b4c438c
Compare
b4c438c to
c7b7cfa
Compare
9dad213 to
83bf995
Compare
c7b7cfa to
546ab30
Compare
83bf995 to
d5690c8
Compare
546ab30 to
2568de5
Compare
d5690c8 to
c15a08f
Compare
2568de5 to
ec0eac3
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArielElp).
crates/apollo_committer/src/committer.rs line 98 at r2 (raw file):
/// `height` is already committed; return the stored global root without writing. Historical { global_root: GlobalRoot }, /// `height` is the chain tip; inputs are validated and ready to commit.
Suggestion:
/// `height` is the next uncommitted offset;crates/apollo_committer/src/committer.rs line 207 at r2 (raw file):
update_metrics(height, &block_measurements.block_measurement); self.update_offset(next_offset); Ok(CommitBlockResponse { global_root })
no changes here, right? cut-paste?
Code quote:
// Happy flow. Commits the state diff and returns the computed global root.
debug!(
"Committing block number {height} with state diff {state_diff_commitment:?}"
);
let mut block_measurements = SingleBlockMeasurements::default();
block_measurements.start_measurement(Action::EndToEnd);
let CommitStateDiffOutput { filled_forest, global_root, deleted_nodes } =
self.commit_state_diff(state_diff, &mut block_measurements).await?;
let next_offset = height.unchecked_next();
let metadata = HashMap::from([
(
ForestMetadataType::CommitmentOffset,
DbValue(DbBlockNumber(next_offset).serialize().to_vec()),
),
(
ForestMetadataType::StateRoot(DbBlockNumber(height)),
serialize_felt_no_packing(global_root.0),
),
(
ForestMetadataType::StateDiffHash(DbBlockNumber(height)),
serialize_felt_no_packing(state_diff_commitment.0.0),
),
]);
info!(
"For block number {height}, writing filled forest to storage with metadata: \
{metadata:?}, delete {} nodes",
deleted_nodes.len()
);
block_measurements.start_measurement(Action::Write);
let n_write_entries = self
.forest_storage
.write_with_metadata(&filled_forest, metadata, deleted_nodes)
.await
.map_err(|err| self.map_internal_error(err))?;
block_measurements.attempt_to_stop_measurement(Action::Write, n_write_entries).ok();
block_measurements.attempt_to_stop_measurement(Action::EndToEnd, 0).ok();
update_metrics(height, &block_measurements.block_measurement);
self.update_offset(next_offset);
Ok(CommitBlockResponse { global_root })
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 2 comments.
Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).
crates/apollo_committer/src/committer.rs line 207 at r2 (raw file):
Previously, dorimedini-starkware wrote…
no changes here, right? cut-paste?
yes
crates/apollo_committer/src/committer.rs line 98 at r2 (raw file):
/// `height` is already committed; return the stored global root without writing. Historical { global_root: GlobalRoot }, /// `height` is the chain tip; inputs are validated and ready to commit.
Done.
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 file and all commit messages, and resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).
Merge activity
|
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.