Skip to content

feat: add externaldisputeid, make dispute null if none instead of zero #41

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

Closed
wants to merge 1 commit into from

Conversation

kemuru
Copy link
Contributor

@kemuru kemuru commented Jun 17, 2024

if approved, to be redeployed onto the multisig subgraph

PR-Codex overview

This PR adds functionality to track external dispute IDs in requests and updates related fields in the data model.

Detailed summary

  • Added externalDisputeID field to Request entity
  • Updated Curate.ts to include request.externalDisputeID
  • Updated Request.ts to remove disputeID and add externalDisputeID
  • Updated schema.graphql to reflect changes in Request entity

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added externalDisputeID field to Request type, improving tracking of external disputes.
  • Bug Fixes

    • Updated disputeID field to allow null values, enhancing data flexibility.
  • Improvements

    • Enhanced handleRequestChallenged function to handle externalDisputeID for better dispute management.

@kemuru kemuru requested a review from tractorss June 17, 2024 23:28
Copy link
Contributor

coderabbitai bot commented Jun 17, 2024

Walkthrough

These updates modify the Request type in the GraphQL schema to allow the disputeID field to be nullable and add a new field, externalDisputeID. Corresponding changes in the Curate.ts file ensure that externalDisputeID is assigned when handling a disputed request. In Request.ts, an obsolete line setting disputeID to ZERO is removed. These adjustments streamline handling external disputes within the system.

Changes

File Change Summary
subgraph/schema.graphql Changed disputeID field to allow BigInt or null, and added a new field externalDisputeID of type BigInt to the Request type.
subgraph/src/Curate.ts Updated handleRequestChallenged function to assign event.params._externalDisputeID to request.externalDisputeID.
subgraph/src/entities/Request.ts Removed the line setting request.disputeID to ZERO in the createRequestFromEvent function.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Subgraph
    participant GraphQL Schema as Schema
    participant Subgraph Logic as Logic

    Note over Client,Subgraph: Before Changes
    Client->>Schema: Submit Dispute Request
    Schema-->>Logic: Handle Request
    Logic->>Logic: Set disputeID to ZERO
    Logic-->>Schema: Response
    Schema-->>Client: Acknowledgment

    Note over Client,Subgraph: After Changes
    Client->>Schema: Submit Dispute Request
    Schema-->>Logic: Handle Request
    Logic->>Logic: Set externalDisputeID from event
    Logic-->>Schema: Nullable disputeID and maintained externalDisputeID
    Schema-->>Client: Acknowledgment
Loading

Poem

In a warren coded bright,
Disputes now take a different flight,
With disputeID null or set,
And externalDisputeID to get.
Curate and Request align,
In perfect harmony, designs so fine.
🐇✨🏷️


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.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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

netlify bot commented Jun 17, 2024

Deploy Preview for curate-v2 failed. Why did it fail? →

Name Link
🔨 Latest commit 20b52b2
🔍 Latest deploy log https://app.netlify.com/sites/curate-v2/deploys/6670c69d4904900008e00190

Copy link
Contributor

@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 (1)
subgraph/src/Curate.ts (1)

Line range hint 2-2: Consider renaming the BigInt import to avoid shadowing the global BigInt object, which could lead to confusion.

- import { BigInt, json, log } from "@graphprotocol/graph-ts";
+ import { BigInt as GraphBigInt, json, log } from "@graphprotocol/graph-ts";
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3ba2584 and 20b52b2.

Files selected for processing (3)
  • subgraph/schema.graphql (1 hunks)
  • subgraph/src/Curate.ts (1 hunks)
  • subgraph/src/entities/Request.ts (1 hunks)
Additional context used
Biome
subgraph/src/Curate.ts

[error] 2-2: Do not shadow the global "BigInt" property. (lint/suspicious/noShadowRestrictedNames)

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

Additional comments not posted (3)
subgraph/src/entities/Request.ts (1)

Line range hint 14-20: The removal of setting request.disputeID to ZERO aligns with the PR objective to handle cases where there is no dispute. Consider adding a comment to explain why disputeID is not set here for future maintainability.

subgraph/schema.graphql (1)

166-168: The schema changes to make disputeID nullable and add externalDisputeID are correctly implemented. Ensure all related queries and mutations are updated to handle these changes.

subgraph/src/Curate.ts (1)

287-287: Correctly implemented the assignment of externalDisputeID in the handleRequestChallenged function.

@kemuru
Copy link
Contributor Author

kemuru commented Jun 18, 2024

this is solved by harmeet in another PR that he will push soon.

@kemuru kemuru closed this Jun 18, 2024
@kemuru kemuru deleted the feat(subgraph)/add-externaldisputeid branch June 18, 2024 10:01
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