Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_syncing incorrectly reports syncing when it's not #2618

Closed
tersec opened this issue Sep 12, 2024 · 2 comments
Closed

eth_syncing incorrectly reports syncing when it's not #2618

tersec opened this issue Sep 12, 2024 · 2 comments

Comments

@tersec
Copy link
Contributor

tersec commented Sep 12, 2024

status-im/infra-nimbus#193 (comment)

There are two RPC API implementations with eth_syncing, but the one which the nimbus command appears to run is:

server.rpc("eth_syncing") do() -> SyncingStatus:
## Returns SyncObject or false when not syncing.
# TODO: make sure we are not syncing
# when we reach the recent block
let numPeers = node.peerPool.connectedNodes.len
if numPeers > 0:
var sync = SyncObject(
startingBlock: w3Qty com.syncStart,
currentBlock : w3Qty com.syncCurrent,
highestBlock : w3Qty com.syncHighest
)
result = SyncingStatus(syncing: true, syncObject: sync)
else:
result = SyncingStatus(syncing: false)

numPeers > 0 is not correct logic to report syncing happening.

@tersec
Copy link
Contributor Author

tersec commented Sep 12, 2024

server.rpc("eth_syncing") do() -> SyncingStatus:
## Returns SyncObject or false when not syncing.
if api.com.syncState != Waiting:
let sync = SyncObject(
startingBlock: w3Qty api.com.syncStart,
currentBlock : w3Qty api.com.syncCurrent,
highestBlock : w3Qty api.com.syncHighest
)
return SyncingStatus(syncing: true, syncObject: sync)
else:
return SyncingStatus(syncing: false)

looks mostly fine, and doesn't have this incorrect dependency on peer count, but isn't what's used in the application:
proc installRPC(server: RpcServer,
nimbus: NimbusNode,
conf: NimbusConf,
com: CommonRef,
oracle: Oracle,
flags: set[RpcFlag]) =
setupCommonRpc(nimbus.ethNode, conf, server)
if RpcFlag.Eth in flags:
setupEthRpc(nimbus.ethNode, nimbus.ctx, com, nimbus.txPool, oracle, server)

sets up the p2p.nim version.

@tersec
Copy link
Contributor Author

tersec commented Sep 12, 2024

#2619

@tersec tersec closed this as completed Sep 12, 2024
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

No branches or pull requests

1 participant