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

Added functional beacon snapshots reader and generator to Caplin #8570

Merged
merged 63 commits into from
Oct 24, 2023

Conversation

Giulio2002
Copy link
Collaborator

@Giulio2002 Giulio2002 commented Oct 24, 2023

This PR adds beacon blocks snapshots and beacon blocks snapshot generator to Caplin, plus a snapshot verifier CLI

@Giulio2002 Giulio2002 changed the title Added function beacon snapshots reader and generator Added functional beacon snapshots reader and generator to Caplin Oct 24, 2023
"io/fs"
"testing"

"github.com/ledgerwatch/erigon/spectest"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use _test.go for test files - then they will not compiled in binary

p.Processed.Add(1)
num := make([]byte, 8)
n := binary.PutUvarint(num, i)
if err := idx.AddKey(num[:n], offset); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Likely more compact encoding of keys will not make index more compact (it doesn’t store keys). Feel free to use BigEndiqn encoding - ifyou like. Ot important

@Giulio2002 Giulio2002 merged commit d7448fd into devel Oct 24, 2023
7 checks passed
@Giulio2002 Giulio2002 deleted the fix-beacon-snapshots branch October 24, 2023 19:32
@@ -1118,6 +1118,28 @@ func noOverlaps(in []snaptype.FileInfo) (res []snaptype.FileInfo) {
return res
}

func SegmentsCaplin(dir string) (res []snaptype.FileInfo, missingSnapshots []Range, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont like this repeated code with Segments... is there a way we make this generic, configurable, etc?

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.

None yet

3 participants