Merge pull request #1266 from maticnetwork/master

Back merge master to develop after v1.3.3 release
This commit is contained in:
Pratik Patil 2024-06-12 14:34:41 +05:30 committed by GitHub
commit d0a212b4d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 53 additions and 15 deletions

View file

@ -40,10 +40,15 @@ const (
) )
const ( const (
maxUncleDist = 7 // Maximum allowed backward distance from the chain head 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 // maxQueueDist is increased for bor to allow storing more block announcements
blockLimit = 64 // Maximum number of unique blocks a peer may have delivered // 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 ( var (

View file

@ -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) return common.Big0, nil, nil, nil, fmt.Errorf("%w: %f", errInvalidPercentile, p)
} }
if i > 0 && p < rewardPercentiles[i-1] { 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) return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f >= #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p)
} }
} }

View file

@ -610,13 +610,30 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) {
log.Error("Propagating dangling block", "number", block.Number(), "hash", hash) log.Error("Propagating dangling block", "number", block.Number(), "hash", hash)
return 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 // Send the block to a subset of our peers
transfer := peers[:int(math.Sqrt(float64(len(peers))))] transfer := peers[:int(math.Sqrt(float64(len(peers))))]
for _, peer := range transfer { for _, peer := range transfer {
peer.AsyncSendNewBlock(block, td) 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 return
} }
@ -626,7 +643,7 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) {
peer.AsyncSendNewBlockHash(block) 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)))
} }
} }

View file

@ -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. // knownCache is a cache for known hashes.
type knownCache struct { type knownCache struct {
hashes mapset.Set[common.Hash] hashes mapset.Set[common.Hash]

View file

@ -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() header = block.Header()
td = fullBackend.GetTd(context.Background(), header.Hash()) td = fullBackend.GetTd(context.Background(), header.Hash())

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.2 Version: 1.3.3
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -23,7 +23,7 @@ import (
const ( const (
VersionMajor = 1 // Major version component of the current release VersionMajor = 1 // Major version component of the current release
VersionMinor = 3 // Minor 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 VersionMeta = "" // Version metadata to append to the version string
) )