-
Notifications
You must be signed in to change notification settings - Fork 409
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
Verify OP_MSG
message checksum
#2540
Conversation
@AlekSi I cannot write the data directly into the crc32 hasher, I need to parse the whole message, check if the |
For this implementation to work, the data can first be read into a |
Sorry, I don't follow. TeeReader, MultiWriter, and other IO helpers like those two do not keep read or written data in memory. So there is no duplication of work. I also don't think we should parse the whole message to calculate the checksum. After all, we calculate the checksum of bytes, not parsed data structure. I think the algorithm could be something like that:
|
@AlekSi I found a way around using a TeeReader and made use of the read bytes instead. Please kindly review and let me know what you think. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2540 +/- ##
==========================================
- Coverage 66.31% 66.30% -0.02%
==========================================
Files 419 419
Lines 20444 20480 +36
==========================================
+ Hits 13558 13579 +21
- Misses 5972 5982 +10
- Partials 914 919 +5
... and 1 file with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. |
@AlekSi some of the tests are failing and I'm not sure why. My assumption is that some messages in the records do not contain valid checksums. |
I will check it shortly |
…into fix/checksum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calculation part looks good to me! I left some comments and questions :)
Co-authored-by: Patryk Kwiatek <patryk@kwiatek.xyz>
…into fix/checksum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing! Great job calculating the checksum and figuring out the specifics of the wire package!
OP_MSG
message checksumOP_MSG
message checksum
Description
Closes #1626.
This PR solves the issue with checksum verification for an OP_MSG
task all
, and it passed.@FerretDB/core
), Labels, Project and project's Sprint fields.