-
Notifications
You must be signed in to change notification settings - Fork 34
tests: include the test for the tests #137
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
Conversation
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
tests/test_bolt2-01-open_channel.py:345
- The updated test now accepts either a disconnect or an error event. Consider adding explicit assertions or separate tests to verify each scenario under the new connection lifecycle.
OneOf([ExpectDisconnect(), ExpectError()]),
tests/test_bolt1-02-unknown-messages.py:8
- [nitpick] Ensure that the replacement of TryAll with Wait aligns with the intended behavior for handling unknown messages, and verify that any timing or message-handling edge cases are adequately tested.
from lnprototest import Wait, Connect, ExpectMsg, Msg, RawMsg, Runner
3fdb102
to
bb53e1b
Compare
Some implementations send an error message and at the same time will close the connection. Locally this will cause a reading from a closed socket. However, ldk now has a different life cycle for the connection, and we should receive the error message before. ``` lnprototest.errors.EventError: `Peer did not disconnect` on event [{"event": "ExpectDisconnect", "file": "test_bolt2-01-open_channel.py", "pos": "345"},] =========================== short test summary info ============================ FAILED ../lnprototest/tests/test_bolt2-01-open_channel.py::test_open_channel_opener_side_wrong_announcement_signatures ============= 1 failed, 29 passed, 17 skipped in 96.15s (0:01:36) ============== ``` Link: #134 Reported-by: @Psycho-Pirate Signed-off-by: Vincenzo Palazzo <[email protected]>
bb53e1b
to
544d6e7
Compare
Sequence(ExpectDisconnect(), enable=is_cln), | ||
Sequence(ExpectMsg("error"), enable=(not is_cln)), |
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 have some questions.
- Why are we using
Sequence
instead ofOneOf
? Shouldn't this be aOneOf
list of acceptable responses? That way we might not have to specifyis_cln
? - Instead of
ExpectMsg("error")
maybe we can useExpectError()
.
I was going through the BOLT specification and found
The recipient:
if signature is incorrect OR non-compliant with LOW-S-standard rulehttps://github.com/bitcoin/bitcoin/pull/6769:
MUST send a warning and close the connection, or send an error and fail the channel.
We are checking for Disconnect(closing connection) and Error, maybe we should also check channel closure?
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.
Shouldn't this be a OneOf list of acceptable responses?
Yes, but now the OneOf event will read through the buffer and consume the buffer, so the next event will read from an incorrect buffer. The Sequence allows for disabling the execution for each run.
There could be smarter way to use OneOf, but I am working on a new API that allows a better way of writing tests, so I will stay with what we have!
We are checking for Disconnect(closing connection) and Error, maybe we should also check channel closure?
Right, but we do not have anyone who is now sending warnings. When we have them, we should add the warning there.
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.
Ah probably the ExpectDisconnect
when find the connection ready, and it is able to consume the buffer can stash the info inside the Runner, and then ExpectMsg
check for stashed message :/ but this is so complicated.
We can track this with an issue? In this way we can track it?
Some implementations send an error message and, at the same time, will close the connection. Locally, this will cause a reading from a closed socket.
However, ldk now has a different life cycle for the connection, and we should receive the error message before.
Fixes #134
Reported-by: @Psycho-Pirate