diff --git a/eth/fetcher/block_fetcher.go b/eth/fetcher/block_fetcher.go index 1831b756a3..171c02e217 100644 --- a/eth/fetcher/block_fetcher.go +++ b/eth/fetcher/block_fetcher.go @@ -40,10 +40,15 @@ const ( ) const ( - maxUncleDist = 7 // Maximum allowed backward distance from the chain head - maxQueueDist = 32 // Maximum allowed distance from the chain head to queue - hashLimit = 256 // Maximum number of unique blocks or headers a peer may have announced - blockLimit = 64 // Maximum number of unique blocks a peer may have delivered + maxUncleDist = 7 // Maximum allowed backward distance from the chain head + + // maxQueueDist is increased for bor to allow storing more block announcements + // near chain tip + maxQueueDist = 32 * 6 // Maximum allowed distance from the chain head to queue + hashLimit = 256 // Maximum number of unique blocks or headers a peer may have announced + + // blockLimit is increased for bor to allow storing more unique blocks near chain tip + blockLimit = 64 * 3 // Maximum number of unique blocks a peer may have delivered ) var ( diff --git a/eth/gasprice/feehistory.go b/eth/gasprice/feehistory.go index 3871f79058..371c9ea545 100644 --- a/eth/gasprice/feehistory.go +++ b/eth/gasprice/feehistory.go @@ -244,8 +244,8 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks uint64, unresolvedL return common.Big0, nil, nil, nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) } - if i > 0 && p < rewardPercentiles[i-1] { - return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f > #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p) + if i > 0 && p <= rewardPercentiles[i-1] { + return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f >= #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p) } } diff --git a/eth/handler.go b/eth/handler.go index 72dc4e5431..1775f2df5c 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -610,13 +610,30 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) { log.Error("Propagating dangling block", "number", block.Number(), "hash", hash) return } + + // These are the static and trusted peers which are not + // in `transfer := peers[:int(math.Sqrt(float64(len(peers))))]` + staticAndTrustedPeers := []*ethPeer{} + + for _, peer := range peers[int(math.Sqrt(float64(len(peers)))):] { + if peer.IsTrusted() || peer.IsStatic() { + staticAndTrustedPeers = append(staticAndTrustedPeers, peer) + } + } + // Send the block to a subset of our peers transfer := peers[:int(math.Sqrt(float64(len(peers))))] for _, peer := range transfer { peer.AsyncSendNewBlock(block, td) } - log.Trace("Propagated block", "hash", hash, "recipients", len(transfer), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) + // Send the block to the trusted and static peers + for _, peer := range staticAndTrustedPeers { + log.Trace("Propagating block to static and trusted peer", "hash", hash, "peerID", peer.ID()) + peer.AsyncSendNewBlock(block, td) + } + + log.Debug("Propagated block", "hash", hash, "recipients", len(transfer), "static and trusted recipients", len(staticAndTrustedPeers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) return } @@ -626,7 +643,7 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) { peer.AsyncSendNewBlockHash(block) } - log.Trace("Announced block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) + log.Debug("Announced block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) } } diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 98ad22a8cf..21fd966d58 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -470,6 +470,16 @@ func (p *Peer) RequestTxs(hashes []common.Hash) error { }) } +// IsTrusted returns whether the peer is a trusted peer or not. +func (p *Peer) IsTrusted() bool { + return p.Info().Network.Trusted +} + +// IsStatic returns whether the peer is a static peer or not. +func (p *Peer) IsStatic() bool { + return p.Info().Network.Static +} + // knownCache is a cache for known hashes. type knownCache struct { hashes mapset.Set[common.Hash] diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index 04797525ec..f281725965 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -734,6 +734,12 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats { } } + // It's weird, but it's possible that the block is nil here. + // even though the check for error is done above. + if block == nil { + return nil + } + header = block.Header() td = fullBackend.GetTd(context.Background(), header.Hash()) diff --git a/packaging/templates/package_scripts/control b/packaging/templates/package_scripts/control index f7fe99f821..b95ef8aa6d 100644 --- a/packaging/templates/package_scripts/control +++ b/packaging/templates/package_scripts/control @@ -1,5 +1,5 @@ Source: bor -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.arm64 b/packaging/templates/package_scripts/control.arm64 index 2af8f0be6a..f8a37a1c29 100644 --- a/packaging/templates/package_scripts/control.arm64 +++ b/packaging/templates/package_scripts/control.arm64 @@ -1,5 +1,5 @@ Source: bor -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.amd64 b/packaging/templates/package_scripts/control.profile.amd64 index ea85bf0941..d9e7edfd90 100644 --- a/packaging/templates/package_scripts/control.profile.amd64 +++ b/packaging/templates/package_scripts/control.profile.amd64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.arm64 b/packaging/templates/package_scripts/control.profile.arm64 index 89facfc4ca..cf6823c4e2 100644 --- a/packaging/templates/package_scripts/control.profile.arm64 +++ b/packaging/templates/package_scripts/control.profile.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator b/packaging/templates/package_scripts/control.validator index 823b9ed742..6da01046a3 100644 --- a/packaging/templates/package_scripts/control.validator +++ b/packaging/templates/package_scripts/control.validator @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator.arm64 b/packaging/templates/package_scripts/control.validator.arm64 index 452051dbcb..e7679e5e46 100644 --- a/packaging/templates/package_scripts/control.validator.arm64 +++ b/packaging/templates/package_scripts/control.validator.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.3.2 +Version: 1.3.3 Section: develop Priority: standard Maintainer: Polygon diff --git a/params/version.go b/params/version.go index 35206e280e..7b836091d3 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 3 // Minor version component of the current release - VersionPatch = 2 // Patch version component of the current release + VersionPatch = 3 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )