You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(miner): ignore lastWork when selecting the best mining candidate (#12690)
* fix(miner): ignore lastWork when selecting the best mining candidate
Previously, we only took the new head if it's heavier than the last
head. Unfortunately, this meant that F3 finalization wasn't properly
propagated to the miner.
In terms of impact:
1. It seems likely that this check was simply defensive as, prior to F3,
the new head should never have a lower weight (unless you're talking to
multiple lotus nodes, I guess...).
2. The `lastWork` field is mostly used to track null blocks. Worst-case
scenario, if we switch heads, we'll attempt to re-mine previous heights.
However, that should be relatively fast and, due to the slash filter, we
won't attempt to re-broadcast any of those blocks.
Signed-off-by: Jakub Sztandera <[email protected]>
* fix(miner): continue mining if we fail to submit a block
Signed-off-by: Jakub Sztandera <[email protected]>
* fix(miner): check the slash filter with the correct parent height
We also perform this check inside `SyncSubmitBlock` so we did have an
effective filter, but this was still wrong.
Signed-off-by: Jakub Sztandera <[email protected]>
---------
Signed-off-by: Jakub Sztandera <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Copy file name to clipboardexpand all lines: CHANGELOG.md
+4
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,10 @@
29
29
- The mining loop will now correctly "stick" to the same upstream lotus node for all operations pertaining to mining a single block ([filecoin-project/lotus#12665](https://github.com/filecoin-project/lotus/pull/12665)).
30
30
- Make the ordering of event output for `eth_` APIs and `GetActorEventsRaw` consistent, sorting ascending on: epoch, message index, event index and original event entry order. ([filecoin-project/lotus#12623](https://github.com/filecoin-project/lotus/pull/12623))
31
31
32
+
## Changes
33
+
34
+
- The Lotus Miner will now always mine on the latest chain head returned by lotus, even if that head has less "weight" than the previously seen head. This is necessary because F3 may end up finalizing a tipset with a lower weight, although this situation should be rare on the Filecoin mainnet. ([filecoin-project/lotus#12659](https://github.com/filecoin-project/lotus/pull/12659))
// Continue here, because it's _probably_ wiser to not submit this block
351
-
continue
352
+
break
352
353
}
353
354
354
355
iffault {
355
356
log.Errorf("<!!> SLASH FILTER DETECTED FAULT due to blocks %s and %s", b.Header.Cid(), witness)
356
-
continue
357
+
break
357
358
}
358
359
}
359
360
360
361
// Check for blocks created at the same height.
361
362
if_, ok:=m.minedBlockHeights.Get(b.Header.Height); ok {
362
363
log.Warnw("Created a block at the same height as another block we've created", "height", b.Header.Height, "miner", b.Header.Miner, "parents", b.Header.Parents)
363
-
continue
364
+
break
364
365
}
365
366
366
367
// Add the block height to the mined block heights.
@@ -369,24 +370,26 @@ minerLoop:
369
370
// Submit the newly mined block.
370
371
iferr:=m.api.SyncSubmitBlock(ctx, b); err!=nil {
371
372
log.Errorf("failed to submit newly mined block: %+v", err)
373
+
break
372
374
}
373
-
} else {
374
-
// If no block was mined, increase the null rounds and wait for the next epoch.
0 commit comments