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

feat(net): fix failure to process FETCH_INV_DATA message #5460

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

xxo1shine
Copy link
Contributor

@xxo1shine xxo1shine commented Aug 31, 2023

What does this PR do?
Fix failure to process FETCH_INV_DATA message, fix #5439.

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

synchronized (this) {
if (invToFetch.isEmpty() || peers.isEmpty()) {
return;
}
long now = System.currentTimeMillis();
invToFetch.forEach((item, time) -> {
if (time < now - MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL be replaced with TIMEOUT here?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@codecov-commenter
Copy link

Codecov Report

Merging #5460 (7e2b7fc) into develop (b9ab07a) will increase coverage by 0.00%.
The diff coverage is 50.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             develop    #5460   +/-   ##
==========================================
  Coverage      61.45%   61.45%           
+ Complexity      9370     9369    -1     
==========================================
  Files            846      846           
  Lines          50298    50300    +2     
  Branches        5585     5585           
==========================================
+ Hits           30911    30913    +2     
+ Misses         16969    16968    -1     
- Partials        2418     2419    +1     
Files Changed Coverage Δ
...java/org/tron/core/net/service/adv/AdvService.java 58.49% <50.00%> (+0.87%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

invToFetch.remove(item);
});
peers.stream().filter(peer -> {
Long t = peer.getAdvInvReceive().getIfPresent(item);
Copy link
Contributor

Choose a reason for hiding this comment

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

t(L282) and time(L274) isn't that close to the same?

image image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not the same, times from different caches

Copy link
Contributor

Choose a reason for hiding this comment

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

math.abs(t-time) is very close to 0. Am I getting this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right.

Copy link
Contributor

Choose a reason for hiding this comment

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

math.abs(t-time) is very close to 0

if time >= now - TIMEOUT, now - t < TIMEOUT when is it false?

invToFetch.forEach((item, time) -> {
if (time < now - MSG_CACHE_DURATION_IN_BLOCKS * BLOCK_PRODUCED_INTERVAL) {
if (time < now - TIMEOUT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an assumption: no more than 2w transactions will be broadcast within 15s?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At present, it is basically impossible to reach 20,000 within 15 seconds. We only focus on time and not TPS.

@xxo1shine xxo1shine merged commit 9f8cebd into tronprotocol:develop Sep 8, 2023
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.7.3 milestone Sep 12, 2023
@xxo1shine xxo1shine deleted the fix_msg_process branch May 28, 2024 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to process FETCH_INV_DATA message
6 participants