ethereum-consensus
ethereum-consensus copied to clipboard
disambiguate success responses with enum status
some of the beacon APIs return different status codes in the 2XX range to indicate different notions of success
e.g. https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
200: The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database.
202: The block failed validation, but was successfully broadcast anyway. It was not integrated into the beacon node's database.
it would be nice to disambiguate these cases when it exists
for example, the code calling this API could return something more expressive than a ()
like:
pub enum BlockBroadcastStatus {
ValidatedAndBroadcast,
ValidationFailureAndBroadcast,
}
and there may be other endpoints that do this type of thing where we can add more information about various 2XX status code responses