Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

Conversation

@garry-sharp
Copy link
Contributor

No description provided.

@garry-sharp garry-sharp requested a review from Copilot September 2, 2025 04:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fees-v3-rebroadcast

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds rebroadcast functionality for failed transactions by implementing storage and retrieval of raw transaction data.

  • Adds a new fee_tx table to store raw transaction data with hash as primary key
  • Implements database methods to insert and retrieve transaction data
  • Updates transaction handling to store raw transactions and enables rebroadcasting when transactions are not found on-chain

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
storage/postgres/schema/schema.sql Removes entire schema content (appears to be clearing the file)
storage/postgres/migrations/plugin/20250630152230_fee_runs.sql Adds new fee_tx table to store transaction hash and raw transaction data
storage/postgres/fees.go Implements InsertTx and GetTx methods for storing/retrieving raw transactions
storage/db.go Updates interface to include new transaction storage methods and modifies SetFeeBatchSent signature
plugin/fees/transaction.go Updates to store raw transactions during signing process and use new database methods
plugin/fees/post_tx.go Implements rebroadcast logic by retrieving and resending stored transactions
plugin/fees/helper.go Adds parseTransaction function and renames getHash to getTransaction
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

h.Write(txBytes)
hash := h.Sum(nil)

_, err = tx.Exec(ctx, `insert into fee_tx (hash, raw_tx) values ($1, $2)`, hash, rawTx)
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hash is being stored as raw bytes, but the database column is defined as VARCHAR(66) expecting a hex string. This will cause insertion failures. Convert the hash to hex string using hexutil.Encode(hash).

Suggested change
_, err = tx.Exec(ctx, `insert into fee_tx (hash, raw_tx) values ($1, $2)`, hash, rawTx)
_, err = tx.Exec(ctx, `insert into fee_tx (hash, raw_tx) values ($1, $2)`, hexutil.Encode(hash), rawTx)

Copilot uses AI. Check for mistakes.
return "", err
}
var rawTx string
defer rows.Close()
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing rows.Next() call before scanning. This will always fail with 'no rows in result set' error. Add 'if !rows.Next() { return "", pgx.ErrNoRows }' before the Scan call.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +116
rows, err := p.pool.Query(ctx, query, txHash)
if err != nil {
return "", err
}
var rawTx string
defer rows.Close()
if err := rows.Scan(&rawTx); err != nil {
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Query() for a single row lookup is inefficient. Use QueryRow() instead which is designed for single-row queries and handles the iteration automatically.

Suggested change
rows, err := p.pool.Query(ctx, query, txHash)
if err != nil {
return "", err
}
var rawTx string
defer rows.Close()
if err := rows.Scan(&rawTx); err != nil {
row := p.pool.QueryRow(ctx, query, txHash)
var rawTx string
if err := row.Scan(&rawTx); err != nil {

Copilot uses AI. Check for mistakes.
@garry-sharp garry-sharp force-pushed the fees-v3-post branch 3 times, most recently from 2a1c212 to 5a7dee8 Compare September 4, 2025 12:49
@garry-sharp garry-sharp force-pushed the fees-v3-rebroadcast branch 2 times, most recently from 73aef17 to aba76aa Compare September 4, 2025 13:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant