-
Notifications
You must be signed in to change notification settings - Fork 28
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
Message improvements #48
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
altonen
requested review from
erubboli,
iljakuklic,
muursh,
TheQuantumPhysicist and
zorvan
as code owners
December 14, 2021 11:53
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.
I think this is all my comments for now.
muursh
reviewed
Dec 15, 2021
This macro adds helper functionality for Mintlayer message. Currently it includes new(), into_msg() and from_msg() functions so if a peer wants to send/recv a Hello message, they only need to call: socket.send(Hello::new(..).into_msg()).unwrap(); let hello = socket.recv().unwrap().from_msg().unwrap(); and they only need to give the struct specification, the code for these functions is generated automatically.
The latter doens't implement PartialEq which makes writing tests harder. ErrorKind already contains all of the information P2P might be interested in so it makes more sense to use that.
altonen
force-pushed
the
msg-format
branch
2 times, most recently
from
December 15, 2021 09:21
d735bc1
to
c001a8c
Compare
This is to make messages network-agnostic and keep the interface of each message clean as they don't really care what network is in use when they are being created. Saving the chain config to a lazily evaluated static variable allows the chain config data to be specified at the start-up but also allows different subsystems to use the values as if they were static variables.
I'll close this, the new implementation is not able to use the code written for this message format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use procedural macros to implement a new derive attribute called
Message
which is used to auto-generate helper functions that are going to be common for all messages types. This will significantly reduce the amount of code needed for different message types