-
Notifications
You must be signed in to change notification settings - Fork 408
feature: Allow partial act messages to be received (discussion) #672
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
Comments
Yes, its absolutely critical that we be able to read partial messages. TCP is all kinds of unreliable and only provides a stream, not "reads". I believe this is working fine on master, the above patch seems to be against #494. |
I went through master & #494 to verify the current behaviors. Matt is correct that master will just wait until it receives the full act bytes. #494 has a regression that will disconnect the peer if it receives < act bytes. I'll make these notes in the relevant lines of the review and ensure we keep the behavior the same. A simple patch to show the behavior difference using the tokio tests:
I think we can close this issue out as resolved. |
Thanks for the patch, @julianknutsen! |
@julianknutsen, after skimming over Noise specs again, byte-fragmentation to discover ciphertext boundaries is only a concern during the authentication phase, not during act handshake as it does happen in clear. Matt is right that how we process data packets from unreliable stream at the net layer is a different issue that how we process ciphertexts at the authentication layer. I'm leaning to think that BOLT 8 is incomplete wrt to byte-fragmentation concern, we should pad payload and process them constantly to avoid guessing cipher content. Anyway that's beyond the scope of this issue and we can mark it as closed. |
Thanks for the analysis @ariard. Closing this out as required. |
Uh oh!
There was an error while loading. Please reload this page.
The RFC mentions that any payloads smaller than the act sizes should result in an error. However, it specifically mentions network reads. Since developers of this library are implementing their own network stack, it is possible that the peer_handler code could receive partial sequential read() calls that result in a valid act.
Relevant RFC line:
Is it worth supporting users of the library that send the ACT messages in chunks?
from @ariard:
Relevant patch:
0001-feature-Allow-partial-act-messages-to-be-received.patch.txt
The text was updated successfully, but these errors were encountered: