Currently PropagateNewBlockHashes and BroadcastNewBlock
selects a subset of all sentries by taking a `Sqrt(len(sentries))`,
and then for each sentry SendMessageToRandomPeers
selects a subset of its peers by taking `Sqrt(len(peerInfos))`.
This behaviour limits the broadcast scope with a lot of peers, e.g. 100
becomes 10,
but is not great with very few peers, or if the message is very
important
to broadcast to everyone, which is the case of bor validator/proposer
nodes.
* send to all sentries in both BroadcastNewBlock and PropagateNewBlockHashes
* remove peerCountConstrained sqrt logic in SendMessageToRandomPeers
* add maxPeers provider func as a parameter to MultiClient
* default it to 10 for eth and 0 (unlimited) for bor validators
---------
Co-authored-by: Mark Holt <mark@distributed.vision>
because bor doesn't have headers,
ReadCurrentHeader returns nil as expected
refactor isChainPoS to only call ReadCurrentHeader/ReadTd if needed and
use chain config IDs
problem: it was possible to call startSync
and start sending messages before our Status is sent
solution: wait for the sender goroutine to finish
before calling startSync
refactor handShake parameters to not require peerID and a startSync
callback
Co-authored-by: Mark Holt <mark@distributed.vision>
[txpool](https://github.com/ledgerwatch/erigon-lib/blob/main/txpool/pool.go)
expects an `OnNewBlock` update only after the DB transaction is
committed.
This fixes, for example, a nonce gap mis-detection in Hive test
"engine-cancun/Blob Transactions On Block 1, Cancun Genesis".
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>