Skip to content

Conversation

@vertex451
Copy link
Contributor

@vertex451 vertex451 commented Jan 7, 2026

📝 Description

  • Moved ErrInternal from node repo
  • Added ABCI code assertion to tests

Testing

Tested in the node repo by running single node with chain-sdk changes.

🔧 Purpose of the Change

  • New feature implementation
  • Bug fix
  • Documentation update
  • Code refactoring
  • Dependency upgrade
  • Other: tests

📌 Related Issues

✅ Checklist

  • (n/a) I've updated relevant documentation
  • Code follows Akash Network's style guide
  • I've added/updated relevant unit tests
  • (n/a) Dependencies have been properly updated
  • I agree and adhered to the Contribution Guidelines

📎 Notes for Reviewers

I decided to keep ABCI code for error from the node repo (it was 10), and left corresponding comment.
The gap is not a problem, it keeps backwards compatibility and requires no migrations.

@vertex451 vertex451 requested a review from a team as a code owner January 7, 2026 12:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Walkthrough

Tests across multiple node modules were updated to use *sdkerrors.Error and to assert both gRPC status codes and ABCI codes. A new internal error constant and ErrInternal were added to the provider v1beta4 errors.

Changes

Cohort / File(s) Summary
Error Test Refactoring
go/node/audit/v1/errors_test.go, go/node/cert/v1/errors_test.go, go/node/deployment/v1/errors_test.go, go/node/escrow/module/error_test.go, go/node/market/v1/errors_test.go, go/node/take/v1/errors_test.go, go/node/types/deposit/v1/errors_test.go, go/node/provider/v1beta4/errors_test.go
Test tables switched field err from error to *sdkerrors.Error; added expectedGRPCCode codes.Code and expectedABCICode uint32. Tests now assert both st.Code() (gRPC) and tt.err.ABCICode() (ABCI). Test case names and expected codes updated per module.
Provider Error Definition
go/node/provider/v1beta4/errors.go
Added new internal error constant and public error: errInternal and ErrInternal = sdkerrors.RegisterWithGRPCCode(..., codes.Internal, "internal error").

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • troian
  • cloud-j-luna

Poem

🐰 A hop, a test, a tidy rewrite,
Errors now wear codes that shine so bright.
gRPC and ABCI both checked with glee,
Small changes, big confidence — that's me! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: moving ErrInternal and adding ABCI code assertions to tests, though it's truncated and uses ellipsis.
Description check ✅ Passed The description covers the key changes and purpose but is minimal. It lacks detail on which files were modified and the scope of the refactoring.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 artem/move-error-from-node-repo

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.

errAttributes
errIncompatibleAttributes
errInvalidInfoWebsite
errInternal uint32 = 10 // Code must be 10 for backwards compatibility. Must stay explicit forever.
Copy link
Contributor Author

@vertex451 vertex451 Jan 7, 2026

Choose a reason for hiding this comment

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

This is the most important part of this PR.
I decided to keep ABCI code for error from the node repo (it was 10), and left corresponding comment.
The gap is not a problem, it keeps backwards compatibility and requires no migrations.

Copy link
Member

Choose a reason for hiding this comment

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

this is not a good idea as it breaks iota, as well as introduces possibility of duplicated id, just keep it in iota sequence, its fine if it gets a new id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I am keeping iota seq then.

@vertex451 vertex451 requested a review from troian January 8, 2026 11:56
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: 1

🤖 Fix all issues with AI agents
In @go/node/provider/v1beta4/errors_test.go:
- Around line 69-74: The test and implementation currently use ABCI code 9 for
ErrInternal (errInternal defined as the 9th iota); the PR objectives require
preserving backward compatibility to ABCI code 10—align them by updating the
implementation and tests to use ABCI code 10: adjust the error constants in
errors.go (the errInternal definition and any iota offsets) so errInternal
becomes 10, update the exported v1beta4.ErrInternal mapping if present, and
change the test case in errors_test.go (the "internal" case expecting
expectedABCICode) to expect 10; also update any inline comments or PR docs that
reference the ABCI code to reflect the new value.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e8fdc1 and 16087d6.

📒 Files selected for processing (2)
  • go/node/provider/v1beta4/errors.go
  • go/node/provider/v1beta4/errors_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • go/node/provider/v1beta4/errors.go
🧰 Additional context used
🧬 Code graph analysis (1)
go/node/provider/v1beta4/errors_test.go (4)
go/node/provider/v1beta4/errors.go (9)
  • ErrInvalidProviderURI (22-22)
  • ErrNotAbsProviderURI (25-25)
  • ErrProviderNotFound (28-28)
  • ErrProviderExists (31-31)
  • ErrInvalidAddress (34-34)
  • ErrAttributes (37-37)
  • ErrIncompatibleAttributes (40-40)
  • ErrInvalidInfoWebsite (43-43)
  • ErrInternal (46-46)
go/node/audit/v1/errors.go (2)
  • ErrProviderNotFound (16-16)
  • ErrInvalidAddress (19-19)
go/node/deployment/v1/errors.go (1)
  • ErrInternal (56-56)
go/node/market/v1/errors.go (1)
  • ErrInternal (51-51)
⏰ 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). (4)
  • GitHub Check: proto
  • GitHub Check: go
  • GitHub Check: coverage
  • GitHub Check: test
🔇 Additional comments (3)
go/node/provider/v1beta4/errors_test.go (3)

6-6: LGTM!

The sdkerrors import alias is the conventional naming for the Cosmos SDK errors package and is required to access the *sdkerrors.Error type and its ABCICode() method.


15-19: LGTM!

The struct changes properly separate gRPC and ABCI code expectations, and using *sdkerrors.Error enables direct access to ABCICode() without type assertions.


77-84: LGTM!

The test execution correctly validates both aspects of the error codes. Using status.FromError() to extract the gRPC status and directly calling ABCICode() on the typed error is idiomatic for this SDK. The descriptive assertion messages will aid debugging if tests fail.

@troian troian merged commit 508f706 into main Jan 9, 2026
7 checks passed
@troian troian deleted the artem/move-error-from-node-repo branch January 9, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants