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

Initial Archiver Service Implementation #1

Merged
merged 12 commits into from
Feb 15, 2024
Merged

Conversation

danyalprout
Copy link
Collaborator

@danyalprout danyalprout commented Feb 9, 2024

Description

This PR creates the archiver service. It consists of two components the archiver and the api.

  • archiver continuously polls the beacon chain and writes any blobs it finds to the configured data store.
  • api uses this datastore and the beacon client to resolve get blob sidecar requests

This image shows a visualization of how the key components interact.
Blob Storage (1)

@danyalprout danyalprout force-pushed the initial-archiver branch 4 times, most recently from d90dd45 to 3674105 Compare February 14, 2024 23:36
if err != nil {
return nil, newIndicesError(index)
}
blobIndex := deneb.BlobIndex(parsedInt)
Copy link

@roberto-bayardo roberto-bayardo Feb 15, 2024

Choose a reason for hiding this comment

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

would return error here if the blobIndex is out of range, or catch any unresolved indices in the later loop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My intention here is to mirror the CL client behavior as close as possible, if the index is out of range/duplicated etc it's just ignored (at least on Lighthouse)

❯ curl -s "<cl-url>/eth/v1/beacon/blob_sidecars/0x8f0d0ca5a16fc064514574dddde8d11b39e81f29b642d9f8b149a369b7c9fa9e?indices=10"
{"data":[]}%
❯ curl -s "<cl-url>/eth/v1/beacon/blob_sidecars/0x8f0d0ca5a16fc064514574dddde8d11b39e81f29b642d9f8b149a369b7c9fa9e?indices=1,1,10"
#.. returns a single blob at index 1

Choose a reason for hiding this comment

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

is that in the spec or is that just what Lighthouse does? Duplicated I get, out of range seems worth alerting the caller over.

Copy link
Collaborator Author

@danyalprout danyalprout Feb 15, 2024

Choose a reason for hiding this comment

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

It's the behavior of lighthouse, the spec doesn't specify :D (it's very possible there's a more detailed spec I'm missing though).

// Start starts the archiver service. It begins polling the beacon node for the latest blocks and persisting blobs for
// them. Concurrently it'll also begin a backfill process (see backfillBlobs) to store all blobs from the current head
// to the previously stored blocks. This ensures that during restarts or outages of an archiver, any gaps will be
// filled in.

Choose a reason for hiding this comment

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

What happens if the backfill period exceeds the L1 retention window?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It'll treat the beacon node of the source of truth and keep walking back, writing empty blobs until it hits the last known block.

I wonder if we should extend this to not fetch blobs older than the blob expiry window (though we would have to make it configurable as some people may adjust the pruning time on their CL nodes).

Choose a reason for hiding this comment

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

Right we don't know how the beacon node is configured. I think this is fine for now, just make sure the behavior is documented. We can only archive what's there :)

@roberto-bayardo
Copy link

Overall LGTM modulo my mostly cosmetic comments, thank you for doing this!

@cb-heimdall cb-heimdall dismissed roberto-bayardo’s stale review February 15, 2024 19:35

Approved review 1881782545 from roberto-bayardo is now dismissed due to new commit. Re-request for approval.

@danyalprout danyalprout merged commit 0fa146d into master Feb 15, 2024
2 checks passed
@danyalprout danyalprout deleted the initial-archiver branch February 15, 2024 19:36
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.

2 participants