-
Notifications
You must be signed in to change notification settings - Fork 97
Add back challenge into the send_message endpoint #6753
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
Add back challenge into the send_message endpoint #6753
Conversation
📝 WalkthroughWalkthroughThe changes modify the Changes
Assessment against linked issues
The changes align with the requirement for modifying the message sending API response by introducing a new Finishing Touches
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
hoprd/rest-api/src/messages.rs (1)
Add tests for SendMessageResponse and its challenge field
The codebase analysis confirms that while there are tests for request serialization, there are no tests covering the SendMessageResponse struct and its challenge field. Consider adding tests to verify:
- JSON serialization/deserialization of SendMessageResponse
- Proper handling of the challenge field
- Response format validation
🔗 Analysis chain
Line range hint
1-1
: Add tests for the challenge field.The changes lack test coverage for the new challenge field in SendMessageResponse. Consider adding tests to verify:
- Challenge serialization/deserialization
- Challenge presence in the response
- Challenge format validation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for existing tests related to SendMessageResponse rg -l "SendMessageResponse" --type rust --glob "*test*.rs"Length of output: 58
Script:
#!/bin/bash # Find SendMessageResponse struct definition ast-grep --pattern 'struct SendMessageResponse' # Find test modules or files in the same directory fd messages_test.rs fd "messages.rs$" --exec dirname {} \; | xargs -I {} fd -t f "test" {}Length of output: 188
Script:
#!/bin/bash # Find SendMessageResponse struct definition rg "struct SendMessageResponse" --type rust # Look for test modules in rest-api fd -t f . hoprd/rest-api/src -E vendor | grep -E "(test|spec).*\.rs$" # Find test-related content in messages.rs rg "#\[test\]|#\[cfg\(test\)\]" hoprd/rest-api/src/messages.rsLength of output: 290
Script:
#!/bin/bash # Get the test module content from messages.rs rg -A 20 "#\[cfg\(test\)\]" hoprd/rest-api/src/messages.rsLength of output: 628
Script:
#!/bin/bash # Get complete test module content rg -A 50 "#\[cfg\(test\)\]" hoprd/rest-api/src/messages.rsLength of output: 1495
🧹 Nitpick comments (1)
hoprd/rest-api/src/messages.rs (1)
95-97
: Update schema example to include the challenge field.The schema example above the struct (line 82) should be updated to include the new
challenge
field for accurate API documentation.#[schema(example = json!({ - "timestamp": 2147483647 + "timestamp": 2147483647, + "challenge": "0x1234567890abcdef" // Replace with appropriate example hash }))]
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
hoprd/rest-api/src/messages.rs
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: hoprd / docker
- GitHub Check: hopli / docker
- GitHub Check: Docs / Rust docs
- GitHub Check: tests-smoke-websocket
- GitHub Check: tests-smart-contracts
- GitHub Check: tests-unit-nightly
- GitHub Check: tests-unit
- GitHub Check: Linter
🔇 Additional comments (2)
hoprd/rest-api/src/messages.rs (2)
12-12
: LGTM!The import of
Hash
type is correctly added and necessary for the new challenge field.
Line range hint
1-1
: Verify websocket compatibility with the challenge field.The websocket implementation might need to be updated to handle the challenge field consistently with the REST API changes.
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.
Bump crate version
7c24265
to
80a7272
Compare
80a7272
to
cdb5e9d
Compare
Fix the missing challenge in the send message response for backwards compatibility.
Note
Fixes #6674