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

feat: storage-cost per storage-provider #172

Merged
merged 103 commits into from
May 2, 2024

Conversation

shifty11
Copy link
Contributor

@shifty11 shifty11 commented Apr 23, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced storage cost management with dynamic pricing per storage provider.
    • Added migration logic for storage costs to support upgrades and ensure data consistency.
    • Updated API documentation to reflect changes in storage cost structure.
  • Documentation

    • Updated OpenAPI specifications to align with the new storage cost management system.
  • Bug Fixes

    • Adjusted storage cost retrieval logic across various test scenarios to align with the new dynamic pricing model.
  • Refactor

    • Revamped parameter handling in the x/bundles module to utilize a map structure for storage costs, enhancing flexibility and scalability.

Copy link

coderabbitai bot commented Apr 23, 2024

Walkthrough

The recent updates focus on enhancing the storage cost management and parameter handling in the application. New functions and structures have been introduced to facilitate migrations and parameter updates, especially for the x/bundles module. Changes include method signature updates, new keeper functionalities, and API documentation adjustments to reflect the new storage cost structures.

Changes

File Path Change Summary
app/app.go, app/upgrades/v1_5/upgrade.go Added arguments to New function call and updated function signatures.
docs/static/openapi.yml, proto/.../params.proto Renamed and updated API definitions for new storage cost structures.
x/bundles/keeper/..., x/bundles/types/... Enhanced parameters handling and keeper functionalities.
x/stakers/keeper/... Adjusted storage cost retrieval in stakers keeper tests.

🐰✨
In the land of code where the bits align,
A rabbit hopped through, leaving changes behind.
Storage costs mapped, parameters anew,
In bundles and keepers, our app grew.
Hop, hop, hooray! On bytes we dine,
For every line of code, let's make it shine! 🌟
🐰💻


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9d78b10 and ab8f4c1.
Files selected for processing (2)
  • app/upgrades/v1_5/upgrade.go (2 hunks)
  • x/bundles/spec/08_params.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/upgrades/v1_5/upgrade.go
Additional Context Used
LanguageTool (22)
x/bundles/spec/08_params.md (22)

Near line 7: An apostrophe may be missing.
Context: # Parameters The bundles module contains the following parameter...


Near line 9: Possible typo: you repeated a whitespace
Context: ...ontains the following parameters: | Key | Type ...


Near line 9: Possible typo: you repeated a whitespace
Context: ...wing parameters: | Key | Type | Example ...


Near line 9: Possible typo: you repeated a whitespace
Context: ... | Example | |---------------|---------------------...


Near line 11: Possible spelling mistake found.
Context: ...------------------------------------| | UploadTimeout | uint64 (time s) ...


Near line 11: Possible typo: you repeated a whitespace
Context: ...-----| | UploadTimeout | uint64 (time s) | 600 ...


Near line 11: Possible typo: you repeated a whitespace
Context: ... | 600 | | StorageCosts | []StorageCost (stora...


Near line 12: Possible spelling mistake found.
Context: ... | | StorageCosts | []StorageCost (storageProviderId, co...


Near line 12: Possible typo: you repeated a whitespace
Context: ... | | StorageCosts | []StorageCost (storageProviderId, cost...


Near line 12: Possible spelling mistake found.
Context: ... | | StorageCosts | []StorageCost (storageProviderId, cost in tkyve per b...


Near line 12: Possible spelling mistake found.
Context: ... | | StorageCosts | []StorageCost (storageProviderId, cost in tkyve per byte) | ["storage_pr...


Near line 12: Possible spelling mistake found.
Context: ...StorageCost (storageProviderId, cost in tkyve per byte) | ["storage_provider_id": 1, ...


Near line 13: Possible spelling mistake found.
Context: ...torage_provider_id": 1, "cost": 25] | | NetworkFee | sdk.Dec (%) ...


Near line 13: Possible typo: you repeated a whitespace
Context: ...vider_id": 1, "cost": 25] | | NetworkFee | sdk.Dec (%) ...


Near line 13: Possible spelling mistake found.
Context: ...id": 1, "cost": 25] | | NetworkFee | sdk.Dec (%) ...


Near line 13: Add a space between sentences.
Context: ... 1, "cost": 25] | | NetworkFee | sdk.Dec (%) ...


Near line 13: Possible typo: you repeated a whitespace
Context: ...st": 25] | | NetworkFee | sdk.Dec (%) | "0.01" ...


Near line 13: Possible typo: you repeated a whitespace
Context: ... | "0.01" | | MaxPoints | uint64 ...


Near line 14: Possible spelling mistake found.
Context: ...01" | | MaxPoints | uint64 ...


Near line 14: Possible typo: you repeated a whitespace
Context: ... | | MaxPoints | uint64 ...


Near line 14: Possible typo: you repeated a whitespace
Context: ... | | MaxPoints | uint64 | 5 ...


Near line 14: Possible typo: you repeated a whitespace
Context: ... | 5 |

Additional comments not posted (1)
x/bundles/spec/08_params.md (1)

12-12: Update the StorageCosts parameter to reflect dynamic storage costs per provider.

This change aligns with the PR's objective to handle storage costs dynamically based on the storage provider, enhancing flexibility and scalability.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

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: 3

proto/kyve/bundles/v1beta1/params.proto Outdated Show resolved Hide resolved
app/upgrades/v1_5/upgrade.go Outdated Show resolved Hide resolved
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: 0

Out of diff range and nitpick comments (1)
app/upgrades/v1_5/upgrade.go (1)

38-75: The implementation of migrateStorageCosts correctly handles errors and the migration logic is sound. Consider adding a comment or documentation clarifying that all storage providers will have the same storage cost post-migration, as this might be an important assumption for future maintainers or users of the system.

Copy link
Member

@mbreithecker mbreithecker left a comment

Choose a reason for hiding this comment

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

A Go map can not be used for proto marshalling because the iterator is not deterministic. This needs to be changed to an array.

I would then recommend to just build a get and set function which just iterates the array.
Because it's marshalled into one proto object and always gets loaded and stored as a whole, the O(n) for the small in memory list iteration is negligible.

proto/kyve/bundles/v1beta1/params.proto Outdated Show resolved Hide resolved
@shifty11 shifty11 requested a review from mbreithecker April 29, 2024 11:37
app/upgrades/v1_5/upgrade.go Outdated Show resolved Hide resolved
proto/kyve/bundles/v1beta1/params.proto Outdated Show resolved Hide resolved
x/bundles/keeper/getters_params.go Outdated Show resolved Hide resolved
x/bundles/keeper/msg_server_update_params_test.go Outdated Show resolved Hide resolved
x/bundles/keeper/msg_server_update_params_test.go Outdated Show resolved Hide resolved
@shifty11 shifty11 requested a review from mbreithecker April 30, 2024 13:24
@shifty11 shifty11 merged commit 3f81aca into main May 2, 2024
5 checks passed
@shifty11 shifty11 deleted the rapha/storage-cost-per-storage-id branch May 2, 2024 12:57
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.

2 participants