-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from bloXroute-Labs/v2.129.74
Publish release v2.129.74
- Loading branch information
Showing
118 changed files
with
1,770 additions
and
15,365 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package bdn | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" | ||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" | ||
"github.com/prysmaticlabs/prysm/v5/runtime/version" | ||
) | ||
|
||
// ErrNotDenebBlock is returned when the block is not a Deneb block. | ||
var ErrNotDenebBlock = errors.New("block is not Deneb block") | ||
|
||
// PbGenericBlock returns a generic signed beacon block. | ||
func PbGenericBlock(b interfaces.ReadOnlySignedBeaconBlock) (*ethpb.GenericSignedBeaconBlock, error) { | ||
pb, err := b.Proto() | ||
if err != nil { | ||
return nil, err | ||
} | ||
switch b.Version() { | ||
case version.Deneb: | ||
if b.IsBlinded() { | ||
return ðpb.GenericSignedBeaconBlock{ | ||
Block: ðpb.GenericSignedBeaconBlock_BlindedDeneb{BlindedDeneb: pb.(*ethpb.SignedBlindedBeaconBlockDeneb)}, | ||
}, nil | ||
} | ||
|
||
block, ok := pb.(*ethpb.SignedBeaconBlockDeneb) | ||
if !ok { | ||
return b.PbGenericBlock() | ||
} | ||
|
||
return ðpb.GenericSignedBeaconBlock{ | ||
Block: ðpb.GenericSignedBeaconBlock_Deneb{ | ||
Deneb: ðpb.SignedBeaconBlockContentsDeneb{ | ||
Block: block, | ||
}, | ||
}, | ||
}, nil | ||
case version.Electra: | ||
if b.IsBlinded() { | ||
return ðpb.GenericSignedBeaconBlock{ | ||
Block: ðpb.GenericSignedBeaconBlock_BlindedElectra{BlindedElectra: pb.(*ethpb.SignedBlindedBeaconBlockElectra)}, | ||
}, nil | ||
} | ||
|
||
block, ok := pb.(*ethpb.SignedBeaconBlockElectra) | ||
if !ok { | ||
return b.PbGenericBlock() | ||
} | ||
|
||
return ðpb.GenericSignedBeaconBlock{ | ||
Block: ðpb.GenericSignedBeaconBlock_Electra{ | ||
Electra: ðpb.SignedBeaconBlockContentsElectra{ | ||
Block: block, | ||
}, | ||
}, | ||
}, nil | ||
default: | ||
return b.PbGenericBlock() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.