Here is my case:
writeIndex function takes about 39% in pprof flame graph. I dive into it
and find out that we use POA consensus, therefore mining addresses have
a big bitmap.
```
func writeIndex(blocknum uint64, changes *historyv2.ChangeSet, bucket string, changeDb kv.RwTx) error {
buf := bytes.NewBuffer(nil)
for _, change := range changes.Changes {
k := dbutils.CompositeKeyWithoutIncarnation(change.Key)
index, err := bitmapdb.Get64(changeDb, bucket, k, math.MaxUint32, math.MaxUint32)
if err != nil {
return fmt.Errorf("find chunk failed: %w", err)
}
index.Add(blocknum)
if err = bitmapdb.WalkChunkWithKeys64(k, index, bitmapdb.ChunkLimit, func(chunkKey []byte, chunk *roaring64.Bitmap) error {
buf.Reset()
if _, err = chunk.WriteTo(buf); err != nil {
return err
}
return changeDb.Put(bucket, chunkKey, common.CopyBytes(buf.Bytes()))
}); err != nil {
return err
}
}
return nil
}
```
assume that a mining address has a big bitmap (Cardinality 400000), then
"writeIndex" will split it into 300 small bitmaps according to
”ChunkLimit“ and next time "writeIndex" will union all small bitmaps
into a big bitmap, then use binary search to split it into 300 small
bitmaps. over and over again.
I think blockNum > index.Maximum(), so that we only need get the last
one of 300 small bitmaps .
Co-authored-by: mengweifu <75886642@qq.com>
Bumps
[github.com/supranational/blst](https://github.com/supranational/blst)
from 0.3.10 to 0.3.11.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/supranational/blst/releases">github.com/supranational/blst's
releases</a>.</em></p>
<blockquote>
<h2>Release v0.3.11</h2>
<p>Essential changes:</p>
<ul>
<li>security bugfix in Go bindings</li>
<li>run-time switch in portable build</li>
<li>no-std support [exercised with limited stack size of 56K]</li>
<li>serde support</li>
<li>blst_miller_loop_n interface, with parallelized Rust and Go
counterparts</li>
<li>optional blst_fr_pentaroot subroutine</li>
<li>Emscripten bindings</li>
<li>hardened security on non-asm platforms</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3dd0f804b1"><code>3dd0f80</code></a>
bindings/rust/Cargo.toml: bump the version number.</li>
<li><a
href="fb91221c91"><code>fb91221</code></a>
bindings/go/blst.go: fix logical error in SigValidate.</li>
<li><a
href="c6a3cc00ca"><code>c6a3cc0</code></a>
build.sh: don't pass -mno-avx unless actually required.</li>
<li><a
href="9fa8bcfb93"><code>9fa8bcf</code></a>
vect.h: tolerate compilation with -std=cNM flag.</li>
<li><a
href="5aa7ce1d6f"><code>5aa7ce1</code></a>
bindings/<swig-based>/*: minimize dynamic library symbol
pollution.</li>
<li><a
href="e1a44c97c0"><code>e1a44c9</code></a>
build.sh: drop --version-script linker argument.</li>
<li><a
href="492319a8c0"><code>492319a</code></a>
cpuid.c: adjust symbol visibility.</li>
<li><a
href="6dd7aa4ed9"><code>6dd7aa4</code></a>
Execute build/refresh.sh.</li>
<li><a
href="701e42a70b"><code>701e42a</code></a>
asm/ct_*: add missing .hidden directives.</li>
<li><a
href="dce883beb4"><code>dce883b</code></a>
Execute build/refresh.sh.</li>
<li>Additional commits viewable in <a
href="https://github.com/supranational/blst/compare/v0.3.10...v0.3.11">compare
view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/supranational/blst&package-manager=go_modules&previous-version=0.3.10&new-version=0.3.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ledgerwatch/erigon/network/alerts).
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I'm not sure what caused this failure (for instance, CI for PR #7888 was
green), but currently we have the following test failure in `devel`:
```
--- FAIL: TestGnosisForkDigest (0.00s)
fork_test.go:79:
Error Trace: github.com/ledgerwatch/erigon/cl/fork/fork_test.go:79
Error: Not equal:
expected: [4]uint8{0x82, 0x4b, 0xe4, 0x31}
actual : [4]uint8{0x21, 0xa6, 0xf8, 0x36}
```