Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scroll-worker): add nil consumption block metrics #1033

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions miner/scroll_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ var (
commitReasonCCCCounter = metrics.NewRegisteredCounter("miner/commit_reason_ccc", nil)
commitReasonDeadlineCounter = metrics.NewRegisteredCounter("miner/commit_reason_deadline", nil)
commitGasCounter = metrics.NewRegisteredCounter("miner/commit_gas", nil)

missingRCOnRestartCounter = metrics.NewRegisteredCounter("miner/missing_rc_on_restart", nil)
missingAncestorRCCounter = metrics.NewRegisteredCounter("miner/missing_ancestor_rc", nil)
)

// prioritizedTransaction represents a single transaction that
Expand Down Expand Up @@ -306,6 +309,8 @@ func (w *worker) checkHeadRowConsumption() error {
block := w.chain.GetBlockByNumber(curBlockNum)
// only spawn CCC checkers for blocks with no row consumption data stored in DB
if rawdb.ReadBlockRowConsumption(w.chain.Database(), block.Hash()) == nil {
missingRCOnRestartCounter.Inc(1)

if err := w.asyncChecker.Check(block); err != nil {
return err
}
Expand Down Expand Up @@ -870,6 +875,8 @@ func (w *worker) commit(reorging bool) (common.Hash, error) {
ancestorHeight := currentHeight - maxReorgDepth
ancestorHash := w.chain.GetHeaderByNumber(ancestorHeight).Hash()
if rawdb.ReadBlockRowConsumption(w.chain.Database(), ancestorHash) == nil {
missingAncestorRCCounter.Inc(1)

// reject committing to a block if its ancestor doesn't have its RC stored in DB yet.
// which may either mean that it failed CCC or it is still in the process of being checked
return common.Hash{}, retryableCommitError{inner: errors.New("ancestor doesn't have RC yet")}
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 = 7 // Minor version component of the current release
VersionPatch = 15 // Patch version component of the current release
VersionPatch = 16 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
Loading