-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9649e49
commit 50b672a
Showing
11 changed files
with
634 additions
and
153 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package beacon | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/pkg/errors" | ||
ethpbv1 "github.com/prysmaticlabs/prysm/v3/proto/eth/v1" | ||
) | ||
|
||
func (bs *Server) GetBlobsSidecar(ctx context.Context, req *ethpbv1.BlobsRequest) (*ethpbv1.BlobsResponse, error) { | ||
sblk, err := bs.blockFromBlockID(ctx, req.BlockId) | ||
err = handleGetBlockError(sblk, err) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "GetBlobs") | ||
} | ||
block := sblk.Block() | ||
root, err := block.HashTreeRoot() | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to htr block") | ||
} | ||
sidecar, err := bs.BeaconDB.BlobsSidecar(ctx, root) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get blobs sidecar for block %x", root) | ||
} | ||
var blobs []*ethpbv1.Blob | ||
var aggregatedProof []byte | ||
if sidecar != nil { | ||
aggregatedProof = sidecar.AggregatedProof | ||
for _, b := range sidecar.Blobs { | ||
var data []byte | ||
// go through each element, concat them | ||
for _, el := range b.Data { | ||
data = append(data, el) | ||
} | ||
blobs = append(blobs, ðpbv1.Blob{Data: data}) | ||
} | ||
} | ||
return ðpbv1.BlobsResponse{ | ||
BeaconBlockRoot: root[:], | ||
BeaconBlockSlot: uint64(block.Slot()), | ||
Blobs: blobs, | ||
AggregatedProof: aggregatedProof, | ||
}, nil | ||
} |
Oops, something went wrong.