starknet_committer: read and write patricia paths to index db#13998
starknet_committer: read and write patricia paths to index db#13998ArielElp wants to merge 1 commit into
Conversation
dfd62d8 to
c672275
Compare
c3b74da to
7eb2f0e
Compare
c672275 to
765284d
Compare
7eb2f0e to
82e9411
Compare
765284d to
2562066
Compare
82e9411 to
ff1915d
Compare
d34fe2c to
509ef2f
Compare
ff1915d to
1a13989
Compare
509ef2f to
4f7483a
Compare
1a13989 to
1fd4ef8
Compare
5602190 to
371b039
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on ArielElp).
crates/starknet_committer/src/db/index_db/db.rs line 428 at r1 (raw file):
overlay.mset(kv).await?; let storage_ref: &S = &self.storage; let mut layered = TwoLayerStorage::new(overlay, storage_ref);
Consider creating the layered storage before calling this function. It's not related to the other inputs.
Code quote:
let mut overlay = MapStorage::default();
overlay.mset(kv).await?;
let storage_ref: &S = &self.storage;
let mut layered = TwoLayerStorage::new(overlay, storage_ref);crates/starknet_committer/src/db/index_db/db.rs line 456 at r1 (raw file):
for (metadata_type, value) in metadata { Self::insert_metadata(&mut updates, metadata_type, value); }
Share code with fn write_with_metadata
Code quote:
let mut updates = Self::serialize_forest(filled_forest)?;
for (metadata_type, value) in metadata {
Self::insert_metadata(&mut updates, metadata_type, value);
}b8572e0 to
f4c4883
Compare
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on yoavGrs).
crates/starknet_committer/src/db/index_db/db.rs line 428 at r1 (raw file):
Previously, yoavGrs wrote…
Consider creating the layered storage before calling this function. It's not related to the other inputs.
Only IndexDB has access to the underlying storage so only it can create it. The staged_serialized_forest argument is related to it, you send None of the fist path and the modifications on the second pass.
crates/starknet_committer/src/db/index_db/db.rs line 456 at r1 (raw file):
Previously, yoavGrs wrote…
Share code with
fn write_with_metadata
Done.
f4c4883 to
409fefe
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 2 files and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).
crates/starknet_committer/src/db/index_db/db.rs line 474 at r3 (raw file):
operations.insert(patricia_proofs_db_key(height), DbOperation::Set(encoded)); } }
Code duplication.
Suggestion:
let accessed_keys_digest_key = Self::metadata_key(ForestMetadataType::AccessedKeysDigest(DbBlockNumber(
height,
)));
let patricia_proofs_db_key = patricia_proofs_db_key(height);
match patricia_proofs_updates {
PatriciaProofsUpdates::Delete(height) => {
operations.insert(
accessed_keys_digest_key,
DbOperation::Delete,
);
operations.insert(patricia_proofs_db_key, DbOperation::Delete);
}
PatriciaProofsUpdates::Set { height, keys_digest, witnesses } => {
let encoded = witnesses.serialize()?;
operations.insert(
accessed_keys_digest_key,
DbOperation::Set(DbValue(keys_digest.to_vec())),
);
operations.insert(patricia_proofs_db_key, DbOperation::Set(encoded));
}
}371b039 to
f366550
Compare
409fefe to
22f1def
Compare
f366550 to
b7b568e
Compare
22f1def to
d3900ba
Compare
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 yoavGrs).
crates/starknet_committer/src/db/index_db/db.rs line 474 at r3 (raw file):
Previously, yoavGrs wrote…
Code duplication.
The height is inside the enum. If I try to separate the metadata key from the match arms, then I'm stuck with the operation (does the metadata need to get deleted or set?), and it looks a bit more cumbersome.
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 1 comment and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArielElp).
crates/starknet_committer/src/db/index_db/db.rs line 474 at r3 (raw file):
Previously, ArielElp wrote…
The height is inside the enum. If I try to separate the metadata key from the match arms, then I'm stuck with the operation (does the metadata need to get deleted or set?), and it looks a bit more cumbersome.
OK
b7b568e to
d7f7286
Compare
2bebd64 to
9e0493a
Compare
d7f7286 to
2bc53b6
Compare
9e0493a to
c4ff166
Compare
2bc53b6 to
9e35c51
Compare
c4ff166 to
adeee5c
Compare
0edc7de to
fd1cced
Compare
adeee5c to
3ab669f
Compare
fd1cced to
6506c10
Compare
6bcc7c0 to
57671ad
Compare
6506c10 to
5a5e21c
Compare
57671ad to
b5ab234
Compare
b5ab234 to
a2756a6
Compare

No description provided.