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

Base node initial sync triggers too early #6766

Closed
hansieodendaal opened this issue Jan 27, 2025 · 1 comment · Fixed by #6767
Closed

Base node initial sync triggers too early #6766

hansieodendaal opened this issue Jan 27, 2025 · 1 comment · Fixed by #6767
Assignees

Comments

@hansieodendaal
Copy link
Contributor

The base node will trigger initial sync and say its synced, then start to do a sync from a node:

To test, run a node and see this in the log line: Initial sync is done. Starting mempool sync protocol
After which it will start syncing.

Related to this:
tari-project/universe#1348

@hansieodendaal
Copy link
Contributor Author

See #6767

SWvheerden added a commit that referenced this issue Jan 29, 2025
Description
---
Mempool sync can only start when `is_synced` is set to `true`.
- An edge case was witnessed whereby mempool sync can start early if the
entire network is generally
slow to respond to pings. The `ChainMetadataEvent::NetworkSilence` event
is transmitted if 3x
consecutive ping cycles were started without corresponding pongs
received, which sets
`is_synced` to `true`. The moment that peer metadata is then received,
block sync and mempool sync
will occur at the same time. 
- Prolonged network silence is now detected in the `Starting` state. At
startup, the first successful metadata message received from a peer will
signal the transition to `Listening`, otherwise `Listening` will be
notified of the network silence, which can act accordingly.
- Additional debug logs were added to track all events that can set the
`is_synced` to `true`.
- Removed `log-mdc` from the dependencies as the relevant code is not
used.

The edge case warning message must be monitored to see if it is a real
issue:
```rust
warn!(
    target: LOG_TARGET,
    "Initial sync achieved based on event 'NetworkSilence'; this may not be true if the entire \
    network in general is slow to respond to pings"
);
```

Fixes #6766

Motivation and Context
---
Mempool sync _"started"_ before block sync was achieved.

How Has This Been Tested?
---
System-level testing

What process can a PR reviewer use to test or verify this change?
---
Code review
System-level testing

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->

---------

Co-authored-by: SW van Heerden <swvheerden@gmail.com>
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 a pull request may close this issue.

1 participant