Skip to content

Conversation

@cloud-j-luna
Copy link
Member

@cloud-j-luna cloud-j-luna commented Jun 5, 2025

This PR adds types and services for bid pre-checks and related test utilities.

Summary by CodeRabbit

  • New Features

    • Introduced a bid pre-check endpoint to verify bidding eligibility on specified groups.
    • Provided detailed bid responses per group with minimum bid prices, reasons, and total price.
  • Documentation

    • Enhanced documentation to explain the bid pre-check feature and its usage.

@coderabbitai
Copy link

coderabbitai bot commented Jun 5, 2025

Walkthrough

This change introduces a new bid pre-check feature to the provider service, adding new protobuf messages and an RPC method for bid eligibility checks. The Go client interface and implementation are updated to use the new request and response types. Test utilities are extended with helper functions for generating group specs. Additionally, new methods for attribute comparison and string formatting are added with corresponding tests.

Changes

File(s) Change Summary
proto/provider/akash/provider/v1/service.proto, docs/proto/provider.md Added BidPreCheckRequest, BidPreCheckResponse, GroupBidPreCheck messages and BidPreCheck RPC.
go/provider/client/client.go Updated Client interface and Validate method to use new BidPreCheck types and logic.
go/provider/client/types.go Removed ValidateGroupSpecResult struct and related Cosmos SDK import.
go/testutil/deployment.go, go/testutil/v1beta3/deployment.go Added GroupSpecs helper functions returning group spec slices for tests.
go/node/types/v1beta3/attribute.go Added Attributes methods: GetNonMatchingAttributes and String with fmt import.
go/node/types/v1beta3/attribute_test.go Added tests for GetNonMatchingAttributes and String methods of Attributes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ProviderRPC

    Client->>ProviderRPC: BidPreCheck(BidPreCheckRequest)
    ProviderRPC-->>Client: BidPreCheckResponse (group bid checks, total price)
Loading

Poem

In fields of specs, the rabbits hop,
Checking bids before they drop.
New messages and helpers sprout,
Ensuring every bid checks out.
With pre-checks now in every plan,
The warren’s code runs as it can!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 593d98d and 73fb808.

📒 Files selected for processing (1)
  • go/node/types/v1beta3/attribute_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • go/node/types/v1beta3/attribute_test.go
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: coverage
  • GitHub Check: test
  • GitHub Check: go
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloud-j-luna cloud-j-luna linked an issue Jun 5, 2025 that may be closed by this pull request
2 tasks
@cloud-j-luna cloud-j-luna marked this pull request as ready for review June 11, 2025 18:18
@cloud-j-luna cloud-j-luna requested a review from a team as a code owner June 11, 2025 18:18
Copy link

@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: 4

🧹 Nitpick comments (4)
go/testutil/v1beta3/deployment.go (1)

53-63: Avoid code duplication – reuse existing GroupSpec helper

GroupSpecs duplicates the literal construction already encapsulated by GroupSpec.
Consider building on the single-item helper to keep one source of truth and prevent drift.

-func GroupSpecs(t testing.TB) dtypes.GroupSpecs {
-    t.Helper()
-    return dtypes.GroupSpecs{
-        &dtypes.GroupSpec{
-            Name:         testutil.Name(t, "dgroup"),
-            Requirements: PlacementRequirements(t),
-            Resources:    ResourcesList(t, 1),
-        },
-    }
+func GroupSpecs(t testing.TB) dtypes.GroupSpecs {
+    t.Helper()
+    gs := GroupSpec(t)     // reuse existing generator
+    return dtypes.GroupSpecs{&gs}
 }
go/testutil/deployment.go (1)

52-62: DRY: build slice from GroupSpec instead of repeating struct literal

Same duplication comment as in v1beta3 package; leveraging the existing generator reduces maintenance overhead and keeps behaviour identical.

proto/provider/akash/provider/v1/service.proto (1)

78-90: Typo in comment & lingering TODO

  1. Comment says PreBidCheckResponse while the message is BidPreCheckResponse.
  2. // TODO: Support different coins? should be turned into a tracked issue or removed before merging.
go/provider/client/client.go (1)

383-394: Validation loop fine, but accept empty slice?

gspecs of length 0 passes the loop silently and leads to an empty request – does the provider accept that?
Consider returning ErrInvalidRequest when len(gspecs)==0 to surface accidental misuse.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54ff680 and ad499d9.

⛔ Files ignored due to path filters (10)
  • go/provider/v1/service.pb.go is excluded by !**/*.pb.go
  • go/provider/v1/service.pb.gw.go is excluded by !**/*.pb.gw.go
  • ts/src/generated/akash/inventory/v1/resourcepair.ts is excluded by !**/generated/**
  • ts/src/generated/akash/provider/v1/service.grpc-js.ts is excluded by !**/generated/**
  • ts/src/generated/akash/provider/v1/service.ts is excluded by !**/generated/**
  • ts/src/generated/cosmos/base/v1beta1/coin.original.ts is excluded by !**/generated/**
  • ts/src/generated/cosmos/base/v1beta1/coin.ts is excluded by !**/generated/**
  • ts/src/generated/index.akash.base.v1beta3.ts is excluded by !**/generated/**
  • ts/src/generated/index.akash.ts is excluded by !**/generated/**
  • ts/src/generated/index.ts is excluded by !**/generated/**
📒 Files selected for processing (6)
  • docs/proto/provider.md (3 hunks)
  • go/provider/client/client.go (6 hunks)
  • go/provider/client/types.go (0 hunks)
  • go/testutil/deployment.go (1 hunks)
  • go/testutil/v1beta3/deployment.go (1 hunks)
  • proto/provider/akash/provider/v1/service.proto (2 hunks)
💤 Files with no reviewable changes (1)
  • go/provider/client/types.go
🧰 Additional context used
🧬 Code Graph Analysis (1)
go/testutil/deployment.go (4)
go/testutil/v1beta3/deployment.go (2)
  • GroupSpecs (54-63)
  • GroupSpec (44-51)
go/node/deployment/v1beta3/groupspec.go (1)
  • GroupSpecs (19-19)
go/testutil/v1beta2/deployment.go (1)
  • GroupSpec (44-51)
go/testutil/base.go (3)
  • Name (25-27)
  • PlacementRequirements (57-61)
  • Resources (89-120)
🪛 markdownlint-cli2 (0.17.2)
docs/proto/provider.md

49-49: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)


50-50: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)


51-51: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)


656-656: Headings must start at the beginning of the line
null

(MD023, heading-start-left)


662-662: Link fragments should be valid
null

(MD051, link-fragments)


671-671: Headings must start at the beginning of the line
null

(MD023, heading-start-left)


678-678: Link fragments should be valid
null

(MD051, link-fragments)


687-687: Headings must start at the beginning of the line
null

(MD023, heading-start-left)


694-694: Link fragments should be valid
null

(MD051, link-fragments)

🪛 LanguageTool
docs/proto/provider.md

[duplication] ~656-~656: Possible typo: you repeated a word.
Context: ...vider.v1.BidPreCheckRequest"> ### BidPreCheckRequest BidPreCheckRequest is request type for the BidPreCheck RPC...

(ENGLISH_WORD_REPEAT_RULE)


[duplication] ~687-~687: Possible typo: you repeated a word.
Context: ...rovider.v1.GroupBidPreCheck"> ### GroupBidPreCheck GroupBidPreCheck contains bid information for a specific...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Buf (1.54.0)
proto/provider/akash/provider/v1/service.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

🔇 Additional comments (2)
proto/provider/akash/provider/v1/service.proto (1)

31-40: HTTP verb mismatch with client implementation

RPC is exposed as POST /v1/bidprecheck but the REST client builds a GET request.
Either change the option here to get: or update the client to http.MethodPost; both sides must agree.

docs/proto/provider.md (1)

48-52: Auto-generated file – lint warnings acceptable

Markdown-lint flags indentation and heading issues, but this file is generated; fixing manually will be overwritten.
No action required.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

48-48: Unordered list indentation
Expected: 0; Actual: 1

(MD007, ul-indent)


49-49: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)


50-50: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)


51-51: Unordered list indentation
Expected: 2; Actual: 5

(MD007, ul-indent)

Copy link

@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

🧹 Nitpick comments (1)
go/node/types/v1beta3/attribute.go (1)

403-416: Rename shadowed loop variable to avoid confusion

The inner for re-uses the identifier attr, shadowing the receiver variable.
While it doesn’t break functionality, it hampers readability and can lead to subtle bugs when the code is later modified.

-        for _, attr := range b {
-            if req.SubsetOf(attr) {
+        for _, candidate := range b {
+            if req.SubsetOf(candidate) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad499d9 and 593d98d.

📒 Files selected for processing (2)
  • go/node/types/v1beta3/attribute.go (2 hunks)
  • go/node/types/v1beta3/attribute_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test
  • GitHub Check: coverage
  • GitHub Check: go
🔇 Additional comments (2)
go/node/types/v1beta3/attribute_test.go (2)

184-214: 👍 Good coverage for GetNonMatchingAttributes

The added test cases exercise the typical, empty, and no-match scenarios and will catch regressions in the matching logic.
No changes needed.


216-259: Test expectations correctly reflect the desired String() output

Once the production fix (remove the extra space) is applied, these test cases will pass and will guard against format regressions.
No action required on the test side.

@cloud-j-luna cloud-j-luna self-assigned this Jul 7, 2025
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.

feat(provider): bid pre-check endpoint

2 participants