Skip to content

Conversation

@wolf31o2
Copy link
Member

@wolf31o2 wolf31o2 commented Nov 9, 2025

Summary by CodeRabbit

  • Tests

    • Expanded test suite with additional edge-case coverage.
  • Style

    • Improved code formatting and readability across multiple files.

Note: This release contains internal improvements with no user-facing changes.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@wolf31o2 wolf31o2 requested a review from a team as a code owner November 9, 2025 16:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

📝 Walkthrough

Walkthrough

This PR expands the test suite for Account.String() with additional edge-case test scenarios (empty, nil, single-byte, all-zero, and all-ones staking keys) and reformats both test and error-logging code for improved readability. The changes also adjust some error-message formatting blocks to span multiple lines. No functional behavior or public API changes are introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Test additions for Account.String() are straightforward edge-case coverage
  • Reformatting changes (multiline calls, error-message blocks) are repetitive and low-risk
  • Error-logging reformatting in SubmitTx is purely cosmetic with no behavioral impact

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: make format golines' accurately reflects the pull request's main objective: applying golines formatting to the codebase. The changes involve reformatting code (hexDecode calls, error messages, logging) across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/make-format-golines

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

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (2)
utxorpc/submit.go (2)

80-86: Formatting improves readability.

The multi-line formatting is clearer. However, for consistency with the pattern at lines 65-71, consider simplifying this to use fmt.Sprintf directly instead of wrapping fmt.Errorf in fmt.Sprint:

 s.utxorpc.config.Logger.Error(
-	fmt.Sprint(
-		fmt.Errorf(
-			"failed to decode transaction from CBOR: %w",
-			err,
-		),
-	),
+	fmt.Sprintf(
+		"failed to decode transaction from CBOR: %v",
+		err,
+	),
 )

113-118: Remove unreachable error handling block.

This error check is unreachable because err cannot be non-nil at this point (it would have been caught by the previous if err != nil block at line 100). The last assignment to err was at line 99, and if it's non-nil, execution continues at line 111.

 		}
-		if err != nil {
-			resp.Ref = append(resp.Ref, placeholderRef)
-			errorList[i] = err
-			hasError = true
-			continue
-		}
 		resp.Ref = append(resp.Ref, txHash.Bytes())
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5fa6a5 and c72c767.

📒 Files selected for processing (2)
  • database/models/account_test.go (9 hunks)
  • utxorpc/submit.go (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-22T20:13:35.972Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 971
File: utxorpc/sync_test.go:339-339
Timestamp: 2025-10-22T20:13:35.972Z
Learning: Unit tests under utxorpc should assert that models.Block.Decode() returns a github.com/blinklabs-io/gouroboros/ledger/common.Block, not rely on models.Block directly in protocol/ledger-facing logic.

Applied to files:

  • database/models/account_test.go
📚 Learning: 2025-10-22T21:28:48.396Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 971
File: utxorpc/sync_test.go:339-339
Timestamp: 2025-10-22T21:28:48.396Z
Learning: In utxorpc/sync_test.go, tests must not pass database/models.Block into chain.Chain.AddBlock. They should call models.Block.Decode() and pass the resulting github.com/blinklabs-io/gouroboros/ledger/common.Block to AddBlock.

Applied to files:

  • database/models/account_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: go-test (1.24.x, ubuntu-latest)
  • GitHub Check: nilaway
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
database/models/account_test.go (2)

56-95: Excellent edge case coverage!

The additional test cases provide valuable coverage for boundary conditions:

  • Empty and nil staking keys validate error handling
  • Single-byte input tests minimal valid data
  • All-zeros and all-ones keys test boundary values

These tests will help catch potential issues with edge cases in the Account.String() implementation.


105-270: Formatting improves readability throughout.

The multi-line formatting of error messages and function calls makes the test code more readable and easier to maintain.

@wolf31o2 wolf31o2 merged commit d591b4a into main Nov 10, 2025
12 checks passed
@wolf31o2 wolf31o2 deleted the chore/make-format-golines branch November 10, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants