Skip to content

Commit 8365d41

Browse files
authored
chore: add more info for da (#2707)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> -->
1 parent 58df585 commit 8365d41

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

types/da.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,22 @@ func SubmitWithHelpers(
2727
) coreda.ResultSubmit { // Return core ResultSubmit type
2828
ids, err := da.SubmitWithOptions(ctx, data, gasPrice, namespace, options)
2929

30+
// calculate blob size
31+
var blobSize uint64
32+
for _, blob := range data {
33+
blobSize += uint64(len(blob))
34+
}
35+
3036
// Handle errors returned by Submit
3137
if err != nil {
3238
if errors.Is(err, context.Canceled) {
3339
logger.Debug().Msg("DA submission canceled via helper due to context cancellation")
3440
return coreda.ResultSubmit{
3541
BaseResult: coreda.BaseResult{
36-
Code: coreda.StatusContextCanceled,
37-
Message: "submission canceled",
38-
IDs: ids,
42+
Code: coreda.StatusContextCanceled,
43+
Message: "submission canceled",
44+
IDs: ids,
45+
BlobSize: blobSize,
3946
},
4047
}
4148
}
@@ -67,6 +74,7 @@ func SubmitWithHelpers(
6774
SubmittedCount: uint64(len(ids)),
6875
Height: 0,
6976
Timestamp: time.Now(),
77+
BlobSize: blobSize,
7078
},
7179
}
7280
}
@@ -97,7 +105,7 @@ func SubmitWithHelpers(
97105
IDs: ids,
98106
SubmittedCount: uint64(len(ids)),
99107
Height: height,
100-
BlobSize: 0,
108+
BlobSize: blobSize,
101109
Timestamp: time.Now(),
102110
},
103111
}

0 commit comments

Comments
 (0)