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

Check data availability boundary in rpc request #3891

Closed
wants to merge 16 commits into from

Conversation

emhane
Copy link
Contributor

@emhane emhane commented Jan 17, 2023

Issue Addressed

Addressing this closed PR ethereum/consensus-specs#3211.

Proposed Changes

Check data availability boundary differently for ByRange and ByRoot request and serve client error message with regard to data availability boundary.

Additional Info

For blobs by root, should we do smthg here with the BeaconBlobOrphan column eventually, like responding "data was available"? @michaelsproul
As in the issues you mention here in the last two paragraphs #3852 (review)

@emhane emhane requested review from michaelsproul, realbigsean and pawanjay176 and removed request for michaelsproul January 17, 2023 09:04
Copy link
Member

@realbigsean realbigsean left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for getting some clarity around this behavior

consensus/types/src/signed_beacon_block.rs Show resolved Hide resolved
beacon_node/beacon_chain/src/beacon_chain.rs Outdated Show resolved Hide resolved
beacon_node/beacon_chain/src/beacon_chain.rs Outdated Show resolved Hide resolved
@realbigsean realbigsean added waiting-on-author The reviewer has suggested changes and awaits thier implementation. deneb labels Jan 17, 2023
@emhane emhane mentioned this pull request Jan 18, 2023
@emhane emhane added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jan 18, 2023
@realbigsean
Copy link
Member

For blobs by root, should we do smthg here with the BeaconBlobOrphan column eventually, like responding "data was available"? @michaelsproul

This is an interesting question.. I think this would need to be spec'd out as a specific response code if we wanted to convey "we vouch that this was available at some point"

But this is sort of a "trust me bro" type of statement from a peer so I'm not sure it's actually worth much. I think BeaconBlobOrphan information would be useful when trying to reprocess blocks we've already imported

@emhane emhane force-pushed the dab_rpc branch 2 times, most recently from 862deff to 3543b9a Compare January 19, 2023 19:31
Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM overall. Just a few nits

@emhane emhane added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jan 20, 2023
@emhane emhane added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jan 20, 2023
@emhane
Copy link
Contributor Author

emhane commented Jan 23, 2023

Ok so,

  • Most error handling is equivalent for BlobsByRoot and BlobsByRange, those are now in a new method handle_blobs_request_error. The errors that are not included depend on the fact that BlobsByRange should respond with a chain, and BlobsByRoot can respond with nonconsecutive blocks&blobs.
  • For BlobsByRoot, it's meaningless to check the early attesters cache since we will only be serving finalised block&blobs, for BlobsByRange on the other hand, it makes sense.
  • I noticed that after BeaconChain::get_blobs or BeaconChain::get_block gets called, the returned value was always wrapped in a an atomically referenced counter, so I moved this into to those methods.
  • I think it's appropriate to send sigterm for Server Error, also for BlobsByRoot which allows responses of nonconsecutive blocks&blobs.

@realbigsean
Copy link
Member

So it looks like the latest commits combine some parts of blob ByRange and ByRoot error handling. I think we actually have to keep them distinct as before, otherwise I think this results in us over-using ResourceUnavailable. This is how this particular error is specified:

3: ResourceUnavailable -- the responder does not have requested resource. The response payload adheres to the ErrorMessage schema (described below). Note: This response code is only valid as a response where specified.

In ByRoot it's specified as a response here:

Clients MUST support requesting blocks and sidecars since minimum_request_epoch, where minimum_request_epoch = max(finalized_epoch, current_epoch - MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS, EIP4844_FORK_EPOCH). If any root in the request content references a block earlier than minimum_request_epoch, peers SHOULD respond with error code 3: ResourceUnavailable.

This would map to our NoKzgCommitmentsFieldOnBlock error because this means it's a pre-4844 block. It would also map to our BlobsOlderThanDataAvailabilityBoundary. I spoke to Age and Diva and they suggested for the scenario where we don't have a block that we should, we should use a custom error rather than re-using BlobsUnavailable to avoid confusing these scenarios.

Confusingly, ResourceUnavailable is used in the ByRange request for the scenario where we don't have blobs that we should, and is not used otherwise.

Peers that are unable to reply to blobs sidecars requests within the MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS epoch range SHOULD respond with error code 3: ResourceUnavailable. Such peers that are unable to successfully reply to this range of requests MAY get descored or disconnected at any time.

I tried to implement the ResourceUnavailable handling more precisely here: #3912

Building on top of this commit e145504

@realbigsean
Copy link
Member

closed in favor of #3912

@emhane emhane deleted the dab_rpc branch January 26, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deneb ready-for-review The code is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants