-
Notifications
You must be signed in to change notification settings - Fork 35
Improve Error Message Readability in Lightning Protocol Tests #140
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
base: master
Are you sure you want to change the base?
Conversation
I wasn’t aware of the Black style formatting requirement earlier — I’ve updated the code accordingly now, so the tests should pass. Thanks! |
@vincenzopalazzo I noticed that the test Since the changes in this PR are limited to formatting and improving error message readability, the error could possibly be related to temporary file handling or timing. All other tests are passing consistently. Please let me know if you'd like me to look into this further or if there's anything else you'd like me to adjust. |
Probably @Psycho-Pirate know more about it
|
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.
Thanks for working on this!
Commit 751b5f8 need to be squash inside the previous because unrelated to the git history, see https://stackoverflow.com/a/5201642/10854225 on how to squash.
if all(ord(c) < 128 for c in decoded): | ||
return f" (decoded: {decoded})" | ||
except (ValueError, UnicodeDecodeError): | ||
pass |
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.
This is really dangerous, please do not try to shoot yourself in the foot when you do not need it, we are already using Python.
return f" (decoded: {decoded})" | ||
except (ValueError, UnicodeDecodeError): | ||
pass | ||
return "" |
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.
Not understanding whe need to return an empty string here, can you explainit to me?
if hasattr(msg, "fields"): | ||
error_msg += f": {msg.to_str()}" |
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 do not understand why we are checking the fields
here, can you expand more on this part too?
It looks like the CI is failing because poetry tries to uninstall a pre-installed version of blinker (1.4), which was installed using distutils. We can probably create a good first issue for this. @vincenzopalazzo |
I think the cln error is unrelated to this message #140 (comment) The error is inside the comment itself and was happening in the ldk runner |
Where is it happening? in the old commits as well the LDK CI ran successfully. |
it was happening inside the CI, then I restarted and not it is green, but it is something that we need to to make sure that we are not ignoring a bug |
@Psycho-Pirate I’ve opened PR #141 to address this issue by removing the system-installed |
@arnav-makkar left some questions in the review, please focus on the code and not the CI, the CI is broken anyway with core lightning if you see #135 |
Improve Error Message Readability in Lightning Protocol Tests
Fixes #43
This PR enhances the error message handling in the Lightning Network protocol testing framework by automatically decoding hex-encoded error messages into human-readable text.
Problem
When testing Lightning Network protocol implementations, error messages often contain hex-encoded data that is difficult to read and interpret. For example, an error message about an unknown channel would appear as:
The hex data
556e6b6e6f776e206368616e6e656c20666f7220574952455f53485554444f574e
is actually the ASCII/UTF-8 encoded string "Unknown channel for WIRE_SHUTDOWN", but this is not immediately obvious to developers.Solution
Automatic hex data decoding has been added to the error handling system:
Added a new
decode_hex_data
method inerrors.py
that:Enhanced the
EventError.__str__
method to:Expected Error Message Format
After these changes, the same error message will now appear as:
Implementation Details
The solution:
bytes.fromhex()
anddecode()
methodsTesting
The changes have been tested with:
The existing test suite continues to pass, and the error messages are now more informative.