Skip to content

Commit

Permalink
fix(taiko-client): fix blob server API URL when fetching blob data (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp authored Sep 17, 2024
1 parent e2812a2 commit 7230dfd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/taiko-client/pkg/rpc/blob_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rpc
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/url"

Expand Down Expand Up @@ -87,7 +88,9 @@ func (ds *BlobDataSource) GetBlobs(
sidecars, err = ds.client.L1Beacon.GetBlobs(ctx, timestamp)
}
if err != nil {
log.Info("Failed to get blobs from beacon, try to use blob server.", "error", err.Error())
if !errors.Is(err, pkg.ErrBeaconNotFound) {
log.Info("Failed to get blobs from beacon, try to use blob server.", "error", err.Error())
}
if ds.blobServerEndpoint == nil && ds.socialScanEndpoint == nil {
log.Info("No blob server endpoint set")
return nil, err
Expand Down Expand Up @@ -115,7 +118,7 @@ func (ds *BlobDataSource) getBlobFromServer(ctx context.Context, blobHash common
err error
)
if ds.socialScanEndpoint != nil {
route = "/blob/" + blobHash.String()
route = "/blobs/" + blobHash.String()
requestURL, err = url.JoinPath(ds.socialScanEndpoint.String(), route)
} else {
route = "/blobs/" + blobHash.String()
Expand All @@ -131,7 +134,7 @@ func (ds *BlobDataSource) getBlobFromServer(ctx context.Context, blobHash common
SetHeader("Accept", "application/json").
Get(requestURL)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get blob from server, request_url: %s, err: %w", requestURL, err)
}
if !resp.IsSuccess() {
return nil, fmt.Errorf(
Expand Down

0 comments on commit 7230dfd

Please sign in to comment.