Skip to content

Conversation

@kemuru
Copy link
Contributor

@kemuru kemuru commented Dec 23, 2025

PR-Codex overview

This PR introduces the ArgentinaConsumerProtection feature into the dispute kit system, updating various components, hooks, and configurations to accommodate this new feature. It enhances functionality related to voting and dispute management.

Detailed summary

  • Added ArgentinaConsumerProtection to web/src/consts/index.ts.
  • Updated web/wagmi.config.ts with DisputeKitGatedArgentinaConsumerProtection.
  • Included new address mapping in useDisputeKitAddresses.ts.
  • Created ArgentinaConsumerProtection.tsx component with tooltip.
  • Modified dispute kit checks in Appeal and Voting components to include ArgentinaConsumerProtection.
  • Updated feature groups and dispute kits to include the new feature.
  • Adjusted voting context to handle ArgentinaConsumerProtection voting logic.
  • Integrated new simulation functions for commits and votes in Reveal and Commit components.
  • Enhanced useFundAppeal to manage funding for ArgentinaConsumerProtection.
  • Added necessary imports and adjusted prop types in various components to include disputeKitName.

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

Summary by CodeRabbit

  • New Features
    • Added Argentina Consumer Protection as a new dispute kit type with support for voting, revealing votes, and funding appeals
    • Introduced UI controls for selecting and configuring Argentina Consumer Protection disputes
    • Extended subgraph integration to track Argentina Consumer Protection contract events on Ethereum

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Dec 23, 2025

Deploy Preview for kleros-v2-testnet-devtools failed. Why did it fail? →

Name Link
🔨 Latest commit c643c23
🔍 Latest deploy log https://app.netlify.com/projects/kleros-v2-testnet-devtools/deploys/694ad0fc1311c0000817efed

@netlify
Copy link

netlify bot commented Dec 23, 2025

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

Name Link
🔨 Latest commit c643c23
🔍 Latest deploy log https://app.netlify.com/projects/kleros-v2-testnet/deploys/694ad0fca54b2500082697dd

@netlify
Copy link

netlify bot commented Dec 23, 2025

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

Name Link
🔨 Latest commit c643c23
🔍 Latest deploy log https://app.netlify.com/projects/kleros-v2-neo/deploys/694ad0fc4e7a9300085ba23e

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

This PR introduces a new Argentina Consumer Protection dispute kit across the subgraph and web application, adding data source mappings, UI components, feature flags, voting flows, and appeal mechanisms to support the new dispute resolution variant.

Changes

Cohort / File(s) Summary
Subgraph Configuration
subgraph/core/subgraph.template.yaml
Added new Ethereum data source DisputeKitGatedArgentinaConsumerProtection with event handlers (DisputeCreation, Contribution, Withdrawal, ChoiceFunded, VoteCast, CommitCast) mapping to existing ClassicDispute handlers; references DisputeKitClassic ABI.
Feature UI Component
web/src/components/DisputeFeatures/Features/ArgentinaConsumerProtection.tsx
New React component wrapping StyledRadio with WithHelpTooltip; documents token requirements for jurors (accredited professional or consumer protection lawyer tokens).
Feature Registry & Exports
web/src/components/DisputeFeatures/Features/index.tsx
Imported ArgentinaConsumerProtection component and added mapping to FeatureUIs for rendering; minor formatting adjustment to ShieldedVote tooltip.
Feature & Dispute Kit Constants
web/src/consts/disputeFeature.ts, web/src/consts/index.ts
Added ArgentinaConsumerProtection enum member to Features; added new dispute kit mapping (id: 5) pairing ClassicVote with ArgentinaConsumerProtection feature.
Hook Configuration & Voting Context
web/src/hooks/useDisputeKitAddresses.ts, web/src/hooks/useVotingContext.tsx
Extended DISPUTE_KIT_CONFIG with ArgentinaConsumerProtection mapping; imported and wired new useReadDisputeKitGatedArgentinaConsumerProtectionIsVoteActive hook to track vote status.
Appeal Flow Updates
web/src/pages/Cases/CaseDetails/Appeal/index.tsx, web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx, web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
Extended isClassicDisputeKit classification to include ArgentinaConsumerProtection; threaded disputeKitName prop through component hierarchy; Fund component now conditionally routes to Argentina CP fund logic with new simulate/write hooks.
Voting Flow Updates
web/src/pages/Cases/CaseDetails/Voting/index.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
Added disputeKitName prop threading through voting hierarchy; Commit and Reveal components now select appropriate simulation functions based on dispute kit (classic, gated, or Argentina CP variants).
Artifact & Build Configuration
web/wagmi.config.ts
Added DisputeKitGatedArgentinaConsumerProtection to vanillaArtifacts list for artifact discovery.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • kleros/kleros-v2#1863: Modifies the same Fund.tsx file with changes to isFundDisabled logic and styling; potential conflict points with Argentina CP flow integration.

Suggested labels

Type: Feature🗿, Package: Web

Suggested reviewers

  • Harman-singh-waraich
  • alcercu
  • tractorss

Poem

🐰 A Argentine hop through dispute's grand hall,
New consumer shields protect one and all,
With tokens and lawyers in voting cascade,
We hop through appeals—a protection parade! 🛡️✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add argentina consumer protection dispute kit' clearly and accurately summarizes the main change in the pull request, which adds a new Argentina Consumer Protection dispute kit with corresponding data sources, components, and configuration across the subgraph and web layers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/argentina-consumer-protection-dispute-kit

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
web/src/components/DisputeFeatures/Features/index.tsx (1)

34-36: Unrelated formatting change.

The tooltip text formatting change for ShieldedVote (removed line break, adjusted spacing) appears unrelated to the Argentina Consumer Protection feature addition. Consider separating unrelated formatting changes into separate commits for clearer change history.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d47ed4e and c643c23.

📒 Files selected for processing (15)
  • subgraph/core/subgraph.template.yaml
  • web/src/components/DisputeFeatures/Features/ArgentinaConsumerProtection.tsx
  • web/src/components/DisputeFeatures/Features/index.tsx
  • web/src/consts/disputeFeature.ts
  • web/src/consts/index.ts
  • web/src/hooks/useDisputeKitAddresses.ts
  • web/src/hooks/useVotingContext.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/wagmi.config.ts
🧰 Additional context used
🧠 Learnings (12)
📚 Learning: 2024-10-28T05:55:12.728Z
Learnt from: Harman-singh-waraich
Repo: kleros/kleros-v2 PR: 1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the `CustomContextInputs` component located at `web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx`, the `DisputeRequestParams` array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.

Applied to files:

  • web/src/components/DisputeFeatures/Features/ArgentinaConsumerProtection.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
  • web/src/components/DisputeFeatures/Features/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
📚 Learning: 2025-05-09T13:39:15.086Z
Learnt from: tractorss
Repo: kleros/kleros-v2 PR: 1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.

Applied to files:

  • web/src/hooks/useDisputeKitAddresses.ts
📚 Learning: 2025-09-09T13:33:46.896Z
Learnt from: tractorss
Repo: kleros/kleros-v2 PR: 2117
File: web/src/components/DisputeFeatures/Features/GatedErc1155.tsx:51-66
Timestamp: 2025-09-09T13:33:46.896Z
Learning: The `setDisputeData` function in `NewDisputeContext` at `web/src/context/NewDisputeContext.tsx` has signature `(disputeData: IDisputeData) => void` and only accepts direct state values, not functional updates like standard React state setters. It cannot be used with the pattern `setDisputeData((prev) => ...)`.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
📚 Learning: 2025-05-15T06:50:40.859Z
Learnt from: tractorss
Repo: kleros/kleros-v2 PR: 1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/src/hooks/useVotingContext.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
📚 Learning: 2024-10-14T13:58:25.708Z
Learnt from: Harman-singh-waraich
Repo: kleros/kleros-v2 PR: 1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/src/hooks/useVotingContext.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
📚 Learning: 2024-10-09T10:22:41.474Z
Learnt from: jaybuidl
Repo: kleros/kleros-v2 PR: 1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the `useEffect` hook to set `isClient` and using `suppressHydrationWarning` as a workaround for handling hydration inconsistencies, especially when dealing with data like `knownArbitrables` that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in `web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx`.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx
  • web/src/hooks/useVotingContext.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
📚 Learning: 2024-12-06T13:04:50.495Z
Learnt from: kemuru
Repo: kleros/kleros-v2 PR: 1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In `web/src/components/CasesDisplay/index.tsx`, the variables `numberDisputes` and `numberClosedDisputes` can sometimes be `NaN`, and should default to `0` using logical OR (`||`) to prevent display issues in the `StatsAndFilters` component.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Voting/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
📚 Learning: 2025-09-30T17:18:12.895Z
Learnt from: jaybuidl
Repo: kleros/kleros-v2 PR: 2145
File: contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol:277-286
Timestamp: 2025-09-30T17:18:12.895Z
Learning: In DisputeKitClassicBase.sol's castCommit function, jurors are allowed to re-submit commits during the commit period. The implementation uses a commitCount variable to track only first-time commits (where commit == bytes32(0)) so that totalCommitted is not incremented when a juror updates their existing commit.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
📚 Learning: 2024-06-27T10:11:54.861Z
Learnt from: nikhilverma360
Repo: kleros/kleros-v2 PR: 1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: `useMemo` is used in `DisputeInfoList` to optimize the rendering of `FieldItems` based on changes in `fieldItems`, ensuring that the mapping and truncation operation are only performed when necessary.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/index.tsx
  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
📚 Learning: 2025-09-04T23:36:16.415Z
Learnt from: jaybuidl
Repo: kleros/kleros-v2 PR: 2126
File: contracts/src/arbitration/KlerosCore.sol:472-489
Timestamp: 2025-09-04T23:36:16.415Z
Learning: In this repo, KlerosCore emits AcceptedFeeToken and NewCurrencyRate events that are declared in contracts/src/arbitration/interfaces/IArbitratorV2.sol; implementations don’t need to redeclare these events.

Applied to files:

  • subgraph/core/subgraph.template.yaml
📚 Learning: 2024-11-19T05:31:48.701Z
Learnt from: Harman-singh-waraich
Repo: kleros/kleros-v2 PR: 1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In `useGenesisBlock.ts`, within the `useEffect` hook, the conditions (`isKlerosUniversity`, `isKlerosNeo`, `isTestnetDeployment`) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx
📚 Learning: 2024-12-09T12:36:59.441Z
Learnt from: Harman-singh-waraich
Repo: kleros/kleros-v2 PR: 1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the `StakeWithdrawButton` component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.

Applied to files:

  • web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx
🧬 Code graph analysis (9)
web/src/components/DisputeFeatures/Features/ArgentinaConsumerProtection.tsx (1)
web/src/components/DisputeFeatures/Features/index.tsx (2)
  • RadioInput (15-21)
  • StyledRadio (25-29)
web/src/hooks/useDisputeKitAddresses.ts (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/hooks/useVotingContext.tsx (2)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/consts/index.ts (1)
  • REFETCH_INTERVAL (9-9)
web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/pages/Cases/CaseDetails/Appeal/index.tsx (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx (1)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx (2)
web/src/consts/disputeFeature.ts (1)
  • DisputeKits (33-33)
web/src/hooks/useClassicAppealContext.tsx (1)
  • useSelectedOptionContext (119-119)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Redirect rules - kleros-v2-testnet
  • GitHub Check: Header rules - kleros-v2-testnet
  • GitHub Check: Pages changed - kleros-v2-testnet
  • GitHub Check: hardhat-tests
  • GitHub Check: Mend Security Check
🔇 Additional comments (25)
subgraph/core/subgraph.template.yaml (1)

231-267: Looks good. The data source configuration is correct.

The new Argentina Consumer Protection dispute kit is properly configured. All event signatures match the contract implementation, handler functions exist to process all events, and the configuration structure aligns with other Classic-based dispute kit variants.

web/src/consts/index.ts (1)

50-50: LGTM! Clean enum addition.

The new ArgentinaConsumerProtection dispute kit enum value follows the existing naming conventions and integrates well with the broader dispute kit infrastructure.

web/src/hooks/useVotingContext.tsx (3)

12-12: LGTM! Consistent hook import.

The import follows the established pattern for dispute kit-specific hooks.


85-91: LGTM! Properly integrated hook call.

The argentinaConsumerProtectionVoteResult hook follows the exact pattern of existing dispute kit integrations with proper conditional enabling and refetch configuration.


104-105: LGTM! Complete integration.

The switch case and dependency array are properly updated to handle the new Argentina Consumer Protection dispute kit, maintaining consistency with the existing implementation pattern.

Also applies to: 115-115

web/src/hooks/useDisputeKitAddresses.ts (1)

22-22: LGTM! Proper configuration mapping.

The new dispute kit mapping follows the established pattern and will be automatically resolved by the existing hook logic. The contract address key "disputeKitGatedArgentinaConsumerProtectionAddress" should be present in the generated contracts for proper resolution.

web/src/consts/disputeFeature.ts (3)

14-14: LGTM! Feature enum addition.

The new ArgentinaConsumerProtection feature follows the camelCase naming convention for enum values.


42-47: LGTM! Proper feature grouping.

ArgentinaConsumerProtection is correctly added to the Eligibility group, which is appropriate for this type of dispute kit feature. The formatting change (splitting the array) improves readability.


76-80: LGTM! Well-defined dispute kit configuration.

The new dispute kit (id: 5) properly pairs ClassicVote with ArgentinaConsumerProtection features. The type is set to "general" which is appropriate for this use case.

web/src/pages/Cases/CaseDetails/Appeal/index.tsx (2)

56-59: LGTM! Correct dispute kit classification.

ArgentinaConsumerProtection is appropriately classified as a "classic" dispute kit since it uses ClassicVote, ensuring it follows the same appeal flow as other classic kits.


70-70: LGTM! Proper prop forwarding.

The disputeKitName prop is now passed to the Classic component, enabling downstream components to implement Argentina CP-specific logic when needed.

web/src/components/DisputeFeatures/Features/index.tsx (2)

10-10: LGTM! Consistent component import.

The ArgentinaConsumerProtection component import follows the established pattern for feature components.


53-53: LGTM! Complete feature UI integration.

The Argentina Consumer Protection feature is properly mapped to its UI component, following the same pattern as other features in the FeatureUIs registry.

web/src/pages/Cases/CaseDetails/Voting/index.tsx (2)

75-78: LGTM! Consistent dispute kit classification.

ArgentinaConsumerProtection is correctly classified as a "classic" dispute kit for voting purposes, maintaining consistency with the appeal flow classification.


125-125: LGTM! Complete prop propagation.

The disputeKitName is properly passed to the Classic voting component, enabling downstream commit/reveal components to implement Argentina CP-specific simulation paths.

web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx (3)

5-5: LGTM! Required type import.

The DisputeKits import is necessary for typing the new disputeKitName prop.


22-22: LGTM! Proper interface and prop handling.

The disputeKitName prop is correctly typed as optional (DisputeKits?) and properly destructured in the component, enabling flexible handling when the kit name may not be available.

Also applies to: 25-25


53-58: LGTM! Complete prop forwarding to Fund.

The disputeKitName is properly forwarded to the Fund component via spread props, completing the prop chain from the Appeal parent component down to Fund where Argentina CP-specific logic can be applied.

web/src/components/DisputeFeatures/Features/ArgentinaConsumerProtection.tsx (1)

9-20: LGTM!

The component is well-structured and follows the established pattern for dispute feature components. The tooltip provides clear information about juror token requirements for this dispute kit.

web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx (1)

20-23: LGTM!

Clean prop threading of disputeKitName to child components. The optional typing is appropriate since not all disputes will use this kit.

Also applies to: 33-37

web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx (1)

82-92: LGTM for the enable condition updates.

The enable conditions correctly implement mutual exclusivity: Classic is disabled when isGated || isArgentinaCP, Gated is disabled when isArgentinaCP, and Argentina CP only enables when isArgentinaCP is true.

Also applies to: 95-106

web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx (2)

69-74: LGTM!

The simulation function selection logic correctly prioritizes Argentina Consumer Protection over the gated check, following the expected three-way branching pattern.


86-101: Dependency array correctly updated.

Including disputeKitName ensures the callback is recomputed when the dispute kit changes.

web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (2)

92-97: LGTM!

The simulation function selection mirrors the pattern in Commit.tsx, maintaining consistency across the voting flow components.


109-125: Dependency array correctly updated.

Including disputeKitName in the dependency array ensures proper recomputation when switching between dispute kits.

Comment on lines +121 to +135
return isArgentinaCP
? {
fundAppeal: fundAppealGated,
fundAppealConfig: fundAppealGatedConfig,
isLoading: isLoadingGated,
isError: isErrorGated,
data: fundAppealArgentinaCPConfig,
isLoading: isLoadingArgentinaCP,
isError: isErrorArgentinaCP,
fundAppeal: fundAppealArgentinaCP,
}
: { fundAppeal, fundAppealConfig, isLoading, isError };
: isGated
? {
fundAppeal: fundAppealGated,
fundAppealConfig: fundAppealGatedConfig,
isLoading: isLoadingGated,
isError: isErrorGated,
}
: { fundAppeal, fundAppealConfig, isLoading, isError };
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Return object key mismatch will break Argentina CP funding flow.

The Argentina CP branch returns data as the key for the config object, but the Gated and Classic branches return fundAppealConfig. The destructuring on line 167 expects fundAppealConfig, which will be undefined for Argentina CP disputes. This causes the button click handler (line 204) to silently fail since it checks fundAppealConfig.

🔎 Proposed fix
   return isArgentinaCP
     ? {
-        data: fundAppealArgentinaCPConfig,
+        fundAppealConfig: fundAppealArgentinaCPConfig,
         isLoading: isLoadingArgentinaCP,
         isError: isErrorArgentinaCP,
         fundAppeal: fundAppealArgentinaCP,
       }
     : isGated
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return isArgentinaCP
? {
fundAppeal: fundAppealGated,
fundAppealConfig: fundAppealGatedConfig,
isLoading: isLoadingGated,
isError: isErrorGated,
data: fundAppealArgentinaCPConfig,
isLoading: isLoadingArgentinaCP,
isError: isErrorArgentinaCP,
fundAppeal: fundAppealArgentinaCP,
}
: { fundAppeal, fundAppealConfig, isLoading, isError };
: isGated
? {
fundAppeal: fundAppealGated,
fundAppealConfig: fundAppealGatedConfig,
isLoading: isLoadingGated,
isError: isErrorGated,
}
: { fundAppeal, fundAppealConfig, isLoading, isError };
return isArgentinaCP
? {
fundAppealConfig: fundAppealArgentinaCPConfig,
isLoading: isLoadingArgentinaCP,
isError: isErrorArgentinaCP,
fundAppeal: fundAppealArgentinaCP,
}
: isGated
? {
fundAppeal: fundAppealGated,
fundAppealConfig: fundAppealGatedConfig,
isLoading: isLoadingGated,
isError: isErrorGated,
}
: { fundAppeal, fundAppealConfig, isLoading, isError };
🤖 Prompt for AI Agents
In web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx around lines 121-135,
the Argentina CP branch returns the config under the key "data" while the Gated
and Classic branches return it as "fundAppealConfig", which makes the
destructuring on line 167 get undefined and breaks the click handler on line
204; update the Argentina CP return to use the same key name (fundAppealConfig)
and keep the returned object shape consistent with the other branches so
fundAppealConfig, fundAppeal, isLoading, and isError are always present.

"DisputeKitShutter",
"DisputeKitGated",
"DisputeKitGatedShutter",
"DisputeKitGatedArgentinaConsumerProtection",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that DisputeKitGatedArgentinaConsumerProtection artifact files exist in deployment directories

# Search for the artifact files across deployment directories
fd -e json "DisputeKitGatedArgentinaConsumerProtection" contracts/deployments/ 2>/dev/null | head -20

Repository: kleros/kleros-v2

Length of output: 42


🏁 Script executed:

#!/bin/bash
# Check deployment directory structure and look for similar artifacts

echo "=== Checking if deployments directory exists ==="
ls -la contracts/deployments/ 2>/dev/null | head -20

echo -e "\n=== Searching for other DisputeKit artifacts ==="
fd -e json "DisputeKit" contracts/deployments/ 2>/dev/null | head -20

echo -e "\n=== Listing all deployment subdirectories ==="
find contracts/deployments -maxdepth 1 -type d 2>/dev/null | sort

Repository: kleros/kleros-v2

Length of output: 3081


🏁 Script executed:

#!/bin/bash
# Read the wagmi.config.ts file to understand artifact processing

cat -n contracts/deployments/wagmi.config.ts | head -80

Repository: kleros/kleros-v2

Length of output: 129


🏁 Script executed:

#!/bin/bash
# Find wagmi.config.ts

fd "wagmi.config.ts"

# Also read the file
echo -e "\n=== Reading web/wagmi.config.ts ==="
cat -n web/wagmi.config.ts | head -80

Repository: kleros/kleros-v2

Length of output: 3583


🏁 Script executed:

#!/bin/bash
# Check git history for this file to understand intent

echo "=== Recent commits for web/wagmi.config.ts ==="
git log --oneline web/wagmi.config.ts | head -5

echo -e "\n=== Check if artifact was deployed to any network ==="
fd "DisputeKitGatedArgentinaConsumerProtection" contracts/deployments/

echo -e "\n=== Check all networks for count of DisputeKit artifacts ==="
for dir in contracts/deployments/*/; do
  count=$(ls "$dir"DisputeKit* 2>/dev/null | wc -l)
  echo "$(basename "$dir"): $count DisputeKit files"
done

Repository: kleros/kleros-v2

Length of output: 576


Missing deployment artifacts — this addition cannot be merged without corresponding JSON files.

DisputeKitGatedArgentinaConsumerProtection is added to vanillaArtifacts but deployment files for this artifact do not exist in any network directory (arbitrum/, arbitrumSepolia/, arbitrumSepoliaDevnet/, etc.). The artifact must be deployed and the resulting JSON files added to contracts/deployments/{network}/DisputeKitGatedArgentinaConsumerProtection.json (and any implementation/proxy variants) before this configuration can be merged.

🤖 Prompt for AI Agents
In web/wagmi.config.ts around line 30, you added
"DisputeKitGatedArgentinaConsumerProtection" to vanillaArtifacts but there are
no corresponding deployment JSONs; deploy the contract to each target network
and add the generated JSON files under
contracts/deployments/{network}/DisputeKitGatedArgentinaConsumerProtection.json
(include any proxy/implementation JSONs if applicable), then update the PR to
include those files so the config references real artifacts.

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