-
Notifications
You must be signed in to change notification settings - Fork 33
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
RFQ Guard: fixes #2878
RFQ Guard: fixes #2878
Conversation
WalkthroughThis update focuses on enhancing error reporting and security checks within the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GuardService
participant RelayerService
participant Blockchain
Client->>GuardService: Request bridge proof
GuardService->>GuardService: handleProveCalled()
GuardService->>Blockchain: Retrieve bridge request
Blockchain-->>GuardService: Return bridge request or error
GuardService-->>Client: Return result with error if failed (includes transaction ID)
Client->>RelayerService: Provide proof
RelayerService->>RelayerService: handleProofProvided()
RelayerService->>RelayerService: Verify signer's address
alt Signer address matches
RelayerService->>Blockchain: Post proof on chain
else Signer address does not match
RelayerService-->>Client: Return error
end
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 Configuration 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.
PR Summary
- Enhanced error messages in
services/rfq/guard/service/handlers.go
- Included transaction ID in error output for better debugging
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Deploying sanguine-fe with Cloudflare Pages
|
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: 0
Outside diff range, codebase verification and nitpick comments (2)
services/rfq/guard/service/handlers.go (2)
Line range hint
1-54
: Consider enhancing error messages for better clarity.The function
handleBridgeRequestedLog
uses generic error messages which might not provide enough context during debugging. Consider including more specific details related to the operation being performed.- return fmt.Errorf("could not get correct omnirpc client: %w", err) + return fmt.Errorf("failed to retrieve omnirpc client for chain ID %d: %w", chainID, err) - return fmt.Errorf("could not get correct fast bridge: %w", err) + return fmt.Errorf("failed to instantiate FastBridge contract at address %s: %w", req.Raw.Address.Hex(), err)
Line range hint
167-223
: Refactor suggestion forisProveValid
for better readability.The function
isProveValid
handles multiple error paths and blockchain interactions, which could be refactored for better clarity and maintainability.- if errors.Is(err, ethereum.NotFound) { - return false, nil - } - if err != nil { - return false, fmt.Errorf("could not get receipt: %w", err) - } + if err != nil { + if errors.Is(err, ethereum.NotFound) { + return false, nil + } + return false, fmt.Errorf("could not get receipt for transaction hash %s on destination chain ID %d: %w", hexutil.Encode(proven.TxHash[:]), bridgeRequest.Transaction.DestChainId, err) + }
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- services/rfq/guard/service/handlers.go (1 hunks)
Additional comments not posted (2)
services/rfq/guard/service/handlers.go (2)
Line range hint
56-76
: LGTM: Clear and concise implementation.The function
handleProofProvidedLog
is well-implemented with clear error handling and appropriate use of tracing attributes.
Line range hint
78-93
: LGTM: Efficient and clear error handling.The function
handleProofDisputedLog
effectively updates the status of a disputed proof with good error handling.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2878 +/- ##
===================================================
- Coverage 23.72299% 23.56910% -0.15390%
===================================================
Files 683 679 -4
Lines 50959 50842 -117
Branches 119 80 -39
===================================================
- Hits 12089 11983 -106
+ Misses 37547 37536 -11
Partials 1323 1323
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
PR Summary
(updates since last review)
- Added relayer address check in
services/rfq/relayer/service/handlers.go
tohandleProofProvided
function to ensure event relevance and security.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
if req.Relayer != r.signer.Address() { | ||
return nil | ||
} | ||
|
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.
Security check added to ensure relayer matches the signer's address.
The addition of this check is crucial for ensuring that only authorized relayers can process proofs, which is a significant security improvement. However, it would be beneficial to log or handle cases where this condition fails, as silently returning could make debugging more difficult.
Committable suggestion was skipped due to low confidence.
Summary by CodeRabbit