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

chore: bump latest stable #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

chore: bump latest stable #15

wants to merge 1 commit into from

Conversation

royvardhan
Copy link
Member

@royvardhan royvardhan commented Dec 13, 2024

Summary by CodeRabbit

  • New Features

    • Updated dependencies to enhance functionality with new imports.
  • Bug Fixes

    • Resolved issues related to outdated imports affecting database interactions.
  • Documentation

    • Minor adjustments to comments for clarity.
  • Refactor

    • Consolidated database table references through schema for improved maintainability.
  • Chores

    • Cleaned up unused import statements.

Copy link

coderabbitai bot commented Dec 13, 2024

Walkthrough

The pull request introduces changes primarily to the import statements and dependencies in several files, transitioning from the @ponder/core module to the ponder module. The package.json file reflects this change by removing the old dependency and adding the new one. Other files, such as ponder.config.ts, ponder.schema.ts, src/helpers.ts, src/index.ts, and src/types.ts, have updated their import statements accordingly, ensuring that all references to functions and tables now utilize the new schema-based structure.

Changes

File Change Summary
package.json Dependency updated: "@ponder/core": "0.8.0-next.1""ponder": "0.8.2"
ponder.config.ts Import source modified: import { createConfig, loadBalance } from "@ponder/core";import { createConfig, loadBalance } from "ponder";
ponder.schema.ts Import source updated: import { onchainTable, onchainEnum } from "@ponder/core"import { onchainTable, onchainEnum } from "ponder"
src/helpers.ts Imports updated: import { Context } from "@/generated"import { Context } from "ponder:registry"; schema import updated to import schema from "ponder:schema"; various table references updated to use schema. prefix.
src/index.ts Imports updated: import { ponder } from "@/generated"import { ponder } from "ponder:registry"; schema import updated to consolidate table access.
src/types.ts Import removed: import { type Context } from "@/generated";

Possibly related PRs

Suggested reviewers

  • mejiasd3v

Poem

In the code where bunnies hop,
Dependencies change, they never stop.
From @ponder/core to ponder we leap,
With tables and schemas, our data we keep.
Hopping along, with joy we sing,
In the world of code, new changes bring! 🐇✨


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>, please review it.
    • 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 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 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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. (Experiment)
  • @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.

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

🧹 Outside diff range and nitpick comments (2)
src/helpers.ts (1)

178-178: Consider using type-safe alternatives to @ts-ignore

Instead of using @ts-ignore, consider adding proper type definitions or using type assertions that preserve type safety.

-// @ts-ignore
-assets[network.name].USDC as `0x${string}`,
+assets[network.name as keyof typeof assets].USDC as `0x${string}`,

-// @ts-ignore
-address: addresses.Stratosphere![network.name] as `0x${string}`,
+address: addresses.Stratosphere![network.name as keyof typeof addresses.Stratosphere] as `0x${string}`,

Also applies to: 217-217, 246-246

src/index.ts (1)

78-80: LGTM: Table references updated correctly

All database operations have been properly updated to use the new schema-based structure.

Consider reducing code duplication

The points insertion logic is repeated multiple times with similar structure. Consider extracting this into a helper function to improve maintainability.

+ // Add this helper function
+ async function insertPoints(
+   db: any,
+   hash: string,
+   userData: any,
+   source: string,
+   points: bigint,
+   chainId: number,
+   timestamp: number
+ ) {
+   return await db.insert(schema.pointsTable).values({
+     id: `${hash}-${source}`,
+     userDataId: userData.id,
+     userHistoryId: userData.id,
+     pointsSource: source,
+     points: points,
+     chainId: chainId,
+     timestamp: timestamp,
+   });
+ }

  // Then use it like this:
- await db.insert(schema.pointsTable).values({
-   id: `${hash}-liquid-mining-first-deposit`,
-   userDataId: `${userAddressLowerCase}-${chainId}`,
-   userHistoryId: `${userAddressLowerCase}-${chainId}`,
-   pointsSource: "liquid_mining_first_deposit",
-   points: pointsMap.FirstDepositInVPNDLM,
-   chainId: chainId,
-   timestamp: timestamp,
- });
+ await insertPoints(
+   db,
+   hash,
+   userData,
+   "liquid_mining_first_deposit",
+   pointsMap.FirstDepositInVPNDLM,
+   chainId,
+   timestamp
+ );

Also applies to: 83-85, 88-95, 99-101, 112-119, 126-133, 141-143, 152-154, 164-171, 179-181, 188-195, 203-205, 212-219, 227-229

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f8dc4b7 and a1551c9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • package.json (1 hunks)
  • ponder.config.ts (1 hunks)
  • ponder.schema.ts (1 hunks)
  • src/helpers.ts (16 hunks)
  • src/index.ts (23 hunks)
  • src/types.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/types.ts
✅ Files skipped from review due to trivial changes (1)
  • ponder.schema.ts
🔇 Additional comments (9)
package.json (1)

16-16: Verify ponder version compatibility and breaking changes

Please ensure version 0.8.2 is the latest stable release and review the changelog for any breaking changes that might affect the codebase.

✅ Verification successful

Let me gather more information about the dependency changes and their impact on the codebase.


Version 0.8.2 is the latest stable release and appears compatible

The codebase is already using the unified ponder package (not @ponder/core) with proper imports in ponder.schema.ts and ponder.config.ts. Version 0.8.2 is confirmed as the latest release with only a patch-level bug fix for crash recovery, indicating no breaking changes that would affect the current implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest version and changelog
gh api graphql -f query='
{
  repository(owner: "ponder-sh", name: "ponder") {
    releases(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes {
        tagName
        description
      }
    }
  }
}'

Length of output: 613


Script:

#!/bin/bash
# Check for @ponder/core imports and related patterns
rg "@ponder/core" -A 2

# Check for ponder imports and related patterns
rg "from ['\"]ponder['\"]" -A 2

# Look for ponder configuration files
fd "ponder.config"

Length of output: 340

ponder.config.ts (1)

1-1: LGTM!

The import statement has been correctly updated to use the new ponder package.

src/helpers.ts (3)

9-9: LGTM!

The import statements have been correctly updated to use the new ponder registry and schema.

Also applies to: 20-20


335-337: LGTM!

The type assertion for deployedBlockTimestamps is correctly implemented using keyof typeof.


Line range hint 70-92: LGTM!

The database operations have been correctly updated to use the new schema-based approach consistently throughout the file.

Also applies to: 113-146, 343-420

src/index.ts (4)

1-1: LGTM: Import statements updated correctly

The imports have been properly updated to use the new schema-based structure from the latest stable version.

Also applies to: 24-24


Line range hint 35-42: LGTM: Table reference updated correctly

The pointsTable reference has been properly updated to use the new schema-based structure while maintaining the existing functionality.


261-262: LGTM: Table references updated correctly

All database operations have been properly updated to use the new schema-based structure. The same helper function suggested above could be used here to reduce code duplication.

Also applies to: 266-269, 272-279, 282-286, 294-301, 308-312


Line range hint 354-361: LGTM: Table references updated correctly

All database operations have been properly updated to use the new schema-based structure. The same helper function suggested above could be used here to reduce code duplication in the points insertion logic.

Also applies to: 371-372, 374-381, 386-388, 396-403, 410-414, 421-428, 435-439, 446-453, 460-464

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.

1 participant