Skip to content
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

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/rfq/guard/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
// first, get the corresponding bridge request
bridgeRequest, err := g.db.GetBridgeRequestByID(ctx, proven.TransactionID)
if err != nil {
return fmt.Errorf("could not get bridge request: %w", err)
return fmt.Errorf("could not get bridge request for txid %s: %w", hexutil.Encode(proven.TransactionID[:]), err)

Check warning on line 120 in services/rfq/guard/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/guard/service/handlers.go#L120

Added line #L120 was not covered by tests
}

valid, err := g.isProveValid(ctx, proven, bridgeRequest)
Expand Down
4 changes: 4 additions & 0 deletions services/rfq/relayer/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@
//
// This is the seventh step in the bridge process. Here we process the event that the proof was posted on chain.
func (r *Relayer) handleProofProvided(ctx context.Context, req *fastbridge.FastBridgeBridgeProofProvided) (err error) {
if req.Relayer != r.signer.Address() {
return nil
}

Check warning on line 378 in services/rfq/relayer/service/handlers.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/service/handlers.go#L376-L378

Added lines #L376 - L378 were not covered by tests

Comment on lines +376 to +379
Copy link
Contributor

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.

// TODO: this can still get re-orged
// ALso: we should make sure the previous status is ProvePosting
err = r.db.UpdateQuoteRequestStatus(ctx, req.TransactionId, reldb.ProvePosted, nil)
Expand Down
Loading