Skip to content

Commit

Permalink
fix: make consensus engine wait for a bit before giving up on worker (#…
Browse files Browse the repository at this point in the history
…774)

and if it happens despite the wait, let worker retry
  • Loading branch information
omerfirmak committed May 27, 2024
1 parent dd7f747 commit b9919a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
// Wait until sealing is terminated or delay timeout.
log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay))
go func() {
defer close(results)

select {
case <-stop:
return
Expand All @@ -656,7 +658,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res

select {
case results <- block.WithSeal(header):
default:
case <-time.After(time.Second):
log.Warn("Sealing result is not read by miner", "sealhash", SealHash(header))
}
}()
Expand Down
6 changes: 5 additions & 1 deletion miner/scroll_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,12 @@ func (w *worker) commit(res *pipeline.Result) error {
if err := w.engine.Seal(w.chain, block, resultCh, stopCh); err != nil {
return err
}

// Clique.Seal() will only wait for a second before giving up on us. So make sure there is nothing computational heavy
// or a call that blocks between the call to Seal and the line below
block = <-resultCh
if block == nil {
return errors.New("missed seal response from consensus engine")
}

// verify the generated block with local consensus engine to make sure everything is as expected
if err = w.engine.VerifyHeader(w.chain, block.Header(), true); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 23 // Patch version component of the current release
VersionPatch = 24 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down

0 comments on commit b9919a5

Please sign in to comment.