Skip to content

Commit 8904583

Browse files
committed
consistent naming
1 parent f2aa6ff commit 8904583

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

fibre/client_server_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestClientServerUploadDownload(t *testing.T) {
7777
defer env.Close()
7878

7979
totalBlobs := tt.numClients * tt.blobsPerClient
80-
allCommitments := make([]fibre.BlobID, totalBlobs)
80+
allBlobIDs := make([]fibre.BlobID, totalBlobs)
8181
allPromiseHashes := make([][][]byte, totalBlobs)
8282
allData := make([][]byte, totalBlobs)
8383

@@ -114,7 +114,7 @@ func TestClientServerUploadDownload(t *testing.T) {
114114
allPromiseHashes[slotIdx] = append(allPromiseHashes[slotIdx], promiseHash)
115115
}
116116

117-
allCommitments[slotIdx] = blob.ID()
117+
allBlobIDs[slotIdx] = blob.ID()
118118
allData[slotIdx] = data
119119
}
120120

@@ -132,20 +132,20 @@ func TestClientServerUploadDownload(t *testing.T) {
132132
var rowIndicesMu sync.Mutex
133133

134134
err = env.ForEachStore(t.Context(), func(ctx context.Context, store *fibre.Store, storeIdx int) error {
135-
for i, commitment := range allCommitments {
136-
rows, err := store.Get(ctx, commitment.Commitment())
135+
for i, id := range allBlobIDs {
136+
rows, err := store.Get(ctx, id.Commitment())
137137
if err != nil {
138-
return fmt.Errorf("store %d missing rows for commitment %s: %w", storeIdx, commitment.String(), err)
138+
return fmt.Errorf("store %d missing rows for blob %s: %w", storeIdx, id.String(), err)
139139
}
140140

141141
// verify rows are not empty
142142
if len(rows.Rows) == 0 {
143-
return fmt.Errorf("store %d has empty rows for commitment %s", storeIdx, commitment.String())
143+
return fmt.Errorf("store %d has empty rows for blob %s", storeIdx, id.String())
144144
}
145145

146146
// verify RLC root is set
147147
if rows.GetRoot() == nil || len(rows.GetRoot()) != 32 {
148-
return fmt.Errorf("store %d has invalid RLC root for commitment %s", storeIdx, commitment.String())
148+
return fmt.Errorf("store %d has invalid RLC root for blob %s", storeIdx, id.String())
149149
}
150150

151151
// collect row indices for duplicate detection
@@ -154,7 +154,7 @@ func TestClientServerUploadDownload(t *testing.T) {
154154
indices[j] = row.Index
155155
}
156156
rowIndicesMu.Lock()
157-
rowIndicesByStore[storeIdx][commitment.String()] = indices
157+
rowIndicesByStore[storeIdx][id.String()] = indices
158158
rowIndicesMu.Unlock()
159159

160160
// verify all payment promises are stored (one per duplicate upload)
@@ -165,9 +165,9 @@ func TestClientServerUploadDownload(t *testing.T) {
165165
}
166166

167167
// verify payment promise commitment matches the BlobID's commitment
168-
if promise.Commitment != commitment.Commitment() {
168+
if promise.Commitment != id.Commitment() {
169169
return fmt.Errorf("store %d payment promise %d commitment mismatch: got %x, expected %x",
170-
storeIdx, j, promise.Commitment[:], commitment.Commitment())
170+
storeIdx, j, promise.Commitment[:], id.Commitment())
171171
}
172172
}
173173
}
@@ -176,13 +176,13 @@ func TestClientServerUploadDownload(t *testing.T) {
176176
require.NoError(t, err)
177177

178178
// verify no duplicate rows across stores (sequential check after concurrent collection)
179-
for _, commitment := range allCommitments {
179+
for _, id := range allBlobIDs {
180180
seen := make(map[uint32]int) // row index -> store index
181181
for storeIdx, storeRows := range rowIndicesByStore {
182-
for _, rowIdx := range storeRows[commitment.String()] {
182+
for _, rowIdx := range storeRows[id.String()] {
183183
if existingStore, exists := seen[rowIdx]; exists {
184-
t.Fatalf("duplicate row index %d for commitment %s: found in store %d and store %d",
185-
rowIdx, commitment.String(), existingStore, storeIdx)
184+
t.Fatalf("duplicate row index %d for blob %s: found in store %d and store %d",
185+
rowIdx, id.String(), existingStore, storeIdx)
186186
}
187187
seen[rowIdx] = storeIdx
188188
}
@@ -193,20 +193,20 @@ func TestClientServerUploadDownload(t *testing.T) {
193193
err = env.ForEachClient(t.Context(), func(ctx context.Context, client *fibre.Client, clientIdx int) error {
194194
for blobIdx := range tt.blobsPerClient {
195195
slotIdx := clientIdx*tt.blobsPerClient + blobIdx
196-
commitment := allCommitments[slotIdx]
196+
id := allBlobIDs[slotIdx]
197197
originalData := allData[slotIdx]
198198

199-
blob, err := client.Download(ctx, commitment)
199+
blob, err := client.Download(ctx, id)
200200
if err != nil {
201-
return fmt.Errorf("downloading blob %s: %w", commitment.String(), err)
201+
return fmt.Errorf("downloading blob %s: %w", id.String(), err)
202202
}
203203
if !bytes.Equal(blob.Data(), originalData) {
204204
return fmt.Errorf("data mismatch for %s: downloaded %d bytes, expected %d bytes",
205-
commitment.String(), len(blob.Data()), len(originalData))
205+
id.String(), len(blob.Data()), len(originalData))
206206
}
207-
if !blob.ID().Equals(commitment) {
208-
return fmt.Errorf("commitment mismatch: got %s, expected %s",
209-
blob.ID().String(), commitment.String())
207+
if !blob.ID().Equals(id) {
208+
return fmt.Errorf("blob ID mismatch: got %s, expected %s",
209+
blob.ID().String(), id.String())
210210
}
211211
}
212212
return nil

fibre/store_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,20 @@ func testStoreGetDeterministicOrdering(t *testing.T, store *fibre.Store) {
214214
ctx := t.Context()
215215

216216
blob := makeTestBlobV0(t, 256)
217-
commitment := blob.ID()
217+
id := blob.ID()
218218

219219
// store multiple shards with different row indices
220220
for i := range 5 {
221221
shard := makeShardFrom(t, blob, i*2, i*2+1)
222-
promise := makeTestPaymentPromise(uint64(100+i), commitment)
222+
promise := makeTestPaymentPromise(uint64(100+i), id)
223223
err := store.Put(ctx, promise, shard, promise.CreationTimestamp)
224224
require.NoError(t, err)
225225
}
226226

227227
// get multiple times and verify ordering is deterministic
228228
var firstRowIndex uint32
229229
for i := range 10 {
230-
gotShard, err := store.Get(ctx, commitment.Commitment())
230+
gotShard, err := store.Get(ctx, id.Commitment())
231231
require.NoError(t, err)
232232
require.NotEmpty(t, gotShard.Rows)
233233

0 commit comments

Comments
 (0)