ssvlabs / ssv-spec

GNU General Public License v3.0
26 stars 23 forks source link

GetBlockData/GetBlindedBlockData return versioned block only #221

Open olegshmuelov opened 1 year ago

olegshmuelov commented 1 year ago

ConsensusData GetBlockData should return versioned block only

// TODO func (ci *ConsensusData) GetBlockData() (*spec.VersionedBeaconBlock, error) {
func (ci *ConsensusData) GetBlockData() (*spec.VersionedBeaconBlock, ssz.HashRoot, error) {
    switch ci.Version {
    case spec.DataVersionBellatrix:
        ret := &bellatrix.BeaconBlock{}
        if err := ret.UnmarshalSSZ(ci.DataSSZ); err != nil {
            return nil, nil, errors.Wrap(err, "could not unmarshal ssz")
        }
        return &spec.VersionedBeaconBlock{Bellatrix: ret, Version: spec.DataVersionBellatrix}, ret, nil
    default:
        return nil, nil, errors.Errorf("unknown block version %s", ci.Version.String())
    }
}
alonmuroch commented 1 year ago

We currently return both versioned block and root because we do not utilize the internal Root() function versioned block has