Skip to content

Added functional beacon snapshots reader and generator to Caplin#8570

Merged
Giulio2002 merged 63 commits intodevelfrom
fix-beacon-snapshots
Oct 24, 2023
Merged

Added functional beacon snapshots reader and generator to Caplin#8570
Giulio2002 merged 63 commits intodevelfrom
fix-beacon-snapshots

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
@Giulio2002 Giulio2002 deleted the fix-beacon-snapshots branch October 24, 2023 19:32
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.

3 participants