-
Notifications
You must be signed in to change notification settings - Fork 256
Blob p2p distribution using Reactor API #2938
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
Open
fridrik01
wants to merge
37
commits into
main
Choose a base branch
from
blobreactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5e2e84d to
fce3562
Compare
fce3562 to
8e3f94c
Compare
eac91a1 to
e07b7d9
Compare
…t/integration tests
b62bf9f to
0ef6906
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
issue: #2665
depends on cometbft blob PR: berachain/cometbft#26
Context
Currently, blobs are stored as as CometBFT transaction so a blob will never be cleaned up and will take up wasted space since they have a finite lifespan.
This PR addresses this by implementing a complete p2p blob distribution system using the cometbft Reactor API which fetches missing blobs from other peers. It introduces a
BlobConsensusEnableHeightconfiguration parameter that defines when the chain transitions from storing blobs as transactions to using P2P distribution which requires a hard fork.Components
BlobReactor(inda/blobreactor/)that handles p2p blob requests/responses with timeout handling and makes sure received blobs pass verification (from potential byzantine peers).BlobFetcherbackground service (inbeacon/blockchain/) that manages a persistent filesystem based retry queue. When a block arrives with missing blobs, the request is queued and the background worker attempts to fetch from peers at regular interval with a max retry count. The queue is crash-safe with atomic writes, includes request deduplication, and automatically cleans up requests that exceed retry limits or fall outside the DA availability window.Consensus flow (after blob enable height reached)
PrepareProposal: Blobs included in the block are now returned inPrepareProposalResponsein a separateBlobfield instead of as CometBFT transactions. This prevents blobs from being persisted in CometBFTs block store.ProcessProposal: Blobs are now included in theProcessProposalRequestin a separateBlobfield and are validated synchronously. Proposals are rejected if blobs are missing or invalid. Validated blobs are cached with the state for FinalizeBlock.FinalizeBlock: If node is in consensus mode, then blobs come from theProcessProposalcache and are processed immediately. Otherwise, if the node is syncing (catching up) and comes upon a block that should have blobs the node will make async fetch request toBlobFetcher.FinalizeBlockreturns immediately without blocking, allowing the chain to continue syncing while blobs are fetched in the background.TODO: