Skip to content

starknet_committer: read and write patricia paths to index db#13998

Open
ArielElp wants to merge 1 commit into
ariel/patricia_proofs_db_keysfrom
ariel/index_db_read_and_write_proofs
Open

starknet_committer: read and write patricia paths to index db#13998
ArielElp wants to merge 1 commit into
ariel/patricia_proofs_db_keysfrom
ariel/index_db_read_and_write_proofs

Conversation

@ArielElp
Copy link
Copy Markdown
Contributor

@ArielElp ArielElp commented May 7, 2026

No description provided.

Copy link
Copy Markdown
Contributor Author

ArielElp commented May 7, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from dfd62d8 to c672275 Compare May 7, 2026 12:40
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch 2 times, most recently from c3b74da to 7eb2f0e Compare May 14, 2026 08:43
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from c672275 to 765284d Compare May 14, 2026 08:43
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 7eb2f0e to 82e9411 Compare May 18, 2026 11:56
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 765284d to 2562066 Compare May 18, 2026 11:56
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 82e9411 to ff1915d Compare May 18, 2026 13:52
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch 2 times, most recently from d34fe2c to 509ef2f Compare May 19, 2026 06:55
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from ff1915d to 1a13989 Compare May 19, 2026 06:55
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 509ef2f to 4f7483a Compare May 19, 2026 07:08
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 1a13989 to 1fd4ef8 Compare May 19, 2026 07:08
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 5602190 to 371b039 Compare May 20, 2026 11:28
Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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);
        }

@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from b8572e0 to f4c4883 Compare May 20, 2026 12:23
Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from f4c4883 to 409fefe Compare May 20, 2026 12:32
Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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));
            }
        }

@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 371b039 to f366550 Compare May 25, 2026 08:57
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 409fefe to 22f1def Compare May 25, 2026 08:57
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from f366550 to b7b568e Compare May 25, 2026 08:58
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 22f1def to d3900ba Compare May 25, 2026 08:58
Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoavGrs made 1 comment and resolved 1 discussion.
Reviewable status: :shipit: 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

@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from b7b568e to d7f7286 Compare May 25, 2026 13:32
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch 2 times, most recently from 2bebd64 to 9e0493a Compare May 25, 2026 13:45
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from d7f7286 to 2bc53b6 Compare May 25, 2026 13:45
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 9e0493a to c4ff166 Compare May 25, 2026 13:58
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 2bc53b6 to 9e35c51 Compare May 25, 2026 13:58
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from c4ff166 to adeee5c Compare May 25, 2026 14:13
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch 2 times, most recently from 0edc7de to fd1cced Compare May 26, 2026 10:08
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from adeee5c to 3ab669f Compare May 26, 2026 10:08
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from fd1cced to 6506c10 Compare May 26, 2026 10:48
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch 2 times, most recently from 6bcc7c0 to 57671ad Compare May 26, 2026 11:42
@ArielElp ArielElp force-pushed the ariel/patricia_proofs_db_keys branch from 6506c10 to 5a5e21c Compare May 26, 2026 11:42
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from 57671ad to b5ab234 Compare May 26, 2026 13:03
@ArielElp ArielElp force-pushed the ariel/index_db_read_and_write_proofs branch from b5ab234 to a2756a6 Compare May 26, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants