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

fix: increment and refactor number of hops for routed messages #12188

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

stedfn
Copy link
Contributor

@stedfn stedfn commented Oct 4, 2024

No description provided.

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.83%. Comparing base (99ecfa4) to head (14fbf41).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12188      +/-   ##
==========================================
+ Coverage   71.69%   71.83%   +0.13%     
==========================================
  Files         825      827       +2     
  Lines      165834   166622     +788     
  Branches   165834   166622     +788     
==========================================
+ Hits       118902   119692     +790     
+ Misses      41751    41713      -38     
- Partials     5181     5217      +36     
Flag Coverage Δ
backward-compatibility 0.17% <0.00%> (-0.01%) ⬇️
db-migration 0.17% <0.00%> (-0.01%) ⬇️
genesis-check 1.25% <0.00%> (-0.01%) ⬇️
integration-tests 38.77% <83.33%> (-0.08%) ⬇️
linux 71.52% <100.00%> (+0.13%) ⬆️
linux-nightly 71.41% <100.00%> (+0.14%) ⬆️
macos 54.53% <16.66%> (+0.28%) ⬆️
pytests 1.57% <0.00%> (-0.01%) ⬇️
sanity-checks 1.37% <0.00%> (-0.01%) ⬇️
unittests 65.64% <100.00%> (+0.26%) ⬆️
upgradability 0.21% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stedfn stedfn self-assigned this Oct 4, 2024
@stedfn stedfn requested a review from saketh-are October 4, 2024 11:24
@stedfn stedfn marked this pull request as ready for review October 4, 2024 11:24
@stedfn stedfn requested a review from a team as a code owner October 4, 2024 11:24
Copy link
Collaborator

@saketh-are saketh-are left a comment

Choose a reason for hiding this comment

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

Thanks!

Could be worth adding a couple of basic unit tests covering the 0-hop and 1-hop cases.

@stedfn stedfn changed the title fix: increment num hops for routed messages fix: increment and refactor number of hops for routed messages Oct 11, 2024
@stedfn
Copy link
Contributor Author

stedfn commented Oct 11, 2024

@saketh-are I cleaned it up a bit more and added an assert in an integration test to confirm it gets incremented. Let me know if you are happy with the changes

Copy link
Collaborator

@saketh-are saketh-are left a comment

Choose a reason for hiding this comment

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

Still LGTM, left a couple of small comments

chain/network/src/stats/metrics.rs Outdated Show resolved Hide resolved
bytes borsh = 1;
// Timestamp of creating the Routed message by its original author.
google.protobuf.Timestamp created_at = 2;
// Number of peers this routed message travelled through. Doesn't include the peer that created the message.
optional int32 num_hops = 3;
uint32 num_hops = 4;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to confirm, are you completely sure that deprecating this field and reusing the field name is OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be ok:

  • reusing the field name is fine as the protobuf encoding is based on the tag numbers
  • there could be some data loss with deprecating the old field (for example if a node that uses the old version sends it to one that uses the new one) but the field was not used before anyway

There also is a protobuf backwards compatibility test which passed, but I do not know how it works

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.

2 participants