Skip to content

Commit 7fbc35d

Browse files
authored
fix(blob clients): nil pointer with unexpected blob client response (#1195)
* fix nil pointer with unexpected blob client response * chore: auto version bump [bot]
1 parent cdd77c1 commit 7fbc35d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 51 // Patch version component of the current release
27+
VersionPatch = 52 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

rollup/da_syncer/blob_client/blob_scan_client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ func (c *BlobScanClient) GetBlobByVersionedHashAndBlockTime(ctx context.Context,
6464
if err != nil {
6565
return nil, fmt.Errorf("failed to decode result into struct, err: %w", err)
6666
}
67+
68+
// check that blob data is not empty
69+
if len(result.Data) < 2 {
70+
return nil, fmt.Errorf("blob data is too short to be valid, expected at least 2 characters, got: %s, versioned hash: %s", result.Data, versionedHash.String())
71+
}
72+
6773
blobBytes, err := hex.DecodeString(result.Data[2:])
6874
if err != nil {
6975
return nil, fmt.Errorf("failed to decode data to bytes, err: %w", err)

rollup/da_syncer/blob_client/block_native_client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ func (c *BlockNativeClient) GetBlobByVersionedHashAndBlockTime(ctx context.Conte
5959
if err != nil {
6060
return nil, fmt.Errorf("failed to decode result into struct, err: %w", err)
6161
}
62+
63+
// check that blob data is not empty
64+
if len(result.Blob.Data) < 2 {
65+
return nil, fmt.Errorf("blob data is too short to be valid, expected at least 2 characters, got: %s, versioned hash: %s", result.Blob.Data, versionedHash.String())
66+
}
67+
6268
blobBytes, err := hex.DecodeString(result.Blob.Data[2:])
6369
if err != nil {
6470
return nil, fmt.Errorf("failed to decode data to bytes, err: %w", err)

0 commit comments

Comments
 (0)