-
Notifications
You must be signed in to change notification settings - Fork 385
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
Feat: Make random bytes deterministic within the test test_restored_packages_retry
fixes lightningdevkit#2827
#2833
Conversation
WalkthroughThe recent modification implements a mechanism to create predictable randomness within a specific test in the Rust-Lightning project. This is done to stabilize the Changes
Related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- lightning/src/ln/monitor_tests.rs (1 hunks)
Additional comments: 2
lightning/src/ln/monitor_tests.rs (2)
- 1985-1988: The implementation of the loop to override random bytes appears to be correct, ensuring deterministic behavior for the
get-random
calls. However, it's important to ensure that this deterministic behavior is only enabled during testing and does not affect production code paths.Verification successful
The occurrences of
override_random_bytes
are found only within test files and a test utility file (test_utils.rs
). This confirms that the override is used exclusively for testing purposes and does not affect production code paths.* 1988-1988: Ensure that the deterministic random bytes set by the override are being utilized correctly in the subsequent calls within the test. This is crucial for maintaining the integrity of the test's deterministic behavior.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the override is only set in test code and not in production code. rg --type rust 'override_random_bytes' -- 'src/**/*.rs'Length of output: 107
Script:
#!/bin/bash # Search for occurrences of 'override_random_bytes' across all Rust files in the repository. rg --type rust 'override_random_bytes'Length of output: 1096
So when I add a call to To fix #2827, you'll need to actually check out a different git commit of LDK linked in the issue and regenerate the hardcoded monitor bytes in the test :) |
Okay, thanks for the guidance and patience. I'll learn more and get to work again! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2833 +/- ##
==========================================
+ Coverage 89.17% 89.83% +0.66%
==========================================
Files 118 117 -1
Lines 97986 96179 -1807
Branches 97986 96179 -1807
==========================================
- Hits 87376 86404 -972
+ Misses 8419 7211 -1208
- Partials 2191 2564 +373 ☔ View full report in Codecov by Sentry. |
Hey @Harsh1s do you still intend to work on this? |
Closing as abandoned. |
I've tried to do as the issue wanted but I'm not sure if this is enough since this is my first PR on the org. Please feel free to suggest changes and would really appreciate some guidance as I am really interested in contributing to this org.