From 0e548a45422bab4534f5d1ddb62252ee110899f4 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 30 Dec 2024 20:46:00 +0700 Subject: [PATCH 01/28] recsplit: change default BucketSize (#13272) Params: - change default BucketSize: at `100` i don't see any size grow. but build speed -30% and read speed -20% - keep same default LeafSize: it increasing build speed, but decreasing reads speed. so we do preoritize reads speed. --- erigon-lib/kv/mdbx/kv_mdbx.go | 3 +++ erigon-lib/recsplit/recsplit.go | 2 +- erigon-lib/state/aggregator_test.go | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/erigon-lib/kv/mdbx/kv_mdbx.go b/erigon-lib/kv/mdbx/kv_mdbx.go index b7a52c6d06b..0ec79bc146f 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx.go +++ b/erigon-lib/kv/mdbx/kv_mdbx.go @@ -1109,6 +1109,9 @@ func (tx *MdbxTx) stdCursor(bucket string) (kv.RwCursor, error) { c := &MdbxCursor{bucketName: bucket, tx: tx, bucketCfg: b, id: tx.ID} tx.ID++ + if tx.tx == nil { + panic("assert: tx.tx nil. seems this `tx` was Rollback'ed") + } var err error c.c, err = tx.tx.OpenCursor(mdbx.DBI(tx.db.buckets[c.bucketName].DBI)) if err != nil { diff --git a/erigon-lib/recsplit/recsplit.go b/erigon-lib/recsplit/recsplit.go index a1274f355dd..dd41a7f0347 100644 --- a/erigon-lib/recsplit/recsplit.go +++ b/erigon-lib/recsplit/recsplit.go @@ -143,7 +143,7 @@ type RecSplitArgs struct { // DefaultLeafSize - LeafSize=8 and BucketSize=100, use abount 1.8 bits per key. Increasing the leaf and bucket // sizes gives more compact structures (1.56 bits per key), at the price of a slower construction time const DefaultLeafSize = 8 -const DefaultBucketSize = 2000 // typical from 100 to 2000, with smaller buckets giving slightly larger but faster function +const DefaultBucketSize = 100 // typical from 100 to 2000, with smaller buckets giving slightly larger but faster function // NewRecSplit creates a new RecSplit instance with given number of keys and given bucket size // Typical bucket size is 100 - 2000, larger bucket sizes result in smaller representations of hash functions, at a cost of slower access diff --git a/erigon-lib/state/aggregator_test.go b/erigon-lib/state/aggregator_test.go index f70f655d650..444f3a57bbe 100644 --- a/erigon-lib/state/aggregator_test.go +++ b/erigon-lib/state/aggregator_test.go @@ -547,13 +547,13 @@ func TestAggregatorV3_PruneSmallBatches(t *testing.T) { require.NoError(t, err) codeRangeAfter = extractKVErrIterator(t, it) - its, err := ac.d[kv.AccountsDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, tx) + its, err := ac.d[kv.AccountsDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, afterTx) require.NoError(t, err) accountHistRangeAfter = extractKVSErrIterator(t, its) - its, err = ac.d[kv.CodeDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, tx) + its, err = ac.d[kv.CodeDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, afterTx) require.NoError(t, err) codeHistRangeAfter = extractKVSErrIterator(t, its) - its, err = ac.d[kv.StorageDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, tx) + its, err = ac.d[kv.StorageDomain].ht.HistoryRange(0, int(maxTx), order.Asc, maxInt, afterTx) require.NoError(t, err) storageHistRangeAfter = extractKVSErrIterator(t, its) } From dd3663a39c9922717a5f08077fdb59e422bdd50a Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 30 Dec 2024 21:17:35 +0700 Subject: [PATCH 02/28] commitment domain: make `.kvi` default index (#13276) --- erigon-lib/state/aggregator.go | 12 +++++++++++- erigon-lib/state/aggregator_test.go | 21 ++++++++++++++++++--- erigon-lib/state/domain.go | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/erigon-lib/state/aggregator.go b/erigon-lib/state/aggregator.go index 6123509a46d..4eb8d9cd0fe 100644 --- a/erigon-lib/state/aggregator.go +++ b/erigon-lib/state/aggregator.go @@ -126,6 +126,16 @@ func domainIntegrityCheck(name kv.Domain, dirs datadir.Dirs, fromStep, toStep ui } } +var dbgCommBtIndex = dbg.EnvBool("AGG_COMMITMENT_BT", false) + +func init() { + if dbgCommBtIndex { + cfg := Schema[kv.CommitmentDomain] + cfg.indexList = withBTree | withExistence + Schema[kv.CommitmentDomain] = cfg + } +} + var Schema = map[kv.Domain]domainCfg{ kv.AccountsDomain: { name: kv.AccountsDomain, valuesTable: kv.TblAccountVals, @@ -195,7 +205,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.CommitmentDomain: { name: kv.CommitmentDomain, valuesTable: kv.TblCommitmentVals, - indexList: withBTree | withExistence, + indexList: withHashMap, compression: seg.CompressKeys, compressCfg: DomainCompressCfg, diff --git a/erigon-lib/state/aggregator_test.go b/erigon-lib/state/aggregator_test.go index 444f3a57bbe..2df5b21c9f6 100644 --- a/erigon-lib/state/aggregator_test.go +++ b/erigon-lib/state/aggregator_test.go @@ -1273,9 +1273,24 @@ func TestAggregator_RebuildCommitmentBasedOnFiles(t *testing.T) { compression := ac.d[kv.CommitmentDomain].d.compression fnames := []string{} for _, f := range ac.d[kv.CommitmentDomain].files { - k, stateVal, _, found, err := f.src.bindex.Get(keyCommitmentState, seg.NewReader(f.src.decompressor.MakeGetter(), compression)) - require.NoError(t, err) - require.True(t, found) + var k, stateVal []byte + if ac.d[kv.CommitmentDomain].d.indexList&withHashMap != 0 { + idx := f.src.index.GetReaderFromPool() + r := seg.NewReader(f.src.decompressor.MakeGetter(), compression) + + offset, ok := idx.TwoLayerLookup(keyCommitmentState) + require.True(t, ok) + r.Reset(offset) + k, _ = r.Next(nil) + stateVal, _ = r.Next(nil) + } else { + var found bool + var err error + k, stateVal, _, found, err = f.src.bindex.Get(keyCommitmentState, seg.NewReader(f.src.decompressor.MakeGetter(), compression)) + require.NoError(t, err) + require.True(t, found) + require.EqualValues(t, keyCommitmentState, k) + } require.EqualValues(t, keyCommitmentState, k) rh, err := commitment.HexTrieExtractStateRoot(stateVal) require.NoError(t, err) diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index a9caa460ad6..3d9fb444dc9 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -1055,7 +1055,7 @@ func (d *Domain) buildFileRange(ctx context.Context, stepFrom, stepTo uint64, co if err = d.buildAccessor(ctx, stepFrom, stepTo, valuesDecomp, ps); err != nil { return StaticFiles{}, fmt.Errorf("build %s values idx: %w", d.filenameBase, err) } - valuesIdx, err = recsplit.OpenIndex(d.efAccessorFilePath(stepFrom, stepTo)) + valuesIdx, err = recsplit.OpenIndex(d.kvAccessorFilePath(stepFrom, stepTo)) if err != nil { return StaticFiles{}, err } @@ -1158,7 +1158,7 @@ func (d *Domain) buildFiles(ctx context.Context, step uint64, collation Collatio if err = d.buildAccessor(ctx, step, step+1, valuesDecomp, ps); err != nil { return StaticFiles{}, fmt.Errorf("build %s values idx: %w", d.filenameBase, err) } - valuesIdx, err = recsplit.OpenIndex(d.efAccessorFilePath(step, step+1)) + valuesIdx, err = recsplit.OpenIndex(d.kvAccessorFilePath(step, step+1)) if err != nil { return StaticFiles{}, err } From c72c0be8b5ede03fd1ce5eee019daf5090a3757b Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 31 Dec 2024 18:28:29 +0700 Subject: [PATCH 03/28] Set workers only from one sync (#13284) --- eth/stagedsync/exec3.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 0c8c06fbe23..67516febd4a 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -206,6 +206,8 @@ func ExecV3(ctx context.Context, initialCycle bool, isMining bool, ) error { + inMemExec := txc.Doms != nil + // TODO: e35 doesn't support parallel-exec yet parallel = false //nolint if parallel && cfg.chainConfig.ChainName == networkname.Gnosis { @@ -237,16 +239,17 @@ func ExecV3(ctx context.Context, } } agg := cfg.db.(state2.HasAgg).Agg().(*state2.Aggregator) - if initialCycle { - agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) - agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) - } else { - agg.SetCompressWorkers(1) - agg.SetCollateAndBuildWorkers(1) + if !inMemExec && !isMining { + if initialCycle { + agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) + agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) + } else { + agg.SetCompressWorkers(1) + agg.SetCollateAndBuildWorkers(1) + } } var err error - inMemExec := txc.Doms != nil var doms *state2.SharedDomains if inMemExec { doms = txc.Doms From 6e1bab7ea1dabd95556add338ee78b79f6fc830f Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Wed, 1 Jan 2025 05:05:52 +0100 Subject: [PATCH 04/28] Erigon: revert go-mdbx (#13286) --- erigon-lib/go.mod | 2 +- erigon-lib/go.sum | 5 +++-- erigon-lib/kv/mdbx/kv_mdbx.go | 2 +- go.mod | 2 +- go.sum | 5 +++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index c63958639c5..9b374ea6817 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -10,7 +10,7 @@ replace ( require ( github.com/erigontech/erigon-snapshot v1.3.1-0.20241023024258-f64407a77e8e github.com/erigontech/interfaces v0.0.0-20241120074553-214b5fd396ed - github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55 + github.com/erigontech/mdbx-go v0.38.4 github.com/erigontech/secp256k1 v1.1.0 github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 ) diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index b125a49fa91..4d9209e71d9 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -156,8 +156,8 @@ github.com/erigontech/erigon-snapshot v1.3.1-0.20241023024258-f64407a77e8e h1:Zp github.com/erigontech/erigon-snapshot v1.3.1-0.20241023024258-f64407a77e8e/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M= github.com/erigontech/interfaces v0.0.0-20241120074553-214b5fd396ed h1:un44S8Tuol4LBIC6R94t93GShM53BYjz7GsNPziDLQ8= github.com/erigontech/interfaces v0.0.0-20241120074553-214b5fd396ed/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE= -github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55 h1:OOIbmoNOak87yBBBw6MNmkTZi+A76Rof/ZfWVXbOj+4= -github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55/go.mod h1:ncKVXcwnMpZ+wIye89HLVglDwXFXbEY2L1OI1Iahgzk= +github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo= +github.com/erigontech/mdbx-go v0.38.4/go.mod h1:IcOLQDPw3VM/asP6T5JVPPN4FHHgJtY16XfYjzWKVNI= github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M0X9qY= github.com/erigontech/secp256k1 v1.1.0/go.mod h1:GokhPepsMB+EYDs7I5JZCprxHW6+yfOcJKaKtoZ+Fls= github.com/erigontech/speedtest v0.0.2 h1:W9Cvky/8AMUtUONwkLA/dZjeQ2XfkBdYfJzvhMZUO+U= @@ -273,6 +273,7 @@ github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20241129212102-9c50ad6b591e h1:8AnObPi8WmIgjwcidUxaREhXMSpyUJeeSrIkZTXdabw= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20241129212102-9c50ad6b591e/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= diff --git a/erigon-lib/kv/mdbx/kv_mdbx.go b/erigon-lib/kv/mdbx/kv_mdbx.go index 0ec79bc146f..123bcd1dd19 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx.go +++ b/erigon-lib/kv/mdbx/kv_mdbx.go @@ -202,7 +202,7 @@ func (opts MdbxOpts) Open(ctx context.Context) (kv.RwDB, error) { } - env, err := mdbx.NewEnv(mdbx.Label(opts.label)) + env, err := mdbx.NewEnv() if err != nil { return nil, err } diff --git a/go.mod b/go.mod index cc50c4eb0a4..d19137b65d0 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ replace ( require ( github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116 - github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55 + github.com/erigontech/mdbx-go v0.38.4 github.com/erigontech/secp256k1 v1.1.0 github.com/erigontech/silkworm-go v0.18.0 ) diff --git a/go.sum b/go.sum index 79d6db3b838..ed8f1651f93 100644 --- a/go.sum +++ b/go.sum @@ -271,8 +271,8 @@ github.com/erigontech/erigon-snapshot v1.3.1-0.20241023024258-f64407a77e8e h1:Zp github.com/erigontech/erigon-snapshot v1.3.1-0.20241023024258-f64407a77e8e/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M= github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116 h1:KCFa2uXEfZoBjV4buzjWmCmoqVLXiGCq0ZmQ2OjeRvQ= github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116/go.mod h1:8vQ+VjvLu2gkPs8EwdPrOTAAo++WuLuBi54N7NuAF0I= -github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55 h1:OOIbmoNOak87yBBBw6MNmkTZi+A76Rof/ZfWVXbOj+4= -github.com/erigontech/mdbx-go v0.39.0-alpha.0.20241223021833-1b75fb145a55/go.mod h1:ncKVXcwnMpZ+wIye89HLVglDwXFXbEY2L1OI1Iahgzk= +github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo= +github.com/erigontech/mdbx-go v0.38.4/go.mod h1:IcOLQDPw3VM/asP6T5JVPPN4FHHgJtY16XfYjzWKVNI= github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M0X9qY= github.com/erigontech/secp256k1 v1.1.0/go.mod h1:GokhPepsMB+EYDs7I5JZCprxHW6+yfOcJKaKtoZ+Fls= github.com/erigontech/silkworm-go v0.18.0 h1:j56p61xZHBFhZGH1OixlGU8KcfjHzcw9pjAfjmVsOZA= @@ -487,6 +487,7 @@ github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20241129212102-9c50ad6b591e h1:8AnObPi8WmIgjwcidUxaREhXMSpyUJeeSrIkZTXdabw= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20241129212102-9c50ad6b591e/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= From 68694ca33c8a6a3c1d3aae33064a8ff0814c50cc Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 2 Jan 2025 04:09:57 +0700 Subject: [PATCH 05/28] `.kvi` support in tooling (#13293) - `torrent_create --all` - seedable files list --- erigon-lib/downloader/snaptype/files.go | 2 +- erigon-lib/seg/seg_auto_rw.go | 4 +- erigon-lib/state/aggregator.go | 12 ++-- erigon-lib/state/aggregator_test.go | 2 +- erigon-lib/state/domain.go | 34 ++++----- erigon-lib/state/domain_committed.go | 4 +- erigon-lib/state/domain_shared.go | 6 +- erigon-lib/state/files_item.go | 8 +-- erigon-lib/state/history.go | 4 +- erigon-lib/state/inverted_index.go | 16 +++-- erigon-lib/state/merge.go | 6 +- erigon-lib/state/squeeze.go | 11 +-- turbo/app/snapshots_cmd.go | 93 ++++++++++++++++--------- turbo/rpchelper/helper.go | 1 + 14 files changed, 115 insertions(+), 88 deletions(-) diff --git a/erigon-lib/downloader/snaptype/files.go b/erigon-lib/downloader/snaptype/files.go index b07e1e9f632..b75a402d7d2 100644 --- a/erigon-lib/downloader/snaptype/files.go +++ b/erigon-lib/downloader/snaptype/files.go @@ -232,7 +232,7 @@ func SeedableV3Extensions() []string { } func AllV3Extensions() []string { - return []string{".kv", ".v", ".ef", ".kvei", ".vi", ".efi", ".bt"} + return []string{".kv", ".v", ".ef", ".kvei", ".vi", ".efi", ".bt", ".kvi"} } func IsSeedableExtension(name string) bool { diff --git a/erigon-lib/seg/seg_auto_rw.go b/erigon-lib/seg/seg_auto_rw.go index 92136c8afc4..11487a277fb 100644 --- a/erigon-lib/seg/seg_auto_rw.go +++ b/erigon-lib/seg/seg_auto_rw.go @@ -175,7 +175,7 @@ func DetectCompressType(getter *Getter) (compressed FileCompression) { getter.Reset(0) for i := 0; i < 100; i++ { if getter.HasNext() { - _, _ = getter.NextUncompressed() + _, _ = getter.SkipUncompressed() } if getter.HasNext() { _, _ = getter.Skip() @@ -196,7 +196,7 @@ func DetectCompressType(getter *Getter) (compressed FileCompression) { _, _ = getter.Skip() } if getter.HasNext() { - _, _ = getter.NextUncompressed() + _, _ = getter.SkipUncompressed() } } return compressed diff --git a/erigon-lib/state/aggregator.go b/erigon-lib/state/aggregator.go index 4eb8d9cd0fe..26f147c3958 100644 --- a/erigon-lib/state/aggregator.go +++ b/erigon-lib/state/aggregator.go @@ -131,7 +131,7 @@ var dbgCommBtIndex = dbg.EnvBool("AGG_COMMITMENT_BT", false) func init() { if dbgCommBtIndex { cfg := Schema[kv.CommitmentDomain] - cfg.indexList = withBTree | withExistence + cfg.IndexList = AccessorBTree | AccessorExistence Schema[kv.CommitmentDomain] = cfg } } @@ -140,7 +140,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.AccountsDomain: { name: kv.AccountsDomain, valuesTable: kv.TblAccountVals, - indexList: withBTree | withExistence, + IndexList: AccessorBTree | AccessorExistence, crossDomainIntegrity: domainIntegrityCheck, compression: seg.CompressNone, compressCfg: DomainCompressCfg, @@ -162,7 +162,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.StorageDomain: { name: kv.StorageDomain, valuesTable: kv.TblStorageVals, - indexList: withBTree | withExistence, + IndexList: AccessorBTree | AccessorExistence, compression: seg.CompressKeys, compressCfg: DomainCompressCfg, @@ -183,7 +183,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.CodeDomain: { name: kv.CodeDomain, valuesTable: kv.TblCodeVals, - indexList: withBTree | withExistence, + IndexList: AccessorBTree | AccessorExistence, compression: seg.CompressVals, // compress Code with keys doesn't show any profit. compress of values show 4x ratio on eth-mainnet and 2.5x ratio on bor-mainnet compressCfg: DomainCompressCfg, largeValues: true, @@ -205,7 +205,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.CommitmentDomain: { name: kv.CommitmentDomain, valuesTable: kv.TblCommitmentVals, - indexList: withHashMap, + IndexList: AccessorHashMap, compression: seg.CompressKeys, compressCfg: DomainCompressCfg, @@ -227,7 +227,7 @@ var Schema = map[kv.Domain]domainCfg{ kv.ReceiptDomain: { name: kv.ReceiptDomain, valuesTable: kv.TblReceiptVals, - indexList: withBTree | withExistence, + IndexList: AccessorBTree | AccessorExistence, compression: seg.CompressNone, //seg.CompressKeys | seg.CompressVals, compressCfg: DomainCompressCfg, diff --git a/erigon-lib/state/aggregator_test.go b/erigon-lib/state/aggregator_test.go index 2df5b21c9f6..816eb25c2e9 100644 --- a/erigon-lib/state/aggregator_test.go +++ b/erigon-lib/state/aggregator_test.go @@ -1274,7 +1274,7 @@ func TestAggregator_RebuildCommitmentBasedOnFiles(t *testing.T) { fnames := []string{} for _, f := range ac.d[kv.CommitmentDomain].files { var k, stateVal []byte - if ac.d[kv.CommitmentDomain].d.indexList&withHashMap != 0 { + if ac.d[kv.CommitmentDomain].d.IndexList&AccessorHashMap != 0 { idx := f.src.index.GetReaderFromPool() r := seg.NewReader(f.src.decompressor.MakeGetter(), compression) diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index 3d9fb444dc9..7d9c2770f0a 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -97,8 +97,8 @@ type domainCfg struct { name kv.Domain compression seg.FileCompression compressCfg seg.Cfg - indexList idxList // list of indexes for given domain - valuesTable string // bucket to store domain values; key -> inverted_step + values (Dupsort) + IndexList Accessors // list of indexes for given domain + valuesTable string // bucket to store domain values; key -> inverted_step + values (Dupsort) largeValues bool crossDomainIntegrity rangeDomainIntegrityChecker @@ -358,7 +358,7 @@ func (d *Domain) openDirtyFiles() (err error) { } } - if item.index == nil && d.indexList&withHashMap != 0 { + if item.index == nil && d.IndexList&AccessorHashMap != 0 { fPath := d.kvAccessorFilePath(fromStep, toStep) exists, err := dir.FileExist(fPath) if err != nil { @@ -373,7 +373,7 @@ func (d *Domain) openDirtyFiles() (err error) { } } } - if item.bindex == nil && d.indexList&withBTree != 0 { + if item.bindex == nil && d.IndexList&AccessorBTree != 0 { fPath := d.kvBtFilePath(fromStep, toStep) exists, err := dir.FileExist(fPath) if err != nil { @@ -392,7 +392,7 @@ func (d *Domain) openDirtyFiles() (err error) { } } } - if item.existence == nil && d.indexList&withExistence != 0 { + if item.existence == nil && d.IndexList&AccessorExistence != 0 { fPath := d.kvExistenceIdxFilePath(fromStep, toStep) exists, err := dir.FileExist(fPath) if err != nil { @@ -443,7 +443,7 @@ func (d *Domain) closeWhatNotInList(fNames []string) { } func (d *Domain) reCalcVisibleFiles(toTxNum uint64) { - d._visible = newDomainVisible(d.name, calcVisibleFiles(d.dirtyFiles, d.indexList, false, toTxNum)) + d._visible = newDomainVisible(d.name, calcVisibleFiles(d.dirtyFiles, d.IndexList, false, toTxNum)) d.History.reCalcVisibleFiles(toTxNum) } @@ -674,7 +674,7 @@ func (dt *DomainRoTx) getLatestFromFile(i int, filekey []byte) (v []byte, ok boo } g := dt.statelessGetter(i) - if dt.d.indexList&withBTree != 0 { + if dt.d.IndexList&AccessorBTree != 0 { _, v, offset, ok, err = dt.statelessBtree(i).Get(filekey, g) if err != nil || !ok { return nil, false, 0, err @@ -682,7 +682,7 @@ func (dt *DomainRoTx) getLatestFromFile(i int, filekey []byte) (v []byte, ok boo //fmt.Printf("getLatestFromBtreeColdFiles key %x shard %d %x\n", filekey, exactColdShard, v) return v, true, offset, nil } - if dt.d.indexList&withHashMap != 0 { + if dt.d.IndexList&AccessorHashMap != 0 { reader := dt.statelessIdxReader(i) if reader.Empty() { return nil, false, 0, nil @@ -1051,7 +1051,7 @@ func (d *Domain) buildFileRange(ctx context.Context, stepFrom, stepTo uint64, co return StaticFiles{}, fmt.Errorf("open %s values decompressor: %w", d.filenameBase, err) } - if d.indexList&withHashMap != 0 { + if d.IndexList&AccessorHashMap != 0 { if err = d.buildAccessor(ctx, stepFrom, stepTo, valuesDecomp, ps); err != nil { return StaticFiles{}, fmt.Errorf("build %s values idx: %w", d.filenameBase, err) } @@ -1061,7 +1061,7 @@ func (d *Domain) buildFileRange(ctx context.Context, stepFrom, stepTo uint64, co } } - if d.indexList&withBTree != 0 { + if d.IndexList&AccessorBTree != 0 { btPath := d.kvBtFilePath(stepFrom, stepTo) btM := DefaultBtreeM if stepFrom == 0 && d.filenameBase == "commitment" { @@ -1073,7 +1073,7 @@ func (d *Domain) buildFileRange(ctx context.Context, stepFrom, stepTo uint64, co return StaticFiles{}, fmt.Errorf("build %s .bt idx: %w", d.filenameBase, err) } } - if d.indexList&withExistence != 0 { + if d.IndexList&AccessorExistence != 0 { fPath := d.kvExistenceIdxFilePath(stepFrom, stepTo) exists, err := dir.FileExist(fPath) if err != nil { @@ -1154,7 +1154,7 @@ func (d *Domain) buildFiles(ctx context.Context, step uint64, collation Collatio return StaticFiles{}, fmt.Errorf("open %s values decompressor: %w", d.filenameBase, err) } - if d.indexList&withHashMap != 0 { + if d.IndexList&AccessorHashMap != 0 { if err = d.buildAccessor(ctx, step, step+1, valuesDecomp, ps); err != nil { return StaticFiles{}, fmt.Errorf("build %s values idx: %w", d.filenameBase, err) } @@ -1164,7 +1164,7 @@ func (d *Domain) buildFiles(ctx context.Context, step uint64, collation Collatio } } - if d.indexList&withBTree != 0 { + if d.IndexList&AccessorBTree != 0 { btPath := d.kvBtFilePath(step, step+1) btM := DefaultBtreeM if step == 0 && d.filenameBase == "commitment" { @@ -1175,7 +1175,7 @@ func (d *Domain) buildFiles(ctx context.Context, step uint64, collation Collatio return StaticFiles{}, fmt.Errorf("build %s .bt idx: %w", d.filenameBase, err) } } - if d.indexList&withExistence != 0 { + if d.IndexList&AccessorExistence != 0 { fPath := d.kvExistenceIdxFilePath(step, step+1) exists, err := dir.FileExist(fPath) if err != nil { @@ -1263,7 +1263,7 @@ func (d *Domain) missedAccessors() (l []*filesItem) { func (d *Domain) BuildMissedAccessors(ctx context.Context, g *errgroup.Group, ps *background.ProgressSet) { d.History.BuildMissedAccessors(ctx, g, ps) for _, item := range d.missedBtreeAccessors() { - if d.indexList&withBTree == 0 { + if d.IndexList&AccessorBTree == 0 { continue } if item.decompressor == nil { @@ -1281,7 +1281,7 @@ func (d *Domain) BuildMissedAccessors(ctx context.Context, g *errgroup.Group, ps }) } for _, item := range d.missedAccessors() { - if d.indexList&withHashMap == 0 { + if d.IndexList&AccessorHashMap == 0 { continue } if item.decompressor == nil { @@ -1451,7 +1451,7 @@ func (dt *DomainRoTx) getFromFiles(filekey []byte, maxTxNum uint64) (v []byte, f if maxTxNum == 0 { maxTxNum = math.MaxUint64 } - useExistenceFilter := dt.d.indexList&withExistence != 0 + useExistenceFilter := dt.d.IndexList&AccessorExistence != 0 useCache := dt.name != kv.CommitmentDomain && maxTxNum == math.MaxUint64 hi, _ := dt.ht.iit.hashKey(filekey) diff --git a/erigon-lib/state/domain_committed.go b/erigon-lib/state/domain_committed.go index 33865be7415..8daef3f6b26 100644 --- a/erigon-lib/state/domain_committed.go +++ b/erigon-lib/state/domain_committed.go @@ -110,7 +110,7 @@ func (dt *DomainRoTx) findShortenedKey(fullKey []byte, itemGetter *seg.Reader, i // } //} - if dt.d.indexList&withHashMap != 0 { + if dt.d.IndexList&AccessorHashMap != 0 { reader := recsplit.NewIndexReader(item.index) defer reader.Close() @@ -135,7 +135,7 @@ func (dt *DomainRoTx) findShortenedKey(fullKey []byte, itemGetter *seg.Reader, i } return encodeShorterKey(nil, offset), true } - if dt.d.indexList&withBTree != 0 { + if dt.d.IndexList&AccessorBTree != 0 { if item.bindex == nil { dt.d.logger.Warn("[agg] commitment branch key replacement: file doesn't have index", "name", item.decompressor.FileName()) } diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index 77d4636e55f..e570c8c7263 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -818,8 +818,8 @@ func (sd *SharedDomains) IterateStoragePrefix(prefix []byte, it func(k []byte, v } } case FILE_CURSOR: - indexList := sd.aggTx.d[kv.StorageDomain].d.indexList - if indexList&withBTree != 0 { + indexList := sd.aggTx.d[kv.StorageDomain].d.IndexList + if indexList&AccessorBTree != 0 { if ci1.btCursor.Next() { ci1.key = ci1.btCursor.Key() if ci1.key != nil && bytes.HasPrefix(ci1.key, prefix) { @@ -830,7 +830,7 @@ func (sd *SharedDomains) IterateStoragePrefix(prefix []byte, it func(k []byte, v ci1.btCursor.Close() } } - if indexList&withHashMap != 0 { + if indexList&AccessorHashMap != 0 { ci1.dg.Reset(ci1.latestOffset) if !ci1.dg.HasNext() { break diff --git a/erigon-lib/state/files_item.go b/erigon-lib/state/files_item.go index d59fcbebc4f..c782fb295be 100644 --- a/erigon-lib/state/files_item.go +++ b/erigon-lib/state/files_item.go @@ -243,7 +243,7 @@ type visibleFile struct { func (i *visibleFile) isSubSetOf(j *visibleFile) bool { return i.src.isSubsetOf(j.src) } //nolint func (i *visibleFile) isSubsetOf(j *visibleFile) bool { return i.src.isSubsetOf(j.src) } //nolint -func calcVisibleFiles(files *btree2.BTreeG[*filesItem], l idxList, trace bool, toTxNum uint64) (roItems []visibleFile) { +func calcVisibleFiles(files *btree2.BTreeG[*filesItem], l Accessors, trace bool, toTxNum uint64) (roItems []visibleFile) { newVisibleFiles := make([]visibleFile, 0, files.Len()) // trace = true if trace { @@ -271,21 +271,21 @@ func calcVisibleFiles(files *btree2.BTreeG[*filesItem], l idxList, trace bool, t } continue } - if (l&withBTree != 0) && item.bindex == nil { + if (l&AccessorBTree != 0) && item.bindex == nil { if trace { log.Warn("[dbg] calcVisibleFiles: BTindex not opened", "f", item.decompressor.FileName()) } //panic(fmt.Errorf("btindex nil: %s", item.decompressor.FileName())) continue } - if (l&withHashMap != 0) && item.index == nil { + if (l&AccessorHashMap != 0) && item.index == nil { if trace { log.Warn("[dbg] calcVisibleFiles: RecSplit not opened", "f", item.decompressor.FileName()) } //panic(fmt.Errorf("index nil: %s", item.decompressor.FileName())) continue } - if (l&withExistence != 0) && item.existence == nil { + if (l&AccessorExistence != 0) && item.existence == nil { if trace { log.Warn("[dbg] calcVisibleFiles: Existence not opened", "f", item.decompressor.FileName()) } diff --git a/erigon-lib/state/history.go b/erigon-lib/state/history.go index fd73cf3f7bd..db2258b6046 100644 --- a/erigon-lib/state/history.go +++ b/erigon-lib/state/history.go @@ -96,7 +96,7 @@ type histCfg struct { snapshotsDisabled bool // don't produce .v and .ef files, keep in db table. old data will be pruned anyway. historyDisabled bool // skip all write operations to this History (even in DB) - indexList idxList + indexList Accessors compressorCfg seg.Cfg // compression settings for history files compression seg.FileCompression // defines type of compression for history files @@ -108,7 +108,7 @@ func NewHistory(cfg histCfg, logger log.Logger) (*History, error) { //if cfg.compressorCfg.MaxDictPatterns == 0 && cfg.compressorCfg.MaxPatternLen == 0 { cfg.compressorCfg = seg.DefaultCfg if cfg.indexList == 0 { - cfg.indexList = withHashMap + cfg.indexList = AccessorHashMap } if cfg.iiCfg.filenameBase == "" { cfg.iiCfg.filenameBase = cfg.filenameBase diff --git a/erigon-lib/state/inverted_index.go b/erigon-lib/state/inverted_index.go index 52d0de6e4ee..3f1c1345662 100644 --- a/erigon-lib/state/inverted_index.go +++ b/erigon-lib/state/inverted_index.go @@ -89,7 +89,7 @@ type iiCfg struct { // external checker for integrity of inverted index ranges integrity rangeIntegrityChecker - indexList idxList + indexList Accessors } type iiVisible struct { @@ -111,7 +111,7 @@ func NewInvertedIndex(cfg iiCfg, logger log.Logger) (*InvertedIndex, error) { //if cfg.compressorCfg.MaxDictPatterns == 0 && cfg.compressorCfg.MaxPatternLen == 0 { cfg.compressorCfg = seg.DefaultCfg if cfg.indexList == 0 { - cfg.indexList = withHashMap + cfg.indexList = AccessorHashMap } ii := InvertedIndex{ @@ -200,12 +200,14 @@ func (ii *InvertedIndex) scanDirtyFiles(fileNames []string) { } } -type idxList int +type Accessors int -var ( - withBTree idxList = 0b1 - withHashMap idxList = 0b10 - withExistence idxList = 0b100 +func (l Accessors) Has(target Accessors) bool { return l&target != 0 } + +const ( + AccessorBTree Accessors = 0b1 + AccessorHashMap Accessors = 0b10 + AccessorExistence Accessors = 0b100 ) func (ii *InvertedIndex) reCalcVisibleFiles(toTxNum uint64) { diff --git a/erigon-lib/state/merge.go b/erigon-lib/state/merge.go index 510e0a23af3..2c22e540a30 100644 --- a/erigon-lib/state/merge.go +++ b/erigon-lib/state/merge.go @@ -515,7 +515,7 @@ func (dt *DomainRoTx) mergeFiles(ctx context.Context, domainFiles, indexFiles, h return nil, nil, nil, fmt.Errorf("merge %s decompressor [%d-%d]: %w", dt.d.filenameBase, r.values.from, r.values.to, err) } - if dt.d.indexList&withBTree != 0 { + if dt.d.IndexList&AccessorBTree != 0 { btPath := dt.d.kvBtFilePath(fromStep, toStep) btM := DefaultBtreeM if toStep == 0 && dt.d.filenameBase == "commitment" { @@ -526,7 +526,7 @@ func (dt *DomainRoTx) mergeFiles(ctx context.Context, domainFiles, indexFiles, h return nil, nil, nil, fmt.Errorf("merge %s btindex [%d-%d]: %w", dt.d.filenameBase, r.values.from, r.values.to, err) } } - if dt.d.indexList&withHashMap != 0 { + if dt.d.IndexList&AccessorHashMap != 0 { if err = dt.d.buildAccessor(ctx, fromStep, toStep, valuesIn.decompressor, ps); err != nil { return nil, nil, nil, fmt.Errorf("merge %s buildAccessor [%d-%d]: %w", dt.d.filenameBase, r.values.from, r.values.to, err) } @@ -535,7 +535,7 @@ func (dt *DomainRoTx) mergeFiles(ctx context.Context, domainFiles, indexFiles, h } } - if dt.d.indexList&withExistence != 0 { + if dt.d.IndexList&AccessorExistence != 0 { bloomIndexPath := dt.d.kvExistenceIdxFilePath(fromStep, toStep) exists, err := dir.FileExist(bloomIndexPath) if err != nil { diff --git a/erigon-lib/state/squeeze.go b/erigon-lib/state/squeeze.go index db92ffff8d2..ad929203d53 100644 --- a/erigon-lib/state/squeeze.go +++ b/erigon-lib/state/squeeze.go @@ -57,14 +57,9 @@ func (a *Aggregator) Sqeeze(ctx context.Context, domain kv.Domain) error { strings.ReplaceAll(to, ".kv", ".bt"), strings.ReplaceAll(to, ".kv", ".bt.torrent"), strings.ReplaceAll(to, ".kv", ".kvei"), - strings.ReplaceAll(to, ".kv", ".kvei.torrent")) - - // _ = os.Remove(tempFileCopy) - // _ = os.Remove(strings.ReplaceAll(to, ".kv", ".bt")) - // _ = os.Remove(strings.ReplaceAll(to, ".kv", ".bt.torrent")) - // _ = os.Remove(strings.ReplaceAll(to, ".kv", ".kvei")) - // _ = os.Remove(strings.ReplaceAll(to, ".kv", ".kvei.torrent")) - // _ = os.Remove(strings.ReplaceAll(to, ".kv", ".kv.torrent")) + strings.ReplaceAll(to, ".kv", ".kvei.torrent"), + strings.ReplaceAll(to, ".kv", ".kvi"), + strings.ReplaceAll(to, ".kv", ".kvi.torrent")) } for _, f := range filesToRemove { diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 40b293fb76d..4835364c440 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -644,17 +644,17 @@ func checkIfBlockSnapshotsPublishable(snapDir string) error { return nil } -func checkIfStateSnapshotsPublishable(dir datadir.Dirs) error { +func checkIfStateSnapshotsPublishable(dirs datadir.Dirs) error { var stepSum uint64 var maxStep uint64 - if err := filepath.Walk(dir.SnapDomain, func(path string, info os.FileInfo, err error) error { + if err := filepath.Walk(dirs.SnapDomain, func(path string, info os.FileInfo, err error) error { if err != nil { return err } - if info.IsDir() && path != dir.SnapDomain { - return fmt.Errorf("unexpected directory in domain (%s) check %s", dir.SnapDomain, path) + if info.IsDir() && path != dirs.SnapDomain { + return fmt.Errorf("unexpected directory in domain (%s) check %s", dirs.SnapDomain, path) } - if path == dir.SnapDomain { + if path == dirs.SnapDomain { return nil } rangeString := strings.Split(info.Name(), ".")[1] @@ -677,38 +677,58 @@ func checkIfStateSnapshotsPublishable(dir datadir.Dirs) error { stepSum += to - from // do a range check over all snapshots types (sanitizes domain and history folder) - for _, snapType := range []string{"accounts", "storage", "code", "commitment"} { - expectedFileName := strings.Replace(info.Name(), "accounts", snapType, 1) - if _, err := os.Stat(filepath.Join(dir.SnapDomain, expectedFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", expectedFileName, filepath.Join(dir.SnapDomain, expectedFileName)) + for _, snapType := range kv.StateDomains { + expectedFileName := strings.Replace(info.Name(), "accounts", snapType.String(), 1) + if _, err := os.Stat(filepath.Join(dirs.SnapDomain, expectedFileName)); err != nil { + return fmt.Errorf("missing file %s at path %s", expectedFileName, filepath.Join(dirs.SnapDomain, expectedFileName)) } // check that the index file exist - btFileName := strings.Replace(expectedFileName, ".kv", ".bt", 1) - if _, err := os.Stat(filepath.Join(dir.SnapDomain, btFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", btFileName, filepath.Join(dir.SnapDomain, btFileName)) + if libstate.Schema[snapType].IndexList.Has(libstate.AccessorBTree) { + fileName := strings.Replace(expectedFileName, ".kv", ".bt", 1) + exists, err := dir.FileExist(filepath.Join(dirs.SnapDomain, fileName)) + if err != nil { + return err + } + if !exists { + return fmt.Errorf("missing file %s", fileName) + } } - - kveiFileName := strings.Replace(expectedFileName, ".kv", ".kvei", 1) - if _, err := os.Stat(filepath.Join(dir.SnapDomain, kveiFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", kveiFileName, filepath.Join(dir.SnapDomain, kveiFileName)) + if libstate.Schema[snapType].IndexList.Has(libstate.AccessorExistence) { + fileName := strings.Replace(expectedFileName, ".kv", ".kvei", 1) + exists, err := dir.FileExist(filepath.Join(dirs.SnapDomain, fileName)) + if err != nil { + return err + } + if !exists { + return fmt.Errorf("missing file %s", fileName) + } + } + if libstate.Schema[snapType].IndexList.Has(libstate.AccessorHashMap) { + fileName := strings.Replace(expectedFileName, ".kv", ".kvi", 1) + exists, err := dir.FileExist(filepath.Join(dirs.SnapDomain, fileName)) + if err != nil { + return err + } + if !exists { + return fmt.Errorf("missing file %s", fileName) + } } - } return nil }); err != nil { return err } - if err := filepath.Walk(dir.SnapIdx, func(path string, info os.FileInfo, err error) error { + if err := filepath.Walk(dirs.SnapIdx, func(path string, info os.FileInfo, err error) error { if err != nil { return err } - if info.IsDir() && path != dir.SnapIdx { - return fmt.Errorf("unexpected directory in idx (%s) check %s", dir.SnapIdx, path) + if info.IsDir() && path != dirs.SnapIdx { + return fmt.Errorf("unexpected directory in idx (%s) check %s", dirs.SnapIdx, path) } - if path == dir.SnapIdx { + if path == dirs.SnapIdx { return nil } rangeString := strings.Split(info.Name(), ".")[1] @@ -729,25 +749,25 @@ func checkIfStateSnapshotsPublishable(dir datadir.Dirs) error { // do a range check over all snapshots types (sanitizes domain and history folder) for _, snapType := range []string{"accounts", "storage", "code", "logtopics", "logaddrs", "tracesfrom", "tracesto"} { expectedFileName := strings.Replace(info.Name(), "accounts", snapType, 1) - if _, err := os.Stat(filepath.Join(dir.SnapIdx, expectedFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", expectedFileName, filepath.Join(dir.SnapIdx, expectedFileName)) + if _, err := os.Stat(filepath.Join(dirs.SnapIdx, expectedFileName)); err != nil { + return fmt.Errorf("missing file %s at path %s", expectedFileName, filepath.Join(dirs.SnapIdx, expectedFileName)) } // Check accessors efiFileName := strings.Replace(expectedFileName, ".ef", ".efi", 1) - if _, err := os.Stat(filepath.Join(dir.SnapAccessors, efiFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", efiFileName, filepath.Join(dir.SnapAccessors, efiFileName)) + if _, err := os.Stat(filepath.Join(dirs.SnapAccessors, efiFileName)); err != nil { + return fmt.Errorf("missing file %s at path %s", efiFileName, filepath.Join(dirs.SnapAccessors, efiFileName)) } if !slices.Contains(viTypes, snapType) { continue } viFileName := strings.Replace(expectedFileName, ".ef", ".vi", 1) - if _, err := os.Stat(filepath.Join(dir.SnapAccessors, viFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", viFileName, filepath.Join(dir.SnapAccessors, viFileName)) + if _, err := os.Stat(filepath.Join(dirs.SnapAccessors, viFileName)); err != nil { + return fmt.Errorf("missing file %s at path %s", viFileName, filepath.Join(dirs.SnapAccessors, viFileName)) } // check that .v vFileName := strings.Replace(expectedFileName, ".ef", ".v", 1) - if _, err := os.Stat(filepath.Join(dir.SnapHistory, vFileName)); err != nil { - return fmt.Errorf("missing file %s at path %s", vFileName, filepath.Join(dir.SnapHistory, vFileName)) + if _, err := os.Stat(filepath.Join(dirs.SnapHistory, vFileName)); err != nil { + return fmt.Errorf("missing file %s at path %s", vFileName, filepath.Join(dirs.SnapHistory, vFileName)) } } return nil @@ -814,10 +834,19 @@ func doPublishable(cliCtx *cli.Context) error { return err } // check if salt-state.txt and salt-block.txt exist - if _, err := os.Stat(filepath.Join(dat.Snap, "salt-state.txt")); err != nil { + exists, err := dir.FileExist(filepath.Join(dat.Snap, "salt-state.txt")) + if err != nil { + return err + } + if !exists { return fmt.Errorf("missing file %s", filepath.Join(dat.Snap, "salt-state.txt")) } - if _, err := os.Stat(filepath.Join(dat.Snap, "salt-blocks.txt")); err != nil { + + exists, err = dir.FileExist(filepath.Join(dat.Snap, "salt-blocks.txt")) + if err != nil { + return err + } + if !exists { return fmt.Errorf("missing file %s", filepath.Join(dat.Snap, "salt-blocks.txt")) } log.Info("All snapshots are publishable") @@ -836,7 +865,7 @@ func doClearIndexing(cliCtx *cli.Context) error { } // Delete all files in domainDir with extensions .bt and .bt.torrent - if err := deleteFilesWithExtensions(domainDir, []string{".bt", ".bt.torrent", ".kvei", ".kvei.torrent"}); err != nil { + if err := deleteFilesWithExtensions(domainDir, []string{".bt", ".bt.torrent", ".kvei", ".kvei.torrent", ".kvi", ".kvi.torrent"}); err != nil { return fmt.Errorf("failed to delete files in domainDir: %w", err) } diff --git a/turbo/rpchelper/helper.go b/turbo/rpchelper/helper.go index a544749b5aa..b83bfe2462a 100644 --- a/turbo/rpchelper/helper.go +++ b/turbo/rpchelper/helper.go @@ -20,6 +20,7 @@ import ( "context" "errors" "fmt" + state2 "github.com/erigontech/erigon-lib/state" libcommon "github.com/erigontech/erigon-lib/common" From e525debec3436b352792e69b049a7ef3c78bb71e Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 2 Jan 2025 19:25:22 +0700 Subject: [PATCH 06/28] etl: cursor leak (#13299) --- erigon-lib/etl/collector.go | 1 + 1 file changed, 1 insertion(+) diff --git a/erigon-lib/etl/collector.go b/erigon-lib/etl/collector.go index a0890b0f334..9d509ad718b 100644 --- a/erigon-lib/etl/collector.go +++ b/erigon-lib/etl/collector.go @@ -189,6 +189,7 @@ func (c *Collector) Load(db kv.RwTx, toBucket string, loadFunc LoadFunc, args Tr if err != nil { return err } + defer cursor.Close() var errLast error lastKey, _, errLast = cursor.Last() if errLast != nil { From acc36b38d819f776143ae8b646bf7966da0da1e3 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 2 Jan 2025 19:49:06 +0700 Subject: [PATCH 07/28] add .kvi to downloader whitelist (#13304) --- erigon-lib/downloader/webseed.go | 1 + 1 file changed, 1 insertion(+) diff --git a/erigon-lib/downloader/webseed.go b/erigon-lib/downloader/webseed.go index f7fca735c98..5139caecfe7 100644 --- a/erigon-lib/downloader/webseed.go +++ b/erigon-lib/downloader/webseed.go @@ -589,6 +589,7 @@ func (d *WebSeeds) downloadTorrentFilesFromProviders(ctx context.Context, rootDi strings.HasSuffix(name, ".idx.torrent") || strings.HasSuffix(name, ".kvei.torrent") || strings.HasSuffix(name, ".bt.torrent") || + strings.HasSuffix(name, ".kvi.torrent") || strings.HasSuffix(name, ".vi.torrent") || strings.HasSuffix(name, ".txt.torrent") || strings.HasSuffix(name, ".efi.torrent") From 85489c50f819c8571c34fc482249619eb0fe03e0 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 2 Jan 2025 20:18:40 +0700 Subject: [PATCH 08/28] add more info to header decode error (#13292) --- eth/stagedsync/stage_snapshots.go | 2 +- turbo/snapshotsync/freezeblocks/block_snapshots.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eth/stagedsync/stage_snapshots.go b/eth/stagedsync/stage_snapshots.go index 01090754d39..c5df53527c1 100644 --- a/eth/stagedsync/stage_snapshots.go +++ b/eth/stagedsync/stage_snapshots.go @@ -331,7 +331,7 @@ func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.R diagnostics.Send(diagnostics.CurrentSyncSubStage{SubStage: "Fill DB"}) if err := FillDBFromSnapshots(s.LogPrefix(), ctx, tx, cfg.dirs, cfg.blockReader, agg, logger); err != nil { - return err + return fmt.Errorf("FillDBFromSnapshots: %w", err) } if temporal, ok := tx.(*temporal.Tx); ok { diff --git a/turbo/snapshotsync/freezeblocks/block_snapshots.go b/turbo/snapshotsync/freezeblocks/block_snapshots.go index 64e24b51b89..464d5bf4d99 100644 --- a/turbo/snapshotsync/freezeblocks/block_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/block_snapshots.go @@ -901,12 +901,12 @@ func ForEachHeader(ctx context.Context, s *RoSnapshots, walker func(header *type for _, sn := range view.Headers() { if err := sn.Src().WithReadAhead(func() error { g := sn.Src().MakeGetter() - for g.HasNext() { + for i := 0; g.HasNext(); i++ { word, _ = g.Next(word[:0]) var header types.Header r.Reset(word[1:]) if err := rlp.Decode(r, &header); err != nil { - return err + return fmt.Errorf("%w, file=%s, record=%d", err, sn.Src().FileName(), i) } if err := walker(&header); err != nil { return err From 7316b099fc796a497883bac7e69e7384ae710870 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 2 Jan 2025 20:46:07 +0700 Subject: [PATCH 09/28] linter: close cursor (#13298) --- cl/persistence/beacon_indicies/indicies.go | 5 ++ cmd/evm/internal/t8ntool/transition.go | 1 + cmd/integration/commands/refetence_db.go | 4 ++ cmd/verkle/main.go | 3 + erigon-lib/kv/backup/backup.go | 2 + erigon-lib/kv/mdbx/kv_mdbx.go | 58 +++++++++---------- .../kv/membatchwithdb/memory_mutation.go | 7 ++- erigon-lib/kv/remotedb/kv_remote.go | 7 ++- .../kv/remotedbserver/remotedbserver.go | 6 +- erigon-lib/rules.go | 31 +++++++++- erigon-lib/state/domain_stream.go | 4 +- erigon-lib/state/history.go | 4 +- erigon-lib/state/inverted_index_stream.go | 4 +- eth/stagedsync/stage_txlookup.go | 8 +-- eth/stagedsync/witness_util.go | 1 + p2p/enode/nodedb.go | 4 ++ polygon/bridge/mdbx_store.go | 1 + rules.go | 31 +++++++++- turbo/stages/headerdownload/header_algos.go | 1 + 19 files changed, 131 insertions(+), 51 deletions(-) diff --git a/cl/persistence/beacon_indicies/indicies.go b/cl/persistence/beacon_indicies/indicies.go index c83fa08b211..ebdd51efdd2 100644 --- a/cl/persistence/beacon_indicies/indicies.go +++ b/cl/persistence/beacon_indicies/indicies.go @@ -252,6 +252,7 @@ func PruneSignedHeaders(tx kv.RwTx, from uint64) error { if err != nil { return err } + defer cursor.Close() for k, _, err := cursor.Seek(base_encoding.Encode64ToBytes4(from)); err == nil && k != nil; k, _, err = cursor.Prev() { if err != nil { //nolint:govet return err @@ -268,6 +269,7 @@ func RangeBlockRoots(ctx context.Context, tx kv.Tx, fromSlot, toSlot uint64, fn if err != nil { return err } + defer cursor.Close() for k, v, err := cursor.Seek(base_encoding.Encode64ToBytes4(fromSlot)); err == nil && k != nil && base_encoding.Decode64FromBytes4(k) <= toSlot; k, v, err = cursor.Next() { if !fn(base_encoding.Decode64FromBytes4(k), libcommon.BytesToHash(v)) { break @@ -281,6 +283,7 @@ func PruneBlockRoots(ctx context.Context, tx kv.RwTx, fromSlot, toSlot uint64) e if err != nil { return err } + defer cursor.Close() for k, _, err := cursor.Seek(base_encoding.Encode64ToBytes4(fromSlot)); err == nil && k != nil && base_encoding.Decode64FromBytes4(k) <= toSlot; k, _, err = cursor.Next() { if err := cursor.DeleteCurrent(); err != nil { return err @@ -296,6 +299,7 @@ func ReadBeaconBlockRootsInSlotRange(ctx context.Context, tx kv.Tx, fromSlot, co if err != nil { return nil, nil, err } + defer cursor.Close() currentCount := uint64(0) for k, v, err := cursor.Seek(base_encoding.Encode64ToBytes4(fromSlot)); err == nil && k != nil && currentCount != count; k, v, err = cursor.Next() { currentCount++ @@ -373,6 +377,7 @@ func PruneBlocks(ctx context.Context, tx kv.RwTx, to uint64) error { if err != nil { return err } + defer cursor.Close() for k, _, err := cursor.First(); err == nil && k != nil; k, _, err = cursor.Prev() { if len(k) != 40 { continue diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 0ac1968dc66..7821505ab1d 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -627,6 +627,7 @@ func CalculateStateRoot(tx kv.RwTx) (*libcommon.Hash, error) { if err != nil { return nil, err } + defer c.Close() h := libcommon.NewHasher() defer libcommon.ReturnHasherToPool(h) domains, err := libstate.NewSharedDomains(tx, log.New()) diff --git a/cmd/integration/commands/refetence_db.go b/cmd/integration/commands/refetence_db.go index 9897adb70f6..1e2af3f41b3 100644 --- a/cmd/integration/commands/refetence_db.go +++ b/cmd/integration/commands/refetence_db.go @@ -263,6 +263,7 @@ func compareBuckets(ctx context.Context, tx kv.Tx, b string, refTx kv.Tx, refB s if err != nil { return err } + defer c.Close() k, v, e := c.First() if e != nil { return e @@ -271,6 +272,7 @@ func compareBuckets(ctx context.Context, tx kv.Tx, b string, refTx kv.Tx, refB s if err != nil { return err } + defer refC.Close() refK, refV, revErr := refC.First() if revErr != nil { return revErr @@ -386,6 +388,7 @@ MainLoop: if err != nil { return err } + defer c.Close() for { if !fileScanner.Scan() { @@ -419,6 +422,7 @@ MainLoop: logger.Info("Progress", "bucket", bucket, "key", hex.EncodeToString(k)) } } + c.Close() err = fileScanner.Err() if err != nil { panic(err) diff --git a/cmd/verkle/main.go b/cmd/verkle/main.go index e28d23e34c6..bc90eb2ba0d 100644 --- a/cmd/verkle/main.go +++ b/cmd/verkle/main.go @@ -259,6 +259,7 @@ func dump(ctx context.Context, cfg optionsCfg) error { if err != nil { return err } + defer verkleCursor.Close() for k, v, err := verkleCursor.First(); k != nil; k, v, err = verkleCursor.Next() { if err != nil { return err @@ -324,6 +325,7 @@ func dump_acc_preimages(ctx context.Context, cfg optionsCfg) error { if err != nil { return err } + defer stateCursor.Close() num, err := stages.GetStageProgress(tx, stages.Execution) if err != nil { return err @@ -380,6 +382,7 @@ func dump_storage_preimages(ctx context.Context, cfg optionsCfg, logger log.Logg if err != nil { return err } + defer stateCursor.Close() num, err := stages.GetStageProgress(tx, stages.Execution) if err != nil { return err diff --git a/erigon-lib/kv/backup/backup.go b/erigon-lib/kv/backup/backup.go index f533c7f90ed..52894e96b77 100644 --- a/erigon-lib/kv/backup/backup.go +++ b/erigon-lib/kv/backup/backup.go @@ -111,6 +111,7 @@ func backupTable(ctx context.Context, src kv.RoDB, srcTx kv.Tx, dst kv.RwDB, tab if err != nil { return err } + defer srcC.Close() total, _ = srcTx.Count(table) if err := dst.Update(ctx, func(tx kv.RwTx) error { @@ -128,6 +129,7 @@ func backupTable(ctx context.Context, src kv.RoDB, srcTx kv.Tx, dst kv.RwDB, tab if err != nil { return err } + defer c.Close() casted, isDupsort := c.(kv.RwCursorDupSort) i := uint64(0) diff --git a/erigon-lib/kv/mdbx/kv_mdbx.go b/erigon-lib/kv/mdbx/kv_mdbx.go index 123bcd1dd19..ac07a325f0e 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx.go +++ b/erigon-lib/kv/mdbx/kv_mdbx.go @@ -585,7 +585,7 @@ func (db *MdbxKV) BeginRo(ctx context.Context) (txn kv.Tx, err error) { db: db, tx: tx, readOnly: true, - id: db.leakDetector.Add(), + traceID: db.leakDetector.Add(), }, nil } @@ -616,31 +616,32 @@ func (db *MdbxKV) beginRw(ctx context.Context, flags uint) (txn kv.RwTx, err err } return &MdbxTx{ - db: db, - tx: tx, - ctx: ctx, - id: db.leakDetector.Add(), + db: db, + tx: tx, + ctx: ctx, + traceID: db.leakDetector.Add(), }, nil } type MdbxTx struct { tx *mdbx.Txn - id uint64 // set only if TRACE_TX=true + traceID uint64 // set only if TRACE_TX=true db *MdbxKV statelessCursors map[string]kv.RwCursor readOnly bool ctx context.Context toCloseMap map[uint64]kv.Closer - ID uint64 + cursorID uint64 } type MdbxCursor struct { - tx *MdbxTx + toCloseMap map[uint64]kv.Closer c *mdbx.Cursor bucketName string - bucketCfg kv.TableCfgItem + isDupSort bool id uint64 + label kv.Label // marker to distinct db instances - one process may open many databases. for example to collect metrics of only 1 database } func (db *MdbxKV) Env() *mdbx.Env { return db.env } @@ -872,7 +873,7 @@ func (tx *MdbxTx) Commit() error { } else { runtime.UnlockOSThread() } - tx.db.leakDetector.Del(tx.id) + tx.db.leakDetector.Del(tx.traceID) }() tx.closeCursors() @@ -923,7 +924,7 @@ func (tx *MdbxTx) Rollback() { } else { runtime.UnlockOSThread() } - tx.db.leakDetector.Del(tx.id) + tx.db.leakDetector.Del(tx.traceID) }() tx.closeCursors() //tx.printDebugInfo() @@ -956,7 +957,7 @@ func (tx *MdbxTx) statelessCursor(bucket string) (kv.RwCursor, error) { c, ok := tx.statelessCursors[bucket] if !ok { var err error - c, err = tx.RwCursor(bucket) + c, err = tx.RwCursor(bucket) //nolint:gocritic if err != nil { return nil, err } @@ -1105,9 +1106,8 @@ func (tx *MdbxTx) Cursor(bucket string) (kv.Cursor, error) { } func (tx *MdbxTx) stdCursor(bucket string) (kv.RwCursor, error) { - b := tx.db.buckets[bucket] - c := &MdbxCursor{bucketName: bucket, tx: tx, bucketCfg: b, id: tx.ID} - tx.ID++ + c := &MdbxCursor{bucketName: bucket, toCloseMap: tx.toCloseMap, label: tx.db.opts.label, isDupSort: tx.db.buckets[bucket].Flags&mdbx.DupSort != 0, id: tx.cursorID} + tx.cursorID++ if tx.tx == nil { panic("assert: tx.tx nil. seems this `tx` was Rollback'ed") @@ -1220,7 +1220,7 @@ func (c *MdbxCursor) Delete(k []byte) error { return err } - if c.bucketCfg.Flags&mdbx.DupSort != 0 { + if c.isDupSort { return c.c.Del(mdbx.AllDups) } @@ -1237,7 +1237,7 @@ func (c *MdbxCursor) PutNoOverwrite(k, v []byte) error { return c.c.Put(k, v, md func (c *MdbxCursor) Put(key []byte, value []byte) error { if err := c.c.Put(key, value, 0); err != nil { - return fmt.Errorf("label: %s, table: %s, err: %w", c.tx.db.opts.label, c.bucketName, err) + return fmt.Errorf("label: %s, table: %s, err: %w", c.label, c.bucketName, err) } return nil } @@ -1258,7 +1258,7 @@ func (c *MdbxCursor) SeekExact(key []byte) ([]byte, []byte, error) { // Return error - if provided data will not sorted (or bucket have old records which mess with new in sorting manner). func (c *MdbxCursor) Append(k []byte, v []byte) error { if err := c.c.Put(k, v, mdbx.Append); err != nil { - return fmt.Errorf("label: %s, bucket: %s, %w", c.tx.db.opts.label, c.bucketName, err) + return fmt.Errorf("label: %s, bucket: %s, %w", c.label, c.bucketName, err) } return nil } @@ -1266,7 +1266,7 @@ func (c *MdbxCursor) Append(k []byte, v []byte) error { func (c *MdbxCursor) Close() { if c.c != nil { c.c.Close() - delete(c.tx.toCloseMap, c.id) + delete(c.toCloseMap, c.id) c.c = nil } } @@ -1381,21 +1381,21 @@ func (c *MdbxDupSortCursor) LastDup() ([]byte, error) { func (c *MdbxDupSortCursor) Append(k []byte, v []byte) error { if err := c.c.Put(k, v, mdbx.Append|mdbx.AppendDup); err != nil { - return fmt.Errorf("label: %s, in Append: bucket=%s, %w", c.tx.db.opts.label, c.bucketName, err) + return fmt.Errorf("label: %s, in Append: bucket=%s, %w", c.label, c.bucketName, err) } return nil } func (c *MdbxDupSortCursor) AppendDup(k []byte, v []byte) error { if err := c.c.Put(k, v, mdbx.AppendDup); err != nil { - return fmt.Errorf("label: %s, in AppendDup: bucket=%s, %w", c.tx.db.opts.label, c.bucketName, err) + return fmt.Errorf("label: %s, in AppendDup: bucket=%s, %w", c.label, c.bucketName, err) } return nil } func (c *MdbxDupSortCursor) PutNoDupData(k, v []byte) error { if err := c.c.Put(k, v, mdbx.NoDupData); err != nil { - return fmt.Errorf("label: %s, in PutNoDupData: %w", c.tx.db.opts.label, err) + return fmt.Errorf("label: %s, in PutNoDupData: %w", c.label, err) } return nil @@ -1404,7 +1404,7 @@ func (c *MdbxDupSortCursor) PutNoDupData(k, v []byte) error { // DeleteCurrentDuplicates - delete all of the data items for the current key. func (c *MdbxDupSortCursor) DeleteCurrentDuplicates() error { if err := c.c.Del(mdbx.AllDups); err != nil { - return fmt.Errorf("label: %s,in DeleteCurrentDuplicates: %w", c.tx.db.opts.label, err) + return fmt.Errorf("label: %s,in DeleteCurrentDuplicates: %w", c.label, err) } return nil } @@ -1456,8 +1456,8 @@ func (tx *MdbxTx) Prefix(table string, prefix []byte) (stream.KV, error) { } func (tx *MdbxTx) Range(table string, fromPrefix, toPrefix []byte, asc order.By, limit int) (stream.KV, error) { - s := &cursor2iter{ctx: tx.ctx, tx: tx, fromPrefix: fromPrefix, toPrefix: toPrefix, orderAscend: asc, limit: int64(limit), id: tx.ID} - tx.ID++ + s := &cursor2iter{ctx: tx.ctx, tx: tx, fromPrefix: fromPrefix, toPrefix: toPrefix, orderAscend: asc, limit: int64(limit), id: tx.cursorID} + tx.cursorID++ if tx.toCloseMap == nil { tx.toCloseMap = make(map[uint64]kv.Closer) } @@ -1487,7 +1487,7 @@ func (s *cursor2iter) init(table string, tx kv.Tx) error { if !s.orderAscend && s.fromPrefix != nil && s.toPrefix != nil && bytes.Compare(s.fromPrefix, s.toPrefix) <= 0 { return fmt.Errorf("tx.Dual: %x must be lexicographicaly before %x", s.toPrefix, s.fromPrefix) } - c, err := tx.Cursor(table) + c, err := tx.Cursor(table) //nolint:gocritic if err != nil { return err } @@ -1619,8 +1619,8 @@ func (s *cursor2iter) Next() (k, v []byte, err error) { } func (tx *MdbxTx) RangeDupSort(table string, key []byte, fromPrefix, toPrefix []byte, asc order.By, limit int) (stream.KV, error) { - s := &cursorDup2iter{ctx: tx.ctx, tx: tx, key: key, fromPrefix: fromPrefix, toPrefix: toPrefix, orderAscend: bool(asc), limit: int64(limit), id: tx.ID} - tx.ID++ + s := &cursorDup2iter{ctx: tx.ctx, tx: tx, key: key, fromPrefix: fromPrefix, toPrefix: toPrefix, orderAscend: bool(asc), limit: int64(limit), id: tx.cursorID} + tx.cursorID++ if tx.toCloseMap == nil { tx.toCloseMap = make(map[uint64]kv.Closer) } @@ -1651,7 +1651,7 @@ func (s *cursorDup2iter) init(table string, tx kv.Tx) error { if !s.orderAscend && s.fromPrefix != nil && s.toPrefix != nil && bytes.Compare(s.fromPrefix, s.toPrefix) <= 0 { return fmt.Errorf("tx.Dual: %x must be lexicographicaly before %x", s.toPrefix, s.fromPrefix) } - c, err := tx.CursorDupSort(table) + c, err := tx.CursorDupSort(table) //nolint:gocritic if err != nil { return err } diff --git a/erigon-lib/kv/membatchwithdb/memory_mutation.go b/erigon-lib/kv/membatchwithdb/memory_mutation.go index 60cfbb68dda..fcebd96ab78 100644 --- a/erigon-lib/kv/membatchwithdb/memory_mutation.go +++ b/erigon-lib/kv/membatchwithdb/memory_mutation.go @@ -121,6 +121,7 @@ func initSequences(db kv.Tx, memTx kv.RwTx) error { if err != nil { return err } + defer cursor.Close() for k, v, err := cursor.First(); k != nil; k, v, err = cursor.Next() { if err != nil { return err @@ -169,7 +170,7 @@ func (m *MemoryMutation) statelessCursor(table string) (kv.RwCursor, error) { c, ok := m.statelessCursors[table] if !ok { var err error - c, err = m.RwCursor(table) + c, err = m.RwCursor(table) // nolint:gocritic if err != nil { return nil, err } @@ -664,11 +665,11 @@ func (m *MemoryMutation) makeCursor(bucket string) (kv.RwCursorDupSort, error) { c.table = bucket var err error - c.cursor, err = m.db.CursorDupSort(bucket) + c.cursor, err = m.db.CursorDupSort(bucket) //nolint:gocritic if err != nil { return nil, err } - c.memCursor, err = m.memTx.RwCursorDupSort(bucket) + c.memCursor, err = m.memTx.RwCursorDupSort(bucket) //nolint:gocritic if err != nil { return nil, err } diff --git a/erigon-lib/kv/remotedb/kv_remote.go b/erigon-lib/kv/remotedb/kv_remote.go index 43a3d34cccf..529659a0e05 100644 --- a/erigon-lib/kv/remotedb/kv_remote.go +++ b/erigon-lib/kv/remotedb/kv_remote.go @@ -262,7 +262,7 @@ func (tx *tx) statelessCursor(bucket string) (kv.Cursor, error) { c, ok := tx.statelessCursors[bucket] if !ok { var err error - c, err = tx.Cursor(bucket) + c, err = tx.Cursor(bucket) // nolint:gocritic if err != nil { return nil, err } @@ -282,6 +282,7 @@ func (tx *tx) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) if err != nil { return err } + defer it.Close() for it.HasNext() { k, v, err := it.Next() if err != nil { @@ -689,9 +690,9 @@ func (tx *tx) IndexRange(name kv.InvertedIdx, k []byte, fromTs, toTs int, asc or func (tx *tx) Prefix(table string, prefix []byte) (stream.KV, error) { nextPrefix, ok := kv.NextSubtree(prefix) if !ok { - return tx.Range(table, prefix, nil, order.Asc, kv.Unlim) + return tx.Range(table, prefix, nil, order.Asc, kv.Unlim) //nolint:gocritic } - return tx.Range(table, prefix, nextPrefix, order.Asc, kv.Unlim) + return tx.Range(table, prefix, nextPrefix, order.Asc, kv.Unlim) //nolint:gocritic } func (tx *tx) rangeOrderLimit(table string, fromPrefix, toPrefix []byte, asc order.By, limit int) (stream.KV, error) { diff --git a/erigon-lib/kv/remotedbserver/remotedbserver.go b/erigon-lib/kv/remotedbserver/remotedbserver.go index 54ad31537ea..b7e46c598f0 100644 --- a/erigon-lib/kv/remotedbserver/remotedbserver.go +++ b/erigon-lib/kv/remotedbserver/remotedbserver.go @@ -270,7 +270,7 @@ func (s *KvServer) Tx(stream remote.KV_TxServer) error { if err := s.with(id, func(tx kv.Tx) error { for _, c := range cursors { // restore all cursors position var err error - c.c, err = tx.Cursor(c.bucket) + c.c, err = tx.Cursor(c.bucket) //nolint:gocritic if err != nil { return err } @@ -311,7 +311,7 @@ func (s *KvServer) Tx(stream remote.KV_TxServer) error { CursorID++ var err error if err := s.with(id, func(tx kv.Tx) error { - c, err = tx.Cursor(in.BucketName) + c, err = tx.Cursor(in.BucketName) //nolint:gocritic if err != nil { return err } @@ -331,7 +331,7 @@ func (s *KvServer) Tx(stream remote.KV_TxServer) error { CursorID++ var err error if err := s.with(id, func(tx kv.Tx) error { - c, err = tx.CursorDupSort(in.BucketName) + c, err = tx.CursorDupSort(in.BucketName) //nolint:gocritic if err != nil { return err } diff --git a/erigon-lib/rules.go b/erigon-lib/rules.go index 5d7c14fbbdb..55ac6ecbbc0 100644 --- a/erigon-lib/rules.go +++ b/erigon-lib/rules.go @@ -19,7 +19,6 @@ package gorules -// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module // to apply changes in this file, please do: ./build/bin/golangci-lint cache clean import ( "github.com/quasilyte/go-ruleguard/dsl" @@ -68,6 +67,36 @@ func txDeferRollback(m dsl.Matcher) { `) } +func cursorDeferClose(m dsl.Matcher) { + m.Match( + `$c, $err = $db.Cursor($table); $chk; $close`, + `$c, $err := $db.Cursor($table); $chk; $close`, + `$c, $err = $db.RwCursor($table); $chk; $close`, + `$c, $err := $db.RwCursor($table); $chk; $close`, + `$c, $err = $db.CursorDupSort($table); $chk; $close`, + `$c, $err := $db.CursorDupSort($table); $chk; $close`, + `$c, $err = $db.RwCursorDupSort($table); $chk; $close`, + `$c, $err := $db.RwCursorDupSort($table); $chk; $close`, + ). + Where(!m["close"].Text.Matches(`defer .*\.Close()`)). + //At(m["rollback"]). + Report(`Add "defer $c.Close()" right after cursor creation error check`) +} + +func streamDeferClose(m dsl.Matcher) { + m.Match( + `$c, $err = $db.Range($params); $chk; $close`, + `$c, $err := $db.Range($params); $chk; $close`, + `$c, $err = $db.RangeDupSort($params); $chk; $close`, + `$c, $err := $db.RangeDupSort($params); $chk; $close`, + `$c, $err = $db.Prefix($params); $chk; $close`, + `$c, $err := $db.Prefix($params); $chk; $close`, + ). + Where(!m["close"].Text.Matches(`defer .*\.Close()`)). + //At(m["rollback"]). + Report(`Add "defer $c.Close()" right after cursor creation error check`) +} + func closeCollector(m dsl.Matcher) { m.Match(`$c := etl.NewCollector($*_); $close`). Where(!m["close"].Text.Matches(`defer .*\.Close()`)). diff --git a/erigon-lib/state/domain_stream.go b/erigon-lib/state/domain_stream.go index 67d7605f849..1156be7b3fa 100644 --- a/erigon-lib/state/domain_stream.go +++ b/erigon-lib/state/domain_stream.go @@ -130,7 +130,7 @@ func (hi *DomainLatestIterFile) init(dc *DomainRoTx) error { var key, value []byte if dc.d.largeValues { - valsCursor, err := hi.roTx.Cursor(dc.d.valuesTable) + valsCursor, err := hi.roTx.Cursor(dc.d.valuesTable) //nolint:gocritic if err != nil { return err } @@ -146,7 +146,7 @@ func (hi *DomainLatestIterFile) init(dc *DomainRoTx) error { heap.Push(hi.h, &CursorItem{t: DB_CURSOR, key: common.Copy(k), val: common.Copy(value), cNonDup: valsCursor, endTxNum: endTxNum, reverse: true}) } } else { - valsCursor, err := hi.roTx.CursorDupSort(dc.d.valuesTable) + valsCursor, err := hi.roTx.CursorDupSort(dc.d.valuesTable) //nolint:gocritic if err != nil { return err } diff --git a/erigon-lib/state/history.go b/erigon-lib/state/history.go index db2258b6046..c6832962ce5 100644 --- a/erigon-lib/state/history.go +++ b/erigon-lib/state/history.go @@ -1221,7 +1221,7 @@ func (ht *HistoryRoTx) valsCursor(tx kv.Tx) (c kv.Cursor, err error) { if ht.valsC != nil { return ht.valsC, nil } - ht.valsC, err = tx.Cursor(ht.h.valuesTable) + ht.valsC, err = tx.Cursor(ht.h.valuesTable) //nolint:gocritic if err != nil { return nil, err } @@ -1231,7 +1231,7 @@ func (ht *HistoryRoTx) valsCursorDup(tx kv.Tx) (c kv.CursorDupSort, err error) { if ht.valsCDup != nil { return ht.valsCDup, nil } - ht.valsCDup, err = tx.CursorDupSort(ht.h.valuesTable) + ht.valsCDup, err = tx.CursorDupSort(ht.h.valuesTable) //nolint:gocritic if err != nil { return nil, err } diff --git a/erigon-lib/state/inverted_index_stream.go b/erigon-lib/state/inverted_index_stream.go index bf5aba0155e..6df0a465153 100644 --- a/erigon-lib/state/inverted_index_stream.go +++ b/erigon-lib/state/inverted_index_stream.go @@ -192,7 +192,7 @@ func (it *RecentInvertedIdxIter) advanceInDB() { var v []byte var err error if it.cursor == nil { - if it.cursor, err = it.roTx.CursorDupSort(it.indexTable); err != nil { + if it.cursor, err = it.roTx.CursorDupSort(it.indexTable); err != nil { //nolint:gocritic // TODO pass error properly around panic(err) } @@ -356,7 +356,7 @@ func (it *InvertedIterator1) advanceInDb() { var k, v []byte var err error if it.cursor == nil { - if it.cursor, err = it.roTx.CursorDupSort(it.indexTable); err != nil { + if it.cursor, err = it.roTx.CursorDupSort(it.indexTable); err != nil { //nolint:gocritic // TODO pass error properly around panic(err) } diff --git a/eth/stagedsync/stage_txlookup.go b/eth/stagedsync/stage_txlookup.go index 8083945b318..a198ffff997 100644 --- a/eth/stagedsync/stage_txlookup.go +++ b/eth/stagedsync/stage_txlookup.go @@ -23,17 +23,15 @@ import ( "math/big" "time" - "github.com/erigontech/erigon-lib/kv/rawdbv3" - - "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/eth/stagedsync/stages" - "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/etl" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/kv/rawdbv3" + "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/rawdb" + "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/polygon/bor/borcfg" bortypes "github.com/erigontech/erigon/polygon/bor/types" diff --git a/eth/stagedsync/witness_util.go b/eth/stagedsync/witness_util.go index cebda023e47..ebfeff0a715 100644 --- a/eth/stagedsync/witness_util.go +++ b/eth/stagedsync/witness_util.go @@ -119,6 +119,7 @@ func FindOldestWitness(tx kv.Tx, tableName string) (uint64, error) { if err != nil { return 0, err } + defer cursor.Close() k, _, err := cursor.First() if err != nil { diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 5466ebf8e2c..857d2f0b48a 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -141,6 +141,7 @@ func newPersistentDB(ctx context.Context, logger log.Logger, path string) (*DB, if err != nil { return err } + defer c.Close() _, v, errGet := c.SeekExact([]byte(dbVersionKey)) if errGet != nil { return errGet @@ -381,6 +382,7 @@ func deleteRangeInBucket(tx kv.RwTx, prefix []byte, bucket string) error { if err != nil { return err } + defer c.Close() var k []byte for k, _, err = c.Seek(prefix); (err == nil) && (k != nil) && bytes.HasPrefix(k, prefix); k, _, err = c.Next() { if err = c.DeleteCurrent(); err != nil { @@ -431,6 +433,7 @@ func (db *DB) expireNodes() { if err != nil { return err } + defer c.Close() p := []byte(dbNodePrefix) var prevId ID var empty = true @@ -564,6 +567,7 @@ func (db *DB) QuerySeeds(n int, maxAge time.Duration) []*Node { if err != nil { return err } + defer c.Close() seek: for seeks := 0; len(nodes) < n && seeks < n*5; seeks++ { // seekInFiles to a random entry. The first byte is incremented by a diff --git a/polygon/bridge/mdbx_store.go b/polygon/bridge/mdbx_store.go index 17742bc6f39..660ca54b206 100644 --- a/polygon/bridge/mdbx_store.go +++ b/polygon/bridge/mdbx_store.go @@ -571,6 +571,7 @@ func (s txStore) blockEventIdsRange(ctx context.Context, blockNum uint64, lastFr if err != nil { return start, end, false, err } + defer cursor.Close() _, v, err := cursor.SeekExact(kByte) if err != nil { diff --git a/rules.go b/rules.go index 9a7e62eed6d..6f378fa5579 100644 --- a/rules.go +++ b/rules.go @@ -18,7 +18,6 @@ package gorules -// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module // to apply changes in this file, please do: ./build/bin/golangci-lint cache clean import ( "github.com/quasilyte/go-ruleguard/dsl" @@ -67,6 +66,36 @@ func txDeferRollback(m dsl.Matcher) { `) } +func cursorDeferClose(m dsl.Matcher) { + m.Match( + `$c, $err = $db.Cursor($table); $chk; $close`, + `$c, $err := $db.Cursor($table); $chk; $close`, + `$c, $err = $db.RwCursor($table); $chk; $close`, + `$c, $err := $db.RwCursor($table); $chk; $close`, + `$c, $err = $db.CursorDupSort($table); $chk; $close`, + `$c, $err := $db.CursorDupSort($table); $chk; $close`, + `$c, $err = $db.RwCursorDupSort($table); $chk; $close`, + `$c, $err := $db.RwCursorDupSort($table); $chk; $close`, + ). + Where(!m["close"].Text.Matches(`defer .*\.Close()`)). + //At(m["rollback"]). + Report(`Add "defer $c.Close()" right after cursor creation error check`) +} + +func streamDeferClose(m dsl.Matcher) { + m.Match( + `$c, $err = $db.Range($params); $chk; $close`, + `$c, $err := $db.Range($params); $chk; $close`, + `$c, $err = $db.RangeDupSort($params); $chk; $close`, + `$c, $err := $db.RangeDupSort($params); $chk; $close`, + `$c, $err = $db.Prefix($params); $chk; $close`, + `$c, $err := $db.Prefix($params); $chk; $close`, + ). + Where(!m["close"].Text.Matches(`defer .*\.Close()`)). + //At(m["rollback"]). + Report(`Add "defer $c.Close()" right after cursor creation error check`) +} + func closeCollector(m dsl.Matcher) { m.Match(`$c := etl.NewCollector($*_); $close`). Where(!m["close"].Text.Matches(`defer .*\.Close()`)). diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 7bc99c39788..54d46861a68 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -333,6 +333,7 @@ func (hd *HeaderDownload) RecoverFromDb(db kv.RoDB) error { if err != nil { return err } + defer c.Close() hd.highestInDb, err = stages.GetStageProgress(tx, stages.Headers) if err != nil { return err From ef62be7a5d6714c5acb76cb537cea3e7c7d5ab27 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:40:36 +0000 Subject: [PATCH 10/28] erigon-lib: move event notifier and observers to erigon-lib (#13307) moving `EventNotifier` and `Observers` structs from `polygon/polygoncommon` pkg to `erigon-lib/event` pkg since those will be used in other packages outside of polygon (e.g. using in `shutter` pkg as part of https://github.com/erigontech/erigon/pull/13306) --- .../event/notifier.go | 18 ++++----- .../event}/observers.go | 2 +- polygon/heimdall/scraper.go | 15 ++++--- polygon/heimdall/service.go | 8 ++-- polygon/p2p/message_listener.go | 39 +++++++++---------- polygon/p2p/peer_event_registrar.go | 8 ++-- polygon/p2p/peer_event_registrar_mock.go | 21 +++++----- polygon/p2p/peer_tracker.go | 10 ++--- polygon/p2p/peer_tracker_test.go | 8 ++-- polygon/p2p/publisher_test.go | 8 ++-- polygon/p2p/service.go | 6 +-- polygon/sync/tip_events.go | 11 +++--- 12 files changed, 75 insertions(+), 79 deletions(-) rename polygon/polygoncommon/event_notifier.go => erigon-lib/event/notifier.go (83%) rename {polygon/polygoncommon => erigon-lib/event}/observers.go (99%) diff --git a/polygon/polygoncommon/event_notifier.go b/erigon-lib/event/notifier.go similarity index 83% rename from polygon/polygoncommon/event_notifier.go rename to erigon-lib/event/notifier.go index 1965e362a01..63a4e576536 100644 --- a/polygon/polygoncommon/event_notifier.go +++ b/erigon-lib/event/notifier.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with Erigon. If not, see . -package polygoncommon +package event import ( "context" @@ -22,36 +22,36 @@ import ( "sync/atomic" ) -// EventNotifier notifies waiters about an event. +// Notifier notifies waiters about an event. // It supports a single "producer" and multiple waiters. // A producer can set the event state to "signaled" or "non-signaled". // Waiters can wait for the "signaled" event state. -type EventNotifier struct { +type Notifier struct { mutex sync.Mutex cond *sync.Cond hasEvent atomic.Bool } -func NewEventNotifier() *EventNotifier { - instance := &EventNotifier{} +func NewNotifier() *Notifier { + instance := &Notifier{} instance.cond = sync.NewCond(&instance.mutex) return instance } // Reset to the "non-signaled" state. -func (en *EventNotifier) Reset() { +func (en *Notifier) Reset() { en.hasEvent.Store(false) } // SetAndBroadcast sets the "signaled" state and notifies all waiters. -func (en *EventNotifier) SetAndBroadcast() { +func (en *Notifier) SetAndBroadcast() { en.hasEvent.Store(true) en.cond.Broadcast() } // Wait for the "signaled" state. // If the event is already "signaled" it returns immediately. -func (en *EventNotifier) Wait(ctx context.Context) error { +func (en *Notifier) Wait(ctx context.Context) error { waitCtx, waitCancel := context.WithCancel(ctx) defer waitCancel() @@ -74,7 +74,7 @@ func (en *EventNotifier) Wait(ctx context.Context) error { <-waitCtx.Done() // if the parent context is done, force the waiting goroutine to exit - // this might lead to spurious wake ups for other waiters, + // this might lead to spurious wake-ups for other waiters, // but it is ok due to the waiting loop conditions en.cond.Broadcast() diff --git a/polygon/polygoncommon/observers.go b/erigon-lib/event/observers.go similarity index 99% rename from polygon/polygoncommon/observers.go rename to erigon-lib/event/observers.go index d05c5fd3d7f..46e7785e7ab 100644 --- a/polygon/polygoncommon/observers.go +++ b/erigon-lib/event/observers.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with Erigon. If not, see . -package polygoncommon +package event import ( "sync" diff --git a/polygon/heimdall/scraper.go b/polygon/heimdall/scraper.go index 060b42e9cdf..3cfb97450dc 100644 --- a/polygon/heimdall/scraper.go +++ b/polygon/heimdall/scraper.go @@ -22,12 +22,11 @@ import ( "fmt" "time" + libcommon "github.com/erigontech/erigon-lib/common" commonerrors "github.com/erigontech/erigon-lib/common/errors" "github.com/erigontech/erigon-lib/common/generics" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/log/v3" - - libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/polygon/polygoncommon" ) type Scraper[TEntity Entity] struct { @@ -35,8 +34,8 @@ type Scraper[TEntity Entity] struct { store EntityStore[TEntity] fetcher entityFetcher[TEntity] pollDelay time.Duration - observers *polygoncommon.Observers[[]TEntity] - syncEvent *polygoncommon.EventNotifier + observers *event.Observers[[]TEntity] + syncEvent *event.Notifier transientErrors []error logger log.Logger } @@ -54,8 +53,8 @@ func NewScraper[TEntity Entity]( store: store, fetcher: fetcher, pollDelay: pollDelay, - observers: polygoncommon.NewObservers[[]TEntity](), - syncEvent: polygoncommon.NewEventNotifier(), + observers: event.NewObservers[[]TEntity](), + syncEvent: event.NewNotifier(), transientErrors: transientErrors, logger: logger, } @@ -146,7 +145,7 @@ func (s *Scraper[TEntity]) Run(ctx context.Context) error { return ctx.Err() } -func (s *Scraper[TEntity]) RegisterObserver(observer func([]TEntity)) polygoncommon.UnregisterFunc { +func (s *Scraper[TEntity]) RegisterObserver(observer func([]TEntity)) event.UnregisterFunc { return s.observers.Register(observer) } diff --git a/polygon/heimdall/service.go b/polygon/heimdall/service.go index 5012619b6b1..dd60dc69bbf 100644 --- a/polygon/heimdall/service.go +++ b/polygon/heimdall/service.go @@ -26,10 +26,10 @@ import ( "golang.org/x/sync/errgroup" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bor/valset" - "github.com/erigontech/erigon/polygon/polygoncommon" ) type ServiceConfig struct { @@ -222,7 +222,7 @@ func (s *Service) Producers(ctx context.Context, blockNum uint64) (*valset.Valid return s.reader.Producers(ctx, blockNum) } -func (s *Service) RegisterMilestoneObserver(callback func(*Milestone), opts ...ObserverOption) polygoncommon.UnregisterFunc { +func (s *Service) RegisterMilestoneObserver(callback func(*Milestone), opts ...ObserverOption) event.UnregisterFunc { options := NewObserverOptions(opts...) return s.milestoneScraper.RegisterObserver(func(entities []*Milestone) { for _, entity := range libcommon.SliceTakeLast(entities, options.eventsLimit) { @@ -231,7 +231,7 @@ func (s *Service) RegisterMilestoneObserver(callback func(*Milestone), opts ...O }) } -func (s *Service) RegisterCheckpointObserver(callback func(*Checkpoint), opts ...ObserverOption) polygoncommon.UnregisterFunc { +func (s *Service) RegisterCheckpointObserver(callback func(*Checkpoint), opts ...ObserverOption) event.UnregisterFunc { options := NewObserverOptions(opts...) return s.checkpointScraper.RegisterObserver(func(entities []*Checkpoint) { for _, entity := range libcommon.SliceTakeLast(entities, options.eventsLimit) { @@ -240,7 +240,7 @@ func (s *Service) RegisterCheckpointObserver(callback func(*Checkpoint), opts .. }) } -func (s *Service) RegisterSpanObserver(callback func(*Span), opts ...ObserverOption) polygoncommon.UnregisterFunc { +func (s *Service) RegisterSpanObserver(callback func(*Span), opts ...ObserverOption) event.UnregisterFunc { options := NewObserverOptions(opts...) return s.spanScraper.RegisterObserver(func(entities []*Span) { for _, entity := range libcommon.SliceTakeLast(entities, options.eventsLimit) { diff --git a/polygon/p2p/message_listener.go b/polygon/p2p/message_listener.go index 3d32038bccd..18efcd9d123 100644 --- a/polygon/p2p/message_listener.go +++ b/polygon/p2p/message_listener.go @@ -23,13 +23,12 @@ import ( "google.golang.org/grpc" - "github.com/erigontech/erigon-lib/log/v3" - + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" ) type DecodedInboundMessage[TPacket any] struct { @@ -38,7 +37,7 @@ type DecodedInboundMessage[TPacket any] struct { PeerId *PeerId } -type UnregisterFunc = polygoncommon.UnregisterFunc +type UnregisterFunc = event.UnregisterFunc func NewMessageListener( logger log.Logger, @@ -51,11 +50,11 @@ func NewMessageListener( sentryClient: sentryClient, statusDataFactory: statusDataFactory, peerPenalizer: peerPenalizer, - newBlockObservers: polygoncommon.NewObservers[*DecodedInboundMessage[*eth.NewBlockPacket]](), - newBlockHashesObservers: polygoncommon.NewObservers[*DecodedInboundMessage[*eth.NewBlockHashesPacket]](), - blockHeadersObservers: polygoncommon.NewObservers[*DecodedInboundMessage[*eth.BlockHeadersPacket66]](), - blockBodiesObservers: polygoncommon.NewObservers[*DecodedInboundMessage[*eth.BlockBodiesPacket66]](), - peerEventObservers: polygoncommon.NewObservers[*sentryproto.PeerEvent](), + newBlockObservers: event.NewObservers[*DecodedInboundMessage[*eth.NewBlockPacket]](), + newBlockHashesObservers: event.NewObservers[*DecodedInboundMessage[*eth.NewBlockHashesPacket]](), + blockHeadersObservers: event.NewObservers[*DecodedInboundMessage[*eth.BlockHeadersPacket66]](), + blockBodiesObservers: event.NewObservers[*DecodedInboundMessage[*eth.BlockBodiesPacket66]](), + peerEventObservers: event.NewObservers[*sentryproto.PeerEvent](), } } @@ -64,11 +63,11 @@ type MessageListener struct { sentryClient sentryproto.SentryClient statusDataFactory sentry.StatusDataFactory peerPenalizer *PeerPenalizer - newBlockObservers *polygoncommon.Observers[*DecodedInboundMessage[*eth.NewBlockPacket]] - newBlockHashesObservers *polygoncommon.Observers[*DecodedInboundMessage[*eth.NewBlockHashesPacket]] - blockHeadersObservers *polygoncommon.Observers[*DecodedInboundMessage[*eth.BlockHeadersPacket66]] - blockBodiesObservers *polygoncommon.Observers[*DecodedInboundMessage[*eth.BlockBodiesPacket66]] - peerEventObservers *polygoncommon.Observers[*sentryproto.PeerEvent] + newBlockObservers *event.Observers[*DecodedInboundMessage[*eth.NewBlockPacket]] + newBlockHashesObservers *event.Observers[*DecodedInboundMessage[*eth.NewBlockHashesPacket]] + blockHeadersObservers *event.Observers[*DecodedInboundMessage[*eth.BlockHeadersPacket66]] + blockBodiesObservers *event.Observers[*DecodedInboundMessage[*eth.BlockBodiesPacket66]] + peerEventObservers *event.Observers[*sentryproto.PeerEvent] stopWg sync.WaitGroup } @@ -98,23 +97,23 @@ func (ml *MessageListener) Run(ctx context.Context) error { return ctx.Err() } -func (ml *MessageListener) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { +func (ml *MessageListener) RegisterNewBlockObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { return ml.newBlockObservers.Register(observer) } -func (ml *MessageListener) RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { +func (ml *MessageListener) RegisterNewBlockHashesObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { return ml.newBlockHashesObservers.Register(observer) } -func (ml *MessageListener) RegisterBlockHeadersObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc { +func (ml *MessageListener) RegisterBlockHeadersObserver(observer event.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc { return ml.blockHeadersObservers.Register(observer) } -func (ml *MessageListener) RegisterBlockBodiesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc { +func (ml *MessageListener) RegisterBlockBodiesObserver(observer event.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc { return ml.blockBodiesObservers.Register(observer) } -func (ml *MessageListener) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc { +func (ml *MessageListener) RegisterPeerEventObserver(observer event.Observer[*sentryproto.PeerEvent]) UnregisterFunc { return ml.peerEventObservers.Register(observer) } @@ -193,7 +192,7 @@ func notifyInboundMessageObservers[TPacket any]( ctx context.Context, logger log.Logger, peerPenalizer *PeerPenalizer, - observers *polygoncommon.Observers[*DecodedInboundMessage[TPacket]], + observers *event.Observers[*DecodedInboundMessage[TPacket]], message *sentryproto.InboundMessage, ) error { peerId := PeerIdFromH512(message.PeerId) diff --git a/polygon/p2p/peer_event_registrar.go b/polygon/p2p/peer_event_registrar.go index 9a5c80497a1..b9c900f625e 100644 --- a/polygon/p2p/peer_event_registrar.go +++ b/polygon/p2p/peer_event_registrar.go @@ -17,14 +17,14 @@ package p2p import ( + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" ) //go:generate mockgen -typed=true -source=./peer_event_registrar.go -destination=./peer_event_registrar_mock.go -package=p2p type peerEventRegistrar interface { - RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc - RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc - RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc + RegisterPeerEventObserver(observer event.Observer[*sentryproto.PeerEvent]) UnregisterFunc + RegisterNewBlockObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc + RegisterNewBlockHashesObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc } diff --git a/polygon/p2p/peer_event_registrar_mock.go b/polygon/p2p/peer_event_registrar_mock.go index 866ed27cacf..189c9f3a03f 100644 --- a/polygon/p2p/peer_event_registrar_mock.go +++ b/polygon/p2p/peer_event_registrar_mock.go @@ -12,9 +12,9 @@ package p2p import ( reflect "reflect" + event "github.com/erigontech/erigon-lib/event" sentryproto "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" eth "github.com/erigontech/erigon/eth/protocols/eth" - polygoncommon "github.com/erigontech/erigon/polygon/polygoncommon" gomock "go.uber.org/mock/gomock" ) @@ -22,7 +22,6 @@ import ( type MockpeerEventRegistrar struct { ctrl *gomock.Controller recorder *MockpeerEventRegistrarMockRecorder - isgomock struct{} } // MockpeerEventRegistrarMockRecorder is the mock recorder for MockpeerEventRegistrar. @@ -43,7 +42,7 @@ func (m *MockpeerEventRegistrar) EXPECT() *MockpeerEventRegistrarMockRecorder { } // RegisterNewBlockHashesObserver mocks base method. -func (m *MockpeerEventRegistrar) RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { +func (m *MockpeerEventRegistrar) RegisterNewBlockHashesObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterNewBlockHashesObserver", observer) ret0, _ := ret[0].(UnregisterFunc) @@ -69,19 +68,19 @@ func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Return(arg0 U } // Do rewrite *gomock.Call.Do -func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall { +func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Do(f func(event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall { +func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) DoAndReturn(f func(event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall { c.Call = c.Call.DoAndReturn(f) return c } // RegisterNewBlockObserver mocks base method. -func (m *MockpeerEventRegistrar) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { +func (m *MockpeerEventRegistrar) RegisterNewBlockObserver(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterNewBlockObserver", observer) ret0, _ := ret[0].(UnregisterFunc) @@ -107,19 +106,19 @@ func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Return(arg0 Unregis } // Do rewrite *gomock.Call.Do -func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall { +func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Do(f func(event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall { +func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) DoAndReturn(f func(event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall { c.Call = c.Call.DoAndReturn(f) return c } // RegisterPeerEventObserver mocks base method. -func (m *MockpeerEventRegistrar) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc { +func (m *MockpeerEventRegistrar) RegisterPeerEventObserver(observer event.Observer[*sentryproto.PeerEvent]) UnregisterFunc { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterPeerEventObserver", observer) ret0, _ := ret[0].(UnregisterFunc) @@ -145,13 +144,13 @@ func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Return(arg0 Unregi } // Do rewrite *gomock.Call.Do -func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Do(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall { +func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Do(f func(event.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) DoAndReturn(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall { +func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) DoAndReturn(f func(event.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/polygon/p2p/peer_tracker.go b/polygon/p2p/peer_tracker.go index c54f29b6204..acc23088e1e 100644 --- a/polygon/p2p/peer_tracker.go +++ b/polygon/p2p/peer_tracker.go @@ -24,10 +24,10 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" ) func NewPeerTracker( @@ -65,7 +65,7 @@ type PeerTracker struct { func (pt *PeerTracker) Run(ctx context.Context) error { pt.logger.Info(peerTrackerLogPrefix("running peer tracker component")) - var peerEventUnreg polygoncommon.UnregisterFunc + var peerEventUnreg event.UnregisterFunc defer func() { peerEventUnreg() }() err := func() error { @@ -214,7 +214,7 @@ func (pt *PeerTracker) updatePeerSyncProgress(peerId *PeerId, update func(psp *p update(peerSyncProgress) } -func newPeerEventObserver(pt *PeerTracker) polygoncommon.Observer[*sentryproto.PeerEvent] { +func newPeerEventObserver(pt *PeerTracker) event.Observer[*sentryproto.PeerEvent] { return func(message *sentryproto.PeerEvent) { peerId := PeerIdFromH512(message.PeerId) switch message.EventId { @@ -226,7 +226,7 @@ func newPeerEventObserver(pt *PeerTracker) polygoncommon.Observer[*sentryproto.P } } -func newBlockHashAnnouncesObserver(pt *PeerTracker) polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]] { +func newBlockHashAnnouncesObserver(pt *PeerTracker) event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]] { return func(message *DecodedInboundMessage[*eth.NewBlockHashesPacket]) { for _, hashOrNum := range *message.Decoded { pt.BlockHashPresent(message.PeerId, hashOrNum.Hash) @@ -234,7 +234,7 @@ func newBlockHashAnnouncesObserver(pt *PeerTracker) polygoncommon.Observer[*Deco } } -func newBlockAnnouncesObserver(pt *PeerTracker) polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]] { +func newBlockAnnouncesObserver(pt *PeerTracker) event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]] { return func(message *DecodedInboundMessage[*eth.NewBlockPacket]) { pt.BlockHashPresent(message.PeerId, message.Decoded.Block.Hash()) } diff --git a/polygon/p2p/peer_tracker_test.go b/polygon/p2p/peer_tracker_test.go index 28489077c41..86830fca5bc 100644 --- a/polygon/p2p/peer_tracker_test.go +++ b/polygon/p2p/peer_tracker_test.go @@ -29,12 +29,12 @@ import ( "go.uber.org/mock/gomock" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" "github.com/erigontech/erigon/turbo/testlog" ) @@ -286,7 +286,7 @@ func (ptt *peerTrackerTest) mockPeerProvider(peerReply *sentryproto.PeersReply) func (ptt *peerTrackerTest) mockPeerEvents(events <-chan *sentryproto.PeerEvent) { ptt.peerEventRegistrar.EXPECT(). RegisterPeerEventObserver(gomock.Any()). - DoAndReturn(func(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc { + DoAndReturn(func(observer event.Observer[*sentryproto.PeerEvent]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { @@ -308,7 +308,7 @@ func (ptt *peerTrackerTest) mockNewBlockHashesEvents(events <-chan *DecodedInbou ptt.peerEventRegistrar.EXPECT(). RegisterNewBlockHashesObserver(gomock.Any()). DoAndReturn( - func(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { + func(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { @@ -331,7 +331,7 @@ func (ptt *peerTrackerTest) mockNewBlockEvents(events <-chan *DecodedInboundMess ptt.peerEventRegistrar.EXPECT(). RegisterNewBlockObserver(gomock.Any()). DoAndReturn( - func(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { + func(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { diff --git a/polygon/p2p/publisher_test.go b/polygon/p2p/publisher_test.go index 9cb35448202..8c6f016bb6e 100644 --- a/polygon/p2p/publisher_test.go +++ b/polygon/p2p/publisher_test.go @@ -31,12 +31,12 @@ import ( "google.golang.org/grpc" "github.com/erigontech/erigon-lib/direct" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" "github.com/erigontech/erigon/turbo/testlog" ) @@ -234,7 +234,7 @@ func (pt publisherTest) mockPeerProvider(peerReply *sentryproto.PeersReply) { func (pt publisherTest) mockPeerEvents(events <-chan *sentryproto.PeerEvent) { pt.peerEventRegistrar.EXPECT(). RegisterPeerEventObserver(gomock.Any()). - DoAndReturn(func(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc { + DoAndReturn(func(observer event.Observer[*sentryproto.PeerEvent]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { @@ -260,7 +260,7 @@ func (pt publisherTest) mockNewBlockHashesEvents(events <-chan *DecodedInboundMe pt.peerEventRegistrar.EXPECT(). RegisterNewBlockHashesObserver(gomock.Any()). DoAndReturn( - func(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { + func(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { @@ -287,7 +287,7 @@ func (pt publisherTest) mockNewBlockEvents(events <-chan *DecodedInboundMessage[ pt.peerEventRegistrar.EXPECT(). RegisterNewBlockObserver(gomock.Any()). DoAndReturn( - func(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { + func(observer event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc { ctx, cancel := context.WithCancel(context.Background()) go func() { for { diff --git a/polygon/p2p/service.go b/polygon/p2p/service.go index b21bf38ae99..15c01a15033 100644 --- a/polygon/p2p/service.go +++ b/polygon/p2p/service.go @@ -24,12 +24,12 @@ import ( "golang.org/x/sync/errgroup" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/polygon/polygoncommon" ) func NewService(logger log.Logger, maxPeers int, sc sentryproto.SentryClient, sdf sentry.StatusDataFactory) *Service { @@ -124,10 +124,10 @@ func (s *Service) Penalize(ctx context.Context, peerId *PeerId) error { return s.peerPenalizer.Penalize(ctx, peerId) } -func (s *Service) RegisterNewBlockObserver(o polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) polygoncommon.UnregisterFunc { +func (s *Service) RegisterNewBlockObserver(o event.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) event.UnregisterFunc { return s.messageListener.RegisterNewBlockObserver(o) } -func (s *Service) RegisterNewBlockHashesObserver(o polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) polygoncommon.UnregisterFunc { +func (s *Service) RegisterNewBlockHashesObserver(o event.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) event.UnregisterFunc { return s.messageListener.RegisterNewBlockHashesObserver(o) } diff --git a/polygon/sync/tip_events.go b/polygon/sync/tip_events.go index b839266c97f..c9175a518fb 100644 --- a/polygon/sync/tip_events.go +++ b/polygon/sync/tip_events.go @@ -20,17 +20,16 @@ import ( "context" "fmt" + lru "github.com/hashicorp/golang-lru/v2" "golang.org/x/sync/errgroup" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/event" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/polygon/heimdall" "github.com/erigontech/erigon/polygon/p2p" - "github.com/erigontech/erigon/polygon/polygoncommon" - - lru "github.com/hashicorp/golang-lru/v2" ) type EventType string @@ -107,12 +106,12 @@ func (e Event) AsNewMilestone() EventNewMilestone { } type p2pObserverRegistrar interface { - RegisterNewBlockObserver(polygoncommon.Observer[*p2p.DecodedInboundMessage[*eth.NewBlockPacket]]) polygoncommon.UnregisterFunc - RegisterNewBlockHashesObserver(polygoncommon.Observer[*p2p.DecodedInboundMessage[*eth.NewBlockHashesPacket]]) polygoncommon.UnregisterFunc + RegisterNewBlockObserver(event.Observer[*p2p.DecodedInboundMessage[*eth.NewBlockPacket]]) event.UnregisterFunc + RegisterNewBlockHashesObserver(event.Observer[*p2p.DecodedInboundMessage[*eth.NewBlockHashesPacket]]) event.UnregisterFunc } type heimdallObserverRegistrar interface { - RegisterMilestoneObserver(callback func(*heimdall.Milestone), opts ...heimdall.ObserverOption) polygoncommon.UnregisterFunc + RegisterMilestoneObserver(callback func(*heimdall.Milestone), opts ...heimdall.ObserverOption) event.UnregisterFunc } func NewTipEvents(logger log.Logger, p2pReg p2pObserverRegistrar, heimdallReg heimdallObserverRegistrar) *TipEvents { From e72764983d02999e689f7e7775c6a7ebcc2e3cf8 Mon Sep 17 00:00:00 2001 From: Ostroukhov Nikita Date: Fri, 3 Jan 2025 12:15:54 +0000 Subject: [PATCH 11/28] Updated metrics file with new polygon related panels (#13309) --- .../dashboards/erigon_internals.json | 3937 ++++++++++------- 1 file changed, 2343 insertions(+), 1594 deletions(-) diff --git a/cmd/prometheus/dashboards/erigon_internals.json b/cmd/prometheus/dashboards/erigon_internals.json index 3a580c3eadc..fcc9dccff33 100644 --- a/cmd/prometheus/dashboards/erigon_internals.json +++ b/cmd/prometheus/dashboards/erigon_internals.json @@ -11,16 +11,34 @@ ], "__elements": {}, "__requires": [ + { + "type": "panel", + "id": "barchart", + "name": "Bar chart", + "version": "" + }, + { + "type": "panel", + "id": "bargauge", + "name": "Bar gauge", + "version": "" + }, + { + "type": "panel", + "id": "gauge", + "name": "Gauge", + "version": "" + }, { "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.4.2" + "version": "11.5.0-80207" }, { "type": "panel", - "id": "graph", - "name": "Graph (old)", + "id": "piechart", + "name": "Pie chart", "version": "" }, { @@ -29,6 +47,12 @@ "name": "Prometheus", "version": "1.0.0" }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, { "type": "panel", "id": "timeseries", @@ -61,7 +85,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 2, + "id": null, "links": [], "panels": [ { @@ -100,20 +124,27 @@ "h": 8, "w": 12, "x": 0, - "y": 1 + "y": 2 }, "id": 240, "options": { - "displayLabels": ["percent", "value"], + "displayLabels": [ + "percent", + "value" + ], "legend": { "displayMode": "list", "placement": "right", "showLegend": true, - "values": ["value"] + "values": [ + "value" + ] }, "pieType": "pie", "reduceOptions": { - "calcs": ["max"], + "calcs": [ + "max" + ], "fields": "", "values": false }, @@ -122,7 +153,7 @@ "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { "editorMode": "code", @@ -131,7 +162,11 @@ "instant": true, "legendFormat": "Aggregate verification", "range": false, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -179,8 +214,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -195,7 +229,7 @@ "h": 4, "w": 12, "x": 0, - "y": 10 + "y": 168 }, "id": 219, "options": { @@ -203,7 +237,9 @@ "minVizWidth": 75, "orientation": "auto", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -211,14 +247,18 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "editorMode": "code", "expr": "committee_size{instance=~\"$instance\"}", "legendFormat": "{{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Attestating Committee Size", @@ -241,6 +281,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 32, "gradientMode": "none", @@ -271,8 +312,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -288,12 +328,14 @@ "h": 12, "w": 12, "x": 12, - "y": 10 + "y": 168 }, "id": 220, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -310,7 +352,11 @@ "expr": "aggregate_quality_50{instance=\"dev-bm-e3-ethmainnet-n1\"}*100", "legendFormat": "{{label_name}} {{instance}} 50th", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -383,8 +429,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -399,7 +444,7 @@ "h": 4, "w": 12, "x": 0, - "y": 14 + "y": 292 }, "id": 222, "options": { @@ -409,7 +454,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -417,14 +464,18 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "editorMode": "code", "expr": "current_slot{instance=~\"$instance\"}", "legendFormat": "{{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Current slot", @@ -445,8 +496,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -461,7 +511,7 @@ "h": 4, "w": 12, "x": 0, - "y": 18 + "y": 296 }, "id": 223, "options": { @@ -471,7 +521,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -479,14 +531,18 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "editorMode": "code", "expr": "current_epoch{instance=~\"$instance\"}", "legendFormat": "Epoch {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Current epoch", @@ -532,20 +588,26 @@ "h": 8, "w": 12, "x": 0, - "y": 11 + "y": 169 }, "id": 232, "options": { - "displayLabels": ["percent"], + "displayLabels": [ + "percent" + ], "legend": { "displayMode": "list", "placement": "right", "showLegend": true, - "values": ["value"] + "values": [ + "value" + ] }, "pieType": "pie", "reduceOptions": { - "calcs": ["last"], + "calcs": [ + "last" + ], "fields": "", "values": false }, @@ -561,7 +623,11 @@ "expr": "execution_time{instance=\"dev-bm-e3-ethmainnet-n1\"}", "legendFormat": "Block Execution", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -636,6 +702,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 22, "gradientMode": "none", @@ -666,8 +733,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -683,12 +749,14 @@ "h": 8, "w": 12, "x": 12, - "y": 11 + "y": 169 }, "id": 230, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -705,7 +773,11 @@ "expr": "blob_verification_time{instance=~\"$instance\"}", "legendFormat": "{{label_name}} {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Blob sidecar computation time", @@ -728,6 +800,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 18, "gradientMode": "none", @@ -758,8 +831,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -775,12 +847,14 @@ "h": 8, "w": 12, "x": 0, - "y": 19 + "y": 204 }, "id": 229, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -797,7 +871,11 @@ "expr": "block_importing_latency{instance=~\"$instance\"}", "legendFormat": "{{label_name}} {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Block importing latency", @@ -818,8 +896,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -835,7 +912,7 @@ "h": 8, "w": 12, "x": 12, - "y": 19 + "y": 204 }, "id": 215, "options": { @@ -845,7 +922,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -853,7 +932,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "disableTextWrap": false, @@ -864,7 +943,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Total SyncCommitteeAggregate bandwidth", @@ -906,8 +989,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -923,7 +1005,7 @@ "h": 8, "w": 12, "x": 0, - "y": 27 + "y": 212 }, "id": 236, "options": { @@ -958,7 +1040,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Caplin: Total bandwidth", @@ -979,8 +1065,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -996,7 +1081,7 @@ "h": 8, "w": 12, "x": 12, - "y": 27 + "y": 212 }, "id": 214, "options": { @@ -1006,7 +1091,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "fields": "", "values": false }, @@ -1014,7 +1101,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "disableTextWrap": false, @@ -1025,7 +1112,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Total AggregateAndProof bandwidth", @@ -1046,8 +1137,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1063,7 +1153,7 @@ "h": 8, "w": 12, "x": 0, - "y": 35 + "y": 220 }, "id": 235, "options": { @@ -1073,7 +1163,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -1081,7 +1173,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "disableTextWrap": false, @@ -1092,7 +1184,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Caplin: Outgoing bandwidth", @@ -1115,6 +1211,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 23, "gradientMode": "none", @@ -1145,8 +1242,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1162,7 +1258,7 @@ "h": 8, "w": 12, "x": 12, - "y": 35 + "y": 220 }, "id": 210, "options": { @@ -1188,7 +1284,11 @@ "legendFormat": " {{ method }} {{ instance }}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Caplin: Attestation in block latency", @@ -1209,8 +1309,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1226,7 +1325,7 @@ "h": 8, "w": 12, "x": 0, - "y": 43 + "y": 228 }, "id": 234, "options": { @@ -1236,7 +1335,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "fields": "", "values": false }, @@ -1244,7 +1345,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "disableTextWrap": false, @@ -1255,7 +1356,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Caplin: Ingoing bandwidth", @@ -1278,6 +1383,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 37, "gradientMode": "none", @@ -1308,8 +1414,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1326,7 +1431,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": [" dev-bm-e3-ethmainnet-n1"], + "names": [ + " dev-bm-e3-ethmainnet-n1" + ], "prefix": "All except:", "readOnly": true } @@ -1348,7 +1455,7 @@ "h": 8, "w": 12, "x": 12, - "y": 43 + "y": 228 }, "id": 211, "options": { @@ -1370,7 +1477,11 @@ "expr": "full_block_processing_time{instance=~\"$instance\"}", "legendFormat": " {{ method }} {{ instance }}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Caplin: Block processing time", @@ -1393,6 +1504,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 27, "gradientMode": "none", @@ -1423,8 +1535,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1440,12 +1551,14 @@ "h": 8, "w": 12, "x": 0, - "y": 51 + "y": 236 }, "id": 231, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1462,7 +1575,11 @@ "expr": "execution_time{instance=~\"$instance\"}", "legendFormat": "{{label_name}} {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "ValidateChain: time spent", @@ -1504,8 +1621,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1521,7 +1637,7 @@ "h": 8, "w": 12, "x": 12, - "y": 51 + "y": 236 }, "id": 221, "options": { @@ -1530,7 +1646,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1552,7 +1670,11 @@ "expr": "process_justification_bits_and_finality_time{instance=~\"$instance\"}", "legendFormat": "{{label_name}} {{instance}} process_justification_bits_and_finality", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -1653,6 +1775,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 27, "gradientMode": "none", @@ -1683,8 +1806,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1700,12 +1822,14 @@ "h": 8, "w": 12, "x": 0, - "y": 59 + "y": 244 }, "id": 216, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1726,7 +1850,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Single attestation subnet bandwidth", @@ -1749,6 +1877,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1779,8 +1908,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1797,7 +1925,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": [" snapshotter-bm-e3-ethmainnet-n1"], + "names": [ + " snapshotter-bm-e3-ethmainnet-n1" + ], "prefix": "All except:", "readOnly": true } @@ -1819,7 +1949,7 @@ "h": 8, "w": 12, "x": 12, - "y": 59 + "y": 244 }, "id": 217, "options": { @@ -1841,7 +1971,11 @@ "expr": "epoch_processing_time{instance=~\"$instance\"}", "legendFormat": " {{ method }} {{ instance }}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Epoch processing time", @@ -1911,7 +2045,7 @@ "h": 8, "w": 12, "x": 0, - "y": 67 + "y": 252 }, "id": 228, "options": { @@ -1933,7 +2067,11 @@ "expr": "compute_shuffled_indices{instance=~\"$instance\"} > 0", "legendFormat": "{{label_name}} {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Shuffling validator set", @@ -1970,7 +2108,7 @@ "h": 8, "w": 12, "x": 12, - "y": 67 + "y": 252 }, "id": 213, "options": { @@ -1980,7 +2118,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -1999,7 +2139,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Beacon Block Gossip bandwidth", @@ -2036,7 +2180,7 @@ "h": 8, "w": 12, "x": 0, - "y": 75 + "y": 260 }, "id": 226, "options": { @@ -2046,7 +2190,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -2065,7 +2211,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Total blobs bandwidth", @@ -2135,7 +2285,7 @@ "h": 8, "w": 12, "x": 12, - "y": 75 + "y": 260 }, "id": 227, "options": { @@ -2161,7 +2311,11 @@ "legendFormat": "kb/s {{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Total attestation subnets bandwidth", @@ -2231,7 +2385,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": [" snapshotter-bm-e3-ethmainnet-n1 blobs"], + "names": [ + " snapshotter-bm-e3-ethmainnet-n1 blobs" + ], "prefix": "All except:", "readOnly": true } @@ -2253,7 +2409,7 @@ "h": 9, "w": 24, "x": 0, - "y": 83 + "y": 268 }, "id": 224, "options": { @@ -2275,7 +2431,11 @@ "expr": "frozen_blobs{instance=~\"$instance\"} > 0", "legendFormat": "{{label_name}} {{instance}} blobs", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -2383,12 +2543,14 @@ "h": 12, "w": 24, "x": 0, - "y": 92 + "y": 277 }, "id": 209, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2410,7 +2572,11 @@ "legendFormat": "{{instance}}", "range": true, "refId": "A", - "useBackend": false + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -2458,6 +2624,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2488,8 +2655,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2505,12 +2671,14 @@ "h": 8, "w": 12, "x": 0, - "y": 4 + "y": 170 }, "id": 204, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2527,7 +2695,11 @@ "expr": "rate(kv_get_count{instance=~\"$instance\"}[$rate_interval])", "legendFormat": "{{domain}} {{level}}: {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Files Level", @@ -2550,6 +2722,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2580,8 +2753,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2597,12 +2769,14 @@ "h": 8, "w": 12, "x": 12, - "y": 4 + "y": 170 }, "id": 203, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2619,7 +2793,11 @@ "expr": "kv_get{quantile=\"$quantile\",instance=~\"$instance\"}", "legendFormat": "{{domain}} {{level}}: {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "Files Level", @@ -2642,6 +2820,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2672,8 +2851,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2688,7 +2866,7 @@ "h": 8, "w": 12, "x": 0, - "y": 12 + "y": 205 }, "id": 238, "options": { @@ -2710,7 +2888,11 @@ "expr": "sum by(instance, level) (rate(trie_state_levelled_load_rate{instance=~\"$instance\"}[$__rate_interval]))", "legendFormat": "loaded {{level}} {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } }, { "datasource": { @@ -2758,8 +2940,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2775,7 +2956,7 @@ "h": 3, "w": 12, "x": 0, - "y": 20 + "y": 213 }, "id": 239, "options": { @@ -2785,7 +2966,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -2793,14 +2976,18 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.4.0-77868", "targets": [ { "editorMode": "code", "expr": "100*(trie_state_skip_rate{instance=~\"$instance\"}/(trie_state_skip_rate{instance=~\"$instance\"}+trie_state_load_rate{instance=~\"$instance\"})) ", "legendFormat": "skip {{instance}}", "range": true, - "refId": "A" + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } } ], "title": "state load Skip Ratio", @@ -2837,6 +3024,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2918,7 +3106,9 @@ "id": 196, "options": { "legend": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2928,7 +3118,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -2963,6 +3153,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "none", @@ -3015,7 +3206,9 @@ "id": 206, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -3025,7 +3218,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3063,6 +3256,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3111,7 +3305,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": ["dev-bm-e3-ethmainnet-n1 blocks "], + "names": [ + "dev-bm-e3-ethmainnet-n1 blocks " + ], "prefix": "All except:", "readOnly": true } @@ -3148,7 +3344,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3184,6 +3380,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3234,7 +3431,7 @@ "h": 8, "w": 8, "x": 0, - "y": 11 + "y": 19 }, "id": 197, "options": { @@ -3249,7 +3446,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3344,6 +3541,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "none", @@ -3391,12 +3589,14 @@ "h": 6, "w": 8, "x": 8, - "y": 11 + "y": 19 }, "id": 207, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -3406,7 +3606,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3484,7 +3684,7 @@ "h": 6, "w": 8, "x": 16, - "y": 11 + "y": 19 }, "id": 202, "options": { @@ -3501,7 +3701,9 @@ "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -3509,7 +3711,7 @@ "sizing": "manual", "valueMode": "color" }, - "pluginVersion": "10.4.2", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3557,6 +3759,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3604,12 +3807,14 @@ "h": 5, "w": 8, "x": 8, - "y": 17 + "y": 25 }, "id": 158, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -3619,7 +3824,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3657,6 +3862,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3704,12 +3910,15 @@ "h": 5, "w": 8, "x": 16, - "y": 17 + "y": 25 }, "id": 199, "options": { "legend": { - "calcs": ["mean", "lastNotNull"], + "calcs": [ + "mean", + "lastNotNull" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -3719,7 +3928,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3756,6 +3965,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3804,7 +4014,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": ["commitment took: dev-bm-e3-ethmainnet-n1"], + "names": [ + "commitment took: dev-bm-e3-ethmainnet-n1" + ], "prefix": "All except:", "readOnly": true } @@ -3826,12 +4038,14 @@ "h": 12, "w": 8, "x": 0, - "y": 19 + "y": 27 }, "id": 112, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -3841,7 +4055,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -3927,6 +4141,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3973,7 +4188,7 @@ "h": 9, "w": 8, "x": 8, - "y": 22 + "y": 30 }, "id": 198, "options": { @@ -3988,7 +4203,7 @@ "sort": "desc" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -4084,6 +4299,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4131,7 +4347,7 @@ "h": 9, "w": 8, "x": 16, - "y": 22 + "y": 30 }, "id": 201, "options": { @@ -4146,7 +4362,7 @@ "sort": "desc" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -4200,91 +4416,6 @@ "title": "Block execution delays", "type": "timeseries" }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-BlPu" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "mgas/sec" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 31 - }, - "id": 208, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": ["mean"], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.4.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "exec_mgas{instance=~\"$instance\"} < 5000", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "mgas: {{instance}}", - "range": true, - "refId": "A" - } - ], - "title": "mgas/s ", - "type": "stat" - } - ], - "title": "Blocks execution", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 5 - }, - "id": 17, - "panels": [ { "datasource": { "type": "prometheus", @@ -4302,6 +4433,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4317,7 +4449,7 @@ "scaleDistribution": { "type": "linear" }, - "showPoints": "never", + "showPoints": "auto", "spanNulls": false, "stacking": { "group": "A", @@ -4328,7 +4460,6 @@ } }, "mappings": [], - "min": 0.001, "thresholds": { "mode": "absolute", "steps": [ @@ -4341,18 +4472,17 @@ "value": 80 } ] - }, - "unit": "ops" + } }, "overrides": [] }, "gridPos": { - "h": 5, - "w": 8, + "h": 8, + "w": 12, "x": 0, - "y": 6 + "y": 39 }, - "id": 141, + "id": 245, "options": { "legend": { "calcs": [], @@ -4361,27 +4491,29 @@ "showLegend": true }, "tooltip": { - "mode": "multi", + "mode": "single", "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{type=\"fork_depth\", instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "fork_depth $instance", + "range": true, + "refId": "A", + "useBackend": false, "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(db_commit_seconds_count{phase=\"total\",instance=~\"$instance\"}[$rate_interval]) > 0 ", - "interval": "", - "legendFormat": "commit: {{instance}}", - "range": true, - "refId": "A" + } } ], - "title": "Commit", + "title": "Update Fork Choice depth", "type": "timeseries" }, { @@ -4389,7 +4521,6 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -4402,6 +4533,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4413,13 +4545,12 @@ "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 2, + "pointSize": 5, "scaleDistribution": { - "log": 2, - "type": "log" + "type": "linear" }, - "showPoints": "never", - "spanNulls": 3600000, + "showPoints": "auto", + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -4447,97 +4578,60 @@ "overrides": [] }, "gridPos": { - "h": 9, - "w": 16, - "x": 8, - "y": 6 + "h": 8, + "w": 12, + "x": 12, + "y": 39 }, - "id": 166, + "id": 246, "options": { "legend": { - "calcs": ["mean"], + "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { - "mode": "multi", + "mode": "single", "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"total\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "interval": "", - "legendFormat": "total: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"gc_wall_clock\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "gc_wall_clock: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"write\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "write: {{instance}}", + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{type=\"arrival_delay\", instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "arrival_delay $instance", "range": true, - "refId": "C" - }, - { + "refId": "A", + "useBackend": false, "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"sync\",quantile=\"$quantile\",instance=~\"$instance\"} > 0.002", - "hide": false, - "interval": "", - "legendFormat": "sync: {{instance}}", - "range": true, - "refId": "D" + } }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"gc_cpu_time\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{instance=\"$instance\", quantile=\"$quantile\", type=\"execution_duration\"}", + "fullMetaSearch": false, "hide": false, - "interval": "", - "legendFormat": "gc_cpu_time: {{instance}}", + "includeNullMetadata": true, + "instant": false, + "legendFormat": "execution_duration $instance", "range": true, - "refId": "I" + "refId": "B", + "useBackend": false } ], - "title": "Commit speed", + "title": "Update Fork Choice delays", "type": "timeseries" }, { @@ -4548,15 +4642,119 @@ "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "continuous-BlPu" }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "mgas/sec" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "mgas: snapshotter-bm-e3-ethmainnet-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [] + } + ] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 47 + }, + "id": 208, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "exec_mgas{instance=~\"$instance\"} < 5000", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "mgas: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "mgas/s ", + "type": "stat" + } + ], + "title": "Blocks execution", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 5 + }, + "id": 242, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4572,8 +4770,8 @@ "scaleDistribution": { "type": "linear" }, - "showPoints": "never", - "spanNulls": true, + "showPoints": "auto", + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -4595,18 +4793,17 @@ "value": 80 } ] - }, - "unit": "decbytes" + } }, "overrides": [] }, "gridPos": { - "h": 5, - "w": 8, + "h": 8, + "w": 12, "x": 0, - "y": 11 + "y": 6 }, - "id": 159, + "id": 243, "options": { "legend": { "calcs": [], @@ -4615,37 +4812,46 @@ "showLegend": true }, "tooltip": { - "mode": "multi", + "mode": "single", "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "waypoint_length{type=\"milestone\", instance=\"$instance\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "milestone_length $instance", + "range": true, + "refId": "A", + "useBackend": false, "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" - }, - "expr": "db_size{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "size: {{instance}}", - "refId": "A" + } }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", - "expr": "db_mi_last_pgno{instance=~\"$instance\"}", + "disableTextWrap": false, + "editorMode": "builder", + "expr": "waypoint_length{type=\"checkpoint\", instance=\"$instance\"}", + "fullMetaSearch": false, "hide": false, - "interval": "", - "legendFormat": "db_mi_last_pgno: {{instance}}", + "includeNullMetadata": true, + "instant": false, + "legendFormat": "checkpoint_length $instance", "range": true, - "refId": "B" + "refId": "B", + "useBackend": false } ], - "title": "DB Size", + "title": "Waypoint length", "type": "timeseries" }, { @@ -4665,6 +4871,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4680,7 +4887,7 @@ "scaleDistribution": { "type": "linear" }, - "showPoints": "never", + "showPoints": "auto", "spanNulls": false, "stacking": { "group": "A", @@ -4704,81 +4911,147 @@ } ] }, - "unit": "short" + "unit": "s" }, "overrides": [] }, "gridPos": { - "h": 7, - "w": 16, - "x": 8, - "y": 15 + "h": 8, + "w": 12, + "x": 12, + "y": 6 }, - "id": 168, + "id": 244, "options": { "legend": { - "calcs": ["mean"], + "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { - "mode": "multi", + "mode": "single", "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"newly\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "newly: {{instance}}", + "disableTextWrap": false, + "editorMode": "builder", + "expr": "wiggle_duration{instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "wiggle_duration $instance", "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"cow\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "cow: {{instance}}", - "refId": "B" - }, - { + "refId": "A", + "useBackend": false, "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" + } + } + ], + "title": "Wiggle Duration", + "type": "timeseries" + } + ], + "title": "Polygon", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 17, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"clone\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "clone: {{instance}}", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"split\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "split: {{instance}}", - "refId": "D" + "mappings": [], + "min": 0.001, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 149 + }, + "id": 141, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", @@ -4786,49 +5059,102 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"merge\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, + "expr": "rate(db_commit_seconds_count{phase=\"total\",instance=~\"$instance\"}[$rate_interval]) > 0 ", "interval": "", - "legendFormat": "merge: {{instance}}", + "legendFormat": "commit: {{instance}}", "range": true, - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "refId": "A" + } + ], + "title": "Commit", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"spill\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "spill: {{instance}}", - "refId": "F" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 2, + "scaleDistribution": { + "log": 2, + "type": "log" + }, + "showPoints": "never", + "spanNulls": 3600000, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"wops\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "wops: {{instance}}", - "refId": "G" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"unspill\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "unspill: {{instance}}", - "refId": "H" + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 16, + "x": 8, + "y": 149 + }, + "id": 166, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", @@ -4836,12 +5162,11 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcrloops\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, + "expr": "db_commit_seconds{phase=\"total\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", "interval": "", - "legendFormat": "gcrloops: {{instance}}", + "legendFormat": "total: {{instance}}", "range": true, - "refId": "I" + "refId": "A" }, { "datasource": { @@ -4850,12 +5175,12 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcwloops\", instance=~\"$instance\"}[$rate_interval])", + "expr": "db_commit_seconds{phase=\"gc_wall_clock\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", "hide": false, "interval": "", - "legendFormat": "gcwloops: {{instance}}", + "legendFormat": "gc_wall_clock: {{instance}}", "range": true, - "refId": "J" + "refId": "B" }, { "datasource": { @@ -4864,12 +5189,12 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcxpages\", instance=~\"$instance\"}[$rate_interval])", + "expr": "db_commit_seconds{phase=\"write\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", "hide": false, "interval": "", - "legendFormat": "gcxpages: {{instance}}", + "legendFormat": "write: {{instance}}", "range": true, - "refId": "K" + "refId": "C" }, { "datasource": { @@ -4878,12 +5203,12 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"msync\", instance=~\"$instance\"}[$rate_interval])", + "expr": "db_commit_seconds{phase=\"sync\",quantile=\"$quantile\",instance=~\"$instance\"} > 0.002", "hide": false, "interval": "", - "legendFormat": "msync: {{instance}}", + "legendFormat": "sync: {{instance}}", "range": true, - "refId": "L" + "refId": "D" }, { "datasource": { @@ -4892,39 +5217,15 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_pgops{phase=\"fsync\", instance=~\"$instance\"}[$rate_interval])", + "expr": "db_commit_seconds{phase=\"gc_cpu_time\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", "hide": false, "interval": "", - "legendFormat": "fsync: {{instance}}", + "legendFormat": "gc_cpu_time: {{instance}}", "range": true, - "refId": "M" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"minicore\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "minicore: {{instance}}", - "refId": "N" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"prefault\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "prefault: {{instance}}", - "refId": "O" + "refId": "I" } ], - "title": "DB Pages Ops/sec", + "title": "Commit speed", "type": "timeseries" }, { @@ -4944,6 +5245,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -4988,15 +5290,15 @@ "overrides": [] }, "gridPos": { - "h": 6, + "h": 5, "w": 8, "x": 0, - "y": 16 + "y": 162 }, - "id": 167, + "id": 159, "options": { "legend": { - "calcs": ["mean"], + "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5006,18 +5308,16 @@ "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", - "expr": "tx_limit{instance=~\"$instance\"}", + "expr": "db_size{instance=~\"$instance\"}", "interval": "", - "legendFormat": "limit: {{instance}}", - "range": true, + "legendFormat": "size: {{instance}}", "refId": "A" }, { @@ -5026,15 +5326,15 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "tx_dirty{instance=~\"$instance\"}", + "expr": "db_mi_last_pgno{instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "dirty: {{instance}}", + "legendFormat": "db_mi_last_pgno: {{instance}}", "range": true, "refId": "B" } ], - "title": "Tx Size", + "title": "DB Size", "type": "timeseries" }, { @@ -5054,6 +5354,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5065,7 +5366,7 @@ "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 0, + "pointSize": 5, "scaleDistribution": { "type": "linear" }, @@ -5098,15 +5399,17 @@ "overrides": [] }, "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 22 + "h": 7, + "w": 16, + "x": 8, + "y": 166 }, - "id": 169, + "id": 168, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5116,7 +5419,7 @@ "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5125,9 +5428,10 @@ }, "editorMode": "code", "exemplar": true, - "expr": "db_gc_leaf{instance=~\"$instance\"} > 0", + "expr": "rate(db_pgops{phase=\"newly\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, "interval": "", - "legendFormat": "gc_leaf: {{instance}}", + "legendFormat": "newly: {{instance}}", "range": true, "refId": "A" }, @@ -5136,15 +5440,37 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", "exemplar": true, - "expr": "db_gc_overflow{instance=~\"$instance\"} > 0", + "expr": "rate(db_pgops{phase=\"cow\", instance=~\"$instance\"}[$rate_interval])", "hide": false, "interval": "", - "legendFormat": "gc_overflow: {{instance}}", - "range": true, + "legendFormat": "cow: {{instance}}", "refId": "B" }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"clone\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "clone: {{instance}}", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"split\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "split: {{instance}}", + "refId": "D" + }, { "datasource": { "type": "prometheus", @@ -5152,15 +5478,145 @@ }, "editorMode": "code", "exemplar": true, - "expr": "exec_steps_in_db{instance=~\"$instance\"}/100 > 0", + "expr": "rate(db_pgops{phase=\"merge\", instance=~\"$instance\"}[$rate_interval])", "hide": false, "interval": "", - "legendFormat": "exec_steps_in_db: {{instance}}", + "legendFormat": "merge: {{instance}}", "range": true, "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"spill\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "spill: {{instance}}", + "refId": "F" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"wops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "wops: {{instance}}", + "refId": "G" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"unspill\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "unspill: {{instance}}", + "refId": "H" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcrloops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcrloops: {{instance}}", + "range": true, + "refId": "I" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcwloops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcwloops: {{instance}}", + "range": true, + "refId": "J" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcxpages\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcxpages: {{instance}}", + "range": true, + "refId": "K" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"msync\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "msync: {{instance}}", + "range": true, + "refId": "L" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"fsync\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "fsync: {{instance}}", + "range": true, + "refId": "M" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"minicore\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "minicore: {{instance}}", + "refId": "N" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"prefault\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "prefault: {{instance}}", + "refId": "O" } ], - "title": "GC and State", + "title": "DB Pages Ops/sec", "type": "timeseries" }, { @@ -5168,7 +5624,6 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -5181,6 +5636,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5197,7 +5653,7 @@ "type": "linear" }, "showPoints": "never", - "spanNulls": false, + "spanNulls": true, "stacking": { "group": "A", "mode": "none" @@ -5220,20 +5676,22 @@ } ] }, - "unit": "short" + "unit": "decbytes" }, "overrides": [] }, "gridPos": { "h": 6, - "w": 16, - "x": 8, - "y": 22 + "w": 8, + "x": 0, + "y": 167 }, - "id": 150, + "id": 167, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5243,7 +5701,7 @@ "sort": "none" } }, - "pluginVersion": "11.5.0-80050", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5251,10 +5709,9 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(process_minor_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "expr": "tx_limit{instance=~\"$instance\"}", "interval": "", - "legendFormat": "soft: {{instance}}", + "legendFormat": "limit: {{instance}}", "range": true, "refId": "A" }, @@ -5264,16 +5721,15 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(process_major_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "expr": "tx_dirty{instance=~\"$instance\"}", "hide": false, "interval": "", - "legendFormat": "hard: {{instance}}", + "legendFormat": "dirty: {{instance}}", "range": true, "refId": "B" } ], - "title": "getrusage: minflt - soft page faults (reclaims), majflt - hard faults", + "title": "Tx Size", "type": "timeseries" }, { @@ -5293,6 +5749,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5304,12 +5761,12 @@ "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 5, + "pointSize": 0, "scaleDistribution": { "type": "linear" }, "showPoints": "never", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -5318,7 +5775,6 @@ "mode": "off" } }, - "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -5333,20 +5789,22 @@ } ] }, - "unit": "percentunit" + "unit": "short" }, "overrides": [] }, "gridPos": { - "h": 5, + "h": 6, "w": 8, "x": 0, - "y": 28 + "y": 173 }, - "id": 194, + "id": 169, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5356,7 +5814,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5365,11 +5823,9 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(exec_repeats{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", + "expr": "db_gc_leaf{instance=~\"$instance\"} > 0", "interval": "", - "intervalFactor": 1, - "legendFormat": "repeats: {{instance}}", + "legendFormat": "gc_leaf: {{instance}}", "range": true, "refId": "A" }, @@ -5380,33 +5836,31 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(exec_triggers{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", + "expr": "db_gc_overflow{instance=~\"$instance\"} > 0", "hide": false, "interval": "", - "intervalFactor": 1, - "legendFormat": "triggers: {{instance}}", + "legendFormat": "gc_overflow: {{instance}}", "range": true, "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "exec_steps_in_db{instance=~\"$instance\"}/100 > 0", + "hide": false, + "interval": "", + "legendFormat": "exec_steps_in_db: {{instance}}", + "range": true, + "refId": "E" } ], - "title": "Exec v3", + "title": "GC and State", "type": "timeseries" - } - ], - "title": "Database", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 6 - }, - "id": 134, - "panels": [ + }, { "datasource": { "type": "prometheus", @@ -5425,6 +5879,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5464,20 +5919,22 @@ } ] }, - "unit": "none" + "unit": "short" }, "overrides": [] }, "gridPos": { "h": 6, - "w": 8, + "w": 16, "x": 8, - "y": 7 + "y": 173 }, - "id": 155, + "id": 150, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5487,7 +5944,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5496,8 +5953,258 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(process_io_write_syscalls_total{instance=~\"$instance\"}[$rate_interval]) > 0", - "format": "time_series", + "expr": "rate(process_minor_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "interval": "", + "legendFormat": "soft: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(process_major_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "interval": "", + "legendFormat": "hard: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "getrusage: minflt - soft page faults (reclaims), majflt - hard faults", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 179 + }, + "id": 194, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_repeats{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "repeats: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_triggers{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "triggers: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "Exec v3", + "type": "timeseries" + } + ], + "title": "Database", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 134, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 16 + }, + "id": 155, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(process_io_write_syscalls_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "format": "time_series", "hide": false, "interval": "", "intervalFactor": 1, @@ -5543,6 +6250,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5590,12 +6298,14 @@ "h": 5, "w": 8, "x": 16, - "y": 7 + "y": 16 }, "id": 148, "options": { "legend": { - "calcs": ["max"], + "calcs": [ + "max" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5605,7 +6315,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5709,6 +6419,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5756,12 +6467,14 @@ "h": 5, "w": 8, "x": 16, - "y": 12 + "y": 21 }, "id": 106, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5771,7 +6484,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5809,6 +6522,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -5857,7 +6571,9 @@ "id": "byNames", "options": { "mode": "exclude", - "names": ["write: dev-bm-e3-ethmainnet-n1"], + "names": [ + "write: dev-bm-e3-ethmainnet-n1" + ], "prefix": "All except:", "readOnly": true } @@ -5879,12 +6595,14 @@ "h": 6, "w": 8, "x": 8, - "y": 13 + "y": 22 }, "id": 85, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -5894,7 +6612,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5948,6 +6666,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "none", @@ -5995,12 +6714,14 @@ "h": 6, "w": 8, "x": 16, - "y": 17 + "y": 26 }, "id": 153, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6010,7 +6731,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6047,6 +6768,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6094,12 +6816,14 @@ "h": 6, "w": 8, "x": 8, - "y": 19 + "y": 28 }, "id": 154, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6109,7 +6833,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6227,6 +6951,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6274,7 +6999,7 @@ "h": 6, "w": 8, "x": 16, - "y": 23 + "y": 32 }, "id": 128, "options": { @@ -6289,7 +7014,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6337,6 +7062,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6384,12 +7110,14 @@ "h": 5, "w": 8, "x": 8, - "y": 25 + "y": 34 }, "id": 86, "options": { "legend": { - "calcs": ["mean"], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6399,7 +7127,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6453,6 +7181,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6500,7 +7229,7 @@ "h": 5, "w": 8, "x": 16, - "y": 29 + "y": 38 }, "id": 124, "options": { @@ -6515,7 +7244,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6544,7 +7273,7 @@ "h": 1, "w": 24, "x": 0, - "y": 7 + "y": 8 }, "id": 183, "panels": [ @@ -6565,6 +7294,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6612,12 +7342,15 @@ "h": 8, "w": 12, "x": 0, - "y": 8 + "y": 9 }, "id": 185, "options": { "legend": { - "calcs": ["mean", "last"], + "calcs": [ + "mean", + "last" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6627,7 +7360,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6673,6 +7406,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6720,12 +7454,15 @@ "h": 8, "w": 12, "x": 12, - "y": 8 + "y": 9 }, "id": 186, "options": { "legend": { - "calcs": ["mean", "last"], + "calcs": [ + "mean", + "last" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6735,7 +7472,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6769,6 +7506,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6816,12 +7554,15 @@ "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 17 }, "id": 187, "options": { "legend": { - "calcs": ["mean", "last"], + "calcs": [ + "mean", + "last" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -6831,7 +7572,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6865,6 +7606,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -6912,7 +7654,7 @@ "h": 8, "w": 12, "x": 12, - "y": 16 + "y": 17 }, "id": 188, "options": { @@ -6927,7 +7669,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6972,6 +7714,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -7019,12 +7762,15 @@ "h": 6, "w": 8, "x": 8, - "y": 24 + "y": 25 }, "id": 189, "options": { "legend": { - "calcs": ["mean", "last"], + "calcs": [ + "mean", + "last" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -7034,7 +7780,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7105,6 +7851,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -7151,12 +7898,15 @@ "h": 6, "w": 8, "x": 16, - "y": 24 + "y": 25 }, "id": 184, "options": { "legend": { - "calcs": ["mean", "last"], + "calcs": [ + "mean", + "last" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -7166,7 +7916,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7203,1024 +7953,1051 @@ "type": "row" }, { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 8 + "y": 9 }, "id": 75, - "panels": [ + "panels": [], + "title": "Network", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "Bps" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "ingress: snapshotter-bm-e3-bormainnet-n1", + "ingress: snapshotter-bm-e3-ethmainnet-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 96, + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "editorMode": "code", + "exemplar": true, + "expr": "rate(p2p_ingress{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "ingress: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(p2p_egress{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "egress: {{instance}}", + "range": true, + "refId": "C" + } + ], + "title": "Traffic", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "unit": "Bps" - }, - "overrides": [ { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "ingress: snapshotter-bm-e3-bormainnet-n1", - "ingress: snapshotter-bm-e3-ethmainnet-n1" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] + "color": "red", + "value": 80 } ] }, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 9 + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 77, + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "id": 96, - "options": { - "legend": { - "calcs": ["mean", "lastNotNull", "max", "min"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } + "expr": "p2p_peers{instance=~\"$instance\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "peers: {{instance}}", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(p2p_ingress{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "ingress: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "expr": "rate(p2p_dials{instance=~\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "dials: {{instance}}", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "rate(p2p_serves{instance=~\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "serves: {{instance}}", + "refId": "C" + } + ], + "title": "Peers", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 19 + }, + "id": 173, + "panels": [], + "title": "TxPool", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(p2p_egress{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 1, - "legendFormat": "egress: {{instance}}", - "range": true, - "refId": "C" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 20 + }, + "id": 175, + "options": { + "legend": { + "calcs": [ + "mean", + "last" ], - "title": "Traffic", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 77, - "options": { - "legend": { - "calcs": ["mean", "lastNotNull", "max", "min"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "p2p_peers{instance=~\"$instance\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "peers: {{instance}}", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "rate(p2p_dials{instance=~\"$instance\"}[1m])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "dials: {{instance}}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "rate(p2p_serves{instance=~\"$instance\"}[1m])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "serves: {{instance}}", - "refId": "C" - } - ], - "title": "Peers", - "type": "timeseries" - } - ], - "title": "Network", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 9 - }, - "id": 173, - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 10 - }, - "id": 175, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_process_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", - "interval": "", - "legendFormat": "process_remote_txs: {{ instance }}", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_add_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "add_remote_txs: {{ instance }}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_new_block{quantile=\"$quantile\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "new_block: {{ instance }}", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_write_to_db{quantile=\"$quantile\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "write_to_db: {{ instance }}", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_propagate_to_new_peer{quantile=\"$quantile\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "propagate_to_new_peer: {{ instance }}", - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "pool_propagate_new_txs{quantile=\"$quantile\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "propagate_new_txs: {{ instance }}", - "refId": "F" - } - ], - "title": "Timings", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "reqps" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 10 - }, - "id": 177, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(pool_process_remote_txs_count{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "pool_process_remote_txs_count: {{ instance }}", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(pool_add_remote_txs_count{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "pool_add_remote_txs_count: {{ instance }}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(pool_new_block_count{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "pool_new_block_count: {{ instance }}", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "rate(pool_write_to_db_count{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "pool_write_to_db_count: {{ instance }}", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(pool_p2p_out{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "__auto", - "range": true, - "refId": "E" - } - ], - "title": "RPS", - "type": "timeseries" + "exemplar": true, + "expr": "pool_process_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", + "interval": "", + "legendFormat": "process_remote_txs: {{ instance }}", + "refId": "A" }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] + "exemplar": true, + "expr": "pool_add_remote_txs{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "add_remote_txs: {{ instance }}", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 18 + "exemplar": true, + "expr": "pool_new_block{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "new_block: {{ instance }}", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "id": 176, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "exemplar": true, + "expr": "pool_write_to_db{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "write_to_db: {{ instance }}", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "sum(delta(cache_total{result=\"hit\",name=\"txpool\",instance=~\"$instance\"}[1m]))/sum(delta(cache_total{name=\"txpool\",instance=~\"$instance\"}[1m])) ", - "hide": false, - "interval": "", - "legendFormat": "hit rate: {{ instance }} ", - "refId": "A" - } - ], - "title": "Cache hit-rate", - "type": "timeseries" + "exemplar": true, + "expr": "pool_propagate_to_new_peer{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "propagate_to_new_peer: {{ instance }}", + "refId": "E" }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "exemplar": true, + "expr": "pool_propagate_new_txs{quantile=\"$quantile\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "propagate_new_txs: {{ instance }}", + "refId": "F" + } + ], + "title": "Timings", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + { + "color": "red", + "value": 80 } - }, - "overrides": [] + ] }, - "gridPos": { - "h": 6, - "w": 8, - "x": 8, - "y": 18 + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 20 + }, + "id": 177, + "options": { + "legend": { + "calcs": [ + "mean", + "last" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "id": 180, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "exemplar": true, + "expr": "rate(pool_process_remote_txs_count{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "pool_process_remote_txs_count: {{ instance }}", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "exemplar": true, + "expr": "rate(pool_add_remote_txs_count{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "pool_add_remote_txs_count: {{ instance }}", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(pool_new_block_count{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "pool_new_block_count: {{ instance }}", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(pool_write_to_db_count{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "pool_write_to_db_count: {{ instance }}", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(pool_p2p_out{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "__auto", + "range": true, + "refId": "E" + } + ], + "title": "RPS", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" }, - "exemplar": true, - "expr": "rate(cache_total{name=\"txpool\",instance=~\"$instance\"}[1m])", - "hide": false, - "interval": "", - "legendFormat": "{{ result }}: {{ instance }} ", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 28 + }, + "id": 176, + "options": { + "legend": { + "calcs": [ + "mean", + "last" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0-77868", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "sum(delta(cache_total{result=\"hit\",name=\"txpool\",instance=~\"$instance\"}[1m]))/sum(delta(cache_total{name=\"txpool\",instance=~\"$instance\"}[1m])) ", + "hide": false, + "interval": "", + "legendFormat": "hit rate: {{ instance }} ", + "refId": "A" + } + ], + "title": "Cache hit-rate", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" }, - "exemplar": true, - "expr": "rate(cache_timeout_total{name=\"txpool\",instance=~\"$instance\"}[1m])", - "hide": false, - "interval": "", - "legendFormat": "timeout: {{ instance }} ", - "refId": "B" - } + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 28 + }, + "id": 180, + "options": { + "legend": { + "calcs": [ + "mean", + "last" ], - "title": "Cache rps", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0-77868", + "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 18 - }, - "id": 181, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "cache_keys_total{name=\"txpool\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "keys: {{ instance }} ", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": true, - "expr": "cache_list_total{name=\"txpool\",instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "list: {{ instance }} ", - "refId": "B" - } - ], - "title": "Cache keys", - "type": "timeseries" + "exemplar": true, + "expr": "rate(cache_total{name=\"txpool\",instance=~\"$instance\"}[1m])", + "hide": false, + "interval": "", + "legendFormat": "{{ result }}: {{ instance }} ", + "refId": "A" }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "exemplar": true, + "expr": "rate(cache_timeout_total{name=\"txpool\",instance=~\"$instance\"}[1m])", + "hide": false, + "interval": "", + "legendFormat": "timeout: {{ instance }} ", + "refId": "B" + } + ], + "title": "Cache rps", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" }, - "unit": "binBps" - }, - "overrides": [] + { + "color": "red", + "value": 80 + } + ] }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 24 + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 28 + }, + "id": 181, + "options": { + "legend": { + "calcs": [ + "mean", + "last" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0-77868", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "id": 178, - "options": { - "legend": { - "calcs": ["mean", "last"], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "exemplar": true, + "expr": "cache_keys_total{name=\"txpool\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "keys: {{ instance }} ", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "exemplar": true, + "expr": "cache_list_total{name=\"txpool\",instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "list: {{ instance }} ", + "refId": "B" + } + ], + "title": "Cache keys", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" }, - "exemplar": true, - "expr": "rate(pool_write_to_db_bytes{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "pool_write_to_db_bytes: {{ instance }}", - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 34 + }, + "id": 178, + "options": { + "legend": { + "calcs": [ + "mean", + "last" ], - "title": "DB", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0-77868", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": true, + "expr": "rate(pool_write_to_db_bytes{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "pool_write_to_db_bytes: {{ instance }}", + "refId": "A" } ], - "title": "TxPool", - "type": "row" + "title": "DB", + "type": "timeseries" } ], "refresh": "10s", - "schemaVersion": 39, + "schemaVersion": 40, "tags": [], "templating": { "list": [ { "current": { - "selected": false, "text": "0.97", "value": "0.97" }, - "hide": 0, "includeAll": false, - "multi": false, "name": "quantile", "options": [ { @@ -8260,21 +9037,15 @@ } ], "query": "0.0,0.25,0.5, 0.9, 0.97, 0.99, 1", - "skipUrlSync": false, "type": "custom" }, { - "current": { - "selected": true, - "text": ["All"], - "value": ["$__all"] - }, + "current": {}, "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, "definition": "go_goroutines", - "hide": 0, "includeAll": true, "label": "instance", "multi": true, @@ -8287,8 +9058,6 @@ }, "refresh": 1, "regex": "/.*instance=\"([^\"]*).*/", - "skipUrlSync": false, - "sort": 0, "type": "query" }, { @@ -8296,11 +9065,9 @@ "auto_count": 30, "auto_min": "10s", "current": { - "selected": false, "text": "1m", "value": "1m" }, - "hide": 0, "label": "Rate Interval", "name": "rate_interval", "options": [ @@ -8362,25 +9129,7 @@ ], "query": "1m,10m,30m,1h,3h,6h,12h,1d,7d,14d,30d", "refresh": 2, - "skipUrlSync": false, "type": "interval" - }, - { - "current": { - "selected": false, - "text": "Prometheus", - "value": "PBFA97CFB590B2093" - }, - "hide": 0, - "includeAll": false, - "multi": false, - "name": "DS_PROMETHEUS", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "type": "datasource" } ] }, @@ -8404,6 +9153,6 @@ "timezone": "", "title": "1. Erigon CUSTOM METRICS", "uid": "b42a61d7-02b1-416c-8ab4-b9c864356174", - "version": 21, + "version": 278, "weekStart": "" -} +} \ No newline at end of file From 0a57d69853794e189481c3927b442f6a09f5c74a Mon Sep 17 00:00:00 2001 From: teenager-ETH Date: Fri, 3 Jan 2025 16:08:16 +0100 Subject: [PATCH 12/28] typo fix Update wmake.ps1 (#13228) # Typo Fix in `wmake.ps1` ## Description This pull request addresses a typo in the `wmake.ps1` file: - Corrected "insterted" to "inserted" in a comment. ## Changes - Improved the accuracy of comments by fixing a minor spelling error. ## Testing This change only updates a comment in the script and does not affect the script's functionality. No additional testing is required. ## Notes for Reviewers Please review the corrected comment to ensure compliance with the project's documentation standards. Let me know if further updates are necessary. Thank you! --- wmake.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wmake.ps1 b/wmake.ps1 index f1397750efb..8ebcfec54fd 100644 --- a/wmake.ps1 +++ b/wmake.ps1 @@ -160,7 +160,7 @@ function Get-Uninstall-Item { param ([string]$pattern = $(throw "A search pattern must be provided")) # Trying to get the enumerable of all installed programs using Get-ItemProperty may cause - # exceptions due to possible garbage values insterted into the registry by installers. + # exceptions due to possible garbage values inserted into the registry by installers. # Specifically an invalid cast exception throws when registry keys contain invalid DWORD data. # See https://github.com/PowerShell/PowerShell/issues/9552 # Due to this all items must be parsed one by one From 98b4911b0bf5ffd6ea90f9ee6bc8035c13e096b6 Mon Sep 17 00:00:00 2001 From: linchizhen Date: Fri, 3 Jan 2025 23:08:33 +0800 Subject: [PATCH 13/28] chore: fix some struct names in comment (#13213) fix some struct names in comment Signed-off-by: linchizhen --- eth/protocols/eth/protocol.go | 14 +++++++------- turbo/stages/bodydownload/body_algos.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index f9875371694..4c2509024a7 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -157,7 +157,7 @@ type GetBlockHeadersPacket struct { Reverse bool // Query direction (false = rising towards latest, true = falling towards genesis) } -// GetBlockHeadersPacket represents a block header query over eth/66 +// GetBlockHeadersPacket66 represents a block header query over eth/66 type GetBlockHeadersPacket66 struct { RequestId uint64 *GetBlockHeadersPacket @@ -202,7 +202,7 @@ func (hn *HashOrNumber) DecodeRLP(s *rlp.Stream) error { // BlockHeadersPacket represents a block header response. type BlockHeadersPacket []*types.Header -// BlockHeadersPacket represents a block header response over eth/66. +// BlockHeadersPacket66 represents a block header response over eth/66. type BlockHeadersPacket66 struct { RequestId uint64 BlockHeadersPacket @@ -300,13 +300,13 @@ type BlockBodiesPacket []*types.Body // BlockRawBodiesPacket is the network packet for block content distribution. type BlockRawBodiesPacket []*types.RawBody -// BlockBodiesPacket is the network packet for block content distribution over eth/66. +// BlockBodiesPacket66 is the network packet for block content distribution over eth/66. type BlockBodiesPacket66 struct { RequestId uint64 BlockBodiesPacket } -// BlockBodiesPacket is the network packet for block content distribution over eth/66. +// BlockRawBodiesPacket66 is the network packet for block content distribution over eth/66. type BlockRawBodiesPacket66 struct { RequestId uint64 BlockRawBodiesPacket @@ -340,7 +340,7 @@ func (p *BlockRawBodiesPacket) Unpack() ([][][]byte, [][]*types.Header, []types. // GetReceiptsPacket represents a block receipts query. type GetReceiptsPacket []libcommon.Hash -// GetReceiptsPacket represents a block receipts query over eth/66. +// GetReceiptsPacket66 represents a block receipts query over eth/66. type GetReceiptsPacket66 struct { RequestId uint64 GetReceiptsPacket @@ -349,7 +349,7 @@ type GetReceiptsPacket66 struct { // ReceiptsPacket is the network packet for block receipts distribution. type ReceiptsPacket [][]*types.Receipt -// ReceiptsPacket is the network packet for block receipts distribution over eth/66. +// ReceiptsPacket66 is the network packet for block receipts distribution over eth/66. type ReceiptsPacket66 struct { RequestId uint64 ReceiptsPacket @@ -358,7 +358,7 @@ type ReceiptsPacket66 struct { // ReceiptsRLPPacket is used for receipts, when we already have it encoded type ReceiptsRLPPacket []rlp.RawValue -// ReceiptsPacket66 is the eth-66 version of ReceiptsRLPPacket +// ReceiptsRLPPacket66 is the eth-66 version of ReceiptsRLPPacket type ReceiptsRLPPacket66 struct { RequestId uint64 ReceiptsRLPPacket diff --git a/turbo/stages/bodydownload/body_algos.go b/turbo/stages/bodydownload/body_algos.go index b6580584ce5..1ecc34481c2 100644 --- a/turbo/stages/bodydownload/body_algos.go +++ b/turbo/stages/bodydownload/body_algos.go @@ -227,7 +227,7 @@ func (bd *BodyDownload) DeliverBodies(txs [][][]byte, uncles [][]*types.Header, } } -// RawTransaction implements core/types.DerivableList interface for hashing +// RawTransactions implements core/types.DerivableList interface for hashing type RawTransactions [][]byte func (rt RawTransactions) Len() int { From 6fbd1e218db7690707b65cd9ef069a067c175fe6 Mon Sep 17 00:00:00 2001 From: Tristav <124001124+Pricstas@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:08:50 +0100 Subject: [PATCH 14/28] Fix article usage in code comments and documentation (#13195) This pull request corrects the use of articles in multiple code files, specifically replacing the incorrect "a" with "an" and vice versa in places where the next word starts with a vowel sound or a consonant sound. These changes improve the clarity and grammatical accuracy of comments and documentation. --- accounts/abi/event.go | 2 +- accounts/abi/reflect.go | 2 +- accounts/abi/type_test.go | 2 +- cl/cltypes/block_production.go | 2 +- cmd/erigoncustom/main.go | 2 +- consensus/aura/config.go | 2 +- consensus/merge/merge.go | 2 +- turbo/node/node.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/accounts/abi/event.go b/accounts/abi/event.go index 84aa6e02c6a..7e7b76b3186 100644 --- a/accounts/abi/event.go +++ b/accounts/abi/event.go @@ -32,7 +32,7 @@ import ( // don't get the signature canonical representation as the first LOG topic. type Event struct { // Name is the event name used for internal representation. It's derived from - // the raw name and a suffix will be added in the case of a event overload. + // the raw name and a suffix will be added in the case of an event overload. // // e.g. // These are two events that have the same name: diff --git a/accounts/abi/reflect.go b/accounts/abi/reflect.go index 4e381f3847f..3d5edcec6de 100644 --- a/accounts/abi/reflect.go +++ b/accounts/abi/reflect.go @@ -27,7 +27,7 @@ import ( "strings" ) -// ConvertType converts an interface of a runtime type into a interface of the +// ConvertType converts an interface of a runtime type into an interface of the // given type // e.g. turn // var fields []reflect.StructField diff --git a/accounts/abi/type_test.go b/accounts/abi/type_test.go index 9a0816d691e..ed45449bf3f 100644 --- a/accounts/abi/type_test.go +++ b/accounts/abi/type_test.go @@ -28,7 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" ) -// typeWithoutStringer is a alias for the Type type which simply doesn't implement +// typeWithoutStringer is an alias for the Type type which simply doesn't implement // the stringer interface to allow printing type details in the tests below. type typeWithoutStringer Type diff --git a/cl/cltypes/block_production.go b/cl/cltypes/block_production.go index 2d623366a3a..197b5ef9150 100644 --- a/cl/cltypes/block_production.go +++ b/cl/cltypes/block_production.go @@ -25,7 +25,7 @@ import ( ) // BlindOrExecutionBeaconBlock is a union type that can be either a BlindedBeaconBlock or a BeaconBlock, depending on the context. -// It's a intermediate type used in the block production process. +// It's an intermediate type used in the block production process. type BlindOrExecutionBeaconBlock struct { Slot uint64 `json:"-"` ProposerIndex uint64 `json:"-"` diff --git a/cmd/erigoncustom/main.go b/cmd/erigoncustom/main.go index 8318fb40219..4c93a12e8ec 100644 --- a/cmd/erigoncustom/main.go +++ b/cmd/erigoncustom/main.go @@ -61,7 +61,7 @@ func runErigon(ctx *cli.Context) error { //err := eri.Serve() //if err != nil { - // log.Error("error while serving a Erigon node", "err", err) + // log.Error("error while serving an Erigon node", "err", err) // return err //} return nil diff --git a/consensus/aura/config.go b/consensus/aura/config.go index 2f4d775870f..9c6e1c4abbb 100644 --- a/consensus/aura/config.go +++ b/consensus/aura/config.go @@ -30,7 +30,7 @@ import ( "github.com/erigontech/erigon/consensus" ) -// Draws an validator nonce modulo number of validators. +// Draws a validator nonce modulo number of validators. func GetFromValidatorSet(set ValidatorSet, parent libcommon.Hash, nonce uint, call consensus.Call) (libcommon.Address, error) { //d, err := set.defaultCaller(parent) //if err != nil { diff --git a/consensus/merge/merge.go b/consensus/merge/merge.go index 1151b255549..e50d91ab447 100644 --- a/consensus/merge/merge.go +++ b/consensus/merge/merge.go @@ -52,7 +52,7 @@ var ( // errInvalidNonce is returned if the nonce is non-zero. errInvalidNonce = errors.New("invalid nonce") - // errInvalidUncleHash is returned if a block contains an non-empty uncle list. + // errInvalidUncleHash is returned if a block contains a non-empty uncle list. errInvalidUncleHash = errors.New("non empty uncle hash") errOlderBlockTime = errors.New("timestamp older than parent") diff --git a/turbo/node/node.go b/turbo/node/node.go index 7e98e7f57c9..2c839487439 100644 --- a/turbo/node/node.go +++ b/turbo/node/node.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with Erigon. If not, see . -// Package node contains classes for running a Erigon node. +// Package node contains classes for running an Erigon node. package node import ( From 5dc66507dfc92a46423642675cfe9915be32135d Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 3 Jan 2025 23:09:49 +0800 Subject: [PATCH 15/28] docs: Spelling error. (#13199) Spelling error. Signed-off-by: RiceChuan --- cmd/sentry/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/sentry/README.md b/cmd/sentry/README.md index d6209975027..1fe9566f8df 100644 --- a/cmd/sentry/README.md +++ b/cmd/sentry/README.md @@ -19,7 +19,7 @@ combined). Ethereum mainnet configuration is currently hard-coded. ./build/bin/sentry --datadir= ``` -The command above specifies `--datadir` option - directory where the database files will be written (it doesn't need access to Erion's datadir). These two options +The command above specifies `--datadir` option - directory where the database files will be written (it doesn't need access to Erigon's datadir). These two options will need to be specified regardless of the mode the program is run. This specific command above assumes and external p2p sentry running on the same computer listening to the port `9091`. In order to use a p2p sentry on a different computer, or a different port (or both), the option `--sentry.api.addr` can be used. For example: From 2f96df369b2c01a200cba3fac0e8fd1594f8c101 Mon Sep 17 00:00:00 2001 From: Yi Song Date: Fri, 3 Jan 2025 23:11:00 +0800 Subject: [PATCH 16/28] chore: fix struct field name in comment (#13176) Signed-off-by: goodfirm --- cl/validator/sync_contribution_pool/sync_contribution_pool.go | 2 +- turbo/snapshotsync/freezeblocks/beacon_block_reader.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cl/validator/sync_contribution_pool/sync_contribution_pool.go b/cl/validator/sync_contribution_pool/sync_contribution_pool.go index c56481928e0..925b77dce49 100644 --- a/cl/validator/sync_contribution_pool/sync_contribution_pool.go +++ b/cl/validator/sync_contribution_pool/sync_contribution_pool.go @@ -37,7 +37,7 @@ type syncContributionKey struct { } type syncContributionPoolImpl struct { - // syncContributionPool is a map of sync contributions, indexed by slot, subcommittee index and block root. + // syncContributionPoolForBlocks is a map of sync contributions, indexed by slot, subcommittee index and block root. syncContributionPoolForBlocks map[syncContributionKey]*cltypes.Contribution // Used for block publishing. syncContributionPoolForAggregates map[syncContributionKey]*cltypes.Contribution // Used for sync committee messages aggregation. beaconCfg *clparams.BeaconChainConfig diff --git a/turbo/snapshotsync/freezeblocks/beacon_block_reader.go b/turbo/snapshotsync/freezeblocks/beacon_block_reader.go index cd69fa09421..8d076a852e6 100644 --- a/turbo/snapshotsync/freezeblocks/beacon_block_reader.go +++ b/turbo/snapshotsync/freezeblocks/beacon_block_reader.go @@ -48,7 +48,7 @@ var decompressorPool = sync.Pool{ } type BeaconSnapshotReader interface { - // ReadBlock reads the block at the given slot. + // ReadBlockBySlot reads the block at the given slot. // If the block is not present, it returns nil. ReadBlockBySlot(ctx context.Context, tx kv.Tx, slot uint64) (*cltypes.SignedBeaconBlock, error) ReadBlockByRoot(ctx context.Context, tx kv.Tx, blockRoot libcommon.Hash) (*cltypes.SignedBeaconBlock, error) From 8945a32131b8d6d0c0a344d43ed6cc04b0f5944c Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Sat, 4 Jan 2025 01:54:04 +0800 Subject: [PATCH 17/28] caplin: Use `HandleEndpointFunc` for `node` endpoints (#13308) This fixes an issue where correct response headers were not set for these endpoints. Specifically, `Content-Type` was being set to `text/plain` instead of `application/json`. --- cl/beacon/beaconhttp/api.go | 13 ++-- cl/beacon/handler/handler.go | 12 ++-- cl/beacon/handler/node.go | 121 ++++++++++++++--------------------- 3 files changed, 60 insertions(+), 86 deletions(-) diff --git a/cl/beacon/beaconhttp/api.go b/cl/beacon/beaconhttp/api.go index 8b8f0bf2292..8a266a449cb 100644 --- a/cl/beacon/beaconhttp/api.go +++ b/cl/beacon/beaconhttp/api.go @@ -99,14 +99,13 @@ func HandleEndpointFunc[T any](h EndpointHandlerFunc[T]) http.HandlerFunc { } func HandleEndpoint[T any](h EndpointHandler[T]) http.HandlerFunc { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { ans, err := h.Handle(w, r) if err != nil { var endpointError *EndpointError - if e, ok := err.(*EndpointError); ok { + var e *EndpointError + if errors.As(err, &e) { endpointError = e - } else { - endpointError = WrapEndpointError(err) } endpointError.WriteTo(w) return @@ -131,14 +130,14 @@ func HandleEndpoint[T any](h EndpointHandler[T]) http.HandlerFunc { w.WriteHeader(200) } case strings.Contains(contentType, "application/octet-stream"): - sszMarshaler, ok := any(ans).(ssz.Marshaler) + sizeMarshaller, ok := any(ans).(ssz.Marshaler) if !ok { NewEndpointError(http.StatusBadRequest, ErrorSszNotSupported).WriteTo(w) return } w.Header().Set("Content-Type", "application/octet-stream") // TODO: we should probably figure out some way to stream this in the future :) - encoded, err := sszMarshaler.EncodeSSZ(nil) + encoded, err := sizeMarshaller.EncodeSSZ(nil) if err != nil { WrapEndpointError(err).WriteTo(w) return @@ -149,7 +148,7 @@ func HandleEndpoint[T any](h EndpointHandler[T]) http.HandlerFunc { default: http.Error(w, "content type must include application/json, application/octet-stream, or text/event-stream, got "+contentType, http.StatusBadRequest) } - }) + } } func isNil[T any](t T) bool { diff --git a/cl/beacon/handler/handler.go b/cl/beacon/handler/handler.go index 264e7195cda..b097f93bbda 100644 --- a/cl/beacon/handler/handler.go +++ b/cl/beacon/handler/handler.go @@ -228,12 +228,12 @@ func (a *ApiHandler) init() { if a.routerCfg.Node { r.Route("/node", func(r chi.Router) { r.Get("/health", a.GetEthV1NodeHealth) - r.Get("/version", a.GetEthV1NodeVersion) - r.Get("/peer_count", a.GetEthV1NodePeerCount) - r.Get("/peers", a.GetEthV1NodePeersInfos) - r.Get("/peers/{peer_id}", a.GetEthV1NodePeerInfos) - r.Get("/identity", a.GetEthV1NodeIdentity) - r.Get("/syncing", a.GetEthV1NodeSyncing) + r.Get("/version", beaconhttp.HandleEndpointFunc(a.GetEthV1NodeVersion)) + r.Get("/peer_count", beaconhttp.HandleEndpointFunc(a.GetEthV1NodePeerCount)) + r.Get("/peers", beaconhttp.HandleEndpointFunc(a.GetEthV1NodePeersInfos)) + r.Get("/peers/{peer_id}", beaconhttp.HandleEndpointFunc(a.GetEthV1NodePeerInfos)) + r.Get("/identity", beaconhttp.HandleEndpointFunc(a.GetEthV1NodeIdentity)) + r.Get("/syncing", beaconhttp.HandleEndpointFunc(a.GetEthV1NodeSyncing)) }) } diff --git a/cl/beacon/handler/node.go b/cl/beacon/handler/node.go index c1f900a66f9..9ace8716cb5 100644 --- a/cl/beacon/handler/node.go +++ b/cl/beacon/handler/node.go @@ -17,7 +17,7 @@ package handler import ( - "encoding/json" + "errors" "fmt" "net/http" "runtime" @@ -60,37 +60,29 @@ func (a *ApiHandler) GetEthV1NodeHealth(w http.ResponseWriter, r *http.Request) w.WriteHeader(http.StatusOK) } -func (a *ApiHandler) GetEthV1NodeVersion(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodeVersion(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { // Get OS and Arch - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": map[string]interface{}{ - "version": fmt.Sprintf("Caplin/%s %s/%s", a.version, runtime.GOOS, runtime.GOARCH), - }, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } + return newBeaconResponse(map[string]interface{}{ + "version": fmt.Sprintf("Caplin/%s %s/%s", a.version, runtime.GOOS, runtime.GOARCH), + }), nil } -func (a *ApiHandler) GetEthV1NodePeerCount(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodePeerCount(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { ret, err := a.sentinel.GetPeers(r.Context(), &sentinel.EmptyMessage{}) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + return nil, beaconhttp.NewEndpointError(http.StatusInternalServerError, err) } + // all fields should be converted to string - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": map[string]interface{}{ - "connected": strconv.FormatUint(ret.Connected, 10), - "disconnected": strconv.FormatUint(ret.Disconnected, 10), - "connecting": strconv.FormatUint(ret.Connecting, 10), - "disconnecting": strconv.FormatUint(ret.Disconnecting, 10), - }, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } + return newBeaconResponse(map[string]interface{}{ + "connected": strconv.FormatUint(ret.Connected, 10), + "disconnected": strconv.FormatUint(ret.Disconnected, 10), + "connecting": strconv.FormatUint(ret.Connecting, 10), + "disconnecting": strconv.FormatUint(ret.Disconnecting, 10), + }), nil } -func (a *ApiHandler) GetEthV1NodePeersInfos(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodePeersInfos(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { state := r.URL.Query().Get("state") direction := r.URL.Query().Get("direction") @@ -107,8 +99,7 @@ func (a *ApiHandler) GetEthV1NodePeersInfos(w http.ResponseWriter, r *http.Reque State: stateIn, }) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + return nil, beaconhttp.NewEndpointError(http.StatusInternalServerError, err) } peers := make([]peer, 0, len(ret.Peers)) for i := range ret.Peers { @@ -121,80 +112,64 @@ func (a *ApiHandler) GetEthV1NodePeersInfos(w http.ResponseWriter, r *http.Reque AgentVersion: ret.Peers[i].AgentVersion, }) } - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": peers, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } + + return newBeaconResponse(peers), nil } -func (a *ApiHandler) GetEthV1NodePeerInfos(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodePeerInfos(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { pid, err := beaconhttp.StringFromRequest(r, "peer_id") if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return + return nil, beaconhttp.NewEndpointError(http.StatusBadRequest, err) } ret, err := a.sentinel.PeersInfo(r.Context(), &sentinel.PeersInfoRequest{}) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + return nil, beaconhttp.NewEndpointError(http.StatusInternalServerError, err) } // find the peer with matching enr for _, p := range ret.Peers { if p.Pid == pid { - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": peer{ - PeerID: p.Pid, - State: p.State, - Enr: p.Enr, - LastSeenP2PAddress: p.Address, - Direction: p.Direction, - AgentVersion: p.AgentVersion, - }, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - return + return newBeaconResponse(peer{ + PeerID: p.Pid, + State: p.State, + Enr: p.Enr, + LastSeenP2PAddress: p.Address, + Direction: p.Direction, + AgentVersion: p.AgentVersion, + }), nil } } - http.Error(w, "peer not found", http.StatusNotFound) + + return nil, beaconhttp.NewEndpointError(http.StatusNotFound, errors.New("peer not found")) } -func (a *ApiHandler) GetEthV1NodeIdentity(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodeIdentity(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { id, err := a.sentinel.Identity(r.Context(), &sentinel.EmptyMessage{}) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + return nil, beaconhttp.NewEndpointError(http.StatusInternalServerError, err) } - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": map[string]interface{}{ - "peer_id": id.Pid, - "enr": id.Enr, - "p2p_addresses": id.P2PAddresses, - "discovery_addresses": id.DiscoveryAddresses, - "metadata": map[string]interface{}{ - "seq": strconv.FormatUint(id.Metadata.Seq, 10), - "attnets": id.Metadata.Attnets, - "syncnets": id.Metadata.Syncnets, - }, + + return newBeaconResponse(map[string]interface{}{ + "peer_id": id.Pid, + "enr": id.Enr, + "p2p_addresses": id.P2PAddresses, + "discovery_addresses": id.DiscoveryAddresses, + "metadata": map[string]interface{}{ + "seq": strconv.FormatUint(id.Metadata.Seq, 10), + "attnets": id.Metadata.Attnets, + "syncnets": id.Metadata.Syncnets, }, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } + }), nil } -func (a *ApiHandler) GetEthV1NodeSyncing(w http.ResponseWriter, r *http.Request) { +func (a *ApiHandler) GetEthV1NodeSyncing(w http.ResponseWriter, r *http.Request) (*beaconhttp.BeaconResponse, error) { currentSlot := a.ethClock.GetCurrentSlot() - if err := json.NewEncoder(w).Encode(map[string]interface{}{ - "data": map[string]interface{}{ + return newBeaconResponse( + map[string]interface{}{ "head_slot": strconv.FormatUint(a.syncedData.HeadSlot(), 10), "sync_distance": strconv.FormatUint(currentSlot-a.syncedData.HeadSlot(), 10), "is_syncing": a.syncedData.Syncing(), "is_optimistic": false, // needs to change "el_offline": false, - }, - }); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } + }), nil } From 1337da1acb317aa65e398c3b33aad1f107e98764 Mon Sep 17 00:00:00 2001 From: bloxster <40316187+bloxster@users.noreply.github.com> Date: Sat, 4 Jan 2025 17:01:39 +0100 Subject: [PATCH 18/28] Corrected "accessor" folder mistyping (#13318) Corrected from "accessors" to "accessor" --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7355131e8a..627a2c2dd4c 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ datadir domain # Latest State history # Historical values idx # InvertedIndices: can search/filtering/union/intersect them - to find historical data. like eth_getLogs or trace_transaction - accessors # Additional (generated) indices of history - have "random-touch" read-pattern. They can serve only `Get` requests (no search/filters). + accessor # Additional (generated) indices of history - have "random-touch" read-pattern. They can serve only `Get` requests (no search/filters). txpool # pending transactions. safe to remove. nodes # p2p peers. safe to remove. temp # used to sort data bigger than RAM. can grow to ~100gb. cleaned at startup. @@ -155,11 +155,11 @@ datadir domain # link to fast disk history idx - accessors + accessor temp # buffers to sort data >> RAM. sequential-buffered IO - is slow-disk-friendly # Example: how to speedup history access: -# - go step-by-step - first try store `accessors` on fast disk +# - go step-by-step - first try store `accessor` on fast disk # - if speed is not good enough: `idx` # - if still not enough: `history` ``` From 3820a8da1c0c4a2621a15cf83d7a405f78f95f42 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sat, 4 Jan 2025 23:38:12 +0100 Subject: [PATCH 19/28] Caplin: added ability to do recent chain sync + change in flags name (#13263) Here are some changes to flags names: `--caplin.archive` -> `--caplin.states-archive` `--caplin.backfiiling` -> `--caplin.blocks-archive` `--caplin.backfiiling.blobs` -> `--caplin.blobs-archive` Lastly added a new flag: `--caplin.blobs-immediate-backfill` which will backfill the last 18 days worth of blobs for an op-node or other uses. --- cl/clparams/config.go | 15 +++++--- cl/persistence/blob_storage/blob_db.go | 9 +++-- cl/phase1/stages/cleanup_and_pruning.go | 2 +- cl/phase1/stages/clstages.go | 37 ++++++++++--------- cl/phase1/stages/stage_history_download.go | 42 +++++++++++++++------- cmd/capcli/cli.go | 2 +- cmd/caplin/caplin1/run.go | 14 +++----- cmd/utils/flags.go | 33 ++++++++++------- turbo/cli/default_flags.go | 8 +++-- turbo/stages/stageloop.go | 12 +++---- 10 files changed, 101 insertions(+), 73 deletions(-) diff --git a/cl/clparams/config.go b/cl/clparams/config.go index 2be5df351b1..20682c3ec4c 100644 --- a/cl/clparams/config.go +++ b/cl/clparams/config.go @@ -41,12 +41,15 @@ import ( var LatestStateFileName = "latest.ssz_snappy" type CaplinConfig struct { - Backfilling bool - BlobBackfilling bool + // Archive related config + ArchiveBlocks bool + ArchiveBlobs bool + ArchiveStates bool + ImmediateBlobsBackfilling bool BlobPruningDisabled bool - Archive bool SnapshotGenerationEnabled bool - NetworkId NetworkType + // Network related config + NetworkId NetworkType // DisableCheckpointSync is optional and is used to disable checkpoint sync used by default in the node DisabledCheckpointSync bool // CaplinMeVRelayUrl is optional and is used to connect to the external builder service. @@ -341,7 +344,11 @@ var ConfigurableCheckpointsURLs = []string{} // MinEpochsForBlockRequests equal to MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT / 2 func (b *BeaconChainConfig) MinEpochsForBlockRequests() uint64 { return b.MinValidatorWithdrawabilityDelay + (b.ChurnLimitQuotient)/2 +} +// MinSlotsForBlobRequests equal to MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUEST * SLOTS_PER_EPOCH +func (b *BeaconChainConfig) MinSlotsForBlobsSidecarsRequest() uint64 { + return b.MinEpochsForBlobsSidecarsRequest * b.SlotsPerEpoch } type ConfigByte byte diff --git a/cl/persistence/blob_storage/blob_db.go b/cl/persistence/blob_storage/blob_db.go index 0377bde4d7a..0df212207c5 100644 --- a/cl/persistence/blob_storage/blob_db.go +++ b/cl/persistence/blob_storage/blob_db.go @@ -39,7 +39,9 @@ import ( "github.com/spf13/afero" ) -const subdivisionSlot = 10_000 +const ( + subdivisionSlot = 10_000 +) type BlobStorage interface { WriteBlobSidecars(ctx context.Context, blockRoot libcommon.Hash, blobSidecars []*cltypes.BlobSidecar) error @@ -160,8 +162,9 @@ func (bs *BlobStore) Prune() error { currentSlot -= bs.slotsKept currentSlot = (currentSlot / subdivisionSlot) * subdivisionSlot var startPrune uint64 - if currentSlot >= 1_000_000 { - startPrune = currentSlot - 1_000_000 + minSlotsForBlobSidecarRequest := bs.beaconChainConfig.MinSlotsForBlobsSidecarsRequest() + if currentSlot >= minSlotsForBlobSidecarRequest { + startPrune = currentSlot - minSlotsForBlobSidecarRequest } // delete all the folders that are older than slotsKept for i := startPrune; i < currentSlot; i += subdivisionSlot { diff --git a/cl/phase1/stages/cleanup_and_pruning.go b/cl/phase1/stages/cleanup_and_pruning.go index cdd14cb7f55..2982f3ff6ff 100644 --- a/cl/phase1/stages/cleanup_and_pruning.go +++ b/cl/phase1/stages/cleanup_and_pruning.go @@ -16,7 +16,7 @@ func cleanupAndPruning(ctx context.Context, logger log.Logger, cfg *Cfg, args Ar defer tx.Rollback() pruneDistance := uint64(1_000_000) - if !cfg.backfilling { + if !cfg.caplinConfig.ArchiveBlocks { if err := beacon_indicies.PruneBlocks(ctx, tx, args.seenSlot-pruneDistance); err != nil { return err } diff --git a/cl/phase1/stages/clstages.go b/cl/phase1/stages/clstages.go index ab842a29ec4..dbcd73642c7 100644 --- a/cl/phase1/stages/clstages.go +++ b/cl/phase1/stages/clstages.go @@ -64,8 +64,8 @@ type Cfg struct { blobStore blob_storage.BlobStorage attestationDataProducer attestation_producer.AttestationDataProducer validatorMonitor monitor.ValidatorMonitor - - hasDownloaded, backfilling, blobBackfilling bool + caplinConfig clparams.CaplinConfig + hasDownloaded bool } type Args struct { @@ -91,8 +91,7 @@ func ClStagesCfg( blockReader freezeblocks.BeaconSnapshotReader, dirs datadir.Dirs, syncBackLoopLimit uint64, - backfilling bool, - blobBackfilling bool, + caplinConfig clparams.CaplinConfig, syncedData *synced_data.SyncedDataManager, emitters *beaconevents.EventEmitter, blobStore blob_storage.BlobStorage, @@ -100,24 +99,24 @@ func ClStagesCfg( validatorMonitor monitor.ValidatorMonitor, ) *Cfg { return &Cfg{ - rpc: rpc, - antiquary: antiquary, - ethClock: ethClock, - beaconCfg: beaconCfg, - state: state, - executionClient: executionClient, - gossipManager: gossipManager, - forkChoice: forkChoice, - dirs: dirs, - indiciesDB: indiciesDB, - sn: sn, - blockReader: blockReader, - backfilling: backfilling, + rpc: rpc, + antiquary: antiquary, + ethClock: ethClock, + caplinConfig: caplinConfig, + beaconCfg: beaconCfg, + state: state, + executionClient: executionClient, + gossipManager: gossipManager, + forkChoice: forkChoice, + dirs: dirs, + indiciesDB: indiciesDB, + sn: sn, + blockReader: blockReader, + syncedData: syncedData, emitter: emitters, blobStore: blobStore, blockCollector: block_collector.NewBlockCollector(log.Root(), executionClient, beaconCfg, syncBackLoopLimit, dirs.Tmp), - blobBackfilling: blobBackfilling, attestationDataProducer: attestationDataProducer, validatorMonitor: validatorMonitor, } @@ -254,7 +253,7 @@ func ConsensusClStages(ctx context.Context, startingSlot := cfg.state.LatestBlockHeader().Slot downloader := network2.NewBackwardBeaconDownloader(ctx, cfg.rpc, cfg.sn, cfg.executionClient, cfg.indiciesDB) - if err := SpawnStageHistoryDownload(StageHistoryReconstruction(downloader, cfg.antiquary, cfg.sn, cfg.indiciesDB, cfg.executionClient, cfg.beaconCfg, cfg.backfilling, cfg.blobBackfilling, false, startingRoot, startingSlot, cfg.dirs.Tmp, 600*time.Millisecond, cfg.blockCollector, cfg.blockReader, cfg.blobStore, logger), context.Background(), logger); err != nil { + if err := SpawnStageHistoryDownload(StageHistoryReconstruction(downloader, cfg.antiquary, cfg.sn, cfg.indiciesDB, cfg.executionClient, cfg.beaconCfg, cfg.caplinConfig, false, startingRoot, startingSlot, cfg.dirs.Tmp, 600*time.Millisecond, cfg.blockCollector, cfg.blockReader, cfg.blobStore, logger), context.Background(), logger); err != nil { cfg.hasDownloaded = false return err } diff --git a/cl/phase1/stages/stage_history_download.go b/cl/phase1/stages/stage_history_download.go index 3f3c3ad3bda..276522c4dfd 100644 --- a/cl/phase1/stages/stage_history_download.go +++ b/cl/phase1/stages/stage_history_download.go @@ -44,8 +44,7 @@ type StageHistoryReconstructionCfg struct { downloader *network.BackwardBeaconDownloader sn *freezeblocks.CaplinSnapshots startingRoot libcommon.Hash - backfilling bool - blobsBackfilling bool + caplinConfig clparams.CaplinConfig waitForAllRoutines bool startingSlot uint64 tmpdir string @@ -61,7 +60,7 @@ type StageHistoryReconstructionCfg struct { const logIntervalTime = 30 * time.Second -func StageHistoryReconstruction(downloader *network.BackwardBeaconDownloader, antiquary *antiquary.Antiquary, sn *freezeblocks.CaplinSnapshots, indiciesDB kv.RwDB, engine execution_client.ExecutionEngine, beaconCfg *clparams.BeaconChainConfig, backfilling, blobsBackfilling, waitForAllRoutines bool, startingRoot libcommon.Hash, startinSlot uint64, tmpdir string, backfillingThrottling time.Duration, executionBlocksCollector block_collector.BlockCollector, blockReader freezeblocks.BeaconSnapshotReader, blobStorage blob_storage.BlobStorage, logger log.Logger) StageHistoryReconstructionCfg { +func StageHistoryReconstruction(downloader *network.BackwardBeaconDownloader, antiquary *antiquary.Antiquary, sn *freezeblocks.CaplinSnapshots, indiciesDB kv.RwDB, engine execution_client.ExecutionEngine, beaconCfg *clparams.BeaconChainConfig, caplinConfig clparams.CaplinConfig, waitForAllRoutines bool, startingRoot libcommon.Hash, startinSlot uint64, tmpdir string, backfillingThrottling time.Duration, executionBlocksCollector block_collector.BlockCollector, blockReader freezeblocks.BeaconSnapshotReader, blobStorage blob_storage.BlobStorage, logger log.Logger) StageHistoryReconstructionCfg { return StageHistoryReconstructionCfg{ beaconCfg: beaconCfg, downloader: downloader, @@ -70,7 +69,7 @@ func StageHistoryReconstruction(downloader *network.BackwardBeaconDownloader, an startingSlot: startinSlot, waitForAllRoutines: waitForAllRoutines, logger: logger, - backfilling: backfilling, + caplinConfig: caplinConfig, indiciesDB: indiciesDB, antiquary: antiquary, engine: engine, @@ -78,7 +77,6 @@ func StageHistoryReconstruction(downloader *network.BackwardBeaconDownloader, an backfillingThrottling: backfillingThrottling, executionBlocksCollector: executionBlocksCollector, blockReader: blockReader, - blobsBackfilling: blobsBackfilling, blobStorage: blobStorage, } } @@ -90,7 +88,7 @@ func SpawnStageHistoryDownload(cfg StageHistoryReconstructionCfg, ctx context.Co currentSlot := cfg.startingSlot if !clparams.SupportBackfilling(cfg.beaconCfg.DepositNetworkID) { - cfg.backfilling = false // disable backfilling if not on a supported network + cfg.caplinConfig.ArchiveBlocks = false // disable backfilling if not on a supported network } // Start the procedure @@ -112,17 +110,26 @@ func SpawnStageHistoryDownload(cfg StageHistoryReconstructionCfg, ctx context.Co return false, err } defer tx.Rollback() + // handle the case where the block is a CL block including an execution payload if blk.Version() >= clparams.BellatrixVersion { currEth1Progress.Store(int64(blk.Block.Body.ExecutionPayload.BlockNumber)) } slot := blk.Block.Slot isInCLSnapshots := cfg.sn.SegmentsMax() > blk.Block.Slot + // Skip blocks that are already in the snapshots if !isInCLSnapshots { if err := beacon_indicies.WriteBeaconBlockAndIndicies(ctx, tx, blk, true); err != nil { return false, err } } + // we need to backfill an equivalent number of blobs to the blocks + hasDownloadEnoughForImmediateBlobsBackfilling := true + if cfg.caplinConfig.ImmediateBlobsBackfilling { + // download twice the number of blocks needed for good measure + blocksToDownload := cfg.beaconCfg.MinSlotsForBlobsSidecarsRequest() * 2 + hasDownloadEnoughForImmediateBlobsBackfilling = cfg.startingSlot < blocksToDownload || slot > cfg.startingSlot-blocksToDownload + } if cfg.engine != nil && cfg.engine.SupportInsertion() && blk.Version() >= clparams.BellatrixVersion { frozenBlocksInEL := cfg.engine.FrozenBlocks(ctx) @@ -143,8 +150,8 @@ func SpawnStageHistoryDownload(cfg StageHistoryReconstructionCfg, ctx context.Co return false, tx.Commit() } } - if hasELBlock && !cfg.backfilling { - return true, tx.Commit() + if hasELBlock && !cfg.caplinConfig.ArchiveBlocks { + return hasDownloadEnoughForImmediateBlobsBackfilling, tx.Commit() } } isInElSnapshots := true @@ -159,7 +166,10 @@ func SpawnStageHistoryDownload(cfg StageHistoryReconstructionCfg, ctx context.Co if slot == 0 || (isInCLSnapshots && isInElSnapshots) { return true, tx.Commit() } - return (!cfg.backfilling || slot <= cfg.sn.SegmentsMax()) && (slot <= destinationSlotForEL || isInElSnapshots), tx.Commit() + return hasDownloadEnoughForImmediateBlobsBackfilling && + (!cfg.caplinConfig.ArchiveBlocks || slot <= cfg.sn.SegmentsMax()) && + (slot <= destinationSlotForEL || isInElSnapshots), + tx.Commit() }) prevProgress := cfg.downloader.Progress() @@ -228,14 +238,15 @@ func SpawnStageHistoryDownload(cfg StageHistoryReconstructionCfg, ctx context.Co } } cfg.antiquary.NotifyBackfilled() - if cfg.backfilling { + fmt.Println(cfg.caplinConfig.ArchiveBlocks) + if cfg.caplinConfig.ArchiveBlocks { cfg.logger.Info("Full backfilling finished") } else { cfg.logger.Info("Missing blocks download finished (note: this does not mean that the history is complete, only that the missing blocks need for sync have been downloaded)") } close(finishCh) - if cfg.blobsBackfilling { + if cfg.caplinConfig.ArchiveBlobs || cfg.caplinConfig.ImmediateBlobsBackfilling { go func() { if err := downloadBlobHistoryWorker(cfg, ctx, true, logger); err != nil { logger.Error("Error downloading blobs", "err", err) @@ -288,6 +299,11 @@ func downloadBlobHistoryWorker(cfg StageHistoryReconstructionCfg, ctx context.Co prevLogSlot := currentSlot prevTime := time.Now() targetSlot := cfg.beaconCfg.DenebForkEpoch * cfg.beaconCfg.SlotsPerEpoch + // in case of immediate blobs backfilling we need to backfill the blobs for the last relevant epochs + if !cfg.caplinConfig.ArchiveBlobs && cfg.caplinConfig.ImmediateBlobsBackfilling { + targetSlot = currentSlot - min(currentSlot, cfg.beaconCfg.MinSlotsForBlobsSidecarsRequest()) + } + logger.Info("[Blobs-Downloader] Downloading blobs backwards", "slot", currentSlot) for currentSlot >= targetSlot { if currentSlot <= cfg.sn.FrozenBlobs() { @@ -346,7 +362,7 @@ func downloadBlobHistoryWorker(cfg StageHistoryReconstructionCfg, ctx context.Co prevLogSlot = currentSlot prevTime = time.Now() - logger.Info("Downloading blobs backwards", "slot", currentSlot, "blks/sec", blkSecStr) + logger.Info("[Blobs-Downloader] Downloading blobs backwards", "slot", currentSlot, "blks/sec", blkSecStr) default: } // Generate the request @@ -381,7 +397,7 @@ func downloadBlobHistoryWorker(cfg StageHistoryReconstructionCfg, ctx context.Co } } if shouldLog { - logger.Info("Blob history download finished successfully") + logger.Info("[Blobs-Downloader] Blob history download finished successfully") } cfg.antiquary.NotifyBlobBackfilled() return nil diff --git a/cmd/capcli/cli.go b/cmd/capcli/cli.go index ae5250199be..75f5f59f6ea 100644 --- a/cmd/capcli/cli.go +++ b/cmd/capcli/cli.go @@ -184,7 +184,7 @@ func (c *Chain) Run(ctx *Context) error { } downloader := network.NewBackwardBeaconDownloader(ctx, beacon, nil, nil, db) - cfg := stages.StageHistoryReconstruction(downloader, antiquary.NewAntiquary(ctx, nil, nil, nil, nil, dirs, nil, nil, nil, nil, nil, nil, nil, false, false, false, false, nil), csn, db, nil, beaconConfig, true, false, true, bRoot, bs.Slot(), "/tmp", 300*time.Millisecond, nil, nil, blobStorage, log.Root()) + cfg := stages.StageHistoryReconstruction(downloader, antiquary.NewAntiquary(ctx, nil, nil, nil, nil, dirs, nil, nil, nil, nil, nil, nil, nil, false, false, false, false, nil), csn, db, nil, beaconConfig, clparams.CaplinConfig{}, true, bRoot, bs.Slot(), "/tmp", 300*time.Millisecond, nil, nil, blobStorage, log.Root()) return stages.SpawnStageHistoryDownload(cfg, ctx, log.Root()) } diff --git a/cmd/caplin/caplin1/run.go b/cmd/caplin/caplin1/run.go index 81d4cbd331a..ed2bb0730c4 100644 --- a/cmd/caplin/caplin1/run.go +++ b/cmd/caplin/caplin1/run.go @@ -133,11 +133,6 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi dirs datadir.Dirs, eth1Getter snapshot_format.ExecutionBlockReaderByNumber, snDownloader proto_downloader.DownloaderClient, creds credentials.TransportCredentials, snBuildSema *semaphore.Weighted) error { - var ( - backfilling = config.Backfilling - blobBackfilling = config.BlobBackfilling - states = config.Archive - ) var networkConfig *clparams.NetworkConfig var beaconConfig *clparams.BeaconChainConfig @@ -214,7 +209,7 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi ethClock := eth_clock.NewEthereumClock(state.GenesisTime(), state.GenesisValidatorsRoot(), beaconConfig) pruneBlobDistance := uint64(128600) - if config.BlobBackfilling || config.BlobPruningDisabled { + if config.ArchiveBlobs || config.BlobPruningDisabled { pruneBlobDistance = math.MaxUint64 } @@ -391,7 +386,7 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi vTables := state_accessors.NewStaticValidatorTable() // Read the current table - if states { + if config.ArchiveStates { if err := state_accessors.ReadValidatorsTable(tx, vTables); err != nil { return err } @@ -400,7 +395,7 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi if err := stateSnapshots.OpenFolder(); err != nil { return err } - antiq := antiquary.NewAntiquary(ctx, blobStorage, genesisState, vTables, beaconConfig, dirs, snDownloader, indexDB, stateSnapshots, csn, rcsn, syncedDataManager, logger, states, backfilling, blobBackfilling, config.SnapshotGenerationEnabled, snBuildSema) + antiq := antiquary.NewAntiquary(ctx, blobStorage, genesisState, vTables, beaconConfig, dirs, snDownloader, indexDB, stateSnapshots, csn, rcsn, syncedDataManager, logger, config.ArchiveStates, config.ArchiveBlocks, config.ArchiveBlobs, config.SnapshotGenerationEnabled, snBuildSema) // Create the antiquary go func() { if err := antiq.Loop(); err != nil { @@ -470,8 +465,7 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi rcsn, dirs, config.LoopBlockLimit, - backfilling, - blobBackfilling, + config, syncedDataManager, emitters, blobStorage, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 7e63d1cb44d..97ae92d9205 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1006,18 +1006,28 @@ var ( Usage: "Print in logs RPC requests slower than given threshold: 100ms, 1s, 1m. Exluded methods: " + strings.Join(rpccfg.SlowLogBlackList, ","), Value: 0, } - CaplinBackfillingFlag = cli.BoolFlag{ - Name: "caplin.backfilling", + CaplinArchiveBlocksFlag = cli.BoolFlag{ + Name: "caplin.blocks-archive", Usage: "sets whether backfilling is enabled for caplin", Value: false, } - CaplinBlobBackfillingFlag = cli.BoolFlag{ - Name: "caplin.backfilling.blob", + CaplinArchiveStatesFlag = cli.BoolFlag{ + Name: "caplin.states-archive", + Usage: "enables archival node for historical states in caplin (it will enable block archival as well)", + Value: false, + } + CaplinArchiveBlobsFlag = cli.BoolFlag{ + Name: "caplin.blobs-archive", Usage: "sets whether backfilling is enabled for caplin", Value: false, } + CaplinImmediateBlobBackfillFlag = cli.BoolFlag{ + Name: "caplin.blobs-immediate-backfill", + Usage: "sets whether caplin should immediatelly backfill blobs (4096 epochs)", + Value: false, + } CaplinDisableBlobPruningFlag = cli.BoolFlag{ - Name: "caplin.backfilling.blob.no-pruning", + Name: "caplin.blobs-no-pruning", Usage: "disable blob pruning in caplin", Value: false, } @@ -1026,11 +1036,7 @@ var ( Usage: "disable checkpoint sync in caplin", Value: false, } - CaplinArchiveFlag = cli.BoolFlag{ - Name: "caplin.archive", - Usage: "enables archival node in caplin", - Value: false, - } + CaplinEnableSnapshotGeneration = cli.BoolFlag{ Name: "caplin.snapgen", Usage: "enables snapshot generation in caplin", @@ -1753,13 +1759,14 @@ func setBeaconAPI(ctx *cli.Context, cfg *ethconfig.Config) error { func setCaplin(ctx *cli.Context, cfg *ethconfig.Config) { // Caplin's block's backfilling is enabled if any of the following flags are set - cfg.CaplinConfig.Backfilling = ctx.Bool(CaplinBackfillingFlag.Name) || ctx.Bool(CaplinArchiveFlag.Name) || ctx.Bool(CaplinBlobBackfillingFlag.Name) + cfg.CaplinConfig.ArchiveBlocks = ctx.Bool(CaplinArchiveBlocksFlag.Name) || ctx.Bool(CaplinArchiveStatesFlag.Name) || ctx.Bool(CaplinArchiveBlobsFlag.Name) cfg.CaplinConfig.SnapshotGenerationEnabled = ctx.Bool(CaplinEnableSnapshotGeneration.Name) // More granularity here. - cfg.CaplinConfig.BlobBackfilling = ctx.Bool(CaplinBlobBackfillingFlag.Name) + cfg.CaplinConfig.ArchiveBlobs = ctx.Bool(CaplinArchiveBlobsFlag.Name) + cfg.CaplinConfig.ImmediateBlobsBackfilling = ctx.Bool(CaplinImmediateBlobBackfillFlag.Name) cfg.CaplinConfig.BlobPruningDisabled = ctx.Bool(CaplinDisableBlobPruningFlag.Name) cfg.CaplinConfig.DisabledCheckpointSync = ctx.Bool(CaplinDisableCheckpointSyncFlag.Name) - cfg.CaplinConfig.Archive = ctx.Bool(CaplinArchiveFlag.Name) + cfg.CaplinConfig.ArchiveStates = ctx.Bool(CaplinArchiveStatesFlag.Name) cfg.CaplinConfig.MevRelayUrl = ctx.String(CaplinMevRelayUrl.Name) cfg.CaplinConfig.EnableValidatorMonitor = ctx.Bool(CaplinValidatorMonitorFlag.Name) if checkpointUrls := ctx.StringSlice(CaplinCheckpointSyncUrlFlag.Name); len(checkpointUrls) > 0 { diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index f62cfe22636..e05e469cf24 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -213,11 +213,13 @@ var DefaultFlags = []cli.Flag{ &utils.BeaconApiProtocolFlag, &utils.BeaconApiIdleTimeoutFlag, - &utils.CaplinBackfillingFlag, - &utils.CaplinBlobBackfillingFlag, + &utils.CaplinArchiveBlocksFlag, + &utils.CaplinArchiveBlobsFlag, + &utils.CaplinArchiveStatesFlag, + &utils.CaplinImmediateBlobBackfillFlag, + &utils.CaplinDisableBlobPruningFlag, &utils.CaplinDisableCheckpointSyncFlag, - &utils.CaplinArchiveFlag, &utils.CaplinEnableSnapshotGeneration, &utils.CaplinMevRelayUrl, &utils.CaplinValidatorMonitorFlag, diff --git a/turbo/stages/stageloop.go b/turbo/stages/stageloop.go index 716926b6a4c..3c3db298934 100644 --- a/turbo/stages/stageloop.go +++ b/turbo/stages/stageloop.go @@ -690,7 +690,7 @@ func NewDefaultStages(ctx context.Context, runInTestMode := cfg.ImportMode return stagedsync.DefaultStages(ctx, - stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.Backfilling, cfg.CaplinConfig.BlobBackfilling, cfg.CaplinConfig.Archive, silkworm, cfg.Prune), + stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.ArchiveBlocks, cfg.CaplinConfig.ArchiveBlobs, cfg.CaplinConfig.ArchiveStates, silkworm, cfg.Prune), stagedsync.StageHeadersCfg(db, controlServer.Hd, controlServer.Bd, *controlServer.ChainConfig, cfg.Sync, controlServer.SendHeaderRequest, controlServer.PropagateNewBlockHashes, controlServer.Penalize, cfg.BatchSize, p2pCfg.NoDiscovery, blockReader, blockWriter, dirs.Tmp, notifications), stagedsync.StageBorHeimdallCfg(db, snapDb, stagedsync.MiningState{}, *controlServer.ChainConfig, heimdallClient, heimdallStore, bridgeStore, blockReader, controlServer.Hd, controlServer.Penalize, recents, signatures, cfg.WithHeimdallWaypointRecording, nil), stagedsync.StageBlockHashesCfg(db, dirs.Tmp, controlServer.ChainConfig, blockWriter), @@ -730,7 +730,7 @@ func NewPipelineStages(ctx context.Context, if len(cfg.Sync.UploadLocation) == 0 { return stagedsync.PipelineStages(ctx, - stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.Backfilling, cfg.CaplinConfig.BlobBackfilling, cfg.CaplinConfig.Archive, silkworm, cfg.Prune), + stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.ArchiveBlocks, cfg.CaplinConfig.ArchiveBlobs, cfg.CaplinConfig.ArchiveStates, silkworm, cfg.Prune), stagedsync.StageBlockHashesCfg(db, dirs.Tmp, controlServer.ChainConfig, blockWriter), stagedsync.StageSendersCfg(db, controlServer.ChainConfig, cfg.Sync, false, dirs.Tmp, cfg.Prune, blockReader, controlServer.Hd), stagedsync.StageExecuteBlocksCfg(db, cfg.Prune, cfg.BatchSize, controlServer.ChainConfig, controlServer.Engine, &vm.Config{}, notifications, cfg.StateStream, false, dirs, blockReader, controlServer.Hd, cfg.Genesis, cfg.Sync, SilkwormForExecutionStage(silkworm, cfg)), @@ -739,7 +739,7 @@ func NewPipelineStages(ctx context.Context, } return stagedsync.UploaderPipelineStages(ctx, - stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.Backfilling, cfg.CaplinConfig.BlobBackfilling, cfg.CaplinConfig.Archive, silkworm, cfg.Prune), + stagedsync.StageSnapshotsCfg(db, *controlServer.ChainConfig, cfg.Sync, dirs, blockRetire, snapDownloader, blockReader, notifications, cfg.InternalCL && cfg.CaplinConfig.ArchiveBlocks, cfg.CaplinConfig.ArchiveBlobs, cfg.CaplinConfig.ArchiveStates, silkworm, cfg.Prune), stagedsync.StageHeadersCfg(db, controlServer.Hd, controlServer.Bd, *controlServer.ChainConfig, cfg.Sync, controlServer.SendHeaderRequest, controlServer.PropagateNewBlockHashes, controlServer.Penalize, cfg.BatchSize, p2pCfg.NoDiscovery, blockReader, blockWriter, dirs.Tmp, notifications), stagedsync.StageBlockHashesCfg(db, dirs.Tmp, controlServer.ChainConfig, blockWriter), stagedsync.StageSendersCfg(db, controlServer.ChainConfig, cfg.Sync, false, dirs.Tmp, cfg.Prune, blockReader, controlServer.Hd), @@ -795,9 +795,9 @@ func NewPolygonSyncStages( snapDownloader, blockReader, notifications, - config.InternalCL && config.CaplinConfig.Backfilling, - config.CaplinConfig.BlobBackfilling, - config.CaplinConfig.Archive, + config.InternalCL && config.CaplinConfig.ArchiveBlocks, + config.CaplinConfig.ArchiveBlobs, + config.CaplinConfig.ArchiveStates, silkworm, config.Prune, ), From 32da1c983b8f20536e1ee8f6ac112c788baea60e Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:56:25 +0000 Subject: [PATCH 20/28] prometheus: remove outdated charts (#13331) removes outdated charts we added as part of https://github.com/erigontech/erigon/pull/12927 because: 1. these were changed and superseded by new versions in erigon_internals as part of https://github.com/erigontech/erigon/pull/13309 2. no need to duplicate these both in `prometheus/dashboards/erigon.json` and `prometheus/dashboards/erigon_internals.json` - only `erigon_internals.json` is enough --- cmd/prometheus/dashboards/erigon.json | 327 -------------------------- 1 file changed, 327 deletions(-) diff --git a/cmd/prometheus/dashboards/erigon.json b/cmd/prometheus/dashboards/erigon.json index 732cbe2338a..78dc8885059 100644 --- a/cmd/prometheus/dashboards/erigon.json +++ b/cmd/prometheus/dashboards/erigon.json @@ -1199,333 +1199,6 @@ "title": "Block consume delay", "type": "row" }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 16, - "y": 25 - }, - "id": 201, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.2.0-74515", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "update_fork_choice{type=\"arrival_delay\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "arrival_delay: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "update_fork_choice{type=\"execution_duration\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "execution_duration: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "wiggle_duration{instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "wiggle_duration: {{instance}}", - "range": true, - "refId": "C" - } - ], - "title": "Update fork delays", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 16, - "y": 25 - }, - "id": 201, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.2.0-74515", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "update_fork_choice{type=\"fork_depth\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "fork_depth: {{instance}}", - "range": true, - "refId": "A" - } - ], - "title": "Update fork depth", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 16, - "y": 25 - }, - "id": 201, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.2.0-74515", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "waypoint_length{type=\"checkpoint\",instance=~\"$instance\"}", - "hide": false, - "legendFormat": "checkpoint_length: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "waypoint_length{type=\"milestone\",instance=~\"$instance\"}", - "hide": false, - "legendFormat": "milestone_length: {{instance}}", - "range": true, - "refId": "B" - } - ], - "title": "Block finalisation", - "type": "timeseries" - }, { "datasource": { "type": "prometheus", From dc547a8f1d556b330f87eabf6ab338c0027cf206 Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Tue, 7 Jan 2025 00:20:02 +0800 Subject: [PATCH 21/28] caplin: Fix `nil` panic during error handling (#13333) Fixes #13332 --- cl/beacon/beaconhttp/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cl/beacon/beaconhttp/api.go b/cl/beacon/beaconhttp/api.go index 8a266a449cb..1aef8a84a39 100644 --- a/cl/beacon/beaconhttp/api.go +++ b/cl/beacon/beaconhttp/api.go @@ -106,6 +106,8 @@ func HandleEndpoint[T any](h EndpointHandler[T]) http.HandlerFunc { var e *EndpointError if errors.As(err, &e) { endpointError = e + } else { + endpointError = WrapEndpointError(err) } endpointError.WriteTo(w) return From dc4ffceeb8752a2155c5b250d5580e3f22baa591 Mon Sep 17 00:00:00 2001 From: Michele Modolo <70838029+michelemodolo@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:10:54 +0100 Subject: [PATCH 22/28] [automation] Backup of erigon_custom_metrics dashboard - 07 Jan 2025 (#13339) The erigon_custom_metrics dashboard got changed so the new version should overtake the currently stored one, which should in turn get archived in a compressed form Co-authored-by: Michele Modolo --- .../erigon_custom_metrics.internal.json | 4907 +++++++++-------- .../history/20250107.tar.gz | Bin 0 -> 12240 bytes 2 files changed, 2684 insertions(+), 2223 deletions(-) create mode 100644 dashboards/erigon_custom_metrics/history/20250107.tar.gz diff --git a/dashboards/erigon_custom_metrics/erigon_custom_metrics.internal.json b/dashboards/erigon_custom_metrics/erigon_custom_metrics.internal.json index 085644e9e49..b8a482cfeb1 100644 --- a/dashboards/erigon_custom_metrics/erigon_custom_metrics.internal.json +++ b/dashboards/erigon_custom_metrics/erigon_custom_metrics.internal.json @@ -28,7 +28,7 @@ "links": [], "panels": [ { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, @@ -36,108 +36,109 @@ "y": 0 }, "id": 241, - "panels": [], - "title": "Agg CL", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } - }, - "mappings": [], - "unit": "ms" - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - " dev-bm-e3-ethmainnet-n1" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [] - } - ] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 1 - }, - "id": 240, - "options": { - "displayLabels": [ - "percent", - "value" - ], - "legend": { - "displayMode": "list", - "placement": "right", - "showLegend": true, - "values": [ - "value" - ] - }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "max" - ], - "fields": "", - "values": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-79146", - "targets": [ - { - "editorMode": "code", - "exemplar": false, - "expr": "((aggregate_and_proof_signatures{instance=\"validator-bm-ethgiuweak-e3caplin-c1-n1\"}/577)*3)*0.4", - "instant": true, - "legendFormat": "Aggregate verification", - "range": false, - "refId": "A" - }, + "panels": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", - "expr": "3000", - "hide": false, - "instant": false, - "legendFormat": "Spare time", - "range": true, - "refId": "B" + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "unit": "ms" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + " dev-bm-e3-ethmainnet-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 2 + }, + "id": 240, + "options": { + "displayLabels": [ + "percent", + "value" + ], + "legend": { + "displayMode": "list", + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "max" + ], + "fields": "", + "values": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "editorMode": "code", + "exemplar": false, + "expr": "((aggregate_and_proof_signatures{instance=\"validator-bm-ethgiuweak-e3caplin-c1-n1\"}/577)*3)*0.4", + "instant": true, + "legendFormat": "Aggregate verification", + "range": false, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "3000", + "hide": false, + "instant": false, + "legendFormat": "Spare time", + "range": true, + "refId": "B" + } + ], + "title": "Aggregate verificiation per slot", + "type": "piechart" } ], - "title": "Aggregate verificiation per slot", - "type": "piechart" + "title": "Agg CL", + "type": "row" }, { "collapsed": true, @@ -145,7 +146,7 @@ "h": 1, "w": 24, "x": 0, - "y": 9 + "y": 1 }, "id": 218, "panels": [ @@ -179,7 +180,7 @@ "h": 4, "w": 12, "x": 0, - "y": 17 + "y": 160 }, "id": 219, "options": { @@ -274,7 +275,7 @@ "h": 12, "w": 12, "x": 12, - "y": 17 + "y": 160 }, "id": 220, "options": { @@ -386,7 +387,7 @@ "h": 4, "w": 12, "x": 0, - "y": 141 + "y": 284 }, "id": 222, "options": { @@ -449,7 +450,7 @@ "h": 4, "w": 12, "x": 0, - "y": 145 + "y": 288 }, "id": 223, "options": { @@ -492,7 +493,7 @@ "h": 1, "w": 24, "x": 0, - "y": 10 + "y": 2 }, "id": 212, "panels": [ @@ -522,7 +523,7 @@ "h": 8, "w": 12, "x": 0, - "y": 18 + "y": 161 }, "id": 232, "options": { @@ -679,7 +680,7 @@ "h": 8, "w": 12, "x": 12, - "y": 18 + "y": 161 }, "id": 230, "options": { @@ -773,7 +774,7 @@ "h": 8, "w": 12, "x": 0, - "y": 53 + "y": 196 }, "id": 229, "options": { @@ -834,7 +835,7 @@ "h": 8, "w": 12, "x": 12, - "y": 53 + "y": 196 }, "id": 215, "options": { @@ -923,7 +924,7 @@ "h": 8, "w": 12, "x": 0, - "y": 61 + "y": 204 }, "id": 236, "options": { @@ -995,7 +996,7 @@ "h": 8, "w": 12, "x": 12, - "y": 61 + "y": 204 }, "id": 214, "options": { @@ -1063,7 +1064,7 @@ "h": 8, "w": 12, "x": 0, - "y": 69 + "y": 212 }, "id": 235, "options": { @@ -1164,7 +1165,7 @@ "h": 8, "w": 12, "x": 12, - "y": 69 + "y": 212 }, "id": 210, "options": { @@ -1227,7 +1228,7 @@ "h": 8, "w": 12, "x": 0, - "y": 77 + "y": 220 }, "id": 234, "options": { @@ -1353,7 +1354,7 @@ "h": 8, "w": 12, "x": 12, - "y": 77 + "y": 220 }, "id": 211, "options": { @@ -1445,7 +1446,7 @@ "h": 8, "w": 12, "x": 0, - "y": 85 + "y": 228 }, "id": 231, "options": { @@ -1527,7 +1528,7 @@ "h": 8, "w": 12, "x": 12, - "y": 85 + "y": 228 }, "id": 221, "options": { @@ -1708,7 +1709,7 @@ "h": 8, "w": 12, "x": 0, - "y": 93 + "y": 236 }, "id": 216, "options": { @@ -1831,7 +1832,7 @@ "h": 8, "w": 12, "x": 12, - "y": 93 + "y": 236 }, "id": 217, "options": { @@ -1923,7 +1924,7 @@ "h": 8, "w": 12, "x": 0, - "y": 101 + "y": 244 }, "id": 228, "options": { @@ -1982,7 +1983,7 @@ "h": 8, "w": 12, "x": 12, - "y": 101 + "y": 244 }, "id": 213, "options": { @@ -2050,7 +2051,7 @@ "h": 8, "w": 12, "x": 0, - "y": 109 + "y": 252 }, "id": 226, "options": { @@ -2151,7 +2152,7 @@ "h": 8, "w": 12, "x": 12, - "y": 109 + "y": 252 }, "id": 227, "options": { @@ -2271,7 +2272,7 @@ "h": 9, "w": 24, "x": 0, - "y": 117 + "y": 260 }, "id": 224, "options": { @@ -2401,7 +2402,7 @@ "h": 12, "w": 24, "x": 0, - "y": 126 + "y": 269 }, "id": 209, "options": { @@ -2457,7 +2458,7 @@ "h": 1, "w": 24, "x": 0, - "y": 11 + "y": 3 }, "id": 205, "panels": [ @@ -2525,7 +2526,7 @@ "h": 8, "w": 12, "x": 0, - "y": 19 + "y": 162 }, "id": 204, "options": { @@ -2603,7 +2604,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2619,7 +2621,7 @@ "h": 8, "w": 12, "x": 12, - "y": 19 + "y": 162 }, "id": 203, "options": { @@ -2636,7 +2638,7 @@ "sort": "desc" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "editorMode": "code", @@ -2712,7 +2714,7 @@ "h": 8, "w": 12, "x": 0, - "y": 54 + "y": 197 }, "id": 238, "options": { @@ -2798,7 +2800,7 @@ "h": 3, "w": 12, "x": 0, - "y": 62 + "y": 205 }, "id": 239, "options": { @@ -2836,1517 +2838,752 @@ "type": "row" }, { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 12 + "y": 4 }, "id": 171, - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "panels": [], + "title": "Blocks execution", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "execution: validator-bm-holesky-e3caplin-cluster1-n1" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 20 - }, - "id": 196, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" }, - "tooltip": { - "mode": "multi", - "sort": "none" + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" } }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "editorMode": "code", - "expr": "sync{instance=~\"$instance\",stage=\"execution\"} > 0 ", - "instant": false, - "legendFormat": "{{ stage }}: {{instance}}", - "range": true, - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "execution: validator-bm-holesky-e3caplin-cluster1-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 5 + }, + "id": 196, + "options": { + "legend": { + "calcs": [ + "lastNotNull" ], - "title": "Sync Stages progress", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 8, - "y": 20 + "editorMode": "code", + "expr": "sync{instance=~\"$instance\",stage=\"execution\"} > 0 ", + "instant": false, + "legendFormat": "{{ stage }}: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "Sync Stages progress", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 206, - "options": { - "legend": { - "calcs": [ - "mean" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "tooltip": { - "mode": "multi", - "sort": "none" + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" } }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(exec_gas{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "gas/s {{instance}}", - "range": true, - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 5 + }, + "id": 206, + "options": { + "legend": { + "calcs": [ + "mean" ], - "title": "Exec throughput", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 60 - } - ] - }, - "unit": "s" + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_gas{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "gas/s {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "Exec throughput", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "overrides": [ + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 4, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "dev-bm-e3-ethmainnet-n1 blocks " - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] + "color": "green", + "value": null + }, + { + "color": "red", + "value": 60 } ] }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 20 - }, - "id": 200, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "unit": "s" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "dev-bm-e3-ethmainnet-n1 blocks " + ], + "prefix": "All except:", + "readOnly": true + } }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "prune_seconds{quantile=\"$quantile\",instance=~\"$instance\"}", - "instant": false, - "legendFormat": "{{instance}} {{type}} ", - "range": true, - "refId": "A" - } - ], - "title": "Prune, seconds", - "transparent": true, - "type": "timeseries" + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 5 + }, + "id": 200, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 4, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 53 - }, - "id": 197, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } + "editorMode": "code", + "expr": "prune_seconds{quantile=\"$quantile\",instance=~\"$instance\"}", + "instant": false, + "legendFormat": "{{instance}} {{type}} ", + "range": true, + "refId": "A" + } + ], + "title": "Prune, seconds", + "transparent": true, + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "irate(domain_collation_size{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "collated [domain]: {{instance}}", - "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "irate(domain_collation_hist_size{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "collated [history]: {{instance}}", - "range": true, - "refId": "E" + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "sum(rate(domain_commitment_keys{instance=~\"$instance\"}[$rate_interval])) by (instance) > 0", - "hide": false, - "legendFormat": "keys committed: {{instance}}", - "range": true, - "refId": "A" + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "irate(domain_commitment_updates{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "commitment node updates: {{instance}}", - "range": true, - "refId": "C" + "lineWidth": 1, + "pointSize": 4, + "scaleDistribution": { + "type": "linear" }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "irate(domain_commitment_updates_applied{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "commitment trie node updates: {{instance}}", - "range": true, - "refId": "F" + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "irate(domain_prune_size{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "pruned keys [{{type}}]: {{instance}}", - "range": true, - "refId": "G" + "thresholdsStyle": { + "mode": "off" } - ], - "title": "State: Collate/Prune/Merge/Commitment", - "type": "timeseries" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 11 + }, + "id": 197, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 8, - "y": 53 - }, - "id": 207, - "options": { - "legend": { - "calcs": [ - "mean" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "txs apply: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(exec_txns{instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "instant": false, - "legendFormat": "txn/s {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "C" - } - ], - "title": "Exec v3: txs/s ", - "type": "timeseries" + "editorMode": "code", + "expr": "irate(domain_collation_size{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "collated [domain]: {{instance}}", + "range": true, + "refId": "D" }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 2 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 53 - }, - "id": 202, - "options": { - "displayMode": "lcd", - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": false - }, - "maxVizHeight": 81, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "manual", - "valueMode": "color" - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_prunable{instance=~\"$instance\",type=\"domain\"}", - "hide": false, - "legendFormat": "{{instance}} {{type}}-{{table}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_prunable{instance=~\"$instance\",type=\"history\",table!=\"commitment\"}/1562500", - "hide": false, - "legendFormat": "{{instance}} {{type}}-{{table}}", - "range": true, - "refId": "C" - } - ], - "title": "pruning availability, steps", - "transparent": true, - "type": "bargauge" + "editorMode": "code", + "expr": "irate(domain_collation_hist_size{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "collated [history]: {{instance}}", + "range": true, + "refId": "E" }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": 3600000, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 8, - "y": 59 + "editorMode": "code", + "expr": "sum(rate(domain_commitment_keys{instance=~\"$instance\"}[$rate_interval])) by (instance) > 0", + "hide": false, + "legendFormat": "keys committed: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - "id": 158, - "options": { - "legend": { - "calcs": [ - "mean" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } + "editorMode": "code", + "expr": "irate(domain_commitment_updates{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "commitment node updates: {{instance}}", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(sync{instance=~\"$instance\",stage=\"execution\"}[$rate_interval]) ", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "{{ stage }}: {{instance}}", - "range": true, - "refId": "A" - } - ], - "title": "Sync Stages progress rate", - "type": "timeseries" + "editorMode": "code", + "expr": "irate(domain_commitment_updates_applied{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "commitment trie node updates: {{instance}}", + "range": true, + "refId": "F" }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 16, - "y": 59 + "editorMode": "code", + "expr": "irate(domain_prune_size{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "pruned keys [{{type}}]: {{instance}}", + "range": true, + "refId": "G" + } + ], + "title": "State: Collate/Prune/Merge/Commitment", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, - "id": 199, - "options": { - "legend": { - "calcs": [ - "mean", - "lastNotNull" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "tooltip": { - "mode": "multi", - "sort": "none" + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" } }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "exemplar": true, - "expr": "chain_execution_seconds{quantile=\"$quantile\",instance=~\"$instance\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "execution: {{instance}}", - "refId": "A" - } + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 11 + }, + "id": 207, + "options": { + "legend": { + "calcs": [ + "mean" ], - "title": "Block Execution speed ", - "type": "timeseries" + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisGridShow": true, - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "commitment took: dev-bm-e3-ethmainnet-n1" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] - } - ] + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "txs apply: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - "gridPos": { - "h": 12, - "w": 8, - "x": 0, - "y": 61 + "editorMode": "code", + "expr": "rate(exec_txns{instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "instant": false, + "legendFormat": "txn/s {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - "id": 112, - "options": { - "legend": { - "calcs": [ - "mean" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } + "editorMode": "code", + "expr": "rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "C" + } + ], + "title": "Exec v3: txs/s ", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(domain_collate_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", - "format": "time_series", - "instant": false, - "legendFormat": "collation took: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(domain_step_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "step took: {{instance}}", - "range": true, - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(domain_prune_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "prune took [{{type}}]: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "rate(domain_commitment_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "legendFormat": "commitment took: {{instance}}", - "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null }, - "editorMode": "code", - "exemplar": false, - "expr": "rate(domain_commitment_write_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "instant": false, - "legendFormat": "commitment update write took: {{instance}}", - "range": true, - "refId": "F" - } + { + "color": "red", + "value": 2 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 11 + }, + "id": 202, + "options": { + "displayMode": "lcd", + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "maxVizHeight": 81, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "title": "State: timins", - "type": "timeseries" + "fields": "", + "values": false }, + "showUnfilled": true, + "sizing": "manual", + "valueMode": "color" + }, + "pluginVersion": "11.5.0-80207", + "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 8, - "x": 8, - "y": 64 - }, - "id": 198, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_running_merges{instance=~\"$instance\"}", - "legendFormat": "running merges: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_running_collations{instance=~\"$instance\"}", - "hide": false, - "legendFormat": "running collations: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_pruning_progress{instance=~\"$instance\"}", - "hide": false, - "legendFormat": "running prunes: {{instance}}", - "range": true, - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_running_commitment{instance=~\"$instance\"}", - "hide": false, - "legendFormat": "running commitment: {{instance}}", - "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_running_files_building{instance=~\"$instance\"}", - "hide": false, - "instant": false, - "legendFormat": "running files building: {{instance}}", - "range": true, - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "domain_wal_flushes{instance=~\"$instance\"}", - "hide": false, - "instant": false, - "legendFormat": "WAL flushes {{instance}}", - "range": true, - "refId": "F" - } - ], - "title": "State: running collate/merge/prune", - "type": "timeseries" + "editorMode": "code", + "expr": "domain_prunable{instance=~\"$instance\",type=\"domain\"}", + "hide": false, + "legendFormat": "{{instance}} {{type}}-{{table}}", + "range": true, + "refId": "B" }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 8, - "x": 16, - "y": 64 - }, - "id": 201, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "block_consumer_delay{type=\"header_download\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "header: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "block_consumer_delay{type=\"body_download\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "body: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "block_consumer_delay{type=\"pre_execution\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "execution_start: {{instance}}", - "range": true, - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "expr": "block_consumer_delay{type=\"post_execution\",instance=~\"$instance\",quantile=\"$quantile\"}", - "hide": false, - "legendFormat": "execution_end: {{instance}}", - "range": true, - "refId": "D" - } - ], - "title": "Block execution delays", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-BlPu" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "mgas/sec" - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "mgas: snapshotter-bm-e3-ethmainnet-n1" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [] - } - ] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 73 - }, - "id": 208, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.4.0-77868", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "exec_mgas{instance=~\"$instance\"} < 5000", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "mgas: {{instance}}", - "range": true, - "refId": "A" - } - ], - "title": "mgas/s ", - "type": "stat" + "editorMode": "code", + "expr": "domain_prunable{instance=~\"$instance\",type=\"history\",table!=\"commitment\"}/1562500", + "hide": false, + "legendFormat": "{{instance}} {{type}}-{{table}}", + "range": true, + "refId": "C" } ], - "title": "Blocks execution", - "type": "row" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 13 - }, - "id": 17, - "panels": [], - "title": "Database", - "type": "row" + "title": "pruning availability, steps", + "transparent": true, + "type": "bargauge" }, { "datasource": { @@ -4382,7 +3619,7 @@ "type": "linear" }, "showPoints": "never", - "spanNulls": false, + "spanNulls": 3600000, "stacking": { "group": "A", "mode": "none" @@ -4392,7 +3629,6 @@ } }, "mappings": [], - "min": 0.001, "thresholds": { "mode": "absolute", "steps": [ @@ -4413,13 +3649,15 @@ "gridPos": { "h": 5, "w": 8, - "x": 0, - "y": 14 + "x": 8, + "y": 17 }, - "id": 141, + "id": 158, "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -4429,7 +3667,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -4438,14 +3676,16 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(db_commit_seconds_count{phase=\"total\",instance=~\"$instance\"}[$rate_interval]) > 0 ", + "expr": "rate(sync{instance=~\"$instance\",stage=\"execution\"}[$rate_interval]) ", + "format": "time_series", "interval": "", - "legendFormat": "commit: {{instance}}", + "intervalFactor": 1, + "legendFormat": "{{ stage }}: {{instance}}", "range": true, "refId": "A" } ], - "title": "Commit", + "title": "Sync Stages progress rate", "type": "timeseries" }, { @@ -4453,7 +3693,6 @@ "type": "prometheus", "uid": "grafanacloud-prom" }, - "description": "", "fieldConfig": { "defaults": { "color": { @@ -4478,13 +3717,12 @@ "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 2, + "pointSize": 5, "scaleDistribution": { - "log": 2, - "type": "log" + "type": "linear" }, "showPoints": "never", - "spanNulls": 3600000, + "spanNulls": true, "stacking": { "group": "A", "mode": "none" @@ -4512,16 +3750,17 @@ "overrides": [] }, "gridPos": { - "h": 9, - "w": 16, - "x": 8, - "y": 14 + "h": 5, + "w": 8, + "x": 16, + "y": 17 }, - "id": 166, + "id": 199, "options": { "legend": { "calcs": [ - "mean" + "mean", + "lastNotNull" ], "displayMode": "list", "placement": "bottom", @@ -4532,95 +3771,40 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", "exemplar": true, - "expr": "db_commit_seconds{phase=\"total\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "expr": "chain_execution_seconds{quantile=\"$quantile\",instance=~\"$instance\"}", + "format": "time_series", "interval": "", - "legendFormat": "total: {{instance}}", - "range": true, + "intervalFactor": 1, + "legendFormat": "execution: {{instance}}", "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"gc_wall_clock\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "gc_wall_clock: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"write\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "write: {{instance}}", - "range": true, - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"sync\",quantile=\"$quantile\",instance=~\"$instance\"} > 0.002", - "hide": false, - "interval": "", - "legendFormat": "sync: {{instance}}", - "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_commit_seconds{phase=\"gc_cpu_time\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "gc_cpu_time: {{instance}}", - "range": true, - "refId": "I" - } - ], - "title": "Commit speed", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" + } + ], + "title": "Block Execution speed ", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", + "axisGridShow": true, "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -4641,7 +3825,7 @@ "type": "linear" }, "showPoints": "never", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -4664,20 +3848,47 @@ } ] }, - "unit": "decbytes" + "unit": "s" }, - "overrides": [] + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "commitment took: dev-bm-e3-ethmainnet-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] }, "gridPos": { - "h": 5, + "h": 12, "w": 8, "x": 0, "y": 19 }, - "id": 159, + "id": 112, "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -4687,16 +3898,19 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "expr": "db_size{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "size: {{instance}}", + "editorMode": "code", + "expr": "rate(domain_collate_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", + "format": "time_series", + "instant": false, + "legendFormat": "collation took: {{instance}}", + "range": true, "refId": "A" }, { @@ -4705,15 +3919,52 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "expr": "db_mi_last_pgno{instance=~\"$instance\"}", + "expr": "rate(domain_step_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", "hide": false, - "interval": "", - "legendFormat": "db_mi_last_pgno: {{instance}}", + "legendFormat": "step took: {{instance}}", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "rate(domain_prune_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "prune took [{{type}}]: {{instance}}", "range": true, "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "rate(domain_commitment_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "legendFormat": "commitment took: {{instance}}", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": false, + "expr": "rate(domain_commitment_write_took_sum{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "instant": false, + "legendFormat": "commitment update write took: {{instance}}", + "range": true, + "refId": "F" } ], - "title": "DB Size", + "title": "State: timins", "type": "timeseries" }, { @@ -4743,13 +3994,13 @@ "viz": false }, "insertNulls": false, - "lineInterpolation": "linear", + "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "never", + "showPoints": "auto", "spanNulls": false, "stacking": { "group": "A", @@ -4772,33 +4023,30 @@ "value": 80 } ] - }, - "unit": "short" + } }, "overrides": [] }, "gridPos": { - "h": 7, - "w": 16, + "h": 9, + "w": 8, "x": 8, - "y": 23 + "y": 22 }, - "id": 168, + "id": 198, "options": { "legend": { - "calcs": [ - "mean" - ], + "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", - "sort": "none" + "sort": "desc" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -4806,113 +4054,22 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"newly\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "newly: {{instance}}", + "expr": "domain_running_merges{instance=~\"$instance\"}", + "legendFormat": "running merges: {{instance}}", "range": true, "refId": "A" }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"cow\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "cow: {{instance}}", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"clone\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "clone: {{instance}}", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"split\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "split: {{instance}}", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"merge\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "merge: {{instance}}", - "range": true, - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"spill\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "spill: {{instance}}", - "refId": "F" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"wops\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "wops: {{instance}}", - "refId": "G" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"unspill\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "unspill: {{instance}}", - "refId": "H" - }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcrloops\", instance=~\"$instance\"}[$rate_interval])", + "expr": "domain_running_collations{instance=~\"$instance\"}", "hide": false, - "interval": "", - "legendFormat": "gcrloops: {{instance}}", + "legendFormat": "running collations: {{instance}}", "range": true, - "refId": "I" + "refId": "B" }, { "datasource": { @@ -4920,13 +4077,11 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcwloops\", instance=~\"$instance\"}[$rate_interval])", + "expr": "domain_pruning_progress{instance=~\"$instance\"}", "hide": false, - "interval": "", - "legendFormat": "gcwloops: {{instance}}", + "legendFormat": "running prunes: {{instance}}", "range": true, - "refId": "J" + "refId": "C" }, { "datasource": { @@ -4934,13 +4089,11 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"gcxpages\", instance=~\"$instance\"}[$rate_interval])", + "expr": "domain_running_commitment{instance=~\"$instance\"}", "hide": false, - "interval": "", - "legendFormat": "gcxpages: {{instance}}", + "legendFormat": "running commitment: {{instance}}", "range": true, - "refId": "K" + "refId": "D" }, { "datasource": { @@ -4948,13 +4101,12 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"msync\", instance=~\"$instance\"}[$rate_interval])", + "expr": "domain_running_files_building{instance=~\"$instance\"}", "hide": false, - "interval": "", - "legendFormat": "msync: {{instance}}", + "instant": false, + "legendFormat": "running files building: {{instance}}", "range": true, - "refId": "L" + "refId": "E" }, { "datasource": { @@ -4962,40 +4114,15 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "exemplar": true, - "expr": "rate(db_pgops{phase=\"fsync\", instance=~\"$instance\"}[$rate_interval])", + "expr": "domain_wal_flushes{instance=~\"$instance\"}", "hide": false, - "interval": "", - "legendFormat": "fsync: {{instance}}", + "instant": false, + "legendFormat": "WAL flushes {{instance}}", "range": true, - "refId": "M" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"minicore\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "minicore: {{instance}}", - "refId": "N" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "exemplar": true, - "expr": "rate(db_pgops{phase=\"prefault\", instance=~\"$instance\"}[$rate_interval])", - "hide": false, - "interval": "", - "legendFormat": "prefault: {{instance}}", - "refId": "O" + "refId": "F" } ], - "title": "DB Pages Ops/sec", + "title": "State: running collate/merge/prune", "type": "timeseries" }, { @@ -5025,14 +4152,14 @@ "viz": false }, "insertNulls": false, - "lineInterpolation": "linear", + "lineInterpolation": "smooth", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "never", - "spanNulls": true, + "showPoints": "auto", + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -5055,32 +4182,30 @@ } ] }, - "unit": "decbytes" + "unit": "s" }, "overrides": [] }, "gridPos": { - "h": 6, + "h": 9, "w": 8, - "x": 0, - "y": 24 + "x": 16, + "y": 22 }, - "id": 167, + "id": 201, "options": { "legend": { - "calcs": [ - "mean" - ], + "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", - "sort": "none" + "sort": "desc" } }, - "pluginVersion": "11.4.0-79146", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5088,9 +4213,9 @@ "uid": "grafanacloud-prom" }, "editorMode": "code", - "expr": "tx_limit{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "limit: {{instance}}", + "expr": "block_consumer_delay{type=\"header_download\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "header: {{instance}}", "range": true, "refId": "A" }, @@ -5099,382 +4224,1695 @@ "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", - "expr": "tx_dirty{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "dirty: {{instance}}", - "range": true, - "refId": "B" - } - ], - "title": "Tx Size", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 0, - "scaleDistribution": { - "type": "linear" + "editorMode": "code", + "expr": "block_consumer_delay{type=\"body_download\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "body: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "block_consumer_delay{type=\"pre_execution\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "execution_start: {{instance}}", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "block_consumer_delay{type=\"post_execution\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "execution_end: {{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Block execution delays", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 245, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{type=\"fork_depth\", instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "fork_depth $instance", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Update Fork Choice depth", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 31 + }, + "id": 246, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{type=\"arrival_delay\", instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "arrival_delay $instance", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "update_fork_choice{instance=\"$instance\", quantile=\"$quantile\", type=\"execution_duration\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "execution_duration $instance", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Update Fork Choice delays", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-BlPu" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "mgas/sec" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "mgas: snapshotter-bm-e3-ethmainnet-n1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [] + } + ] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 39 + }, + "id": 208, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "exec_mgas{instance=~\"$instance\"} < 5000", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "mgas: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "mgas/s ", + "type": "stat" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 47 + }, + "id": 242, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 56 + }, + "id": 243, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "waypoint_length{type=\"milestone\", instance=\"$instance\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "milestone_length $instance", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "waypoint_length{type=\"checkpoint\", instance=\"$instance\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "checkpoint_length $instance", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Waypoint length", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 56 + }, + "id": 244, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "wiggle_duration{instance=\"$instance\", quantile=\"$quantile\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "wiggle_duration $instance", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Wiggle Duration", + "type": "timeseries" + } + ], + "title": "Polygon", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 48 + }, + "id": 17, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0.001, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 141 + }, + "id": 141, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_commit_seconds_count{phase=\"total\",instance=~\"$instance\"}[$rate_interval]) > 0 ", + "interval": "", + "legendFormat": "commit: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "Commit", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 2, + "scaleDistribution": { + "log": 2, + "type": "log" + }, + "showPoints": "never", + "spanNulls": 3600000, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 16, + "x": 8, + "y": 141 + }, + "id": 166, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_commit_seconds{phase=\"total\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "interval": "", + "legendFormat": "total: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_commit_seconds{phase=\"gc_wall_clock\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "hide": false, + "interval": "", + "legendFormat": "gc_wall_clock: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_commit_seconds{phase=\"write\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "hide": false, + "interval": "", + "legendFormat": "write: {{instance}}", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_commit_seconds{phase=\"sync\",quantile=\"$quantile\",instance=~\"$instance\"} > 0.002", + "hide": false, + "interval": "", + "legendFormat": "sync: {{instance}}", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_commit_seconds{phase=\"gc_cpu_time\",quantile=\"$quantile\",instance=~\"$instance\"} > 0", + "hide": false, + "interval": "", + "legendFormat": "gc_cpu_time: {{instance}}", + "range": true, + "refId": "I" + } + ], + "title": "Commit speed", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 154 + }, + "id": 159, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "expr": "db_size{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "size: {{instance}}", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "db_mi_last_pgno{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "db_mi_last_pgno: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "DB Size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 16, + "x": 8, + "y": 158 + }, + "id": 168, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"newly\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "newly: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"cow\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "cow: {{instance}}", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"clone\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "clone: {{instance}}", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"split\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "split: {{instance}}", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"merge\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "merge: {{instance}}", + "range": true, + "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"spill\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "spill: {{instance}}", + "refId": "F" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"wops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "wops: {{instance}}", + "refId": "G" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"unspill\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "unspill: {{instance}}", + "refId": "H" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcrloops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcrloops: {{instance}}", + "range": true, + "refId": "I" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcwloops\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcwloops: {{instance}}", + "range": true, + "refId": "J" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"gcxpages\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "gcxpages: {{instance}}", + "range": true, + "refId": "K" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"msync\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "msync: {{instance}}", + "range": true, + "refId": "L" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(db_pgops{phase=\"fsync\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "fsync: {{instance}}", + "range": true, + "refId": "M" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"minicore\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "minicore: {{instance}}", + "refId": "N" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "exemplar": true, + "expr": "rate(db_pgops{phase=\"prefault\", instance=~\"$instance\"}[$rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "prefault: {{instance}}", + "refId": "O" + } + ], + "title": "DB Pages Ops/sec", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 159 + }, + "id": 167, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "thresholdsStyle": { - "mode": "off" + "tooltip": { + "mode": "multi", + "sort": "none" } }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 30 - }, - "id": 169, - "options": { - "legend": { - "calcs": [ - "mean" + "editorMode": "code", + "expr": "tx_limit{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "limit: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "expr": "tx_dirty{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "dirty: {{instance}}", + "range": true, + "refId": "B" + } ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-79146", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "editorMode": "code", - "exemplar": true, - "expr": "db_gc_leaf{instance=~\"$instance\"} > 0", - "interval": "", - "legendFormat": "gc_leaf: {{instance}}", - "range": true, - "refId": "A" + "title": "Tx Size", + "type": "timeseries" }, { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", - "exemplar": true, - "expr": "db_gc_overflow{instance=~\"$instance\"} > 0", - "hide": false, - "interval": "", - "legendFormat": "gc_overflow: {{instance}}", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 0, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] }, - "editorMode": "code", - "exemplar": true, - "expr": "exec_steps_in_db{instance=~\"$instance\"}/100 > 0", - "hide": false, - "interval": "", - "legendFormat": "exec_steps_in_db: {{instance}}", - "range": true, - "refId": "E" - } - ], - "title": "GC and State", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 165 }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" + "id": 169, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "thresholdsStyle": { - "mode": "off" + "tooltip": { + "mode": "multi", + "sort": "none" } }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 16, - "x": 8, - "y": 30 - }, - "id": 150, - "options": { - "legend": { - "calcs": [ - "mean" + "editorMode": "code", + "exemplar": true, + "expr": "db_gc_leaf{instance=~\"$instance\"} > 0", + "interval": "", + "legendFormat": "gc_leaf: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "db_gc_overflow{instance=~\"$instance\"} > 0", + "hide": false, + "interval": "", + "legendFormat": "gc_overflow: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "exec_steps_in_db{instance=~\"$instance\"}/100 > 0", + "hide": false, + "interval": "", + "legendFormat": "exec_steps_in_db: {{instance}}", + "range": true, + "refId": "E" + } ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "title": "GC and State", + "type": "timeseries" }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-79146", - "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(process_minor_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", - "interval": "", - "legendFormat": "soft: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(process_major_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", - "hide": false, - "interval": "", - "legendFormat": "hard: {{instance}}", - "range": true, - "refId": "B" - } - ], - "title": "getrusage: minflt - soft page faults (reclaims), majflt - hard faults", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" + "gridPos": { + "h": 6, + "w": 16, + "x": 8, + "y": 165 }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" + "id": 150, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "thresholdsStyle": { - "mode": "off" + "tooltip": { + "mode": "multi", + "sort": "none" } }, - "decimals": 2, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 8, - "x": 0, - "y": 36 - }, - "id": 194, - "options": { - "legend": { - "calcs": [ - "mean" + "editorMode": "code", + "exemplar": true, + "expr": "rate(process_minor_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "interval": "", + "legendFormat": "soft: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(process_major_pagefaults_total{instance=~\"$instance\"}[$rate_interval]) > 0", + "hide": false, + "interval": "", + "legendFormat": "hard: {{instance}}", + "range": true, + "refId": "B" + } ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "title": "getrusage: minflt - soft page faults (reclaims), majflt - hard faults", + "type": "timeseries" }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "11.4.0-79146", - "targets": [ { "datasource": { "type": "prometheus", "uid": "grafanacloud-prom" }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(exec_repeats{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "interval": "", - "intervalFactor": 1, - "legendFormat": "repeats: {{instance}}", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "grafanacloud-prom" + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] }, - "editorMode": "code", - "exemplar": true, - "expr": "rate(exec_triggers{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", - "format": "time_series", - "hide": false, - "interval": "", - "intervalFactor": 1, - "legendFormat": "triggers: {{instance}}", - "range": true, - "refId": "B" + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 171 + }, + "id": 194, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_repeats{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "repeats: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "grafanacloud-prom" + }, + "editorMode": "code", + "exemplar": true, + "expr": "rate(exec_triggers{instance=~\"$instance\"}[$rate_interval])/rate(exec_txs_done{instance=~\"$instance\"}[$rate_interval])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "triggers: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "Exec v3", + "type": "timeseries" } ], - "title": "Exec v3", - "type": "timeseries" + "title": "Database", + "type": "row" }, { "collapsed": false, @@ -5482,7 +5920,7 @@ "h": 1, "w": 24, "x": 0, - "y": 41 + "y": 49 }, "id": 134, "panels": [], @@ -5538,7 +5976,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -5554,7 +5993,7 @@ "h": 6, "w": 8, "x": 8, - "y": 42 + "y": 50 }, "id": 155, "options": { @@ -5571,7 +6010,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5658,7 +6097,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -5674,7 +6114,7 @@ "h": 5, "w": 8, "x": 16, - "y": 42 + "y": 50 }, "id": 148, "options": { @@ -5691,7 +6131,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5826,7 +6266,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -5842,7 +6283,7 @@ "h": 5, "w": 8, "x": 16, - "y": 47 + "y": 55 }, "id": 106, "options": { @@ -5859,7 +6300,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -5928,7 +6369,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -5969,7 +6411,7 @@ "h": 6, "w": 8, "x": 8, - "y": 48 + "y": 56 }, "id": 85, "options": { @@ -5986,7 +6428,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6071,7 +6513,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6087,7 +6530,7 @@ "h": 6, "w": 8, "x": 16, - "y": 52 + "y": 60 }, "id": 153, "options": { @@ -6104,7 +6547,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6172,7 +6615,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6188,7 +6632,7 @@ "h": 6, "w": 8, "x": 8, - "y": 54 + "y": 62 }, "id": 154, "options": { @@ -6205,7 +6649,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6354,7 +6798,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6370,7 +6815,7 @@ "h": 6, "w": 8, "x": 16, - "y": 58 + "y": 66 }, "id": 128, "options": { @@ -6385,7 +6830,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6464,7 +6909,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6480,7 +6926,7 @@ "h": 5, "w": 8, "x": 8, - "y": 60 + "y": 68 }, "id": 86, "options": { @@ -6497,7 +6943,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6582,7 +7028,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6598,7 +7045,7 @@ "h": 5, "w": 8, "x": 16, - "y": 64 + "y": 72 }, "id": 124, "options": { @@ -6613,7 +7060,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6638,7 +7085,7 @@ "h": 1, "w": 24, "x": 0, - "y": 69 + "y": 77 }, "id": 183, "panels": [], @@ -6693,7 +7140,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6709,7 +7157,7 @@ "h": 8, "w": 12, "x": 0, - "y": 70 + "y": 78 }, "id": 185, "options": { @@ -6727,7 +7175,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6804,7 +7252,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6820,7 +7269,7 @@ "h": 8, "w": 12, "x": 12, - "y": 70 + "y": 78 }, "id": 186, "options": { @@ -6838,7 +7287,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -6903,7 +7352,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -6919,7 +7369,7 @@ "h": 8, "w": 12, "x": 0, - "y": 78 + "y": 86 }, "id": 187, "options": { @@ -6937,7 +7387,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7002,7 +7452,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7018,7 +7469,7 @@ "h": 8, "w": 12, "x": 12, - "y": 78 + "y": 86 }, "id": 188, "options": { @@ -7033,7 +7484,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7109,7 +7560,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7125,7 +7577,7 @@ "h": 6, "w": 8, "x": 8, - "y": 86 + "y": 94 }, "id": 189, "options": { @@ -7143,7 +7595,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7245,7 +7697,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7260,7 +7713,7 @@ "h": 6, "w": 8, "x": 16, - "y": 86 + "y": 94 }, "id": 184, "options": { @@ -7278,7 +7731,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7316,7 +7769,7 @@ "h": 1, "w": 24, "x": 0, - "y": 92 + "y": 100 }, "id": 75, "panels": [], @@ -7371,7 +7824,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7413,7 +7867,7 @@ "h": 9, "w": 12, "x": 0, - "y": 93 + "y": 101 }, "id": 96, "options": { @@ -7433,7 +7887,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7518,7 +7972,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7534,7 +7989,7 @@ "h": 9, "w": 12, "x": 12, - "y": 93 + "y": 101 }, "id": 77, "options": { @@ -7554,7 +8009,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7602,7 +8057,7 @@ "h": 1, "w": 24, "x": 0, - "y": 102 + "y": 110 }, "id": 173, "panels": [], @@ -7657,7 +8112,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7673,7 +8129,7 @@ "h": 8, "w": 12, "x": 0, - "y": 103 + "y": 111 }, "id": 175, "options": { @@ -7691,7 +8147,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7816,7 +8272,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7832,7 +8289,7 @@ "h": 8, "w": 12, "x": 12, - "y": 103 + "y": 111 }, "id": 177, "options": { @@ -7850,7 +8307,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -7966,7 +8423,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -7981,7 +8439,7 @@ "h": 6, "w": 8, "x": 0, - "y": 111 + "y": 119 }, "id": 176, "options": { @@ -7999,7 +8457,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -8065,7 +8523,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -8080,7 +8539,7 @@ "h": 6, "w": 8, "x": 8, - "y": 111 + "y": 119 }, "id": 180, "options": { @@ -8098,7 +8557,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -8176,7 +8635,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -8192,7 +8652,7 @@ "h": 6, "w": 8, "x": 16, - "y": 111 + "y": 119 }, "id": 181, "options": { @@ -8210,7 +8670,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -8288,7 +8748,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -8304,7 +8765,7 @@ "h": 6, "w": 8, "x": 0, - "y": 117 + "y": 125 }, "id": 178, "options": { @@ -8322,7 +8783,7 @@ "sort": "none" } }, - "pluginVersion": "11.4.0-77868", + "pluginVersion": "11.5.0-80207", "targets": [ { "datasource": { @@ -8508,6 +8969,6 @@ "timezone": "", "title": "1. Erigon CUSTOM METRICS", "uid": "b42a61d7-02b1-416c-8ab4-b9c864356174", - "version": 276, + "version": 279, "weekStart": "" } diff --git a/dashboards/erigon_custom_metrics/history/20250107.tar.gz b/dashboards/erigon_custom_metrics/history/20250107.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ee1da02347adb33fbc70c01e482834217f577366 GIT binary patch literal 12240 zcmY+KRZtv2mxTv+7=lA^26tzG;O_3uV8I=Ny99R~AV|=_U;%e^Y1?F zZddi~`ud*g``D*$H)T93;J*jLpTNh|wU$NOzjs>Z+V^=dkB*I!#k0Cm?G>kCfongq zRu|`uSRU3mX(eT?(!RlsxbbVJzlxxto7;;A=RR*yM;#&Cu& zxX`z`UQgcC*%!(iIlR8Npfm&mQHIGk7d7B9Q@MRxT(wd8T!-up%T-yiF#F>T*>gmg z%Sv8O1=$$~y&qG-;HE=dwP2=gwO|#k?@pcGO^0=CLfTG%y&P_}W`Tb&z_ z)uijlUw+T)4`;qEW!cNFB?|9m%PI_`ifi82Kv2{Sr<;>9(`YPRQgRe45AFgIoqyeJ6T#^?o%B}Ns=M(r_P!(reTT8Z zKC;(mwguZ)mC~OIbG`p&LchhZ*Fv2p$-uZ5@AHK2hInK5fp4#Ruiq|Aju(6^7_!D3 z%JP2b?BqDU-ezJ4x9OWTsMwGv9#pX*WI8T zI9K!S#^`=E?Q$})I5g4JKtp%<&TmZVeOk^Qu9auiFw1;^HBL^VYDM8sU|hgYs>Ee($a$`rhX9 zxZo$r(Q>@skQK*|u0$RipL)hbS3uej8M>!7<`mIwrSs=OUvS{v&c#a7>%kXK=*z0{ zucoVmtEo(ty8-dKr&meq&4qK%4C*RRuNKQmE}sBvjHgJaB98BQe*T>?0NWgO8_*b{ zNBN%O=W9P6IzyEw6@cb-f5K62a2DwFk75It`z>f6k7qb1CX?fOE*B?e_VXOc0dQqK z*-GD;f;lBn+yn?59ad5RW}g~`6JIFS=O|@eR;ftMTjQ)eo2b#?j$I4)%lT6a3E3re z8p>+TdV0+@iX6P8-MQ=}6l6S;SQsN#2f(wA=)&q>CcYP0K=$>c4&31|dbL?_%}4ce zNSTXShHNN)xFTzo@zYcYl3POpNaSr)yQe;~;XoZM3i07zO$7OTPr^EjK3b($@?dx` zXXWtqby*eJGCT6>bLv%c$WS%6(!s00ols_5Bz@#1w{_$C^u}Rgr3g7|mbqv;s$On7n7Lzn`s1T&pAvFy<_1>EScfLCkGWlKC^4I>jbYgFPk`%Y- z5ASe!aSuame>FOmlXW85@olHGKGxT7zf-Z>HSGtq@dHZ9UE}C;rRqPD=#2a=`}N!xw${<+$XQ+N4wh5kjT;K2kt7W(wH>5m0wjKL z8t$q0NdQ9&G@7*=S;zfO{()X@bhA1~s3|5J$9lh0XEBrL=}x#Bv8vE1 zZDwqqAkeigimdzEUaZ}W4oE(a3nz&hF+GZ2?3M#04Fkec&*M@@=w-GqOQLs{cgsCz z$T(tVM9icq2fCSXG?W<9YZ56+j(}5|0E(#0;WQ$)Jx-k-W+1wD$=K&Rk zvUEET@9t_435OEmPJM~DE`IMMdW6Pl*_bydn*aL1gE4x&=><@>`Y4^65+4}iUH{cqw_rY#CA!j`O zxuc^ae`^mnzY^qfx)4%=sp{#7Sf+x!ue!QO3U*;##widr#8O8_cK!t~247;*i_ND% z_$gCkdXYz-%`aiLhuvRVI`zX4_-jr_ zg{fL0=HowT4b#F^hCQZ-zxs4|2tU<_zC*AdP1dM$FZjTh@f-6Hs!;$`I3u!WN(}&{ z?B3Fjf+j!3(Al0-r@nmMkc+ku-;qnrGMuJLeUYXa9mj`a^`S+ixO7|}a`s0{EoN6O z%Qt7TOx-KHry}M1?~?UQC-$lzrD`FXGxn&56z31YMNuGP?mfB<_rJpjf6Wd@P`9fp z?w2ke9C{9qEIt;Ei;Bcd#5vf7v$L!~$!W07xrFj;{7GHjGUQO)i{h=L7og%KgtyWl zPm!GlOi;Y$cwU)V+r)@}5j|CYW~x7`;$Wp0)3)gbB%J)&3YfBwLzGMFsy zXoGb1dfI0%k9p9_fznNyL zNSVxy-H-nZg1~nAijiS+MTp8a@x|V_PS!MNijj*+_(@nf$8T`Uy?hxu;(q^LRjT+h zyURa_Z{kN8?1AzrzyeW7#!oPo%fTNm255}Sgb&EUF?KxGmt!TkK zjvMQK@z`ID#to(I1sWe_Dq<||b-7NG6UKQl#igPNX4!re$Z_w)%>OHT>9JAs`jI-S zuwhQ0n}H|bb~QMCXsQs-d4Ff0ER*An^zoq$k#UMKL6vHzO0D9UTIN{R{Y+mQJfw{?B_C!=6V4`>sdY)!=~nfKz@IF^^Q8nw%rdf z6v|@pCDaWdqPFD+W`*l)n8XIV#j3vadK?g9Jp+2le!#zJ$XO-MRStyFpq$l(Wn0Av zA>&W6d604q2kaPH%CwT6adTyzPKvySholZLE+I0nTKY53aO$H?%0 zsTceD1@IuFY&xqqz=+8;J*sCO%Up-WssXPw-*n1ePyGMz@_@f^fOfFBji>mz`S$_Ob}1MkI%qH(o{#6?wsT%+x-%Vt$7{Od*7l#2+_h*;?h|0FEUjnMwfU0`EHQ zraloTPV$<$QfM^c)!}< z>s+Psxbl8`MuNNHkl;{;EkMq72ovMXD* zQO8~L6lEAKhGQ8qhOPYsd8wP5SERijmR`6c`2U3#2z1SdZ*>$z~ zI~ir{Rgoz9HZ&rfGy52lt^h<7IwtsDI2nR)w9Yj8n>xtC?jVYBhAF8Q*SCAz+=e8o z59SNXpKH@@XcyMMOPH&%8x%r{ys%CJZ2tl}t*-*QzX6 zqRHKyzb+v=tgUO^g)3p#A1W(2JwocjMNw^>rA)H8C2pnHG+?N)JD(ryX-i_J=c5^- zh{UX;@A{271JN0Mx-u0aUIAag?2pYi3q2@JeuC%)V`<(Zz(l02D-Fj942ocl7iVXf zHKXm7M-CF(QeEGQ(kcjCR zX5W3QloD^>b%V!gbT*)q>qpX(smNC~B5uJ?O0qLl9t&i$Zt}?QyWri7jmcuHQZjYD zqkk4zvXaPKB@fwc&g#G4x6$WWq2AFU=uiz=+hoyU&`}P_TWZ&?X=n8^UPlLT2i-lSTd1ntTge#0#$f#@ZA)wdZ`)Kd|I{K$YNUzT-aZ= z_p)ed<1XXRDxcq9O|3k-rS)<6-e{zdF7SH8{%s{|=M;hZ_H~^Hs>J{{;Vc=YMec zpTO;(VErGqwn+}xlE(h4xbv^#_kSgvJt7m=jEmF$Vd+1#_lQ(=sF~*2=OKN%9E{jX z+KSHEN(vaNoK;WO677VCqbA2dC6N$89SElz6aUX5t>*UheuNn`$*hyAJ(ffiIjYNvnXdTzKt?1$EEmayqzP!l~vXfg3C3 zsh2oW;lQrm`N?ee?`M_Sb()Qpbd!~}?RQW_|MLVG%>!?$dudRW+*;8I&9qlX^@*fE zWZEkYBEE!VBH&*I4b+$P-Ye3tqNd=>XpT%ooUcN5LqDr;nf zGBN3ufahj|^?5Xtf%eWhyur+^e$!t(kW^)pCJT_OD&%qK`)mSb+M$~Bzq_DCJ18a2 zt#04tzjrK*Jgxr_;Pc#ecl%VV*d`_Laj6yoE}CrdU`=zv40u!glgt0{jxa^+R@mfL zbWR&f&f1~G&Y`5@+!b0@@vFz1;h3(J;9=@>N>p7XpvrdZTc} zl*6`Dee=|jm)#iUcit85T&`YKFlEfw{eU#NubOPJ>q~>A1Qs>^jM&PAW&UqE^nBx0 zdpXXx^7G8hpKUaZa6N2Et$Fyng1didfv=%n2*QVKe-H(SfB+3ZNi>{vK^X+H-GVoW zGr+ZoONCz8@E{aKyb1!2siEq|NwSzm0vLH$CgDodDMNyu=d_fwwwj=*SD0^qXN9Ys z8&Lr00DOR56)`})i5w6)!rB835&L2ruOntrlG}6b`Le?{K3i_-FOZoaQ z1m0s(s2`^L*{zNfGMbbmVz1z>s_!&=EvcFE%5PfW9lh2Hubwak)=z&6D!^) z7L_kmRCl`5xZSGtg3mHN+dq8bJ&G05Q!|{5GbMD5%MvM)3CQ{w1wW-l=>%5R7a!E& zA(FM4m3I=yBQREE%<}brpzr^UY$QaZ1;TDLa#}_cuYXODtPdr4lS4KfJ*|9x? zEuPMbuKCLxn8UFefMA~NaEYy&B>B>5oToniKB#t#9QMX^uh^I)V+@*dO)F-tV6qu9WhwtFlxlx z+3$LA%mXfvR(x|qW)skrCq_Kp;f6d3LVd#C`h>If2{z@?kONlzY4+v!w~}Yg`A;aJ zABQ+F>qxY<_R?WU)kpbE09UY_7Z}=mOEs@xW@5ZjsE{GNz|Cj-jBsGIfp_(XtPJzf z$_IT@4*bG{|5>cxWtOqmq(!W=ku4mIdTd@t^)UaPk-aOX%f}X7^P@zk>)#EQ%6nErg@Sg1=>YLuY5+W=$Fbdcas`k z?ebN?xo_#2hN?vrhswAuX{PX1Q@0fSB{Y0TmipP{c-Vc8XJP4Zh-iW6=TF~DY&`W( zZg>;Cs2mdJYNvIgxM3aC--UG$9fQrE;|mj4{%c=0)WNXW z*mAy~N#T=Rk@|c=A1J3iY-C2u>7zY@O3Jyu&Ya&pLzi62gEe?a>DD*pM0kRX?q)(U z#;tc^$7aDGY;@@*&m2^WA|n1MgGQ1oo)e;X@_Pa9Tdn)|RTAm3gjd$+(#myNOZnWv z1P68~B?klRKGyl*mR77LG54A!I_ zH2CQq{sHpFA}q~=)_H1_vI#F_Cl$hPrM;D2VK%+}78yVwoMl&MU@t=Q`FZV0*l^n_ z&{*zBk{_uwK*v)m=P2r|ZYmjvdbay3p_(XdyvgPMLlc0?SL_OjI+rw`5-sj@=#eY` z<_O_$k};*KG*m?SP0q%C;W{{dU6>^yuLJKhPiW6u3UN>6u{7TcWwVy_er@%}Wn}4< zsyE{$T?rim85?{IHjtdkzm*C+z~J@_co2DPN_#7Zcuw9UW%OQG$7R(yVNdzxq3=42 zq1~9`=2T-i&?c$-c#z24A^pVj@klSanh3pD$`wHG#5R(gM7P4Cp5I6jQzD&;h z-bFI}+yn|eC1p4=g_&p4!3$b9X z2Eb)2BiJw@^%q$hnmTT;#aO+<&k;_@aJUnLER<Ld|u(SmW2{tUAUA6Uh#Hdx!_%ac6+Tpc*VB@}c>c%Pyqc(KS zOu|CRyu5Olwxr%duF$W&I3-Etva+riv`c$}h5iYFX}|jNN`h-wxZi`Yd0O%d=F3ui zE8}5b&>u_toH!2RyEgM@0pf8W@pz9u@(?#?W@rQJYg#`~<{o2ff0~TWAG`H58Aw!< zgjn;}-elw`-n((|_w0=X)p@nKOVqzK@)C~f z9;oQMPS?-_(gG3p>-EO%qHq)Q3ipH#I1-X5O7niTrq<`POh$$`hQQ?YMzp;wQ3@D) z>u}wbAu=|FCzj8Qi9*fpP0>D}J1P&j&I`M#CSEkZK|u^Yd+-gBX1NedsE*JAEfOeb zw1qR}cH1FuP?MaMrx%fI1cEpdY6HqJbG7yD;|j(TyHv2x9ir1nm4Cf*35j$a+GMWL zFn>s{-L8eThzN*vN;EKa{7R75#A?Yo8UQ4lpDoo-k&~ z1>oijtsTb9#Tk%8JHN}TXE=#I@FAVzROAGce%#y2cPs1|zT=iXU;mZ6p|?`V9QnzC z_dYDU`7o~Gmm*g~O4PsBm}v?Ux7K@OEB!D&ogbNsOX};vxP}DOI&g}$+gM62;_w{$ zARK*}b3M?MUhz_O>TvbInojSW&hZ}eovY5JGl5@=;txXz1zWKI3(KBjr#|163%=jC zI1#;!AG(ngEOn>sKN~gn%bDFZ2-+&pjkSat{VJ6dPZQte4M(nmIx8bpZi0r;G>Y6Z z?eip6(!zPUN$F7_5v0Wm%bLinaim);1(uPGRhB&yVg-zS_hN(3?dpf1MXANjfh@l- z#v5Hf$z<~PjQi{&Kwip5juIGp({q?xeVZ&}yAR9m#kOxEcJ>fEUqw#Vyl1sqL!wf{KMrPiu*Ta zAxS#am~ZskABoRFmY<1#DGj}Y;2aSkbSd17CjiW%Zb`10dwO?5!-eRw`$PEfFb=r2 z=K*0gqx-H~D@^tFb+cc9Q8k(#j(DfG)@=xSnC_k4ZogThsZEel*4YPNLZ zD%~s}2l2VTKWAX+SGTZo9IWcbW){@rje_A5W<4L*GzV)XxTGcOJVDE*{p5{?RfRY3 zMYgsfY9;n+9dO3Ea{Pvr%a2c>HjdX3&|*XCJPD+Vs{3Y2LoWl@EPD%ZNQehGV1eCV zzTWa$wgOrfBWfe`Th>@@3h0l&?lzOfNTxApC|soD)Z}Ne-MczSY4s}s08ZdQAK8bzRa^>PsFUz6;A<6U{Z^SJ3Gs| zs=>%$3@$BX`(UfD+VkojwC8bXKpx6!FVs;)}w#x3@a zrM*W-Ow{WO>P&q|5Zvn-#p}NNpg1pUj~PWmB0Fgd`yKh6hZoASPY0fHNMI7evo3g4 zOb>#<;mb@-3`eka;SPtTda{l8Dwv?L1TjS_CX8mz?MG0WeAz0YS{m#gf|oBI;jp z6TV=f@X}1jjFpJW^DukA_p8jyWSawsQ7VkEj+X097%DVtBw^&zPKdq?M8AY{|+_Bg4G(`rT_J?y6SP}&mV4M*Rqg( zq+Fuof3Yt8j<=>Ja}Gqn96m}mT`*=j3@c2X5vN)lnjwYTu=m)o_ZMmtLE2zy>OaZ+ z=`503z_+25fQ)%r5YpS;Mh-Z$jA|$Jb+M8W=3g}WmHD?-FC+b*Gxj8UEBT0mgm}7N z`B9xz+#XN{=Ou1W+?Oy`QOS3D@T*9BTBrD!(}5SI;|eub3WYBk{g4we%FJu+7GKJA zyA1LT!tZlJPB6)*A&MI9NKuMCCnLcDJd!En6*BR3o~QB`JWD=C&xw7e5q0X|-sten zw8m(65x;V>oTSOs1Nji~&4rX&qjEcaind3R|CsT0aq!0hS``=mcVSq=KJ!d%+UT%V z`^@-aLyK_V;~$+8V}`V72AlP8*y`^H+FG5G)jY)(q82?_;fnCl;N)vs9kncFR+kuL zJl^40eMDMJVheX#jJ$uUsAU^MNP?+5hz49w4G`M z8;I0Q{9xfagjyDPoeXwaJM;UUQE@q5IG#nzGgV1cG7+r` z$DH%x_zwq!Br2e|_z9_9FDlG6F?>1Txu_*#n6J9Jy2m#%U3Jj3x`dQWQ87h&R8^gK zz@zFU4i{k|4OtjFpj})iMzGa7N{K_Ofa0Rhox>ppe^UR@Q!0NaSt4%4E73N0KaRPi%G4I z#s|o@`q6UkTzy{=p^bC4RF$w_gkA|9Kev27+g@pmBI)cIQ`E)m*ThMhaocQ#+)QP#x_V$Bd7c!a zVY51!+ao9$IS-iID=mVI|1B6$cAKrA!fHrv>9gh?B4BfQVfU{@|v$VV`fhBa1K=l_`J=|ZMzfBLJck$5XO+w z;{ki{V+0GXAwE}`d(0!?G=?x1KMrawIPonoZdij(9tp-rDA@`$IA_ztm0!>5o_qze zW_ySIo-`kh?doI}&-I=k{Dm^tUm8ESzZB;)JZUiir+-dLg{slr05+AP+t&aEc+w z<9gApFN(ih%_H+XF=UaJPx=d4iHg!)mL)5I-yFoMOk?St?fi@bNBArG>1anK$of+U zIe|Dsh$^69B2@L)OUT^Gk0@0Px7CNK@~LkO8v6(cNuZLC%$%x969=#{cHKcYVV4H) z5o7*~Sh$5M@p;od3%kqTw>-mImDGvm^IIH2{2QeA)DH{lEHt2yvf}ei9(oy1@!t2s z)UO34WQA<<*6Tgw1QM@#7p1vE_jAKWoC`z$tVH5JD}fD$|0*4{ixP|grC(T7rRaIt5zs5}!28)p*d39*q(BOT6dVe!?q1JP1SAsl2bpEh<`=MjrH zex(Spal;Li@zE?ln83$*AA25>~MjL~b#2qSumH8{Tni)5&{ z;QT$pXr|R|0rCTF<%E+(#R9E+6F-z4y==0S*`rixw#WO;vS{T}D6PE>B>HP)?3*a- znndXR7Jf zO!5Ue5qKBh%k|Hzq8;~s{Ks%~`14(E`ePA2Sfdm3hDkwB`x zbCHAzKa&Q59G+99!JK-mkfX_LJxdll-Sh4cbRd4Ba!EK33L6JaXHP}JM33M)#4K;M z9iFMkBk(V)`(D`jb$EC>`S1Ipu@GjDo+?afjj}ai2_1Tw*lF8am}Xz%00)nD+L4zt zyJ=9L&xhmL3pTtcM-^Ln`3Sz0vPTmzzFz0blc)r)K?I$;`?dqZvMVfbU_urdi<8j(sX@!LM3T{dVjd0;42ratjgGa#VgUD(BhI)534rGuMTwKO35?}Pip(-InoqV zn)_kA7DigLYn}y;SU;YLG6YupRAmXvy$m=tHol%7eTU=U)YkkhhDX0~M7Fz%$VSv; zJnb$qj>L9f-@Lv*g`RN?-_|He12J!pPg^g-lqMHZhfo1R@SkfrkAghzdj*gW^}DfO zKWj$R^A*I%bM;Iz>cyggphuKegtLj~(rp&sf>$R(N$hkYHH(}vv@uqYj4@Uq&YSH7v~d}J1={D!)) zn-L5xcibu4vs?*WH)yX37+<+)mYOYQPBofo8j{}-zcFtYCOFzu7_6dsRe7PB!c^+q z6h8V=s9pLLO7YoBJGkBp+|O!|_ov`2woAM8r5d4J1j|=rKTgaNy!W-z;ap_vu8Ky$ zloCncu&9Fy;4WG<5(%Z&0m09qX3O^Q!k6QkeljOr*&K`!Lh%d@L`;nh4=fejO?IJU z>MH)mir#>>r91y^hre_nKp~H#y%*0Enz&Z~?wS^6?-@>zbN0Tq7_=|h*EfUpVHfP# z6O}b2xw7(CRDU$HRqgMHyJ~YaFyL={>K%?xNBJ?_gcv(~Zt!$U_|gltmUeq5p7x8M zWP7u+M%yxq!k7-l;hk&r$!)AnoP!`<`m_AZYUXGWvo5SVK>gO4dW~NQxFyo#7jg|a zfSW|f*V_w1;hOCD?2YxGy=@;ftF(qQLi2Y<6Fz^qj`sdmdE=bO)MiZ!cvdA6H7bX}u#&3T>3wC1b?jx`L=N6H7!uChT z%hy;O>K+&C&<#6Qi}+NZjDM%&skN6Q>j}22MCr|&-rXgAZZumW7$>1SvxUD zhtBxP{3U_nc5cPJ@<85FyVDY+$<&JkAs}F|fIPchu^kg0E5U$b6?s4f-aOt&ZyRWe z4c>B8H&bym`yF0(lOce zq#BxC0iPKkt1VB)e)hbj{e9sRW^^ljN>m%rca^VnImq5X_PBf*mcI%*5`Fy>9DMZp zcc<|{%=E(MCv?=t7cYv5?NOyL=ntg|HAnR8DOoP5AoWt19;ig#5FIgvE?Z?r`$75w z@d*@x@_wiSFw75MX>OF}o<;12GX0Zqj>E2I)AM70*kV*dD?QtQlo78ex0_La`C4ww zS}yNKCNCq^cG2Y`?8&W!tM+$G`F2aWN-HP<9hu*uz1hNSoitF794tT114GMCDf6Re zn~aKY9Nqrx`l>uTS-whg^k~pt8zHS=1CI)kZgTmc(4v}vyBQcLZ8lV2>~lc&E>`!& zl|7+9;mdF->MJbkX+u%(9B=7Iq-gBj@$O{)JBA3lSe)3-Rsq!)Hjo%yYr`)4oDyrM zU0-?hJ(13(R5On*eA&TabL|ux-p0%I-F39j;l{}nG^p)T?J{!Oj-QkfPa&`H9);&9 zfKFxpS_#4rhMH7nrOmjCq?FUXp_tKjx@ Date: Tue, 7 Jan 2025 15:57:14 +0000 Subject: [PATCH 23/28] txpool: streamline initialisation (#13202) Attempt to simplify how we initialise and run the`TxPool`. Observations: 1. Currently the package exports many sub-components to backend.go such as `Fetch`, `Sender`, `PoolDB`, `newTxs chan txpool.Announcements`. I see these all as internal components of the `TxPool` that `backend.go` and other initialisers should not care about. In reality, the only things `backend.go` cares about are the `TxPool` and the `TxPoolGrpcServer`. 2. Additionally, logic about starting and closing the tx pool leaks to backend.go (ie the creator of tx pool needs to know what sub-components need to be started and disposed). This PR addresses the above by: 1. Moving the p2p fetcher, sender and pool db as internal attributes of TxPool. 2. Introducing the `Run(ctx)` pattern that we are using in Astrid and Shutter where each runnable component is responsible for starting its own background goroutines, loops, listeners, etc. and also is responsible for shutting them all down by being ctx-aware (ie when ctx is cancelled all sub components gets disposed of/shutdown) --- cmd/txpool/main.go | 36 ++-- eth/backend.go | 105 +++++------ turbo/stages/mock/mock_sentry.go | 79 ++++---- txnprovider/txpool/assemble.go | 123 +++++++++++++ txnprovider/txpool/fetch.go | 20 +- txnprovider/txpool/fetch_test.go | 19 +- txnprovider/txpool/options.go | 69 +++++++ txnprovider/txpool/pool.go | 61 ++++-- txnprovider/txpool/pool_db.go | 74 ++++++++ txnprovider/txpool/pool_fuzz_test.go | 6 +- txnprovider/txpool/pool_test.go | 64 +++---- txnprovider/txpool/send.go | 10 +- txnprovider/txpool/txpool_grpc_server.go | 8 +- .../txpool/txpoolutil/all_components.go | 174 ------------------ 14 files changed, 475 insertions(+), 373 deletions(-) create mode 100644 txnprovider/txpool/assemble.go create mode 100644 txnprovider/txpool/options.go delete mode 100644 txnprovider/txpool/txpoolutil/all_components.go diff --git a/cmd/txpool/main.go b/cmd/txpool/main.go index c476f29a2db..eba6b7a2632 100644 --- a/cmd/txpool/main.go +++ b/cmd/txpool/main.go @@ -28,6 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" "github.com/erigontech/erigon-lib/gointerfaces/grpcutil" @@ -38,16 +39,12 @@ import ( "github.com/erigontech/erigon-lib/kv/remotedbserver" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/erigontech/erigon/consensus/misc" - "github.com/erigontech/erigon/ethdb/privateapi" - "github.com/erigontech/erigon/txnprovider/txpool" - "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" - "github.com/erigontech/erigon/txnprovider/txpool/txpoolutil" - - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/ethdb/privateapi" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" + "github.com/erigontech/erigon/txnprovider/txpool" + "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" ) var ( @@ -183,26 +180,31 @@ func doTxpool(ctx context.Context, logger log.Logger) error { cfg.TracedSenders[i] = string(sender[:]) } - newTxs := make(chan txpool.Announcements, 1024) - defer close(newTxs) - txPoolDB, txPool, fetch, send, txpoolGrpcServer, err := txpoolutil.AllComponents(ctx, cfg, - kvcache.New(cacheConfig), newTxs, coreDB, sentryClients, kvClient, misc.Eip1559FeeCalculator, logger) + notifyMiner := func() {} + txPool, txpoolGrpcServer, err := txpool.Assemble( + ctx, + cfg, + coreDB, + kvcache.New(cacheConfig), + sentryClients, + kvClient, + notifyMiner, + logger, + ) if err != nil { return err } - defer txPoolDB.Close() - fetch.ConnectCore() - fetch.ConnectSentries() miningGrpcServer := privateapi.NewMiningServer(ctx, &rpcdaemontest.IsMiningMock{}, nil, logger) - grpcServer, err := txpool.StartGrpc(txpoolGrpcServer, miningGrpcServer, txpoolApiAddr, nil, logger) if err != nil { return err } - notifyMiner := func() {} - txpool.MainLoop(ctx, txPool, newTxs, send, txpoolGrpcServer.NewSlotsStreams, notifyMiner) + err = txPool.Run(ctx) + if err != nil { + return err + } grpcServer.GracefulStop() return nil diff --git a/eth/backend.go b/eth/backend.go index e1b1edcb6d2..08da323e42c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -87,7 +87,6 @@ import ( "github.com/erigontech/erigon/consensus/clique" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/consensus/merge" - "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" @@ -134,7 +133,6 @@ import ( "github.com/erigontech/erigon/txnprovider/shutter" "github.com/erigontech/erigon/txnprovider/txpool" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" - "github.com/erigontech/erigon/txnprovider/txpool/txpoolutil" ) // Config contains the configuration options of the ETH protocol. @@ -193,16 +191,12 @@ type Ethereum struct { waitForStageLoopStop chan struct{} waitForMiningStop chan struct{} - txPoolDB kv.RwDB - txPool *txpool.TxPool - newTxs chan txpool.Announcements - txPoolFetch *txpool.Fetch - txPoolSend *txpool.Send - txPoolGrpcServer txpoolproto.TxpoolServer - shutterPool *shutter.Pool - notifyMiningAboutNewTxs chan struct{} - forkValidator *engine_helpers.ForkValidator - downloader *downloader.Downloader + txPool *txpool.TxPool + txPoolGrpcServer txpoolproto.TxpoolServer + shutterPool *shutter.Pool + blockBuilderNotifyNewTxns chan struct{} + forkValidator *engine_helpers.ForkValidator + downloader *downloader.Downloader blockSnapshots *freezeblocks.RoSnapshots blockReader services.FullBlockReader @@ -276,14 +270,17 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger // kv_remote architecture does blocks on stream.Send - means current architecture require unlimited amount of txs to provide good throughput backend := &Ethereum{ - sentryCtx: ctx, - sentryCancel: ctxCancel, - config: config, - networkID: config.NetworkID, - etherbase: config.Miner.Etherbase, - waitForStageLoopStop: make(chan struct{}), - waitForMiningStop: make(chan struct{}), - logger: logger, + sentryCtx: ctx, + sentryCancel: ctxCancel, + config: config, + networkID: config.NetworkID, + etherbase: config.Miner.Etherbase, + waitForStageLoopStop: make(chan struct{}), + waitForMiningStop: make(chan struct{}), + blockBuilderNotifyNewTxns: make(chan struct{}, 1), + miningSealingQuit: make(chan struct{}), + minedBlocks: make(chan *types.Block, 1), + logger: logger, stopNode: func() error { return stack.Close() }, @@ -645,34 +642,43 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger return nil, err } - var txnProvider txnprovider.TxnProvider - var miningRPC txpoolproto.MiningServer stateDiffClient := direct.NewStateDiffClientDirect(kvRPC) + var txnProvider txnprovider.TxnProvider if config.TxPool.Disable { backend.txPoolGrpcServer = &txpool.GrpcDisabled{} } else { - backend.newTxs = make(chan txpool.Announcements, 1024) - backend.txPoolDB, backend.txPool, backend.txPoolFetch, backend.txPoolSend, backend.txPoolGrpcServer, err = txpoolutil.AllComponents( - ctx, config.TxPool, kvcache.NewDummy(), backend.newTxs, backend.chainDB, backend.sentriesClient.Sentries(), stateDiffClient, misc.Eip1559FeeCalculator, logger, + sentries := backend.sentriesClient.Sentries() + blockBuilderNotifyNewTxns := func() { + select { + case backend.blockBuilderNotifyNewTxns <- struct{}{}: + default: + } + } + backend.txPool, backend.txPoolGrpcServer, err = txpool.Assemble( + ctx, + config.TxPool, + backend.chainDB, + kvcache.NewDummy(), + sentries, + stateDiffClient, + blockBuilderNotifyNewTxns, + logger, ) if err != nil { return nil, err } + txnProvider = backend.txPool } if config.Shutter.Enabled { if config.TxPool.Disable { panic("can't enable shutter pool when devp2p txpool is disabled") } - backend.shutterPool = shutter.NewPool(logger, config.Shutter, txnProvider) + + backend.shutterPool = shutter.NewPool(logger, config.Shutter, backend.txPool) txnProvider = backend.shutterPool } - backend.notifyMiningAboutNewTxs = make(chan struct{}, 1) - backend.miningSealingQuit = make(chan struct{}) - backend.pendingBlocks = make(chan *types.Block, 1) - backend.minedBlocks = make(chan *types.Block, 1) - miner := stagedsync.NewMiningState(&config.Miner) backend.pendingBlocks = miner.PendingResultCh @@ -791,7 +797,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger blockRetire := freezeblocks.NewBlockRetire(1, dirs, blockReader, blockWriter, backend.chainDB, heimdallStore, bridgeStore, backend.chainConfig, config, backend.notifications.Events, segmentsBuildLimiter, logger) - miningRPC = privateapi.NewMiningServer(ctx, backend, ethashApi, logger) + var miningRPC txpoolproto.MiningServer = privateapi.NewMiningServer(ctx, backend, ethashApi, logger) var creds credentials.TransportCredentials if stack.Config().PrivateApiAddr != "" { @@ -821,26 +827,6 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger if currentBlock == nil { currentBlock = genesis } - // We start the transaction pool on startup, for a couple of reasons: - // 1) Hive tests requires us to do so and starting it from eth_sendRawTransaction is not viable as we have not enough data - // to initialize it properly. - // 2) we cannot propose for block 1 regardless. - - if !config.TxPool.Disable { - backend.txPoolFetch.ConnectCore() - backend.txPoolFetch.ConnectSentries() - var newTxsBroadcaster *txpool.NewSlotsStreams - if casted, ok := backend.txPoolGrpcServer.(*txpool.GrpcServer); ok { - newTxsBroadcaster = casted.NewSlotsStreams - } - go txpool.MainLoop(backend.sentryCtx, backend.txPool, backend.newTxs, backend.txPoolSend, newTxsBroadcaster, - func() { - select { - case backend.notifyMiningAboutNewTxs <- struct{}{}: - default: - } - }) - } go func() { defer debug.LogPanic() @@ -1279,8 +1265,8 @@ func (s *Ethereum) StartMining(ctx context.Context, db kv.RwDB, stateDiffClient // block info in the state channel hasWork = true - case <-s.notifyMiningAboutNewTxs: - //log.Warn("[dbg] notifyMiningAboutNewTxs") + case <-s.blockBuilderNotifyNewTxns: + //log.Warn("[dbg] blockBuilderNotifyNewTxns") // Skip mining based on new txn notif for bor consensus hasWork = s.chainConfig.Bor == nil @@ -1598,6 +1584,14 @@ func (s *Ethereum) Start() error { } } + if s.txPool != nil { + // We start the transaction pool on startup, for a couple of reasons: + // 1) Hive tests requires us to do so and starting it from eth_sendRawTransaction is not viable as we have not enough data + // to initialize it properly. + // 2) we cannot propose for block 1 regardless. + s.bgComponentsEg.Go(func() error { return s.txPool.Run(s.sentryCtx) }) + } + if s.shutterPool != nil { s.bgComponentsEg.Go(func() error { return s.shutterPool.Run(s.sentryCtx) }) } @@ -1639,9 +1633,6 @@ func (s *Ethereum) Stop() error { for _, sentryServer := range s.sentryServers { sentryServer.Close() } - if s.txPoolDB != nil { - s.txPoolDB.Close() - } s.chainDB.Close() if s.silkwormRPCDaemonService != nil { diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index 529b4cbfb89..db6203bd52a 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -29,8 +29,9 @@ import ( "github.com/c2h5oh/datasize" lru "github.com/hashicorp/golang-lru/arc/v2" - "github.com/holiman/uint256" + "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" + "golang.org/x/sync/errgroup" "golang.org/x/sync/semaphore" "google.golang.org/protobuf/types/known/emptypb" @@ -44,6 +45,7 @@ import ( proto_downloader "github.com/erigontech/erigon-lib/gointerfaces/downloaderproto" execution "github.com/erigontech/erigon-lib/gointerfaces/executionproto" proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" ptypes "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/kvcache" @@ -125,11 +127,8 @@ type MockSentry struct { Notifications *shards.Notifications // TxPool - TxPoolFetch *txpool.Fetch - TxPoolSend *txpool.Send - TxPoolGrpcServer *txpool.GrpcServer TxPool *txpool.TxPool - txPoolDB kv.RwDB + TxPoolGrpcServer txpoolproto.TxpoolServer HistoryV3 bool agg *libstate.Aggregator @@ -137,13 +136,11 @@ type MockSentry struct { BlockReader services.FullBlockReader ReceiptsReader *receipts.Generator posStagedSync *stagedsync.Sync + bgComponentsEg errgroup.Group } func (ms *MockSentry) Close() { ms.cancel() - if ms.txPoolDB != nil { - ms.txPoolDB.Close() - } if ms.Engine != nil { ms.Engine.Close() } @@ -156,6 +153,9 @@ func (ms *MockSentry) Close() { if ms.DB != nil { ms.DB.Close() } + if err := ms.bgComponentsEg.Wait(); err != nil { + require.Equal(ms.tb, context.Canceled, err) // upon waiting for clean exit we should get ctx cancelled + } } // Stream returns stream, waiting if necessary @@ -318,6 +318,17 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK if tb != nil { tb.Cleanup(mock.Close) } + + // Committed genesis will be shared between download and mock sentry + _, mock.Genesis, err = core.CommitGenesisBlock(mock.DB, gspec, datadir.New(tmpdir), mock.Log) + if _, ok := err.(*chain.ConfigCompatError); err != nil && !ok { + if tb != nil { + tb.Fatal(err) + } else { + panic(err) + } + } + blockWriter := blockio.NewBlockWriter() mock.Address = crypto.PubkeyToAddress(mock.Key.PublicKey) @@ -333,49 +344,33 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK blockPropagator := func(Ctx context.Context, header *types.Header, body *types.RawBody, td *big.Int) {} if !cfg.TxPool.Disable { poolCfg := txpoolcfg.DefaultConfig - newTxs := make(chan txpool.Announcements, 1024) - if tb != nil { - tb.Cleanup(func() { - close(newTxs) - }) - } - chainID, _ := uint256.FromBig(mock.ChainConfig.ChainID) - shanghaiTime := mock.ChainConfig.ShanghaiTime - cancunTime := mock.ChainConfig.CancunTime - pragueTime := mock.ChainConfig.PragueTime - maxBlobsPerBlock := mock.ChainConfig.GetMaxBlobsPerBlock() - mock.txPoolDB = memdb.NewWithLabel(tmpdir, kv.TxPoolDB) - mock.TxPool, err = txpool.New(newTxs, mock.txPoolDB, mock.DB, poolCfg, kvcache.NewDummy(), *chainID, shanghaiTime, nil /* agraBlock */, cancunTime, pragueTime, maxBlobsPerBlock, nil, logger) + stateChangesClient := direct.NewStateDiffClientDirect(erigonGrpcServeer) + mock.TxPool, mock.TxPoolGrpcServer, err = txpool.Assemble( + ctx, + poolCfg, + mock.DB, + kvcache.NewDummy(), + sentries, + stateChangesClient, + func() {}, /* builderNotifyNewTxns */ + logger, + txpool.WithP2PFetcherWg(&mock.ReceiveWg), + txpool.WithP2PSenderWg(nil), + txpool.WithFeeCalculator(nil), + txpool.WithPoolDBInitializer(func(_ context.Context, _ txpoolcfg.Config, _ log.Logger) (kv.RwDB, error) { + return memdb.NewWithLabel(tmpdir, kv.TxPoolDB), nil + }), + ) if err != nil { tb.Fatal(err) } - stateChangesClient := direct.NewStateDiffClientDirect(erigonGrpcServeer) - - mock.TxPoolFetch = txpool.NewFetch(mock.Ctx, sentries, mock.TxPool, stateChangesClient, mock.DB, mock.txPoolDB, *chainID, logger) - mock.TxPoolFetch.SetWaitGroup(&mock.ReceiveWg) - mock.TxPoolSend = txpool.NewSend(mock.Ctx, sentries, mock.TxPool, logger) - mock.TxPoolGrpcServer = txpool.NewGrpcServer(mock.Ctx, mock.TxPool, mock.txPoolDB, *chainID, logger) - - mock.TxPoolFetch.ConnectCore() mock.StreamWg.Add(1) - mock.TxPoolFetch.ConnectSentries() + mock.bgComponentsEg.Go(func() error { return mock.TxPool.Run(ctx) }) mock.StreamWg.Wait() - - go txpool.MainLoop(mock.Ctx, mock.TxPool, newTxs, mock.TxPoolSend, mock.TxPoolGrpcServer.NewSlotsStreams, func() {}) } - // Committed genesis will be shared between download and mock sentry - _, mock.Genesis, err = core.CommitGenesisBlock(mock.DB, gspec, datadir.New(tmpdir), mock.Log) - if _, ok := err.(*chain.ConfigCompatError); err != nil && !ok { - if tb != nil { - tb.Fatal(err) - } else { - panic(err) - } - } latestBlockBuiltStore := builder.NewLatestBlockBuiltStore() - inMemoryExecution := func(txc wrap.TxContainer, header *types.Header, body *types.RawBody, unwindPoint uint64, headersChain []*types.Header, bodiesChain []*types.RawBody, notifications *shards.Notifications) error { terseLogger := log.New() diff --git a/txnprovider/txpool/assemble.go b/txnprovider/txpool/assemble.go new file mode 100644 index 00000000000..77332be8baf --- /dev/null +++ b/txnprovider/txpool/assemble.go @@ -0,0 +1,123 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package txpool + +import ( + "context" + "math/big" + + "github.com/c2h5oh/datasize" + "github.com/holiman/uint256" + + "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" + "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/kv/kvcache" + "github.com/erigontech/erigon-lib/kv/mdbx" + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" +) + +func Assemble( + ctx context.Context, + cfg txpoolcfg.Config, + chainDB kv.RwDB, + cache kvcache.Cache, + sentryClients []sentryproto.SentryClient, + stateChangesClient StateChangesClient, + builderNotifyNewTxns func(), + logger log.Logger, + opts ...Option, +) (*TxPool, txpoolproto.TxpoolServer, error) { + options := applyOpts(opts...) + poolDB, err := options.poolDBInitializer(ctx, cfg, logger) + if err != nil { + return nil, nil, err + } + + chainConfig, _, err := SaveChainConfigIfNeed(ctx, chainDB, poolDB, true, logger) + if err != nil { + return nil, nil, err + } + + chainID, _ := uint256.FromBig(chainConfig.ChainID) + maxBlobsPerBlock := chainConfig.GetMaxBlobsPerBlock() + + shanghaiTime := chainConfig.ShanghaiTime + var agraBlock *big.Int + if chainConfig.Bor != nil { + agraBlock = chainConfig.Bor.GetAgraBlock() + } + cancunTime := chainConfig.CancunTime + pragueTime := chainConfig.PragueTime + if cfg.OverridePragueTime != nil { + pragueTime = cfg.OverridePragueTime + } + + newTxns := make(chan Announcements, 1024) + newSlotsStreams := &NewSlotsStreams{} + pool, err := New( + ctx, + newTxns, + poolDB, + chainDB, + cfg, + cache, + *chainID, + shanghaiTime, + agraBlock, + cancunTime, + pragueTime, + maxBlobsPerBlock, + sentryClients, + stateChangesClient, + builderNotifyNewTxns, + newSlotsStreams, + logger, + opts..., + ) + if err != nil { + return nil, nil, err + } + + grpcServer := NewGrpcServer(ctx, pool, poolDB, newSlotsStreams, *chainID, logger) + return pool, grpcServer, nil +} + +type poolDBInitializer func(ctx context.Context, cfg txpoolcfg.Config, logger log.Logger) (kv.RwDB, error) + +var defaultPoolDBInitializer = func(ctx context.Context, cfg txpoolcfg.Config, logger log.Logger) (kv.RwDB, error) { + opts := mdbx.New(kv.TxPoolDB, logger). + Path(cfg.DBDir). + WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). + WriteMergeThreshold(3 * 8192). + PageSize(16 * datasize.KB). + GrowthStep(16 * datasize.MB). + DirtySpace(uint64(128 * datasize.MB)). + MapSize(1 * datasize.TB). + WriteMap(cfg.MdbxWriteMap) + if cfg.MdbxPageSize > 0 { + opts = opts.PageSize(cfg.MdbxPageSize) + } + if cfg.MdbxDBSizeLimit > 0 { + opts = opts.MapSize(cfg.MdbxDBSizeLimit) + } + if cfg.MdbxGrowthStep > 0 { + opts = opts.GrowthStep(cfg.MdbxGrowthStep) + } + return opts.Open(ctx) +} diff --git a/txnprovider/txpool/fetch.go b/txnprovider/txpool/fetch.go index 21838e85798..1e11b37f706 100644 --- a/txnprovider/txpool/fetch.go +++ b/txnprovider/txpool/fetch.go @@ -43,7 +43,6 @@ import ( type Fetch struct { ctx context.Context // Context used for cancellation and closing of the fetcher pool Pool // Transaction pool implementation - coreDB kv.RoDB db kv.RwDB stateChangesClient StateChangesClient wg *sync.WaitGroup // used for synchronisation in the tests (nil when not in tests) @@ -62,17 +61,26 @@ type StateChangesClient interface { // NewFetch creates a new fetch object that will work with given sentry clients. Since the // SentryClient here is an interface, it is suitable for mocking in tests (mock will need // to implement all the functions of the SentryClient interface). -func NewFetch(ctx context.Context, sentryClients []sentry.SentryClient, pool Pool, stateChangesClient StateChangesClient, coreDB kv.RoDB, db kv.RwDB, - chainID uint256.Int, logger log.Logger) *Fetch { +func NewFetch( + ctx context.Context, + sentryClients []sentry.SentryClient, + pool Pool, + stateChangesClient StateChangesClient, + db kv.RwDB, + chainID uint256.Int, + logger log.Logger, + opts ...Option, +) *Fetch { + options := applyOpts(opts...) f := &Fetch{ ctx: ctx, sentryClients: sentryClients, pool: pool, - coreDB: coreDB, db: db, stateChangesClient: stateChangesClient, stateChangesParseCtx: NewTxnParseContext(chainID).ChainIDRequired(), //TODO: change ctx if rules changed pooledTxnsParseCtx: NewTxnParseContext(chainID).ChainIDRequired(), + wg: options.p2pFetcherWg, logger: logger, } f.pooledTxnsParseCtx.ValidateRLP(f.pool.ValidateSerializedTxn) @@ -81,10 +89,6 @@ func NewFetch(ctx context.Context, sentryClients []sentry.SentryClient, pool Poo return f } -func (f *Fetch) SetWaitGroup(wg *sync.WaitGroup) { - f.wg = wg -} - func (f *Fetch) threadSafeParsePooledTxn(cb func(*TxnParseContext) error) error { f.pooledTxnsParseCtxLock.Lock() defer f.pooledTxnsParseCtxLock.Unlock() diff --git a/txnprovider/txpool/fetch_test.go b/txnprovider/txpool/fetch_test.go index 441404fa743..3f6f0e00f1a 100644 --- a/txnprovider/txpool/fetch_test.go +++ b/txnprovider/txpool/fetch_test.go @@ -24,7 +24,6 @@ import ( "sync" "testing" - "github.com/erigontech/erigon-lib/kv" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" @@ -37,6 +36,7 @@ import ( remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/gointerfaces/typesproto" + "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" ) @@ -53,9 +53,8 @@ func TestFetch(t *testing.T) { m := NewMockSentry(ctx, sentryServer) sentryClient := direct.NewSentryClientDirect(direct.ETH67, m) - fetch := NewFetch(ctx, []sentryproto.SentryClient{sentryClient}, pool, remoteKvClient, nil, nil, *u256.N1, log.New()) var wg sync.WaitGroup - fetch.SetWaitGroup(&wg) + fetch := NewFetch(ctx, []sentryproto.SentryClient{sentryClient}, pool, remoteKvClient, nil, *u256.N1, log.New(), WithP2PFetcherWg(&wg)) m.StreamWg.Add(2) fetch.ConnectSentries() m.StreamWg.Wait() @@ -74,7 +73,7 @@ func TestFetch(t *testing.T) { wg.Wait() } -func TestSendTxPropagate(t *testing.T) { +func TestSendTxnPropagate(t *testing.T) { ctx, cancelFn := context.WithCancel(context.Background()) defer cancelFn() t.Run("few remote byHash", func(t *testing.T) { @@ -102,7 +101,7 @@ func TestSendTxPropagate(t *testing.T) { }).AnyTimes() m := NewMockSentry(ctx, sentryServer) - send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, nil, log.New()) + send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, log.New()) send.BroadcastPooledTxns(testRlps(2), 100) send.AnnouncePooledTxns([]byte{0, 1}, []uint32{10, 15}, toHashes(1, 42), 100) @@ -132,7 +131,7 @@ func TestSendTxPropagate(t *testing.T) { Times(times) m := NewMockSentry(ctx, sentryServer) - send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, nil, log.New()) + send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, log.New()) list := make(Hashes, p2pTxPacketLimit*3) for i := 0; i < len(list); i += 32 { b := []byte(fmt.Sprintf("%x", i)) @@ -167,7 +166,7 @@ func TestSendTxPropagate(t *testing.T) { Times(times) m := NewMockSentry(ctx, sentryServer) - send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, nil, log.New()) + send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, log.New()) send.BroadcastPooledTxns(testRlps(2), 100) send.AnnouncePooledTxns([]byte{0, 1}, []uint32{10, 15}, toHashes(1, 42), 100) @@ -207,7 +206,7 @@ func TestSendTxPropagate(t *testing.T) { }).AnyTimes() m := NewMockSentry(ctx, sentryServer) - send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, nil, log.New()) + send := NewSend(ctx, []sentryproto.SentryClient{direct.NewSentryClientDirect(direct.ETH68, m)}, log.New()) expectPeers := toPeerIDs(1, 2, 42) send.PropagatePooledTxnsToPeersList(expectPeers, []byte{0, 1}, []uint32{10, 15}, toHashes(1, 42)) @@ -231,7 +230,7 @@ func decodeHex(in string) []byte { func TestOnNewBlock(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - coreDB, db := memdb.NewTestDB(t, kv.ChainDB), memdb.NewTestDB(t, kv.TxPoolDB) + _, db := memdb.NewTestDB(t, kv.ChainDB), memdb.NewTestDB(t, kv.TxPoolDB) ctrl := gomock.NewController(t) stream := remote.NewMockKV_StateChangesClient(ctrl) @@ -286,7 +285,7 @@ func TestOnNewBlock(t *testing.T) { }). Times(1) - fetch := NewFetch(ctx, nil, pool, stateChanges, coreDB, db, *u256.N1, log.New()) + fetch := NewFetch(ctx, nil, pool, stateChanges, db, *u256.N1, log.New()) err := fetch.handleStateChanges(ctx, stateChanges) assert.ErrorIs(t, io.EOF, err) assert.Equal(t, 3, len(minedTxns.Txns)) diff --git a/txnprovider/txpool/options.go b/txnprovider/txpool/options.go new file mode 100644 index 00000000000..79f47369511 --- /dev/null +++ b/txnprovider/txpool/options.go @@ -0,0 +1,69 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package txpool + +import ( + "sync" + + "github.com/erigontech/erigon/consensus/misc" +) + +type Option func(*options) + +func WithFeeCalculator(f FeeCalculator) Option { + return func(o *options) { + o.feeCalculator = f + } +} + +func WithPoolDBInitializer(init poolDBInitializer) Option { + return func(o *options) { + o.poolDBInitializer = init + } +} + +func WithP2PFetcherWg(wg *sync.WaitGroup) Option { + return func(o *options) { + o.p2pFetcherWg = wg + } +} + +func WithP2PSenderWg(wg *sync.WaitGroup) Option { + return func(o *options) { + o.p2pSenderWg = wg + } +} + +type options struct { + feeCalculator FeeCalculator + poolDBInitializer poolDBInitializer + p2pSenderWg *sync.WaitGroup + p2pFetcherWg *sync.WaitGroup +} + +func applyOpts(opts ...Option) options { + overriddenDefaults := defaultOptions + for _, opt := range opts { + opt(&overriddenDefaults) + } + return overriddenDefaults +} + +var defaultOptions = options{ + poolDBInitializer: defaultPoolDBInitializer, + feeCalculator: misc.Eip1559FeeCalculator, +} diff --git a/txnprovider/txpool/pool.go b/txnprovider/txpool/pool.go index 2402f0de5f2..6a6b8bbadf5 100644 --- a/txnprovider/txpool/pool.go +++ b/txnprovider/txpool/pool.go @@ -48,6 +48,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" "github.com/erigontech/erigon-lib/gointerfaces/grpcutil" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" + "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/kvcache" @@ -144,6 +145,10 @@ type TxPool struct { isPostPrague atomic.Bool maxBlobsPerBlock uint64 feeCalculator FeeCalculator + p2pFetcher *Fetch + p2pSender *Send + newSlotsStreams *NewSlotsStreams + builderNotifyNewTxns func() logger log.Logger } @@ -152,6 +157,7 @@ type FeeCalculator interface { } func New( + ctx context.Context, newTxns chan Announcements, poolDB kv.RwDB, coreDB kv.RoDB, @@ -163,9 +169,14 @@ func New( cancunTime *big.Int, pragueTime *big.Int, maxBlobsPerBlock uint64, - feeCalculator FeeCalculator, + sentryClients []sentryproto.SentryClient, + stateChangesClient StateChangesClient, + builderNotifyNewTxns func(), + newSlotsStreams *NewSlotsStreams, logger log.Logger, + opts ...Option, ) (*TxPool, error) { + options := applyOpts(opts...) localsHistory, err := simplelru.NewLRU[string, struct{}](10_000, nil) if err != nil { return nil, err @@ -211,7 +222,9 @@ func New( minedBlobTxnsByBlock: map[uint64][]*metaTxn{}, minedBlobTxnsByHash: map[string]*metaTxn{}, maxBlobsPerBlock: maxBlobsPerBlock, - feeCalculator: feeCalculator, + feeCalculator: options.feeCalculator, + builderNotifyNewTxns: builderNotifyNewTxns, + newSlotsStreams: newSlotsStreams, logger: logger, } @@ -244,10 +257,12 @@ func New( res.pragueTime = &pragueTimeU64 } + res.p2pFetcher = NewFetch(ctx, sentryClients, res, stateChangesClient, poolDB, chainID, logger, opts...) + res.p2pSender = NewSend(ctx, sentryClients, logger, opts...) return res, nil } -func (p *TxPool) Start(ctx context.Context) error { +func (p *TxPool) start(ctx context.Context) error { if p.started.Load() { return nil } @@ -1731,7 +1746,7 @@ func (p *TxPool) promote(pendingBaseFee uint64, pendingBlobFee uint64, announcem } } -// MainLoop - does: +// Run - does: // send pending byHash to p2p: // - new byHash // - all pooled byHash to recently connected peers @@ -1739,7 +1754,11 @@ func (p *TxPool) promote(pendingBaseFee uint64, pendingBlobFee uint64, announcem // // promote/demote transactions // reorgs -func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send *Send, newSlotsStreams *NewSlotsStreams, notifyMiningAboutNewSlots func()) { +func (p *TxPool) Run(ctx context.Context) error { + defer p.poolDB.Close() + p.p2pFetcher.ConnectCore() + p.p2pFetcher.ConnectSentries() + syncToNewPeersEvery := time.NewTicker(p.cfg.SyncToNewPeersEvery) defer syncToNewPeersEvery.Stop() processRemoteTxnsEvery := time.NewTicker(p.cfg.ProcessRemoteTxnsEvery) @@ -1749,16 +1768,20 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * logEvery := time.NewTicker(p.cfg.LogEvery) defer logEvery.Stop() - if err := p.Start(ctx); err != nil { + if err := p.start(ctx); err != nil { p.logger.Error("[txpool] Failed to start", "err", err) - return + return err } for { select { case <-ctx.Done(): - _, _ = p.flush(ctx) - return + err := ctx.Err() + _, flushErr := p.flush(context.Background()) // need background ctx since the other one is cancelled + if flushErr != nil { + err = fmt.Errorf("%w: %w", flushErr, err) + } + return err case <-logEvery.C: p.logStats() case <-processRemoteTxnsEvery.C: @@ -1785,11 +1808,11 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * writeToDBBytesCounter.SetUint64(written) p.logger.Debug("[txpool] Commit", "written_kb", written/1024, "in", time.Since(t)) } - case announcements := <-newTxns: + case announcements := <-p.newPendingTxns: go func() { for i := 0; i < 16; i++ { // drain more events from channel, then merge and dedup them select { - case a := <-newTxns: + case a := <-p.newPendingTxns: announcements.AppendOther(a) continue default: @@ -1803,7 +1826,7 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * announcements = announcements.DedupCopy() - notifyMiningAboutNewSlots() + p.builderNotifyNewTxns() if p.cfg.NoGossip { // drain newTxns for emptying newTxn channel @@ -1868,17 +1891,17 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * p.logger.Error("[txpool] collect info to propagate", "err", err) return } - if newSlotsStreams != nil { - newSlotsStreams.Broadcast(&txpoolproto.OnAddReply{RplTxs: slotsRlp}, p.logger) + if p.newSlotsStreams != nil { + p.newSlotsStreams.Broadcast(&txpoolproto.OnAddReply{RplTxs: slotsRlp}, p.logger) } // broadcast local transactions const localTxnsBroadcastMaxPeers uint64 = 10 - txnSentTo := send.BroadcastPooledTxns(localTxnRlps, localTxnsBroadcastMaxPeers) + txnSentTo := p.p2pSender.BroadcastPooledTxns(localTxnRlps, localTxnsBroadcastMaxPeers) for i, peer := range txnSentTo { p.logger.Trace("Local txn broadcast", "txHash", hex.EncodeToString(broadcastHashes.At(i)), "to peer", peer) } - hashSentTo := send.AnnouncePooledTxns(localTxnTypes, localTxnSizes, localTxnHashes, localTxnsBroadcastMaxPeers*2) + hashSentTo := p.p2pSender.AnnouncePooledTxns(localTxnTypes, localTxnSizes, localTxnHashes, localTxnsBroadcastMaxPeers*2) for i := 0; i < localTxnHashes.Len(); i++ { hash := localTxnHashes.At(i) p.logger.Trace("Local txn announced", "txHash", hex.EncodeToString(hash), "to peer", hashSentTo[i], "baseFee", p.pendingBaseFee.Load()) @@ -1886,8 +1909,8 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * // broadcast remote transactions const remoteTxnsBroadcastMaxPeers uint64 = 3 - send.BroadcastPooledTxns(remoteTxnRlps, remoteTxnsBroadcastMaxPeers) - send.AnnouncePooledTxns(remoteTxnTypes, remoteTxnSizes, remoteTxnHashes, remoteTxnsBroadcastMaxPeers*2) + p.p2pSender.BroadcastPooledTxns(remoteTxnRlps, remoteTxnsBroadcastMaxPeers) + p.p2pSender.AnnouncePooledTxns(remoteTxnTypes, remoteTxnSizes, remoteTxnHashes, remoteTxnsBroadcastMaxPeers*2) }() case <-syncToNewPeersEvery.C: // new peer newPeers := p.recentlyConnectedPeers.GetAndClean() @@ -1904,7 +1927,7 @@ func MainLoop(ctx context.Context, p *TxPool, newTxns chan Announcements, send * var types []byte var sizes []uint32 types, sizes, hashes = p.AppendAllAnnouncements(types, sizes, hashes[:0]) - go send.PropagatePooledTxnsToPeersList(newPeers, types, sizes, hashes) + go p.p2pSender.PropagatePooledTxnsToPeersList(newPeers, types, sizes, hashes) propagateToNewPeerTimer.ObserveDuration(t) } } diff --git a/txnprovider/txpool/pool_db.go b/txnprovider/txpool/pool_db.go index 4c81a71faae..f180826d4fc 100644 --- a/txnprovider/txpool/pool_db.go +++ b/txnprovider/txpool/pool_db.go @@ -18,13 +18,17 @@ package txpool import ( "bytes" + "context" "encoding/binary" "encoding/json" + "errors" "fmt" + "time" "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/log/v3" ) var PoolChainConfigKey = []byte("chain_config") @@ -96,3 +100,73 @@ func PutChainConfig(tx kv.Putter, cc *chain.Config, buf []byte) error { } return nil } + +func SaveChainConfigIfNeed( + ctx context.Context, + coreDB kv.RoDB, + poolDB kv.RwDB, + force bool, + logger log.Logger, +) (cc *chain.Config, blockNum uint64, err error) { + if err = poolDB.View(ctx, func(tx kv.Tx) error { + cc, err = ChainConfig(tx) + if err != nil { + return err + } + blockNum, err = LastSeenBlock(tx) + if err != nil { + return err + } + return nil + }); err != nil { + return nil, 0, err + } + if cc != nil && !force { + if cc.ChainID.Uint64() == 0 { + return nil, 0, errors.New("wrong chain config") + } + return cc, blockNum, nil + } + + for { + if err = coreDB.View(ctx, func(tx kv.Tx) error { + cc, err = chain.GetConfig(tx, nil) + if err != nil { + return err + } + n, err := chain.CurrentBlockNumber(tx) + if err != nil { + return err + } + if n != nil { + blockNum = *n + } + return nil + }); err != nil { + logger.Error("cant read chain config from core db", "err", err) + time.Sleep(5 * time.Second) + continue + } else if cc == nil { + logger.Error("cant read chain config from core db") + time.Sleep(5 * time.Second) + continue + } + break + } + + if err = poolDB.Update(ctx, func(tx kv.RwTx) error { + if err = PutChainConfig(tx, cc, nil); err != nil { + return err + } + if err = PutLastSeenBlock(tx, blockNum, nil); err != nil { + return err + } + return nil + }); err != nil { + return nil, 0, err + } + if cc.ChainID.Uint64() == 0 { + return nil, 0, errors.New("wrong chain config") + } + return cc, blockNum, nil +} diff --git a/txnprovider/txpool/pool_fuzz_test.go b/txnprovider/txpool/pool_fuzz_test.go index 3beb109c7db..72ebf61c204 100644 --- a/txnprovider/txpool/pool_fuzz_test.go +++ b/txnprovider/txpool/pool_fuzz_test.go @@ -325,10 +325,10 @@ func FuzzOnNewBlocks(f *testing.F) { cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) - err = pool.Start(ctx) + err = pool.start(ctx) assert.NoError(err) pool.senders.senderIDs = senderIDs @@ -551,7 +551,7 @@ func FuzzOnNewBlocks(f *testing.F) { check(p2pReceived, TxnSlots{}, "after_flush") checkNotify(p2pReceived, TxnSlots{}, "after_flush") - p2, err := New(ch, db, coreDB, txpoolcfg.DefaultConfig, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + p2, err := New(ctx, ch, db, coreDB, txpoolcfg.DefaultConfig, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) p2.senders = pool.senders // senders are not persisted diff --git a/txnprovider/txpool/pool_test.go b/txnprovider/txpool/pool_test.go index 3d2f15b8db6..fc945fc2822 100644 --- a/txnprovider/txpool/pool_test.go +++ b/txnprovider/txpool/pool_test.go @@ -49,16 +49,15 @@ import ( func TestNonceFromAddress(t *testing.T) { assert, require := assert.New(t), require.New(t) ch := make(chan Announcements, 100) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) - cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 pendingBaseFee := uint64(200000) // start blocks from 0, set empty hash - then kvcache will also work on this @@ -172,13 +171,13 @@ func TestReplaceWithHigherFee(t *testing.T) { ch := make(chan Announcements, 100) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.NotEqual(nil, pool) - ctx := context.Background() var stateVersionID uint64 = 0 pendingBaseFee := uint64(200000) // start blocks from 0, set empty hash - then kvcache will also work on this @@ -289,13 +288,13 @@ func TestReverseNonces(t *testing.T) { ch := make(chan Announcements, 100) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 pendingBaseFee := uint64(1_000_000) // start blocks from 0, set empty hash - then kvcache will also work on this @@ -413,13 +412,13 @@ func TestTxnPoke(t *testing.T) { ch := make(chan Announcements, 100) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 pendingBaseFee := uint64(200000) // start blocks from 0, set empty hash - then kvcache will also work on this @@ -703,10 +702,11 @@ func TestShanghaiValidateTxn(t *testing.T) { shanghaiTime = big.NewInt(0) } + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) cache := &kvcache.DummyCache{} - pool, err := New(ch, nil, coreDB, cfg, cache, *u256.N1, shanghaiTime, nil /* agraBlock */, nil /* cancunTime */, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, logger) + pool, err := New(ctx, ch, nil, coreDB, cfg, cache, *u256.N1, shanghaiTime, nil /* agraBlock */, nil /* cancunTime */, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, logger, WithFeeCalculator(nil)) asrt.NoError(err) - ctx := context.Background() tx, err := coreDB.BeginRw(ctx) defer tx.Rollback() asrt.NoError(err) @@ -745,17 +745,17 @@ func TestShanghaiValidateTxn(t *testing.T) { func TestSetCodeTxnValidationWithLargeAuthorizationValues(t *testing.T) { maxUint256 := new(uint256.Int).SetAllOne() - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) ch := make(chan Announcements, 1) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) cfg := txpoolcfg.DefaultConfig chainID := *maxUint256 cache := &kvcache.DummyCache{} logger := log.New() - pool, err := New(ch, nil, coreDB, cfg, cache, chainID, common.Big0 /* shanghaiTime */, nil, /* agraBlock */ - common.Big0 /* cancunTime */, common.Big0 /* pragueTime */, fixedgas.DefaultMaxBlobsPerBlock, nil, logger) + pool, err := New(ctx, ch, nil, coreDB, cfg, cache, chainID, common.Big0 /* shanghaiTime */, nil, /* agraBlock */ + common.Big0 /* cancunTime */, common.Big0 /* pragueTime */, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, logger, WithFeeCalculator(nil)) assert.NoError(t, err) - ctx := context.Background() tx, err := coreDB.BeginRw(ctx) defer tx.Rollback() assert.NoError(t, err) @@ -797,13 +797,13 @@ func TestBlobTxnReplacement(t *testing.T) { ch := make(chan Announcements, 5) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, common.Big0, nil, common.Big0, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, common.Big0, nil, common.Big0, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 h1 := gointerfaces.ConvertHashToH256([32]byte{}) @@ -977,13 +977,13 @@ func TestDropRemoteAtNoGossip(t *testing.T) { logger := log.New() sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - txnPool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, big.NewInt(0), big.NewInt(0), nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, logger) + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + txnPool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, big.NewInt(0), big.NewInt(0), nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, logger, WithFeeCalculator(nil)) assert.NoError(err) require.True(txnPool != nil) - ctx := context.Background() - - err = txnPool.Start(ctx) + err = txnPool.start(ctx) assert.NoError(err) var stateVersionID uint64 = 0 @@ -1078,15 +1078,15 @@ func TestBlobSlots(t *testing.T) { coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) cfg := txpoolcfg.DefaultConfig - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) //Setting limits for blobs in the pool cfg.TotalBlobPoolLimit = 20 sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, common.Big0, nil, common.Big0, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, common.Big0, nil, common.Big0, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 h1 := gointerfaces.ConvertHashToH256([32]byte{}) @@ -1152,15 +1152,15 @@ func TestBlobSlots(t *testing.T) { func TestGasLimitChanged(t *testing.T) { assert, require := assert.New(t), require.New(t) ch := make(chan Announcements, 100) - + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) db := memdb.NewTestPoolDB(t) cfg := txpoolcfg.DefaultConfig sendersCache := kvcache.New(kvcache.DefaultCoherentConfig) - pool, err := New(ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, log.New()) + pool, err := New(ctx, ch, db, coreDB, cfg, sendersCache, *u256.N1, nil, nil, nil, nil, fixedgas.DefaultMaxBlobsPerBlock, nil, nil, func() {}, nil, log.New(), WithFeeCalculator(nil)) assert.NoError(err) require.True(pool != nil) - ctx := context.Background() var stateVersionID uint64 = 0 pendingBaseFee := uint64(200000) // start blocks from 0, set empty hash - then kvcache will also work on this diff --git a/txnprovider/txpool/send.go b/txnprovider/txpool/send.go index 38c72d5301b..721269e6c5c 100644 --- a/txnprovider/txpool/send.go +++ b/txnprovider/txpool/send.go @@ -35,25 +35,21 @@ import ( // does not initiate any messages by self type Send struct { ctx context.Context - pool Pool wg *sync.WaitGroup sentryClients []sentryproto.SentryClient // sentry clients that will be used for accessing the network logger log.Logger } -func NewSend(ctx context.Context, sentryClients []sentryproto.SentryClient, pool Pool, logger log.Logger) *Send { +func NewSend(ctx context.Context, sentryClients []sentryproto.SentryClient, logger log.Logger, opts ...Option) *Send { + options := applyOpts(opts...) return &Send{ ctx: ctx, - pool: pool, sentryClients: sentryClients, logger: logger, + wg: options.p2pSenderWg, } } -func (f *Send) SetWaitGroup(wg *sync.WaitGroup) { - f.wg = wg -} - const ( // This is the target size for the packs of transactions or announcements. A // pack can get larger than this if a single transactions exceeds this size. diff --git a/txnprovider/txpool/txpool_grpc_server.go b/txnprovider/txpool/txpool_grpc_server.go index 4b384075444..72fdb977007 100644 --- a/txnprovider/txpool/txpool_grpc_server.go +++ b/txnprovider/txpool/txpool_grpc_server.go @@ -103,14 +103,14 @@ type GrpcServer struct { ctx context.Context txPool txPool db kv.RoDB - NewSlotsStreams *NewSlotsStreams + newSlotsStreams *NewSlotsStreams chainID uint256.Int logger log.Logger } -func NewGrpcServer(ctx context.Context, txPool txPool, db kv.RoDB, chainID uint256.Int, logger log.Logger) *GrpcServer { - return &GrpcServer{ctx: ctx, txPool: txPool, db: db, NewSlotsStreams: &NewSlotsStreams{}, chainID: chainID, logger: logger} +func NewGrpcServer(ctx context.Context, txPool txPool, db kv.RoDB, newSlotsStreams *NewSlotsStreams, chainID uint256.Int, logger log.Logger) *GrpcServer { + return &GrpcServer{ctx: ctx, txPool: txPool, db: db, newSlotsStreams: newSlotsStreams, chainID: chainID, logger: logger} } func (s *GrpcServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { @@ -248,7 +248,7 @@ func mapDiscardReasonToProto(reason txpoolcfg.DiscardReason) txpool_proto.Import func (s *GrpcServer) OnAdd(req *txpool_proto.OnAddRequest, stream txpool_proto.Txpool_OnAddServer) error { s.logger.Info("New txns subscriber joined") //txpool.Loop does send messages to this streams - remove := s.NewSlotsStreams.Add(stream) + remove := s.newSlotsStreams.Add(stream) defer remove() select { case <-stream.Context().Done(): diff --git a/txnprovider/txpool/txpoolutil/all_components.go b/txnprovider/txpool/txpoolutil/all_components.go deleted file mode 100644 index f4870598354..00000000000 --- a/txnprovider/txpool/txpoolutil/all_components.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2021 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package txpoolutil - -import ( - "context" - "errors" - "math/big" - "time" - - "github.com/c2h5oh/datasize" - "github.com/holiman/uint256" - - "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/kv/kvcache" - "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/txnprovider/txpool" - "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" -) - -func SaveChainConfigIfNeed(ctx context.Context, coreDB kv.RoDB, txPoolDB kv.RwDB, force bool, logger log.Logger) (cc *chain.Config, blockNum uint64, err error) { - if err = txPoolDB.View(ctx, func(tx kv.Tx) error { - cc, err = txpool.ChainConfig(tx) - if err != nil { - return err - } - blockNum, err = txpool.LastSeenBlock(tx) - if err != nil { - return err - } - return nil - }); err != nil { - return nil, 0, err - } - if cc != nil && !force { - if cc.ChainID.Uint64() == 0 { - return nil, 0, errors.New("wrong chain config") - } - return cc, blockNum, nil - } - - for { - if err = coreDB.View(ctx, func(tx kv.Tx) error { - cc, err = chain.GetConfig(tx, nil) - if err != nil { - return err - } - n, err := chain.CurrentBlockNumber(tx) - if err != nil { - return err - } - if n != nil { - blockNum = *n - } - return nil - }); err != nil { - logger.Error("cant read chain config from core db", "err", err) - time.Sleep(5 * time.Second) - continue - } else if cc == nil { - logger.Error("cant read chain config from core db") - time.Sleep(5 * time.Second) - continue - } - break - } - - if err = txPoolDB.Update(ctx, func(tx kv.RwTx) error { - if err = txpool.PutChainConfig(tx, cc, nil); err != nil { - return err - } - if err = txpool.PutLastSeenBlock(tx, blockNum, nil); err != nil { - return err - } - return nil - }); err != nil { - return nil, 0, err - } - if cc.ChainID.Uint64() == 0 { - return nil, 0, errors.New("wrong chain config") - } - return cc, blockNum, nil -} - -func AllComponents(ctx context.Context, cfg txpoolcfg.Config, cache kvcache.Cache, newTxns chan txpool.Announcements, chainDB kv.RoDB, - sentryClients []sentryproto.SentryClient, stateChangesClient txpool.StateChangesClient, feeCalculator txpool.FeeCalculator, logger log.Logger) (kv.RwDB, *txpool.TxPool, *txpool.Fetch, *txpool.Send, *txpool.GrpcServer, error) { - opts := mdbx.New(kv.TxPoolDB, logger).Path(cfg.DBDir). - WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). - WriteMergeThreshold(3 * 8192). - PageSize(16 * datasize.KB). - GrowthStep(16 * datasize.MB). - DirtySpace(uint64(128 * datasize.MB)). - MapSize(1 * datasize.TB). - WriteMap(cfg.MdbxWriteMap) - - if cfg.MdbxPageSize > 0 { - opts = opts.PageSize(cfg.MdbxPageSize) - } - if cfg.MdbxDBSizeLimit > 0 { - opts = opts.MapSize(cfg.MdbxDBSizeLimit) - } - if cfg.MdbxGrowthStep > 0 { - opts = opts.GrowthStep(cfg.MdbxGrowthStep) - } - - txPoolDB, err := opts.Open(ctx) - - if err != nil { - return nil, nil, nil, nil, nil, err - } - - chainConfig, _, err := SaveChainConfigIfNeed(ctx, chainDB, txPoolDB, true, logger) - if err != nil { - return nil, nil, nil, nil, nil, err - } - - chainID, _ := uint256.FromBig(chainConfig.ChainID) - maxBlobsPerBlock := chainConfig.GetMaxBlobsPerBlock() - - shanghaiTime := chainConfig.ShanghaiTime - var agraBlock *big.Int - if chainConfig.Bor != nil { - agraBlock = chainConfig.Bor.GetAgraBlock() - } - cancunTime := chainConfig.CancunTime - pragueTime := chainConfig.PragueTime - if cfg.OverridePragueTime != nil { - pragueTime = cfg.OverridePragueTime - } - - txPool, err := txpool.New( - newTxns, - txPoolDB, - chainDB, - cfg, - cache, - *chainID, - shanghaiTime, - agraBlock, - cancunTime, - pragueTime, - maxBlobsPerBlock, - feeCalculator, - logger, - ) - if err != nil { - return nil, nil, nil, nil, nil, err - } - - fetch := txpool.NewFetch(ctx, sentryClients, txPool, stateChangesClient, chainDB, txPoolDB, *chainID, logger) - //fetch.ConnectCore() - //fetch.ConnectSentries() - - send := txpool.NewSend(ctx, sentryClients, txPool, logger) - txpoolGrpcServer := txpool.NewGrpcServer(ctx, txPool, txPoolDB, *chainID, logger) - return txPoolDB, txPool, fetch, send, txpoolGrpcServer, nil -} From 04799cb621510142ded9df56495f1d58dfa66c5f Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Tue, 7 Jan 2025 19:07:07 +0100 Subject: [PATCH 24/28] Caplin: do not kill caplin when we have non-valid state snapshots (#13313) --- cmd/caplin/caplin1/run.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/caplin/caplin1/run.go b/cmd/caplin/caplin1/run.go index ed2bb0730c4..01ec38030a4 100644 --- a/cmd/caplin/caplin1/run.go +++ b/cmd/caplin/caplin1/run.go @@ -392,9 +392,6 @@ func RunCaplinService(ctx context.Context, engine execution_client.ExecutionEngi } } stateSnapshots := snapshotsync.NewCaplinStateSnapshots(ethconfig.BlocksFreezing{}, beaconConfig, dirs, snapshotsync.MakeCaplinStateSnapshotsTypes(indexDB), logger) - if err := stateSnapshots.OpenFolder(); err != nil { - return err - } antiq := antiquary.NewAntiquary(ctx, blobStorage, genesisState, vTables, beaconConfig, dirs, snDownloader, indexDB, stateSnapshots, csn, rcsn, syncedDataManager, logger, config.ArchiveStates, config.ArchiveBlocks, config.ArchiveBlobs, config.SnapshotGenerationEnabled, snBuildSema) // Create the antiquary go func() { From e3cb56ec7485eb445a4b5fdff00eb0d54b18c399 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Tue, 7 Jan 2025 21:37:24 +0000 Subject: [PATCH 25/28] downloader: show correct rates after restart (#13324) Set initial values `prevStats.BytesDownload` and `prevStats.BytesCompleted` if they are zero, which can occur if the node was restarted or launched for first time. Fix for https://github.com/erigontech/erigon/issues/13250 and https://github.com/erigontech/erigon/issues/13044 --- erigon-lib/downloader/downloader.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index 22e40c13eaa..5b19cb89495 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -1973,6 +1973,15 @@ func (d *Downloader) ReCalcStats(interval time.Duration) { stats.BytesDownload = uint64(connStats.BytesReadData.Int64()) stats.BytesCompleted = uint64(connStats.BytesCompleted.Int64()) + // if we have no previous stats, it means that node was restarted and need to set initial values + if prevStats.BytesDownload == 0 { + prevStats.BytesDownload = stats.BytesCompleted + } + + if prevStats.BytesCompleted == 0 { + prevStats.BytesCompleted = stats.BytesCompleted + } + lastMetadataReady := stats.MetadataReady stats.BytesTotal, stats.ConnectionsTotal, stats.MetadataReady = 0, 0, 0 From cc41076ec032a4eaa2b18e5acc056b211f425058 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Wed, 8 Jan 2025 05:41:43 +0100 Subject: [PATCH 26/28] Caplin: Remove cache files completely (#13340) * It was a pre-optimization and it is now not needed * simpler code * less headaches for concurrency --- cl/beacon/handler/block_production.go | 17 +++++++++++------ cl/cltypes/solid/hash_list.go | 6 ++++++ cl/cltypes/solid/uint64slice_byte.go | 5 +++++ cl/cltypes/solid/validator_set.go | 5 +++++ cl/merkle_tree/merkle_tree.go | 6 +++++- cl/phase1/core/state/cache.go | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/cl/beacon/handler/block_production.go b/cl/beacon/handler/block_production.go index 710fd009c4c..9d9b4bf239c 100644 --- a/cl/beacon/handler/block_production.go +++ b/cl/beacon/handler/block_production.go @@ -300,11 +300,16 @@ func (a *ApiHandler) GetEthV3ValidatorBlock( ) } - // make a simple copy to the current head state - baseState, err := a.forkchoiceStore.GetStateAtBlockRoot( - baseBlockRoot, - true, - ) // we start the block production from this state + var baseState *state.CachingBeaconState + if err := a.syncedData.ViewHeadState(func(headState *state.CachingBeaconState) error { + baseState, err = headState.Copy() + if err != nil { + return err + } + return nil + }); err != nil { + return nil, err + } if err != nil { return nil, err @@ -1177,7 +1182,7 @@ func (a *ApiHandler) storeBlockAndBlobs( return err } - if err := a.forkchoiceStore.OnBlock(ctx, block, true, false, false); err != nil { + if err := a.forkchoiceStore.OnBlock(ctx, block, true, true, false); err != nil { return err } finalizedBlockRoot := a.forkchoiceStore.FinalizedCheckpoint().Root diff --git a/cl/cltypes/solid/hash_list.go b/cl/cltypes/solid/hash_list.go index 1b8bc09fcd2..cca7e5c435c 100644 --- a/cl/cltypes/solid/hash_list.go +++ b/cl/cltypes/solid/hash_list.go @@ -109,6 +109,12 @@ func (h *hashList) CopyTo(t IterableSSZ[libcommon.Hash]) { tu.MerkleTree = &merkle_tree.MerkleTree{} } h.MerkleTree.CopyInto(tu.MerkleTree) + // make the leaf function on the new buffer + tu.MerkleTree.SetComputeLeafFn(func(idx int, out []byte) { + copy(out, tu.u[idx*length.Hash:]) + }) + } else { + tu.MerkleTree = nil } copy(tu.u, h.u) } diff --git a/cl/cltypes/solid/uint64slice_byte.go b/cl/cltypes/solid/uint64slice_byte.go index a251d683c8f..750e9378ffb 100644 --- a/cl/cltypes/solid/uint64slice_byte.go +++ b/cl/cltypes/solid/uint64slice_byte.go @@ -81,6 +81,11 @@ func (arr *byteBasedUint64Slice) CopyTo(target *byteBasedUint64Slice) { target.MerkleTree = &merkle_tree.MerkleTree{} } arr.MerkleTree.CopyInto(target.MerkleTree) + target.SetComputeLeafFn(func(idx int, out []byte) { + copy(out, target.u[idx*length.Hash:]) + }) + } else { + target.MerkleTree = nil } target.u = target.u[:len(arr.u)] diff --git a/cl/cltypes/solid/validator_set.go b/cl/cltypes/solid/validator_set.go index 6c439c5d53c..79e94d67b4c 100644 --- a/cl/cltypes/solid/validator_set.go +++ b/cl/cltypes/solid/validator_set.go @@ -141,6 +141,11 @@ func (v *ValidatorSet) CopyTo(t *ValidatorSet) { t.MerkleTree = &merkle_tree.MerkleTree{} } v.MerkleTree.CopyInto(t.MerkleTree) + t.MerkleTree.SetComputeLeafFn(func(idx int, out []byte) { + copy(out, t.buffer[idx*validatorSize:]) + }) + } else { + t.MerkleTree = nil } // skip copying (unsupported for phase0) t.phase0Data = make([]Phase0Data, t.l) diff --git a/cl/merkle_tree/merkle_tree.go b/cl/merkle_tree/merkle_tree.go index e7480fb6b4b..819ab224dda 100644 --- a/cl/merkle_tree/merkle_tree.go +++ b/cl/merkle_tree/merkle_tree.go @@ -58,6 +58,10 @@ func (m *MerkleTree) Initialize(leavesCount, maxTreeCacheDepth int, computeLeaf m.dirtyLeaves = make([]atomic.Bool, leavesCount) } +func (m *MerkleTree) SetComputeLeafFn(computeLeaf func(idx int, out []byte)) { + m.computeLeaf = computeLeaf +} + func (m *MerkleTree) MarkLeafAsDirty(idx int) { m.mu.RLock() defer m.mu.RUnlock() @@ -207,7 +211,7 @@ func (m *MerkleTree) CopyInto(other *MerkleTree) { m.mu.RLock() defer m.mu.RUnlock() defer other.mu.Unlock() - other.computeLeaf = m.computeLeaf + //other.computeLeaf = m.computeLeaf if len(other.layers) > len(m.layers) { // reset the internal layers for i := len(m.layers); i < len(other.layers); i++ { diff --git a/cl/phase1/core/state/cache.go b/cl/phase1/core/state/cache.go index a5180932831..e3b76a4916b 100644 --- a/cl/phase1/core/state/cache.go +++ b/cl/phase1/core/state/cache.go @@ -267,7 +267,7 @@ func (b *CachingBeaconState) initCaches() error { func (b *CachingBeaconState) InitBeaconState() error { b.totalActiveBalanceCache = nil b._refreshActiveBalancesIfNeeded() - + b.previousStateRoot = common.Hash{} b.publicKeyIndicies = make(map[[48]byte]uint64) b.ForEachValidator(func(validator solid.Validator, i, total int) bool { b.publicKeyIndicies[validator.PublicKey()] = uint64(i) From ecbe76831b481309147f0cef60e57edcff6cee46 Mon Sep 17 00:00:00 2001 From: sudeep Date: Wed, 8 Jan 2025 13:31:45 +0530 Subject: [PATCH 27/28] move domains/ii registration out of aggregator constructor (#13327) https://github.com/erigontech/erigon/issues/13326 and https://github.com/erigontech/erigon/issues/13325 --- cmd/evm/runner.go | 2 +- cmd/evm/staterunner.go | 2 +- cmd/integration/commands/stages.go | 2 +- cmd/rpcdaemon/cli/config.go | 2 +- cmd/state/commands/opcode_tracer.go | 2 +- core/genesis_write.go | 2 +- core/state/intra_block_state_test.go | 2 +- core/state/state_test.go | 4 +- core/test/domains_restart_test.go | 2 +- core/vm/gas_table_test.go | 2 +- core/vm/runtime/runtime.go | 4 +- core/vm/runtime/runtime_test.go | 4 +- .../kv/membatchwithdb/memory_mutation_test.go | 2 +- .../temporaltest/kv_temporal_testdb.go | 2 +- erigon-lib/state/aggregator.go | 165 +--------------- erigon-lib/state/aggregator2.go | 177 ++++++++++++++++++ erigon-lib/state/aggregator_bench_test.go | 2 +- erigon-lib/state/aggregator_fuzz_test.go | 2 +- erigon-lib/state/aggregator_test.go | 6 +- eth/backend.go | 2 +- turbo/app/snapshots_cmd.go | 2 +- turbo/app/squeeze_cmd.go | 4 +- 22 files changed, 206 insertions(+), 188 deletions(-) create mode 100644 erigon-lib/state/aggregator2.go diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index 556a0e7cbe1..f35ec298106 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -171,7 +171,7 @@ func runCmd(ctx *cli.Context) error { } else { genesisConfig = new(types.Genesis) } - agg, err := state2.NewAggregator(context.Background(), datadir.New(os.TempDir()), config3.DefaultStepSize, db, log.New()) + agg, err := state2.NewAggregator2(context.Background(), datadir.New(os.TempDir()), config3.DefaultStepSize, db, log.New()) if err != nil { return err } diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 6b2270207bc..a231ca88576 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -141,7 +141,7 @@ func aggregateResultsFromStateTests( MustOpen() defer _db.Close() - agg, err := libstate.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, _db, log.New()) + agg, err := libstate.NewAggregator2(context.Background(), dirs, config3.DefaultStepSize, _db, log.New()) if err != nil { return nil, err } diff --git a/cmd/integration/commands/stages.go b/cmd/integration/commands/stages.go index 6cd8da51232..dd709b75d8e 100644 --- a/cmd/integration/commands/stages.go +++ b/cmd/integration/commands/stages.go @@ -1338,7 +1338,7 @@ func allSnapshots(ctx context.Context, db kv.RoDB, logger log.Logger) (*freezebl blockReader := freezeblocks.NewBlockReader(_allSnapshotsSingleton, _allBorSnapshotsSingleton, _heimdallStoreSingleton, _bridgeStoreSingleton) txNums := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, blockReader)) - _aggSingleton, err = libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) + _aggSingleton, err = libstate.NewAggregator2(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { panic(err) } diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index a55ac8b7af3..66fad4cb9cb 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -424,7 +424,7 @@ func RemoteServices(ctx context.Context, cfg *httpcfg.HttpCfg, logger log.Logger blockReader = freezeblocks.NewBlockReader(allSnapshots, allBorSnapshots, heimdallStore, bridgeStore) txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, blockReader)) - agg, err := libstate.NewAggregator(ctx, cfg.Dirs, config3.DefaultStepSize, rawDB, logger) + agg, err := libstate.NewAggregator2(ctx, cfg.Dirs, config3.DefaultStepSize, rawDB, logger) if err != nil { return nil, nil, nil, nil, nil, nil, nil, ff, nil, nil, fmt.Errorf("create aggregator: %w", err) } diff --git a/cmd/state/commands/opcode_tracer.go b/cmd/state/commands/opcode_tracer.go index a5133f2a46c..d0e7319f40c 100644 --- a/cmd/state/commands/opcode_tracer.go +++ b/cmd/state/commands/opcode_tracer.go @@ -436,7 +436,7 @@ func OpcodeTracer(genesis *types.Genesis, blockNum uint64, chaindata string, num rawChainDb := mdbx.MustOpen(dirs.Chaindata) defer rawChainDb.Close() - agg, err := state2.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, rawChainDb, log.New()) + agg, err := state2.NewAggregator2(context.Background(), dirs, config3.DefaultStepSize, rawChainDb, log.New()) if err != nil { return err } diff --git a/core/genesis_write.go b/core/genesis_write.go index 4d6b52767ee..ff34fc81614 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -505,7 +505,7 @@ func GenesisToBlock(g *types.Genesis, dirs datadir.Dirs, logger log.Logger) (*ty genesisTmpDB := mdbx.New(kv.TemporaryDB, logger).InMem(dirs.DataDir).MapSize(2 * datasize.GB).GrowthStep(1 * datasize.MB).MustOpen() defer genesisTmpDB.Close() - agg, err := state2.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, genesisTmpDB, logger) + agg, err := state2.NewAggregator2(context.Background(), dirs, config3.DefaultStepSize, genesisTmpDB, logger) if err != nil { return err } diff --git a/core/state/intra_block_state_test.go b/core/state/intra_block_state_test.go index f7d0767015c..0c463a473c7 100644 --- a/core/state/intra_block_state_test.go +++ b/core/state/intra_block_state_test.go @@ -241,7 +241,7 @@ func (test *snapshotTest) run() bool { db := memdb.NewStateDB("") defer db.Close() - agg, err := stateLib.NewAggregator(context.Background(), datadir.New(""), 16, db, log.New()) + agg, err := stateLib.NewAggregator2(context.Background(), datadir.New(""), 16, db, log.New()) if err != nil { test.err = err return false diff --git a/core/state/state_test.go b/core/state/state_test.go index 7e3ad911053..c1a3e561f08 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -122,7 +122,7 @@ func (s *StateSuite) SetUpTest(c *checker.C) { db := memdb.NewStateDB("") defer db.Close() - agg, err := stateLib.NewAggregator(context.Background(), datadir.New(""), 16, db, log.New()) + agg, err := stateLib.NewAggregator2(context.Background(), datadir.New(""), 16, db, log.New()) if err != nil { panic(err) } @@ -394,7 +394,7 @@ func NewTestTemporalDb(tb testing.TB) (kv.TemporalRwDB, kv.TemporalRwTx, *state. db := memdb.NewStateDB(tb.TempDir()) tb.Cleanup(db.Close) - agg, err := state.NewAggregator(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) + agg, err := state.NewAggregator2(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) if err != nil { tb.Fatal(err) } diff --git a/core/test/domains_restart_test.go b/core/test/domains_restart_test.go index 952906fbb6b..d5ae4a7f3dd 100644 --- a/core/test/domains_restart_test.go +++ b/core/test/domains_restart_test.go @@ -66,7 +66,7 @@ func testDbAndAggregatorv3(t *testing.T, fpath string, aggStep uint64) (kv.RwDB, db := mdbx.New(kv.ChainDB, logger).Path(dirs.Chaindata).MustOpen() t.Cleanup(db.Close) - agg, err := state.NewAggregator(context.Background(), dirs, aggStep, db, logger) + agg, err := state.NewAggregator2(context.Background(), dirs, aggStep, db, logger) require.NoError(t, err) t.Cleanup(agg.Close) err = agg.OpenFolder() diff --git a/core/vm/gas_table_test.go b/core/vm/gas_table_test.go index 95677431ac5..3a2bd414611 100644 --- a/core/vm/gas_table_test.go +++ b/core/vm/gas_table_test.go @@ -104,7 +104,7 @@ func testTemporalDB(t *testing.T) *temporal.DB { t.Cleanup(db.Close) - agg, err := state3.NewAggregator(context.Background(), datadir.New(t.TempDir()), 16, db, log.New()) + agg, err := state3.NewAggregator2(context.Background(), datadir.New(t.TempDir()), 16, db, log.New()) require.NoError(t, err) t.Cleanup(agg.Close) diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index 77748306170..cdf3d26dd89 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -131,7 +131,7 @@ func Execute(code, input []byte, cfg *Config, tempdir string) ([]byte, *state.In if !externalState { db := memdb.NewStateDB(tempdir) defer db.Close() - agg, err := state3.NewAggregator(context.Background(), datadir.New(tempdir), config3.DefaultStepSize, db, log.New()) + agg, err := state3.NewAggregator2(context.Background(), datadir.New(tempdir), config3.DefaultStepSize, db, log.New()) if err != nil { return nil, nil, err } @@ -193,7 +193,7 @@ func Create(input []byte, cfg *Config, blockNr uint64) ([]byte, libcommon.Addres db := memdb.NewStateDB(tmp) defer db.Close() - agg, err := state3.NewAggregator(context.Background(), datadir.New(tmp), config3.DefaultStepSize, db, log.New()) + agg, err := state3.NewAggregator2(context.Background(), datadir.New(tmp), config3.DefaultStepSize, db, log.New()) if err != nil { return nil, [20]byte{}, 0, err } diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index f3521a1dcf7..9df1c03717b 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -56,7 +56,7 @@ func NewTestTemporalDb(tb testing.TB) (kv.RwDB, kv.RwTx, *stateLib.Aggregator) { db := memdb.NewStateDB(tb.TempDir()) tb.Cleanup(db.Close) - agg, err := stateLib.NewAggregator(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) + agg, err := stateLib.NewAggregator2(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) if err != nil { tb.Fatal(err) } @@ -177,7 +177,7 @@ func testTemporalDB(t testing.TB) *temporal.DB { t.Cleanup(db.Close) - agg, err := stateLib.NewAggregator(context.Background(), datadir.New(t.TempDir()), 16, db, log.New()) + agg, err := stateLib.NewAggregator2(context.Background(), datadir.New(t.TempDir()), 16, db, log.New()) require.NoError(t, err) t.Cleanup(agg.Close) diff --git a/erigon-lib/kv/membatchwithdb/memory_mutation_test.go b/erigon-lib/kv/membatchwithdb/memory_mutation_test.go index cd4ce3cd532..7183bd46fa5 100644 --- a/erigon-lib/kv/membatchwithdb/memory_mutation_test.go +++ b/erigon-lib/kv/membatchwithdb/memory_mutation_test.go @@ -212,7 +212,7 @@ func NewTestTemporalDb(tb testing.TB) (kv.RwDB, kv.RwTx, *stateLib.Aggregator) { db := memdb.NewStateDB(tb.TempDir()) tb.Cleanup(db.Close) - agg, err := stateLib.NewAggregator(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) + agg, err := stateLib.NewAggregator2(context.Background(), datadir.New(tb.TempDir()), 16, db, log.New()) if err != nil { tb.Fatal(err) } diff --git a/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go b/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go index aba7fec9396..6891112caa8 100644 --- a/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go +++ b/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go @@ -42,7 +42,7 @@ func NewTestDB(tb testing.TB, dirs datadir.Dirs) (kv.TemporalRwDB, *state.Aggreg rawDB = memdb.New(dirs.DataDir, kv.ChainDB) } - agg, err := state.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, rawDB, log.New()) + agg, err := state.NewAggregator2(context.Background(), dirs, config3.DefaultStepSize, rawDB, log.New()) if err != nil { panic(err) } diff --git a/erigon-lib/state/aggregator.go b/erigon-lib/state/aggregator.go index 26f147c3958..a589a6e1687 100644 --- a/erigon-lib/state/aggregator.go +++ b/erigon-lib/state/aggregator.go @@ -126,141 +126,14 @@ func domainIntegrityCheck(name kv.Domain, dirs datadir.Dirs, fromStep, toStep ui } } -var dbgCommBtIndex = dbg.EnvBool("AGG_COMMITMENT_BT", false) - -func init() { - if dbgCommBtIndex { - cfg := Schema[kv.CommitmentDomain] - cfg.IndexList = AccessorBTree | AccessorExistence - Schema[kv.CommitmentDomain] = cfg - } -} - -var Schema = map[kv.Domain]domainCfg{ - kv.AccountsDomain: { - name: kv.AccountsDomain, valuesTable: kv.TblAccountVals, - - IndexList: AccessorBTree | AccessorExistence, - crossDomainIntegrity: domainIntegrityCheck, - compression: seg.CompressNone, - compressCfg: DomainCompressCfg, - - hist: histCfg{ - valuesTable: kv.TblAccountHistoryVals, - compression: seg.CompressNone, - - historyLargeValues: false, - filenameBase: kv.AccountsDomain.String(), //TODO: looks redundant - - iiCfg: iiCfg{ - keysTable: kv.TblAccountHistoryKeys, valuesTable: kv.TblAccountIdx, - withExistence: false, compressorCfg: seg.DefaultCfg, - filenameBase: kv.AccountsDomain.String(), //TODO: looks redundant - }, - }, - }, - kv.StorageDomain: { - name: kv.StorageDomain, valuesTable: kv.TblStorageVals, - - IndexList: AccessorBTree | AccessorExistence, - compression: seg.CompressKeys, - compressCfg: DomainCompressCfg, - - hist: histCfg{ - valuesTable: kv.TblStorageHistoryVals, - compression: seg.CompressNone, - - historyLargeValues: false, - filenameBase: kv.StorageDomain.String(), - - iiCfg: iiCfg{ - keysTable: kv.TblStorageHistoryKeys, valuesTable: kv.TblStorageIdx, - withExistence: false, compressorCfg: seg.DefaultCfg, - filenameBase: kv.StorageDomain.String(), - }, - }, - }, - kv.CodeDomain: { - name: kv.CodeDomain, valuesTable: kv.TblCodeVals, - - IndexList: AccessorBTree | AccessorExistence, - compression: seg.CompressVals, // compress Code with keys doesn't show any profit. compress of values show 4x ratio on eth-mainnet and 2.5x ratio on bor-mainnet - compressCfg: DomainCompressCfg, - largeValues: true, - - hist: histCfg{ - valuesTable: kv.TblCodeHistoryVals, - compression: seg.CompressKeys | seg.CompressVals, - - historyLargeValues: true, - filenameBase: kv.CodeDomain.String(), - - iiCfg: iiCfg{ - withExistence: false, compressorCfg: seg.DefaultCfg, - keysTable: kv.TblCodeHistoryKeys, valuesTable: kv.TblCodeIdx, - filenameBase: kv.CodeDomain.String(), - }, - }, - }, - kv.CommitmentDomain: { - name: kv.CommitmentDomain, valuesTable: kv.TblCommitmentVals, - - IndexList: AccessorHashMap, - compression: seg.CompressKeys, - compressCfg: DomainCompressCfg, - - hist: histCfg{ - valuesTable: kv.TblCommitmentHistoryVals, - compression: seg.CompressNone, - - snapshotsDisabled: true, - historyLargeValues: false, - filenameBase: kv.CommitmentDomain.String(), - - iiCfg: iiCfg{ - keysTable: kv.TblCommitmentHistoryKeys, valuesTable: kv.TblCommitmentIdx, - withExistence: false, compressorCfg: seg.DefaultCfg, - filenameBase: kv.CommitmentDomain.String(), - }, - }, - }, - kv.ReceiptDomain: { - name: kv.ReceiptDomain, valuesTable: kv.TblReceiptVals, - - IndexList: AccessorBTree | AccessorExistence, - compression: seg.CompressNone, //seg.CompressKeys | seg.CompressVals, - compressCfg: DomainCompressCfg, - - hist: histCfg{ - valuesTable: kv.TblReceiptHistoryVals, - compression: seg.CompressNone, - - historyLargeValues: false, - filenameBase: kv.ReceiptDomain.String(), - - iiCfg: iiCfg{ - keysTable: kv.TblReceiptHistoryKeys, valuesTable: kv.TblReceiptIdx, - withExistence: false, compressorCfg: seg.DefaultCfg, - filenameBase: kv.ReceiptDomain.String(), - }, - }, - }, -} - func NewAggregator(ctx context.Context, dirs datadir.Dirs, aggregationStep uint64, db kv.RoDB, logger log.Logger) (*Aggregator, error) { - tmpdir := dirs.Tmp - salt, err := getStateIndicesSalt(dirs.Snap) - if err != nil { - return nil, err - } - ctx, ctxCancel := context.WithCancel(ctx) - a := &Aggregator{ + return &Aggregator{ ctx: ctx, ctxCancel: ctxCancel, onFreeze: func(frozenFileNames []string) {}, dirs: dirs, - tmpdir: tmpdir, + tmpdir: dirs.Tmp, aggregationStep: aggregationStep, db: db, leakDetector: dbg.NewLeakDetector("agg", dbg.SlowTx()), @@ -272,39 +145,7 @@ func NewAggregator(ctx context.Context, dirs datadir.Dirs, aggregationStep uint6 commitmentValuesTransform: AggregatorSqueezeCommitmentValues, produce: true, - } - - if err := a.registerDomain(kv.AccountsDomain, salt, dirs, aggregationStep, logger); err != nil { - return nil, err - } - if err := a.registerDomain(kv.StorageDomain, salt, dirs, aggregationStep, logger); err != nil { - return nil, err - } - if err := a.registerDomain(kv.CodeDomain, salt, dirs, aggregationStep, logger); err != nil { - return nil, err - } - if err := a.registerDomain(kv.CommitmentDomain, salt, dirs, aggregationStep, logger); err != nil { - return nil, err - } - if err := a.registerDomain(kv.ReceiptDomain, salt, dirs, aggregationStep, logger); err != nil { - return nil, err - } - if err := a.registerII(kv.LogAddrIdxPos, salt, dirs, aggregationStep, kv.FileLogAddressIdx, kv.TblLogAddressKeys, kv.TblLogAddressIdx, logger); err != nil { - return nil, err - } - if err := a.registerII(kv.LogTopicIdxPos, salt, dirs, aggregationStep, kv.FileLogTopicsIdx, kv.TblLogTopicsKeys, kv.TblLogTopicsIdx, logger); err != nil { - return nil, err - } - if err := a.registerII(kv.TracesFromIdxPos, salt, dirs, aggregationStep, kv.FileTracesFromIdx, kv.TblTracesFromKeys, kv.TblTracesFromIdx, logger); err != nil { - return nil, err - } - if err := a.registerII(kv.TracesToIdxPos, salt, dirs, aggregationStep, kv.FileTracesToIdx, kv.TblTracesToKeys, kv.TblTracesToIdx, logger); err != nil { - return nil, err - } - a.KeepRecentTxnsOfHistoriesWithDisabledSnapshots(100_000) // ~1k blocks of history - a.recalcVisibleFiles(a.DirtyFilesEndTxNumMinimax()) - - return a, nil + }, nil } // getStateIndicesSalt - try read salt for all indices from DB. Or fall-back to new salt creation. diff --git a/erigon-lib/state/aggregator2.go b/erigon-lib/state/aggregator2.go new file mode 100644 index 00000000000..f1f51d09121 --- /dev/null +++ b/erigon-lib/state/aggregator2.go @@ -0,0 +1,177 @@ +package state + +import ( + "context" + + "github.com/erigontech/erigon-lib/common/datadir" + "github.com/erigontech/erigon-lib/common/dbg" + "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/seg" +) + +// this is supposed to register domains/iis + +func NewAggregator2(ctx context.Context, dirs datadir.Dirs, aggregationStep uint64, db kv.RoDB, logger log.Logger) (*Aggregator, error) { + salt, err := getStateIndicesSalt(dirs.Snap) + if err != nil { + return nil, err + } + + a, err := NewAggregator(ctx, dirs, aggregationStep, db, logger) + if err != nil { + return nil, err + } + if err := a.registerDomain(kv.AccountsDomain, salt, dirs, aggregationStep, logger); err != nil { + return nil, err + } + if err := a.registerDomain(kv.StorageDomain, salt, dirs, aggregationStep, logger); err != nil { + return nil, err + } + if err := a.registerDomain(kv.CodeDomain, salt, dirs, aggregationStep, logger); err != nil { + return nil, err + } + if err := a.registerDomain(kv.CommitmentDomain, salt, dirs, aggregationStep, logger); err != nil { + return nil, err + } + if err := a.registerDomain(kv.ReceiptDomain, salt, dirs, aggregationStep, logger); err != nil { + return nil, err + } + if err := a.registerII(kv.LogAddrIdxPos, salt, dirs, aggregationStep, kv.FileLogAddressIdx, kv.TblLogAddressKeys, kv.TblLogAddressIdx, logger); err != nil { + return nil, err + } + if err := a.registerII(kv.LogTopicIdxPos, salt, dirs, aggregationStep, kv.FileLogTopicsIdx, kv.TblLogTopicsKeys, kv.TblLogTopicsIdx, logger); err != nil { + return nil, err + } + if err := a.registerII(kv.TracesFromIdxPos, salt, dirs, aggregationStep, kv.FileTracesFromIdx, kv.TblTracesFromKeys, kv.TblTracesFromIdx, logger); err != nil { + return nil, err + } + if err := a.registerII(kv.TracesToIdxPos, salt, dirs, aggregationStep, kv.FileTracesToIdx, kv.TblTracesToKeys, kv.TblTracesToIdx, logger); err != nil { + return nil, err + } + a.KeepRecentTxnsOfHistoriesWithDisabledSnapshots(100_000) // ~1k blocks of history + a.recalcVisibleFiles(a.DirtyFilesEndTxNumMinimax()) + + return a, nil +} + +var dbgCommBtIndex = dbg.EnvBool("AGG_COMMITMENT_BT", false) + +func init() { + if dbgCommBtIndex { + cfg := Schema[kv.CommitmentDomain] + cfg.IndexList = AccessorBTree | AccessorExistence + Schema[kv.CommitmentDomain] = cfg + } +} + +var Schema = map[kv.Domain]domainCfg{ + kv.AccountsDomain: { + name: kv.AccountsDomain, valuesTable: kv.TblAccountVals, + + IndexList: AccessorBTree | AccessorExistence, + crossDomainIntegrity: domainIntegrityCheck, + compression: seg.CompressNone, + compressCfg: DomainCompressCfg, + + hist: histCfg{ + valuesTable: kv.TblAccountHistoryVals, + compression: seg.CompressNone, + + historyLargeValues: false, + filenameBase: kv.AccountsDomain.String(), //TODO: looks redundant + + iiCfg: iiCfg{ + keysTable: kv.TblAccountHistoryKeys, valuesTable: kv.TblAccountIdx, + withExistence: false, compressorCfg: seg.DefaultCfg, + filenameBase: kv.AccountsDomain.String(), //TODO: looks redundant + }, + }, + }, + kv.StorageDomain: { + name: kv.StorageDomain, valuesTable: kv.TblStorageVals, + + IndexList: AccessorBTree | AccessorExistence, + compression: seg.CompressKeys, + compressCfg: DomainCompressCfg, + + hist: histCfg{ + valuesTable: kv.TblStorageHistoryVals, + compression: seg.CompressNone, + + historyLargeValues: false, + filenameBase: kv.StorageDomain.String(), + + iiCfg: iiCfg{ + keysTable: kv.TblStorageHistoryKeys, valuesTable: kv.TblStorageIdx, + withExistence: false, compressorCfg: seg.DefaultCfg, + filenameBase: kv.StorageDomain.String(), + }, + }, + }, + kv.CodeDomain: { + name: kv.CodeDomain, valuesTable: kv.TblCodeVals, + + IndexList: AccessorBTree | AccessorExistence, + compression: seg.CompressVals, // compress Code with keys doesn't show any profit. compress of values show 4x ratio on eth-mainnet and 2.5x ratio on bor-mainnet + compressCfg: DomainCompressCfg, + largeValues: true, + + hist: histCfg{ + valuesTable: kv.TblCodeHistoryVals, + compression: seg.CompressKeys | seg.CompressVals, + + historyLargeValues: true, + filenameBase: kv.CodeDomain.String(), + + iiCfg: iiCfg{ + withExistence: false, compressorCfg: seg.DefaultCfg, + keysTable: kv.TblCodeHistoryKeys, valuesTable: kv.TblCodeIdx, + filenameBase: kv.CodeDomain.String(), + }, + }, + }, + kv.CommitmentDomain: { + name: kv.CommitmentDomain, valuesTable: kv.TblCommitmentVals, + + IndexList: AccessorHashMap, + compression: seg.CompressKeys, + compressCfg: DomainCompressCfg, + + hist: histCfg{ + valuesTable: kv.TblCommitmentHistoryVals, + compression: seg.CompressNone, + + snapshotsDisabled: true, + historyLargeValues: false, + filenameBase: kv.CommitmentDomain.String(), + + iiCfg: iiCfg{ + keysTable: kv.TblCommitmentHistoryKeys, valuesTable: kv.TblCommitmentIdx, + withExistence: false, compressorCfg: seg.DefaultCfg, + filenameBase: kv.CommitmentDomain.String(), + }, + }, + }, + kv.ReceiptDomain: { + name: kv.ReceiptDomain, valuesTable: kv.TblReceiptVals, + + IndexList: AccessorBTree | AccessorExistence, + compression: seg.CompressNone, //seg.CompressKeys | seg.CompressVals, + compressCfg: DomainCompressCfg, + + hist: histCfg{ + valuesTable: kv.TblReceiptHistoryVals, + compression: seg.CompressNone, + + historyLargeValues: false, + filenameBase: kv.ReceiptDomain.String(), + + iiCfg: iiCfg{ + keysTable: kv.TblReceiptHistoryKeys, valuesTable: kv.TblReceiptIdx, + withExistence: false, compressorCfg: seg.DefaultCfg, + filenameBase: kv.ReceiptDomain.String(), + }, + }, + }, +} diff --git a/erigon-lib/state/aggregator_bench_test.go b/erigon-lib/state/aggregator_bench_test.go index 63fa225af81..3ae00f393cb 100644 --- a/erigon-lib/state/aggregator_bench_test.go +++ b/erigon-lib/state/aggregator_bench_test.go @@ -45,7 +45,7 @@ func testDbAndAggregatorBench(b *testing.B, aggStep uint64) (kv.RwDB, *Aggregato dirs := datadir.New(b.TempDir()) db := mdbx.New(kv.ChainDB, logger).InMem(dirs.Chaindata).MustOpen() b.Cleanup(db.Close) - agg, err := NewAggregator(context.Background(), dirs, aggStep, db, logger) + agg, err := NewAggregator2(context.Background(), dirs, aggStep, db, logger) require.NoError(b, err) b.Cleanup(agg.Close) return db, agg diff --git a/erigon-lib/state/aggregator_fuzz_test.go b/erigon-lib/state/aggregator_fuzz_test.go index 559869f66ad..659dbed084d 100644 --- a/erigon-lib/state/aggregator_fuzz_test.go +++ b/erigon-lib/state/aggregator_fuzz_test.go @@ -276,7 +276,7 @@ func testFuzzDbAndAggregatorv3(f *testing.F, aggStep uint64) (kv.RwDB, *Aggregat db := mdbx.New(kv.ChainDB, logger).InMem(dirs.Chaindata).GrowthStep(32 * datasize.MB).MapSize(2 * datasize.GB).MustOpen() f.Cleanup(db.Close) - agg, err := NewAggregator(context.Background(), dirs, aggStep, db, logger) + agg, err := NewAggregator2(context.Background(), dirs, aggStep, db, logger) require.NoError(err) f.Cleanup(agg.Close) err = agg.OpenFolder() diff --git a/erigon-lib/state/aggregator_test.go b/erigon-lib/state/aggregator_test.go index 816eb25c2e9..759df463408 100644 --- a/erigon-lib/state/aggregator_test.go +++ b/erigon-lib/state/aggregator_test.go @@ -362,7 +362,7 @@ func aggregatorV3_RestartOnDatadir(t *testing.T, rc runCfg) { agg.Close() // Start another aggregator on same datadir - anotherAgg, err := NewAggregator(context.Background(), agg.dirs, aggStep, db, logger) + anotherAgg, err := NewAggregator2(context.Background(), agg.dirs, aggStep, db, logger) require.NoError(t, err) defer anotherAgg.Close() @@ -822,7 +822,7 @@ func TestAggregatorV3_RestartOnFiles(t *testing.T) { newDb := mdbx.New(kv.ChainDB, logger).InMem(dirs.Chaindata).MustOpen() t.Cleanup(newDb.Close) - newAgg, err := NewAggregator(context.Background(), agg.dirs, aggStep, newDb, logger) + newAgg, err := NewAggregator2(context.Background(), agg.dirs, aggStep, newDb, logger) require.NoError(t, err) require.NoError(t, newAgg.OpenFolder()) @@ -1091,7 +1091,7 @@ func testDbAndAggregatorv3(tb testing.TB, aggStep uint64) (kv.RwDB, *Aggregator) db := mdbx.New(kv.ChainDB, logger).InMem(dirs.Chaindata).GrowthStep(32 * datasize.MB).MapSize(2 * datasize.GB).MustOpen() tb.Cleanup(db.Close) - agg, err := NewAggregator(context.Background(), dirs, aggStep, db, logger) + agg, err := NewAggregator2(context.Background(), dirs, aggStep, db, logger) require.NoError(err) tb.Cleanup(agg.Close) err = agg.OpenFolder() diff --git a/eth/backend.go b/eth/backend.go index 08da323e42c..6917a1cb0c9 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -1450,7 +1450,7 @@ func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConf } } blockReader := freezeblocks.NewBlockReader(allSnapshots, allBorSnapshots, heimdallStore, bridgeStore) - agg, err := libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) + agg, err := libstate.NewAggregator2(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { return nil, nil, nil, nil, nil, nil, nil, err } diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 4835364c440..3aaf44d316d 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -1505,7 +1505,7 @@ func dbCfg(label kv.Label, path string) mdbx.MdbxOpts { Accede(true) // integration tool: open db without creation and without blocking erigon } func openAgg(ctx context.Context, dirs datadir.Dirs, chainDB kv.RwDB, logger log.Logger) *libstate.Aggregator { - agg, err := libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, chainDB, logger) + agg, err := libstate.NewAggregator2(ctx, dirs, config3.DefaultStepSize, chainDB, logger) if err != nil { panic(err) } diff --git a/turbo/app/squeeze_cmd.go b/turbo/app/squeeze_cmd.go index da096ff2c02..d71d68ed47c 100644 --- a/turbo/app/squeeze_cmd.go +++ b/turbo/app/squeeze_cmd.go @@ -137,7 +137,7 @@ func squeezeStorage(ctx context.Context, dirs datadir.Dirs, logger log.Logger) e ac := agg.BeginFilesRo() defer ac.Close() - aggOld, err := state.NewAggregator(ctx, dirsOld, config3.DefaultStepSize, db, logger) + aggOld, err := state.NewAggregator2(ctx, dirsOld, config3.DefaultStepSize, db, logger) if err != nil { panic(err) } @@ -178,7 +178,7 @@ func squeezeStorage(ctx context.Context, dirs datadir.Dirs, logger log.Logger) e func squeezeCode(ctx context.Context, dirs datadir.Dirs, logger log.Logger) error { db := dbCfg(kv.ChainDB, dirs.Chaindata).MustOpen() defer db.Close() - agg, err := state.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) + agg, err := state.NewAggregator2(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { return err } From 05d72f066ef7436e1e104a8d132c4f4c544c43f1 Mon Sep 17 00:00:00 2001 From: sudeep Date: Wed, 8 Jan 2025 15:40:52 +0530 Subject: [PATCH 28/28] remove prunesmallbatchesdb (#13337) https://github.com/erigontech/erigon/issues/13328 --- erigon-lib/state/aggregator.go | 90 -------------------------- erigon-lib/state/domain_shared_test.go | 9 ++- turbo/app/snapshots_cmd.go | 26 +++++--- 3 files changed, 20 insertions(+), 105 deletions(-) diff --git a/erigon-lib/state/aggregator.go b/erigon-lib/state/aggregator.go index a589a6e1687..870cb049934 100644 --- a/erigon-lib/state/aggregator.go +++ b/erigon-lib/state/aggregator.go @@ -841,96 +841,6 @@ func (ac *AggregatorRoTx) CanUnwindBeforeBlockNum(blockNum uint64, tx kv.Tx) (un return blockNum, true, nil } -func (ac *AggregatorRoTx) PruneSmallBatchesDb(ctx context.Context, timeout time.Duration, db kv.RwDB) (haveMore bool, err error) { - // On tip-of-chain timeout is about `3sec` - // On tip of chain: must be real-time - prune by small batches and prioritize exact-`timeout` - // Not on tip of chain: must be aggressive (prune as much as possible) by bigger batches - - furiousPrune := timeout > 5*time.Hour - aggressivePrune := !furiousPrune && timeout >= 1*time.Minute - - var pruneLimit uint64 = 1_000 - if furiousPrune { - pruneLimit = 10_000_000 - /* disabling this feature for now - seems it doesn't cancel even after prune finished - // start from a bit high limit to give time for warmup - // will disable warmup after first iteration and will adjust pruneLimit based on `time` - withWarmup = true - */ - } - - started := time.Now() - localTimeout := time.NewTicker(timeout) - defer localTimeout.Stop() - logPeriod := 30 * time.Second - logEvery := time.NewTicker(logPeriod) - defer logEvery.Stop() - aggLogEvery := time.NewTicker(600 * time.Second) // to hide specific domain/idx logging - defer aggLogEvery.Stop() - - fullStat := newAggregatorPruneStat() - innerCtx := context.Background() - goExit := false - - for { - err = db.Update(innerCtx, func(tx kv.RwTx) error { - iterationStarted := time.Now() - // `context.Background()` is important here! - // it allows keep DB consistent - prune all keys-related data or noting - // can't interrupt by ctrl+c and leave dirt in DB - stat, err := ac.Prune(innerCtx, tx, pruneLimit, aggLogEvery) - if err != nil { - ac.a.logger.Warn("[snapshots] PruneSmallBatches failed", "err", err) - return err - } - if stat == nil { - if fstat := fullStat.String(); fstat != "" { - ac.a.logger.Info("[snapshots] PruneSmallBatches finished", "took", time.Since(started).String(), "stat", fstat) - } - goExit = true - return nil - } - fullStat.Accumulate(stat) - - if aggressivePrune { - took := time.Since(iterationStarted) - if took < 2*time.Second { - pruneLimit *= 10 - } - if took > logPeriod { - pruneLimit /= 10 - } - } - - select { - case <-logEvery.C: - ac.a.logger.Info("[snapshots] pruning state", - "until commit", time.Until(started.Add(timeout)).String(), - "pruneLimit", pruneLimit, - "aggregatedStep", ac.StepsInFiles(kv.StateDomains...), - "stepsRangeInDB", ac.a.StepsRangeInDBAsStr(tx), - "pruned", fullStat.String(), - ) - default: - } - return nil - }) - if err != nil { - return false, err - } - select { - case <-localTimeout.C: //must be first to improve responsivness - return true, nil - case <-ctx.Done(): - return false, ctx.Err() - default: - } - if goExit { - return false, nil - } - } -} - // PruneSmallBatches is not cancellable, it's over when it's over or failed. // It fills whole timeout with pruning by small batches (of 100 keys) and making some progress func (ac *AggregatorRoTx) PruneSmallBatches(ctx context.Context, timeout time.Duration, tx kv.RwTx) (haveMore bool, err error) { diff --git a/erigon-lib/state/domain_shared_test.go b/erigon-lib/state/domain_shared_test.go index e05c50b192a..29018977b48 100644 --- a/erigon-lib/state/domain_shared_test.go +++ b/erigon-lib/state/domain_shared_test.go @@ -461,11 +461,10 @@ func TestSharedDomain_StorageIter(t *testing.T) { ac.Close() ac = agg.BeginFilesRo() - //err = db.Update(ctx, func(tx kv.RwTx) error { - // _, err = ac.PruneSmallBatches(ctx, 1*time.Minute, tx) - // return err - //}) - _, err = ac.PruneSmallBatchesDb(ctx, 1*time.Minute, db) + err = db.Update(ctx, func(tx kv.RwTx) error { + _, err = ac.PruneSmallBatches(ctx, 1*time.Minute, tx) + return err + }) require.NoError(t, err) ac.Close() diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 3aaf44d316d..6fa77e759cf 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -1381,15 +1381,18 @@ func doRetireCommand(cliCtx *cli.Context, dirs datadir.Dirs) error { } logger.Info("Prune state history") - ac := agg.BeginFilesRo() - defer ac.Close() for hasMoreToPrune := true; hasMoreToPrune; { - hasMoreToPrune, err = ac.PruneSmallBatchesDb(ctx, 2*time.Minute, db) - if err != nil { + if err := db.Update(ctx, func(tx kv.RwTx) error { + ac := tx.(libstate.HasAggTx).AggTx().(*libstate.AggregatorRoTx) + hasMoreToPrune, err = ac.PruneSmallBatches(ctx, 2*time.Minute, tx) + if err != nil { + return err + } + return nil + }); err != nil { return err } } - ac.Close() logger.Info("Work on state history snapshots") indexWorkers := estimate.IndexSnapshot.Workers() @@ -1435,15 +1438,18 @@ func doRetireCommand(cliCtx *cli.Context, dirs datadir.Dirs) error { return err } - ac = agg.BeginFilesRo() - defer ac.Close() for hasMoreToPrune := true; hasMoreToPrune; { - hasMoreToPrune, err = ac.PruneSmallBatchesDb(context.Background(), 2*time.Minute, db) - if err != nil { + if err := db.Update(ctx, func(tx kv.RwTx) error { + ac := tx.(libstate.HasAggTx).AggTx().(*libstate.AggregatorRoTx) + hasMoreToPrune, err = ac.PruneSmallBatches(ctx, 2*time.Minute, tx) + if err != nil { + return err + } + return nil + }); err != nil { return err } } - ac.Close() if err = agg.MergeLoop(ctx); err != nil { return err