From dc57ae2468d02a086b5ae1a7b7cf481942d81ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20Irmak?= Date: Fri, 7 Jun 2024 10:39:05 +0300 Subject: [PATCH] fix: account for the artificially added delay in commit stage (#806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: account for the artificially added delay in commit stage * linter * chore: auto version bump [bot] --------- Co-authored-by: omerfirmak --- miner/scroll_worker.go | 8 ++++++-- params/version.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/miner/scroll_worker.go b/miner/scroll_worker.go index b815b33562..884076fa37 100644 --- a/miner/scroll_worker.go +++ b/miner/scroll_worker.go @@ -681,8 +681,9 @@ func (e retryableCommitError) Unwrap() error { // commit runs any post-transaction state modifications, assembles the final block // and commits new work if consensus engine is running. func (w *worker) commit(res *pipeline.Result) error { + sealDelay := time.Duration(0) defer func(t0 time.Time) { - l2CommitTimer.Update(time.Since(t0)) + l2CommitTimer.Update(time.Since(t0) - sealDelay) }(time.Now()) if res.CCCErr != nil { @@ -709,8 +710,11 @@ func (w *worker) commit(res *pipeline.Result) error { 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 + // or a call that blocks between the call to Seal and the line below. Seal might introduce some delay, so we keep track of + // that artificially added delay and subtract it from overall runtime of commit(). + sealStart := time.Now() block = <-resultCh + sealDelay = time.Since(sealStart) if block == nil { return errors.New("missed seal response from consensus engine") } diff --git a/params/version.go b/params/version.go index 522aadf0ea..95d6483045 100644 --- a/params/version.go +++ b/params/version.go @@ -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 = 38 // Patch version component of the current release + VersionPatch = 39 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )