Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions api/service/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestAPIService(t *testing.T) {

rootOne := common.HexToHash("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef")
rootTwo := common.HexToHash("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890222222")
rootThree := common.HexToHash("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890333333")

blockOne := storage.BlobData{
Header: storage.Header{
Expand All @@ -92,12 +93,25 @@ func TestAPIService(t *testing.T) {
},
}

// Pectra Block
blockThree := storage.BlobData{
Header: storage.Header{
BeaconBlockHash: rootThree,
},
BlobSidecars: storage.BlobSidecars{
Data: blobtest.NewBlobSidecars(t, 8), // More than 6 blobs
},
}

err := fs.WriteBlob(context.Background(), blockOne)
require.NoError(t, err)

err = fs.WriteBlob(context.Background(), blockTwo)
require.NoError(t, err)

err = fs.WriteBlob(context.Background(), blockThree)
require.NoError(t, err)

beaconClient.Headers["finalized"] = &v1.BeaconBlockHeader{
Root: phase0.Root(rootOne),
}
Expand Down Expand Up @@ -241,6 +255,24 @@ func TestAPIService(t *testing.T) {
path: "/eth/v1/",
status: 404,
},
{
name: "pectra: query all blobs",
path: fmt.Sprintf("/eth/v1/beacon/blob_sidecars/%s", rootThree),
status: 200,
expected: &storage.BlobSidecars{
Data: blockThree.BlobSidecars.Data,
},
},
{
name: "pectra: query blob greater than 6",
path: fmt.Sprintf("/eth/v1/beacon/blob_sidecars/%s?indices=7", rootThree),
status: 200,
expected: &storage.BlobSidecars{
Data: []*deneb.BlobSidecar{
blockThree.BlobSidecars.Data[7],
},
},
},
}

responseFormat := []string{"application/json", "application/octet-stream"}
Expand Down
Loading