Skip to content

Comments

chore: fix several occasional issues for EVN;#3091

Merged
zzzckck merged 4 commits intobnb-chain:developfrom
galaio:new-broadcast
May 15, 2025
Merged

chore: fix several occasional issues for EVN;#3091
zzzckck merged 4 commits intobnb-chain:developfrom
galaio:new-broadcast

Conversation

@galaio
Copy link
Contributor

@galaio galaio commented May 15, 2025

Description

This PR will fix several occasional issues for EVN.

  1. Failed to call getValidators

It reports this error log occasionally, which is caused by unstale chain state, here will use default rpc.LatestBlockNumber.

t=05-15|02:08:49.023 lvl=error msg="Failed to call getValidators" error="header not found"
t=05-15|02:08:49.023 lvl=error msg="Failed to get validators" error="failed to call getValidators: header not found"
  1. New Block fetching request timeout

It reports this error log occasionally, which is caused by sending first.

t=05-15|06:21:04.069 lvl=debug msg="Quick block fetching" peer=56cee43c4bd981efba088f3b6360e0621e8f68c0ac0b4ae4fdeb2e78e8d2d523 hash=0x8720c104038d9798844732d7bf0d69134a27880ccbca0f018362b012736949c9
t=05-15|06:21:04.074 lvl=debug msg="receive BlocksByRange response" from=56cee43c4bd981efba088f3b6360e0621e8f68c0ac0b4ae4fdeb2e78e8d2d523 requestId=15565053124800979956 blocks=1 err="missing the request"
t=05-15|06:21:04.475 lvl=debug msg="Quick block fetching err" hash=0x8720c104038d9798844732d7bf0d69134a27880ccbca0f018362b012736949c9 err="request timeout"

Changes

Notable changes:

  • chore: fix rpc call issue in parlia;
  • p2p: fix a missed request issue;

@galaio galaio requested review from MatusKysel, buddh0 and zzzckck May 15, 2025 08:46
@MatusKysel MatusKysel requested a review from Copilot May 15, 2025 08:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes occasional issues related to validator retrieval and block fetching by updating RPC calls and using the latest chain state across several protocol components.

  • Updated debug logging to provide more context for request/response tracing.
  • Removed block number parameters in favor of rpc.LatestBlockNumber in validator-related functions.
  • Fixed a missed request issue in the p2p dispatcher.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
eth/protocols/bsc/peer.go Added a debug log for RequestBlocksByRange to trace request results.
eth/protocols/bsc/handler.go Changed log level from Trace to Debug and enhanced logging details.
eth/protocols/bsc/dispatcher.go Added logging for request dispatch and cleanup in the dispatcher.
consensus/parlia/stakehub.go Modified GetValidators and getNodeIDsForValidators to always use the latest block, updating log messages accordingly.
Comments suppressed due to low confidence (3)

eth/protocols/bsc/peer.go:204

  • [nitpick] The log field 'ret' is ambiguous; consider renaming it to a more descriptive term, such as 'noResult', to enhance clarity.
log.Debug("RequestBlocksByRange result", "requestID", requestID, "ret", res == nil, "err", err)

consensus/parlia/stakehub.go:22

  • Removing the blockNumber parameter in GetValidators alters the API; ensure that all consumers and tests account for this change and rely on using the latest block.
func (p *Parlia) GetValidators(offset, limit *big.Int) ([]common.Address, []common.Address, *big.Int, error) {

consensus/parlia/stakehub.go:64

  • The removal of the blockNumber parameter in getNodeIDsForValidators simplifies the function, but confirm that this change aligns with intended behavior across all usage scenarios.
func (p *Parlia) getNodeIDsForValidators(validatorsToQuery []common.Address) (map[common.Address][]enode.ID, error) {

@zzzckck zzzckck merged commit 1a054c4 into bnb-chain:develop May 15, 2025
7 checks passed
galaio added a commit to galaio/bsc that referenced this pull request May 29, 2025
galaio added a commit to galaio/bsc that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants