Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

da: replace submit options with gas price #46

Merged
merged 9 commits into from
Jan 10, 2024
Merged

da: replace submit options with gas price #46

merged 9 commits into from
Jan 10, 2024

Conversation

tuxcanfly
Copy link
Collaborator

@tuxcanfly tuxcanfly commented Jan 9, 2024

Overview

This PR upgrades go-da to v0.1.0 (pending release) which has a breaking change: Submit now accepts an additional GasPrice param which can be set to negative to use default options.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Fixes #29

Depends on:

Summary by CodeRabbit

  • New Features

    • Introduced gas price configuration for transaction submissions, enabling prioritization based on gas price.
  • Documentation

    • Updated Celestia Node API specs to reflect the new gas price parameter in transaction submissions.
  • Tests

    • Modified existing tests to accommodate the new gas price parameter in the Submit function calls.

Copy link

coderabbitai bot commented Jan 9, 2024

Important

Auto Review Skipped

Review was skipped due to path filters

Walkthrough

The recent update introduces configurable gas fees for transactions in the Celestia Node API. It allows clients to specify a gas price when submitting transactions, enabling them to influence the priority of their transactions within the network. This change addresses the need for flexible gas fee configurations, as requested in a feature proposal.

Changes

File Pattern Change Summary
celestia/celestia.go Introduced sdktypes and auth imports; added gasPrice parameter to Submit function; implemented gas price calculation and option setting.
celestia/.../celestia_test.go Modified Submit calls in tests to include gasPrice parameters: 0 for two tests, and 0.5 for a test with gas price consideration.
celestia/mock.go Changed parameter names in Submit method; incremented height field by 1.
specs/src/celestia-da.md Updated the Submit function specification to handle gasPrice, allowing transaction prioritization based on the gas price set by the client.

Assessment against linked issues

Objective Addressed Explanation
#29: Allow configurable gas fee, rate options The changes include the ability to pass gas fee rates from the client to the Submit function, aligning with the feature request.

Poem

A hop, a skip, in the code we weave, 🐇💻
Now gas fees flex, for clients to conceive.
Transactions queue, with a price to set,
Prioritize with gas, in the Celestia net.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

go.mod Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bec96db) 71.52% compared to head (f271436) 73.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   71.52%   73.02%   +1.49%     
==========================================
  Files           2        2              
  Lines         144      152       +8     
==========================================
+ Hits          103      111       +8     
  Misses         28       28              
  Partials       13       13              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tuxcanfly tuxcanfly marked this pull request as ready for review January 9, 2024 22:31
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between bec96db and a650b09.
Files ignored due to filter (2)
  • go.mod
  • go.sum
Files selected for processing (3)
  • celestia/celestia.go (3 hunks)
  • celestia/celestia_test.go (2 hunks)
  • specs/src/celestia-da.md (1 hunks)
Additional comments: 7
specs/src/celestia-da.md (1)
  • 51-57: The documentation updates clearly explain the new gasPrice parameter's functionality and its effect on SubmitOptions. This aligns with the code changes and provides the necessary information for users to understand how to use the updated Submit function.
celestia/celestia_test.go (3)
  • 82-82: The update to the Submit_empty test case correctly adds a gasPrice of 0, which should use the default submission options.

  • 121-125: The update to the Submit_existing test case correctly adds a gasPrice of 0, which should use the default submission options.

  • 127-128: The addition of the Submit_existing_with_gasprice test case is a good practice to test the new functionality with a non-zero gasPrice.

celestia/celestia.go (3)
  • 7-7: The import of math is necessary for the use of math.Ceil in the Submit function to calculate the fee based on the gasPrice.

  • 16-17: The new imports sdktypes and auth are required for the updated Submit function to calculate gas prices and limits.

  • 80-94: The Submit function has been correctly updated to handle the new gasPrice parameter. The logic to calculate GasLimit and Fee based on the gasPrice is sound, and the use of math.Ceil ensures that the fee is rounded up to the nearest integer.

celestia/celestia.go Outdated Show resolved Hide resolved
Manav-Aggarwal
Manav-Aggarwal previously approved these changes Jan 9, 2024
S1nus
S1nus previously approved these changes Jan 9, 2024
Copy link
Member

@S1nus S1nus left a comment

Choose a reason for hiding this comment

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

approved, but consider < 0 for a sentinel value!

@tuxcanfly tuxcanfly dismissed stale reviews from S1nus and Manav-Aggarwal via 4988959 January 9, 2024 23: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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a650b09 and 4988959.
Files selected for processing (4)
  • celestia/celestia.go (3 hunks)
  • celestia/celestia_test.go (2 hunks)
  • celestia/mock.go (1 hunks)
  • specs/src/celestia-da.md (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • celestia/celestia.go
  • celestia/celestia_test.go
  • specs/src/celestia-da.md

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4988959 and 5157a3d.
Files selected for processing (1)
  • specs/src/celestia-da.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • specs/src/celestia-da.md

Manav-Aggarwal
Manav-Aggarwal previously approved these changes Jan 9, 2024
S1nus
S1nus previously approved these changes Jan 10, 2024
@tuxcanfly tuxcanfly merged commit 0d72059 into main Jan 10, 2024
16 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature Request]: allow configurable gas fee, rate options
3 participants