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

celestia-da: add client context #33

Merged
merged 2 commits into from
Jan 12, 2024
Merged

celestia-da: add client context #33

merged 2 commits into from
Jan 12, 2024

Conversation

tuxcanfly
Copy link
Collaborator

@tuxcanfly tuxcanfly commented Dec 21, 2023

Overview

This PR updates celestia-da to support client contexts for DA interface methods.

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

Depends on:

Summary by CodeRabbit

  • Refactor

    • Enhanced various data access methods to include context for improved operation management.
  • Documentation

    • Updated method signatures to reflect the inclusion of context parameters.

Copy link

coderabbitai bot commented Dec 21, 2023

Important

Auto Review Skipped

Review was skipped due to path filters

Walkthrough

The codebase has been updated to integrate context.Context parameters into the method signatures of the CelestiaDA struct. This modification enhances the ability to manage request scopes, cancellation, and other context-related functionalities across various data access methods.

Changes

File(s) Summary of Changes
celestia.go Added context.Context to all method signatures of the CelestiaDA struct.
celestia_test.go Modified the SetupSuite function in the TestSuite type to change the invocation of pool.Run.

🐰✨
In the realm of code, where data streams flow,
A rabbit hopped in, context in tow.
With each method call, now neatly wrapped,
Ensuring that resources are aptly capped. 🌟
🐰✨

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.

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d8dd2df and 112edf7.
Files ignored due to filter (2)
  • go.mod
  • go.sum
Files selected for processing (1)
  • celestia.go (4 hunks)
Additional comments: 3
celestia.go (3)
  • 36-38: Adding context.Context as the first parameter of the MaxBlobSize method is a standard practice in Go for passing request-scoped values, cancellation signals, and deadlines to API calls. This change aligns with the PR objective to integrate client context into DA interface methods.

  • 72-74: The Commit method correctly includes a context.Context parameter. Ensure that any downstream methods called within Commit, such as c.blobsAndCommitments, are also updated to accept and use the new context parameter if they make external calls that require it.

  • 123-123: The blobsAndCommitments method is called by methods that have been updated to include context.Context. Verify if blobsAndCommitments makes external calls that require the context and update it accordingly.

celestia.go Outdated Show resolved Hide resolved
celestia.go Outdated Show resolved Hide resolved
celestia.go Outdated Show resolved Hide resolved
celestia.go Outdated Show resolved Hide resolved
celestia.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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 112edf7 and b2919cb.
Files selected for processing (1)
  • celestia_test.go (1 hunks)
Additional comments: 2
celestia_test.go (2)
  • 48-48: The change from "4ecd750" to "394c0b8" in the pool.Run call should be verified to ensure that the correct Docker image tag is being used for the test environment. This is important as it affects the environment in which the tests are run.

  • 48-48: The use of a context with a timeout in TestCelestiaDA is consistent with the PR objectives to integrate client context into DA interface methods. This change should improve the management of execution flow and resource allocation within these methods.

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5bbaa8c) 73.88% compared to head (b06148a) 74.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   73.88%   74.05%   +0.16%     
==========================================
  Files           2        2              
  Lines         157      158       +1     
==========================================
+ Hits          116      117       +1     
  Misses         28       28              
  Partials       13       13              

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

Copy link

@ramin ramin left a comment

Choose a reason for hiding this comment

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

I think the rabbit's comments about using the passed in ctx vs anything stored on c.ctx is the preferred approach here

celestia_test.go Outdated Show resolved Hide resolved
@tuxcanfly tuxcanfly force-pushed the tux/client-context branch 2 times, most recently from d686dc6 to 61989c5 Compare January 11, 2024 23:06
test: add ctx

deps: rebase for submit options
go.mod 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.

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5bbaa8c and 456fc29.
Files ignored due to filter (2)
  • go.mod
  • go.sum
Files selected for processing (3)
  • celestia/celestia.go (7 hunks)
  • celestia/celestia_test.go (3 hunks)
  • celestia_test.go (2 hunks)
Additional comments: 3
celestia_test.go (1)
  • 25-25: The introduction of localCelestiaDevnetImageVersion constant improves code maintainability by avoiding hard-coded strings. Good practice.
celestia/celestia_test.go (1)
  • 51-109: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [59-151]

The addition of the context.Context parameter to the method calls within the test suite is consistent and correctly implemented.

celestia/celestia.go (1)
  • 38-54: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [41-160]

The addition of the context.Context parameter to the methods in the CelestiaDA struct is consistent and correctly implemented, allowing for better control over the execution and cancellation of these methods.

celestia/celestia_test.go Show resolved Hide resolved
celestia/celestia.go Show resolved Hide resolved
celestia/celestia.go Show resolved Hide resolved
Manav-Aggarwal
Manav-Aggarwal previously approved these changes Jan 12, 2024
S1nus
S1nus previously approved these changes Jan 12, 2024
@tuxcanfly tuxcanfly dismissed stale reviews from S1nus and Manav-Aggarwal via b06148a January 12, 2024 15:13
@Manav-Aggarwal Manav-Aggarwal merged commit 4162bb0 into main Jan 12, 2024
18 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants