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

Update Blob Storage Structure #4104

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

ethDreamer
Copy link
Member

@ethDreamer
Copy link
Member Author

I'm not familiar enough with how gossip / fork choice works to refactor blob_verification.rs yet. Taking a look at it briefly, I think the new structure would resemble something like:

enum AvailableBlockInner<E: EthSpec> {
    Block(Arc<SignedBeaconBlock<E>>),
    BlockAndBlob(
        SignedBeaconBlock<E>,
        SignedBlobSidecarList<E>,
    ),
}

but when I tried to do that I got a bit lost in the changes to fork choice and gossip verification. I can keep going down this rabbit hole but perhaps @realbigsean or @divagant-martian have some ideas about this?

@divagant-martian
Copy link
Collaborator

divagant-martian commented Mar 18, 2023

This makes sense to me, but @pawanjay176 is working on something that looks a bit different in #4092 (AvailableBlockInner was removed there, for instance). I liked the approach of having AvailableBlockInner requiring checks to be built, so it seems we ought to have a lil chat to decide how to continue here. Beside that, I think changing the db structure could be glued in some potentially ugly way -as long as we are all on the same page- so that blob verification can be handled in pawan's pr and not this one. What do you all think?

@ethDreamer
Copy link
Member Author

I've updated this PR to make it easier to merge into other PR's without conflicts

&self,
block_root: &Hash256,
) -> Result<Option<SignedBeaconBlockAndBlobsSidecar<T::EthSpec>>, Error> {
) -> Result<Option<Arc<BlobSidecarList<T::EthSpec>>>, Error> {
Copy link
Collaborator

@divagant-martian divagant-martian Mar 20, 2023

Choose a reason for hiding this comment

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

I see why here it makes more sense to arc the list and not the individual blobs. Before storing them in the db we have blobs arc'd individually (since they arrive individually in gossip and rpc and need to use them in a couple of places)

(Question, not suggestion) Should we still store this as an arc'd list of un-arc'd elements?

Comment on lines 1077 to 1078
// TODO (mark): verify this
Ok(Arc::new(BlobSidecarList::empty()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

this won't allocate so I think it's fine? Also better to differentiate between blobs not found and blobs not required

Copy link
Member Author

Choose a reason for hiding this comment

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

@pawanjay176's pr seems to remove this entirely.. not sure why, perhaps we no longer have empty blobs?

Copy link
Collaborator

@divagant-martian divagant-martian Mar 20, 2023

Choose a reason for hiding this comment

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

he has a enum that has a variant Blobs::None (if I remember correctly)

Copy link
Member

Choose a reason for hiding this comment

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

We no longer have to serve empty blobs via RPC (this was a relic of devnet 4) so we no longer need to do the ugly empty blob reconstruction logic. I would leave this as is and I can clean it up in pawan's PR once this is merged

Copy link
Collaborator

Choose a reason for hiding this comment

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

if left like this we still won't serve empty blobs, this is just an empty list. What would you do differently after pawan's?

Copy link
Member

Choose a reason for hiding this comment

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

In that PR we're removing the fallback logic completely because it includes a db read for the block to check whether we should have blobs (and can return the correct Blobs enum variant). So I think the method just returns None. I don't think it was a good thing to always fallback to the block db read, at the end of the day if we don't have the blobs the data's not available. If we do want that fallback-to-block db read logic somewhere we can add it in a new method here somewhere. But I'm not sure where it's useful anymore now that we don't have to reconstruct empty blobs.

@ethDreamer ethDreamer force-pushed the blob_storage_structure branch from 0184c51 to 149b883 Compare March 21, 2023 17:19
@ethDreamer ethDreamer force-pushed the blob_storage_structure branch from 149b883 to 0080df9 Compare March 21, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants