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

silkworm: add state snapshots #13766

Merged
merged 1 commit into from
Feb 17, 2025
Merged

silkworm: add state snapshots #13766

merged 1 commit into from
Feb 17, 2025

Conversation

battlmonstr
Copy link
Contributor

@battlmonstr battlmonstr commented Feb 11, 2025

Previously the Silkworm library was capable of reading Erigon 2 "blocks" snapshots (.seg and .idx). The code to provide them to Silkworm was a part of RoSnapshots. The old code is moved to be a part of silkworm.SnapshotsRepository, and migrated to the updated Silkworm C API.

The new code adds an ability to provide Erigon 3 "state" snapshots for reading by Silkworm during evmone execution mode (--silkworm.exec). It is based on the AggregatorRoTx.StaticFilesInRange method that was made public (with the related DTOs) to be accessible from the silkworm package.

BtIndex.DataHandle() added to expose the memory mapped file pointer to Silkworm (in the same way as Decompressor and recsplit.Index). A bunch of public methods added to filesItem via FilesItem interface to expose the snapshot file objects to Silkworm.

@battlmonstr battlmonstr force-pushed the pr/sw_state_snapshots branch 3 times, most recently from 05c43e7 to 9e10d1d Compare February 12, 2025 15:18
@battlmonstr battlmonstr force-pushed the pr/sw_state_snapshots branch from 9e10d1d to 8b01de4 Compare February 13, 2025 09:43
@battlmonstr battlmonstr force-pushed the pr/sw_state_snapshots branch from 8b01de4 to e4e12d8 Compare February 13, 2025 13:27
@battlmonstr battlmonstr marked this pull request as ready for review February 13, 2025 13:27
@battlmonstr battlmonstr force-pushed the pr/sw_state_snapshots branch from e4e12d8 to ce762ec Compare February 13, 2025 13:34
@battlmonstr battlmonstr force-pushed the pr/sw_state_snapshots branch from ce762ec to 0d38d22 Compare February 13, 2025 13:59
Copy link
Member

@JacekGlen JacekGlen left a comment

Choose a reason for hiding this comment

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

Good work!

}
return DomainSnapshot{
Segment: memoryMappedFile(item.Segment()),
ExistenceIndex: silkworm_go.MemoryMappedFile{
Copy link
Member

@sudeepdino008 sudeepdino008 Feb 14, 2025

Choose a reason for hiding this comment

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

either HashMap index or bt+existence index exist. Maybe we should avoid creating memoryMappedFile always for existence/btree?
Can do this more generally by exposing AccessorList in state.FilesItem, and checking this AccessorList for deciding which indexes to set in DomainSnapshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I'm planning to do this in a follow up work to make this configurable. For now we've decided to workaround this by disabling passing Commitment files because it is the only domain that does it differently at the moment, and we don't support it fully on the silkworm side yet anyway.

@VBulikov VBulikov removed the silkworm label Feb 16, 2025
@battlmonstr battlmonstr merged commit 579dc63 into main Feb 17, 2025
13 of 14 checks passed
@battlmonstr battlmonstr deleted the pr/sw_state_snapshots branch February 17, 2025 10:16
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