mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Verified roblobs (#13190)
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -62,3 +62,31 @@ func (b *ROBlob) BodyRoot() [32]byte {
|
||||
func (b *ROBlob) ProposerIndex() primitives.ValidatorIndex {
|
||||
return b.SignedBlockHeader.Header.ProposerIndex
|
||||
}
|
||||
|
||||
// BlockRootSlice returns the block root as a byte slice. This is often more conveninent/concise
|
||||
// than setting a tmp var to BlockRoot(), just so that it can be sliced.
|
||||
func (b *ROBlob) BlockRootSlice() []byte {
|
||||
return b.root[:]
|
||||
}
|
||||
|
||||
// ROBlobSlice is a custom type for a []ROBlob, allowing methods to be defined that act on a slice of ROBlob.
|
||||
type ROBlobSlice []ROBlob
|
||||
|
||||
// Protos is a helper to make a more concise conversion from []ROBlob->[]*ethpb.BlobSidecar.
|
||||
func (s ROBlobSlice) Protos() []*ethpb.BlobSidecar {
|
||||
pb := make([]*ethpb.BlobSidecar, len(s))
|
||||
for i := range s {
|
||||
pb[i] = s[i].BlobSidecar
|
||||
}
|
||||
return pb
|
||||
}
|
||||
|
||||
// VerifiedROBlob represents an ROBlob that has undergone full verification (eg block sig, inclusion proof, commitment check).
|
||||
type VerifiedROBlob struct {
|
||||
ROBlob
|
||||
}
|
||||
|
||||
// NewVerifiedROBlob "upgrades" an ROBlob to a VerifiedROBlob. This method should only be used by the verification package.
|
||||
func NewVerifiedROBlob(rob ROBlob) VerifiedROBlob {
|
||||
return VerifiedROBlob{ROBlob: rob}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
// ROBlock is a value that embeds a ReadOnlySignedBeaconBlock along with its block root ([32]byte).
|
||||
@@ -77,7 +76,7 @@ func (s ROBlockSlice) Len() int {
|
||||
|
||||
type BlockWithVerifiedBlobs struct {
|
||||
Block ROBlock
|
||||
Blobs []*eth.DeprecatedBlobSidecar
|
||||
Blobs []ROBlob
|
||||
}
|
||||
|
||||
type BlockWithVerifiedBlobsSlice []BlockWithVerifiedBlobs
|
||||
|
||||
Reference in New Issue
Block a user