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 a bug in pubsub message ID hash function #791

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

masih
Copy link
Member

@masih masih commented Dec 12, 2024

The prior implementation I believe intended to include additional fields into account when calculating the message ID from data. But was only returning hash of data for both manifest and GPBFT messages.

Fix this by writing the data to the hasher, then computing the hash with no suffix.

The prior implementation I believe intended to include additional fields
into account when calculating the message ID from data. But was only
returning hash of data for both manifest and GPBFT messages.

Fix this by writing the data to the hasher, _then_ computing the hash
with no suffix.
@masih masih requested review from Stebalien and Kubuxu December 12, 2024 12:31
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 69.38%. Comparing base (1b17c6c) to head (e6549d7).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
internal/psutil/psutil.go 33.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
- Coverage   69.64%   69.38%   -0.27%     
==========================================
  Files          77       77              
  Lines        7900     7904       +4     
==========================================
- Hits         5502     5484      -18     
- Misses       1949     1962      +13     
- Partials      449      458       +9     
Files with missing lines Coverage Δ
internal/psutil/psutil.go 32.25% <33.33%> (+13.73%) ⬆️

... and 3 files with indirect coverage changes

@Kubuxu
Copy link
Contributor

Kubuxu commented Dec 12, 2024

Does that mean our message IDs contained all of the data?

@Kubuxu
Copy link
Contributor

Kubuxu commented Dec 12, 2024

Great catch!!

@masih
Copy link
Member Author

masih commented Dec 12, 2024

Does that mean our message IDs contained all of the data?

No no. It contained only the hash of all of data.

Previously we called blake2b.Sum256 which takes a byte slice and hashes it. We then returned whatever that hash was even though earlier lines instantiated a separate hasher and wrote various values to it which were never used.

@Kubuxu
Copy link
Contributor

Kubuxu commented Dec 12, 2024

One note is that this will break the message propagation.

@masih
Copy link
Member Author

masih commented Dec 12, 2024

So if we want to merge this it's best to fix the tag for the container used by manifest server and observer so that they do not pull the latest 👍

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

That's... wow.

@masih
Copy link
Member Author

masih commented Dec 13, 2024

We can merge this once this pr is merged: https://github.com/filecoin-project/f3-passive-testing/pull/142

@masih masih added this pull request to the merge queue Dec 13, 2024
Merged via the queue into main with commit d4f3a0c Dec 13, 2024
12 of 13 checks passed
@masih masih deleted the masih/fix-bug-pubsub-message-id-func branch December 13, 2024 13:47
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.

3 participants