dymensionxyz / dymint

Sequencing Engine for Dymension RollApps
Other
90 stars 61 forks source link

fix(p2p): avoid receiving duplicated blocks #818

Closed srene closed 1 month ago

srene commented 1 month ago

PR Standards

This PR is aimed at preventing the reception of duplicated blocks from p2p network, by updating Gossipsub router configuration. It also prevents adding blocks to cache when already received. This improves performance and syncing times, because receiving too many packets from p2p may block applying blocks received from DA.

Opening a pull request should be able to meet the following requirements


Close #795 #803 <-- Briefly describe the content of this pull request -->

For Author:


For Reviewer:


After reviewer approval:

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 39.83%. Comparing base (851b312) to head (a4c4ae8). Report is 15 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #818 +/- ## ========================================== - Coverage 40.44% 39.83% -0.62% ========================================== Files 120 118 -2 Lines 18935 18740 -195 ========================================== - Hits 7659 7465 -194 - Misses 10201 10226 +25 + Partials 1075 1049 -26 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

srene commented 1 month ago

not sure if I understood what is the point of this pr? There was too much demand for the mutex before?

it avoids receiving extra duplicates from gossipsub protocol by passing extra options in p2p/client.go, this reduces the demand of the mutex. also it avoids adding already received blocks to the cache, in case it happens.

omritoptix commented 1 month ago

@mtsitrin can we merge?