Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(storage): cleanup heades table #1293

Merged
merged 11 commits into from
Aug 10, 2023
Merged

refactor(storage): cleanup heades table #1293

merged 11 commits into from
Aug 10, 2023

Conversation

Mirko-von-Leipzig
Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig commented Jul 28, 2023

This PR refactors the headers table in the database, aligning it with p2p requirements.

p2p introduces requirements for headers to be a much more standalone concept e.g. the block hash should be calculated only from properties in the header. This PR adds the missing fields to storage, and also renames some things.

Actual changes to the headers table:

  1. table renamed from starknet_blocks to headers
  2. root column renamed to storage_commitment
  3. added columns for transaction_count and event_count
  4. added column for state_commitment which previously was calculated on demand

@CHr15F0x I have no idea how to update the proptests for these new additions?

I would also appreciate thinking if I missed any locations which rely on this information? I have sync and p2p changed so I think its all.

Copy link
Member

@CHr15F0x CHr15F0x left a comment

Choose a reason for hiding this comment

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

LGTM 👍
As for the fallible conversions - feel free to rework them if you deem the current way too ugly 😃

crates/p2p_proto/src/common.rs Outdated Show resolved Hide resolved
crates/storage/src/connection/block.rs Outdated Show resolved Hide resolved
crates/storage/src/schema/revision_0039.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@sergey-melnychuk sergey-melnychuk left a comment

Choose a reason for hiding this comment

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

LGTM % @kkovaacs 's comments

Co-authored-by: Krisztian Kovacs <krisztian@equilibrium.co>

Review changes and fixes.
@Mirko-von-Leipzig
Copy link
Contributor Author

I renamed headers to block_headers and also addressed the rest of @kkovaacs comments.

@Mirko-von-Leipzig Mirko-von-Leipzig merged commit 3a5c409 into main Aug 10, 2023
10 checks passed
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the db_headers branch August 10, 2023 08:20
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.

4 participants