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

Remove the need of reflection of p2p message (de)serialization #1195

Merged
merged 7 commits into from
Jan 10, 2024

Conversation

lontivero
Copy link
Contributor

Reflection makes code stripping impossible and that's an impediment for fully supporting AOT.

This PR is a first step in the removal of reflection and here we start from removing it from the peer-to-peer message serialization/deserialization.

Note: sorry for the eol change in NBitcoin/Protocol/Payloads/AddrPayload.cs, the truth is that NBitcoin has a problem of inconsistency where half of the files are CRLF while the other half are LF so, it is always painful for any contributor.

… string instead of the using the reflection `Activator` class based on the type decorated info.
A `Message` comes always with a Payload type and never with any other type. This means that a `Message` can come with a `BlockPayload` type but never with a `Block` type. So, the `ConsensusFactory` is unnecessary.
@lontivero
Copy link
Contributor Author

Ping @NicolasDorier

@lontivero
Copy link
Contributor Author

I reordered the messages based on my experience but I have no numbers to tell me which messages are more frequent.

@NicolasDorier NicolasDorier merged commit c06f086 into MetacoSA:master Jan 10, 2024
4 of 7 checks passed
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