It will probably be a very difficult migration away from AbstractExecPayload, but I think it'd end up making our types a lot more clear and consistent.
Blocks V3 got me thinking about this because it can return either a blinded or full payload. Because of this we've opted to use concrete types a Blinded vs Full enum in the APIs. At some point we have to convert these types to our generic types though. This is a bug where this conversion ended up biting us: https://github.com/sigp/lighthouse/pull/5005/filesBlockProposalContents is both generic over AbstractExecPayload and an enum over blinded vs. full (essentially). If we opt for superstruct maximalism we should be able to get rid of this type of conversion (and types where the generic and enum variants are reduntant).
I also think this would end up being a solid complexity reduction because we should be able to just delete the the payload.rs file. If we do need to add a new variant to payloads in addition to blinded vs full, I think this should make it easier.
This is a minimal example of how it'd look in lighthouse:
Description
I'm working on adding some features to
superstruct
that should make it easier to work with blinded vs. full payloads as enums https://github.com/sigp/superstruct/pull/35It will probably be a very difficult migration away from
AbstractExecPayload
, but I think it'd end up making our types a lot more clear and consistent.Blocks V3 got me thinking about this because it can return either a blinded or full payload. Because of this we've opted to use concrete types a Blinded vs Full enum in the APIs. At some point we have to convert these types to our generic types though. This is a bug where this conversion ended up biting us: https://github.com/sigp/lighthouse/pull/5005/files
BlockProposalContents
is both generic overAbstractExecPayload
and an enum over blinded vs. full (essentially). If we opt forsuperstruct
maximalism we should be able to get rid of this type of conversion (and types where the generic and enum variants are reduntant).I also think this would end up being a solid complexity reduction because we should be able to just delete the the
payload.rs
file. If we do need to add a new variant to payloads in addition to blinded vs full, I think this should make it easier.This is a minimal example of how it'd look in lighthouse:
And you should be able to keep using this flatten pattern all the way up to our api types (
PublishBlockRequest
).Interested what people think.