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

Add nil hash validation #2296

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Add nil hash validation #2296

wants to merge 5 commits into from

Conversation

AnkushinDaniil
Copy link
Contributor

@AnkushinDaniil AnkushinDaniil commented Dec 1, 2024

Fix #2239
Continue #2290

Protocol Buffer Validation:

  • p2p/spec/common.proto: Added import for buf/validate/validate.proto and added a required field validation to message Hash. [1] [2]
  • p2p/sync/client.go: Integrated protovalidate for validating protocol buffer messages in the requestAndReceiveStream function. [1] [2] [3]

Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.63%. Comparing base (0c6508c) to head (56d5310).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2296      +/-   ##
==========================================
- Coverage   74.69%   74.63%   -0.07%     
==========================================
  Files         110      110              
  Lines       12109    12109              
==========================================
- Hits         9045     9037       -8     
- Misses       2366     2372       +6     
- Partials      698      700       +2     

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

@AnkushinDaniil AnkushinDaniil enabled auto-merge (squash) December 2, 2024 10:36
@pnowosie pnowosie self-requested a review December 2, 2024 10:38
Copy link
Contributor

@pnowosie pnowosie left a comment

Choose a reason for hiding this comment

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

👍

Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@rodrigo-pino rodrigo-pino left a comment

Choose a reason for hiding this comment

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

What does using buf in this PR is improving over not using buf?

Would adding buf means an extra dependency to compile Juno successfully or just for development? Should the use of buf be documented somewhere as dependency?

Some questions, trying to understand the code base

@AnkushinDaniil
Copy link
Contributor Author

What does using buf in this PR is improving over not using buf?

Because we need to import "buf/validate/validate.proto";, which is external proto. protoc requires all proto files to be in the project.

Would adding buf means an extra dependency to compile Juno successfully or just for development? Should the use of buf be documented somewhere as dependency?

This is for development only. buf and protoc are tools that allow you to generate go files from proto files. The main difference is that buf generates remotely and has a more convenient configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Juno panics when receiving Transaction message with nil transaction_hash in P2P sync
3 participants