ethereum-consensus icon indicating copy to clipboard operation
ethereum-consensus copied to clipboard

disambiguate success responses with enum status

Open ralexstokes opened this issue 2 years ago • 1 comments

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,
}

ralexstokes avatar Sep 05 '22 14:09 ralexstokes

and there may be other endpoints that do this type of thing where we can add more information about various 2XX status code responses

ralexstokes avatar Sep 05 '22 14:09 ralexstokes