@@ -170,8 +170,6 @@ func (d *dataColumnSampler1D) refreshPeerInfo() {
170
170
}
171
171
}
172
172
173
- log .WithField ("columnFromPeer" , d .columnFromPeer ).Debug ("Peer info refreshed" )
174
-
175
173
columnWithNoPeers := make ([]uint64 , 0 )
176
174
for column , peers := range d .peerFromColumn {
177
175
if len (peers ) == 0 {
@@ -228,7 +226,7 @@ func (d *dataColumnSampler1D) handleStateNotification(ctx context.Context, event
228
226
return
229
227
}
230
228
231
- if coreTime .PeerDASIsActive (data .Slot ) {
229
+ if ! coreTime .PeerDASIsActive (data .Slot ) {
232
230
// We do not trigger sampling if peerDAS is not active yet.
233
231
return
234
232
}
@@ -249,22 +247,12 @@ func (d *dataColumnSampler1D) handleStateNotification(ctx context.Context, event
249
247
// Randomize columns for sample selection.
250
248
randomizedColumns := randomizeColumns (d .nonCustodyColumns )
251
249
samplesCount := min (params .BeaconConfig ().SamplesPerSlot , uint64 (len (d .nonCustodyColumns ))- params .BeaconConfig ().NumberOfColumns / 2 )
252
- ok , _ , err = d .incrementalDAS (ctx , data .BlockRoot , randomizedColumns , samplesCount )
250
+
251
+ // TODO: Use the first output of `incrementalDAS` as input of the fork choice rule.
252
+ _ , _ , err = d .incrementalDAS (ctx , data .BlockRoot , randomizedColumns , samplesCount )
253
253
if err != nil {
254
254
log .WithError (err ).Error ("Failed to run incremental DAS" )
255
255
}
256
-
257
- if ok {
258
- log .WithFields (logrus.Fields {
259
- "root" : fmt .Sprintf ("%#x" , data .BlockRoot ),
260
- "columns" : randomizedColumns ,
261
- }).Debug ("Data column sampling successful" )
262
- } else {
263
- log .WithFields (logrus.Fields {
264
- "root" : fmt .Sprintf ("%#x" , data .BlockRoot ),
265
- "columns" : randomizedColumns ,
266
- }).Warning ("Data column sampling failed" )
267
- }
268
256
}
269
257
270
258
// incrementalDAS samples data columns from active peers using incremental DAS.
@@ -280,17 +268,28 @@ func (d *dataColumnSampler1D) incrementalDAS(
280
268
firstColumnToSample , extendedSampleCount := uint64 (0 ), peerdas .ExtendedSampleCount (sampleCount , allowedFailures )
281
269
roundSummaries := make ([]roundSummary , 0 , 1 ) // We optimistically allocate only one round summary.
282
270
271
+ start := time .Now ()
272
+
283
273
for round := 1 ; ; /*No exit condition */ round ++ {
284
274
if extendedSampleCount > uint64 (len (columns )) {
285
275
// We already tried to sample all possible columns, this is the unhappy path.
286
- log .WithField ("root" , fmt .Sprintf ("%#x" , root )).Warning ("Some columns are still missing after sampling all possible columns" )
276
+ log .WithFields (logrus.Fields {
277
+ "root" : fmt .Sprintf ("%#x" , root ),
278
+ "round" : round - 1 ,
279
+ }).Warning ("Some columns are still missing after trying to sample all possible columns" )
287
280
return false , roundSummaries , nil
288
281
}
289
282
290
283
// Get the columns to sample for this round.
291
284
columnsToSample := columns [firstColumnToSample :extendedSampleCount ]
292
285
columnsToSampleCount := extendedSampleCount - firstColumnToSample
293
286
287
+ log .WithFields (logrus.Fields {
288
+ "root" : fmt .Sprintf ("%#x" , root ),
289
+ "columns" : columnsToSample ,
290
+ "round" : round ,
291
+ }).Debug ("Start data columns sampling" )
292
+
294
293
// Sample data columns from peers in parallel.
295
294
retrievedSamples := d .sampleDataColumns (ctx , root , columnsToSample )
296
295
@@ -311,7 +310,8 @@ func (d *dataColumnSampler1D) incrementalDAS(
311
310
// All columns were correctly sampled, this is the happy path.
312
311
log .WithFields (logrus.Fields {
313
312
"root" : fmt .Sprintf ("%#x" , root ),
314
- "roundsNeeded" : round ,
313
+ "neededRounds" : round ,
314
+ "duration" : time .Since (start ),
315
315
}).Debug ("All columns were successfully sampled" )
316
316
return true , roundSummaries , nil
317
317
}
@@ -429,14 +429,14 @@ func (d *dataColumnSampler1D) sampleDataColumnsFromPeer(
429
429
"peerID" : pid ,
430
430
"root" : fmt .Sprintf ("%#x" , root ),
431
431
"requestedColumns" : sortedSliceFromMap (requestedColumns ),
432
- }).Debug ("All requested columns were successfully sampled from peer" )
432
+ }).Debug ("Sampled columns from peer successfully " )
433
433
} else {
434
434
log .WithFields (logrus.Fields {
435
435
"peerID" : pid ,
436
436
"root" : fmt .Sprintf ("%#x" , root ),
437
437
"requestedColumns" : sortedSliceFromMap (requestedColumns ),
438
438
"retrievedColumns" : sortedSliceFromMap (retrievedColumns ),
439
- }).Debug ("Some requested columns were not sampled from peer " )
439
+ }).Debug ("Sampled columns from peer with some errors " )
440
440
}
441
441
442
442
return retrievedColumns
0 commit comments