Skip to content

Maintenance buttons at arbitrator-level #1668

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

Merged
merged 7 commits into from
Aug 7, 2024
Merged

Conversation

tractorss
Copy link
Contributor

@tractorss tractorss commented Aug 6, 2024

builds upon #1645 , please merge the previous one first

Adds arbitrator level maintenance buttons as Courts page

  • pass phase
  • execute delayed stake

PR-Codex overview

This PR updates subgraph version, refactors maintenance buttons, and adds stake maintenance features to the Courts page.

Detailed summary

  • Updated subgraph version to 0.7.2
  • Refactored maintenance buttons in various components
  • Added stake maintenance features to the Courts page

The following files were skipped due to too many changes: web/src/pages/Courts/StakeMaintenanceButton/PassPhaseButton.tsx

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

Summary by CodeRabbit

  • New Features

    • Introduced the TransactionBatcher contract for efficient batch transactions.
    • Added a DottedMenuButton component for improved UI interactions.
    • Implemented various maintenance buttons for better dispute management.
    • Added a WithdrawAppealFees component to facilitate the withdrawal of appeal fees.
    • Introduced components for executing rulings and managing phases in disputes.
    • Enhanced the useTransactionBatcher hook for handling multiple transactions efficiently.
    • Updated version of the @kleros/kleros-v2-subgraph package.
    • Improved the PassPeriodButton component's state management for reliability.
  • Bug Fixes

    • Enhanced logic for managing appeal fees and juror rewards.
  • Documentation

    • Updated README.md with direct links to the TransactionBatcher contract on Arbiscan.
  • Style

    • Improved UI styling for several components, including buttons and menus.
  • Tests

    • Added new tests for the TransactionBatcher functionalities and UI components.
  • Chores

    • Refactored existing code to enhance readability and maintainability.

Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for kleros-v2-university canceled.

Name Link
🔨 Latest commit ec0e43f
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/66b35c2d7c6b3d0008b9592d

Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for kleros-v2-testnet ready!

Name Link
🔨 Latest commit 5d9bf8e
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet/deploys/66b35d0f35b5610007ef9afa
😎 Deploy Preview https://deploy-preview-1668--kleros-v2-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 6, 2024

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

Name Link
🔨 Latest commit 5d9bf8e
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/66b35d0fe8a7230008d624ad

Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates introduce significant enhancements across various system components. Key additions include the TransactionBatcher smart contract for streamlined transaction management, enriched GraphQL queries for improved data retrieval, and new React components that enhance user interaction in dispute management. Collectively, these changes optimize operations, elevate user experience, and clarify interactions with the blockchain.

Changes

File(s) Change Summary
contracts/README.md Added entries for the TransactionBatcher contract with proxy links for mainnet and testnet.
contracts/deploy/00-transaction-batcher.ts Introduced deployment script for TransactionBatcher, managing network conditions and deployment utilities.
contracts/deployments/arbitrum/TransactionBatcher.json
contracts/deployments/arbitrumSepoliaDevnet/TransactionBatcher.json
Added deployment details and ABI for TransactionBatcher, including functions for batch sending Ether.
subgraph/core/schema.graphql Updated GraphQL schema for Round and ClassicRound to include new fields for juror management and fee distribution.
subgraph/core/src/DisputeKitClassic.ts Modified logic for handling appeal costs and fee management in disputes.
subgraph/core/src/KlerosCore.ts Enhanced handling of dispute rounds, including state tracking for jurors and reward distribution.
web/src/components/DottedMenuButton.tsx Introduced a new button component featuring a ripple effect for enhanced UI interaction.
web/src/hooks/queries/useClassicAppealQuery.ts
web/src/hooks/queries/useDisputeDetailsQuery.ts
web/src/hooks/queries/useDisputeMaintenanceQuery.ts
Extended GraphQL queries to include new fields for better data management related to disputes and appeals.
web/src/pages/Cases/CaseDetails/MaintenanceButtons/* Implemented multiple new components for managing dispute actions, including distributing rewards and managing periods.
web/src/utils/getLocalRounds.ts Refactored getLocalRounds function for enhanced type safety and flexibility using generics.
web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx Updated PassPeriodButton to improve state management with a fallback value for isDrawn.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant TransactionBatcher
    participant Blockchain

    User->>UI: Clicks to send batch transaction
    UI->>TransactionBatcher: Prepare transaction data
    TransactionBatcher->>Blockchain: Execute batch transaction
    Blockchain-->>TransactionBatcher: Transaction result
    TransactionBatcher-->>UI: Update UI based on result
    UI-->>User: Show success/failure message
Loading

🐇 In the land of code where the rabbits play,
New features hop in, brightening the day.
Batching transactions, oh what a delight,
User interfaces spark joy, shining bright!
With every click, a dance of success,
Hooray for the changes, we’re truly blessed! 🌼


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

Outside diff range, codebase verification and nitpick comments (41)
web/src/hooks/useTransactionBatcher.tsx (11)

1-2: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { useCallback } from "react";
- 

3-4: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { encodeFunctionData, type SimulateContractParameters } from "viem";
- 

5-6: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { isUndefined } from "src/utils";
- 

7-8: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { useSimulateTransactionBatcherBatchSend, useWriteTransactionBatcherBatchSend } from "./contracts/generated";
- 

9-10: Remove unnecessary blank line.

The blank line after the type declaration is unnecessary and can be removed for better readability.

export type TransactionBatcherConfig = SimulateContractParameters[];
- 

11-14: Consider adding a comment for the TransactionBatcherOptions type.

Adding a comment for the TransactionBatcherOptions type would improve readability and understanding.

type TransactionBatcherOptions = {
  // determines if simulation query is enabled
  enabled: boolean;
};

16-34: Remove unnecessary blank lines in the JSDoc comment.

The blank lines in the JSDoc comment are unnecessary and can be removed for better readability.

/**
 * @param configs SimulateContractParameters[] - an array of useWriteContract Parameters
 * @param options TransactionBatcherOptions - an object containing options to apply to hook behaviour
 * @description This takes in multiple write calls and batches them into a single transaction
 * @example useTransactionBatcher([
 *                 { address : "contract one address",
 *                   abi : "contract one abi",
 *                   functionName : "...",
 *                   args: [...]
 *                   value: 0
 *                 },
 *                 { address : "contract 2 address",
 *                   abi : "contract 2 abi",
 *                   functionName : "...",
 *                   args: [...]
 *                   value: 0
 *                 },
 *                ])
 */

35-38: Consider adding a comment for the useTransactionBatcher function.

Adding a comment for the useTransactionBatcher function would improve readability and understanding.

const useTransactionBatcher = (
  configs?: TransactionBatcherConfig,
  options: TransactionBatcherOptions = { enabled: true }
) => {

39-39: Consider renaming validatedConfigs to sanitizedConfigs.

The name validatedConfigs might be misleading as it suggests validation. sanitizedConfigs might be a better name.

  const validatedConfigs = configs ?? [];

61-62: Consider adding comments for the returned values.

Adding comments for the returned values would improve readability and understanding.

  return { executeBatch, batchConfig, isError, isLoading };
};

64-64: Remove unnecessary blank line.

The blank line before the export statement is unnecessary and can be removed for better readability.

- 
export default useTransactionBatcher;
web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/index.tsx (11)

1-3: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import React, { useState } from "react";
import styled from "styled-components";
- 

4-8: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import DottedMenuButton from "components/DottedMenuButton";
import { EnsureChain } from "components/EnsureChain";
import { Overlay } from "components/Overlay";
import { Phase } from "layout/Header/navbar/Debug";
- 

9-11: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import ExecuteDelayedStakeButton from "./ExecuteDelayedStakeButton";
import PassPhaseButton from "./PassPhaseButton";
- 

12-19: Remove unnecessary blank line.

The blank line after the styled component is unnecessary and can be removed for better readability.

const Container = styled.div`
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
`;

21-38: Remove unnecessary blank line.

The blank line after the styled component is unnecessary and can be removed for better readability.

const PopupContainer = styled.div`
  display: flex;
  flex-direction: column;
  position: absolute;
  height: fit-content;
  overflow-y: auto;
  z-index: 31;
  padding: 27px;
  gap: 16px;
  border: 1px solid ${({ theme }) => theme.stroke};
  background-color: ${({ theme }) => theme.whiteBackground};
  border-radius: 3px;
  box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.06);
  bottom: 0;
  left: 0;
  transform: translate(-100%, 100%);
`;

40-44: Remove unnecessary blank line.

The blank line after the styled component is unnecessary and can be removed for better readability.

const StyledDottedMenu = styled(DottedMenuButton)`
  .button-container {
    background-color: ${({ theme }) => theme.whiteBackground};
  }
`;

46-50: Consider adding comments for the Phases enum.

Adding comments for the Phases enum would improve readability and understanding.

export enum Phases {
  staking,
  generating,
  drawing,
}

52-54: Consider adding comments for the IBaseStakeMaintenanceButton interface.

Adding comments for the IBaseStakeMaintenanceButton interface would improve readability and understanding.

export interface IBaseStakeMaintenanceButton {
  setIsOpen: (open: boolean) => void;
}

56-58: Consider adding comments for the IStakeMaintenanceButtons interface.

Adding comments for the IStakeMaintenanceButtons interface would improve readability and understanding.

interface IStakeMaintenanceButtons {
  className?: string;
}

59-82: Consider adding comments for the StakeMaintenanceButtons component.

Adding comments for the StakeMaintenanceButtons component would improve readability and understanding.

const StakeMaintenanceButtons: React.FC<IStakeMaintenanceButtons> = ({ className }) => {
  const [isOpen, setIsOpen] = useState(false);
  const toggle = () => setIsOpen((prevValue) => !prevValue);
  return (
    <Container {...{ className }}>
      {isOpen ? (
        <>
          <Overlay onClick={() => setIsOpen(false)} />
          <PopupContainer>
            <EnsureChain>
              <>
                <Phase />
                <PassPhaseButton {...{ setIsOpen }} />
                <ExecuteDelayedStakeButton {...{ setIsOpen }} />
              </>
            </EnsureChain>
          </PopupContainer>
        </>
      ) : null}
      <StyledDottedMenu {...{ toggle }} displayRipple={false} />
    </Container>
  );
};

84-84: Remove unnecessary blank line.

The blank line before the export statement is unnecessary and can be removed for better readability.

- 
export default StakeMaintenanceButtons;
web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (10)

1-3: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import React, { useMemo, useState } from "react";
import styled from "styled-components";
- 

4-5: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { usePublicClient } from "wagmi";
- 

6-7: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { Button } from "@kleros/ui-components-library";
- 

8-9: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { useSimulateKlerosCoreDraw, useWriteKlerosCoreDraw } from "hooks/contracts/generated";
- 

10-11: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { wrapWithToast } from "utils/wrapWithToast";
- 

12-13: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import useDisputeMaintenanceQuery from "queries/useDisputeMaintenanceQuery";
- 

14-15: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { Period } from "src/graphql/graphql";
- 

16-17: Remove unnecessary blank line.

The blank line after the import statement is unnecessary and can be removed for better readability.

import { isUndefined } from "src/utils";
- 

18-20: Remove unnecessary blank line.

The blank line after the styled component is unnecessary and can be removed for better readability.

const StyledButton = styled(Button)`
  width: 100%;
`;

22-25: Consider adding comments for the IDrawButton interface.

Adding comments for the IDrawButton interface would improve readability and understanding.

22~
interface IDrawButton extends IBaseMaintenanceButton {
23~
  numberOfVotes?: string;
24~
  period?: string;

</blockquote></details>
<details>
<summary>web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx (1)</summary><blockquote>

`26-30`: **Consider renaming `isSending` to `isSubmitting` for clarity.**

The state variable `isSending` could be renamed to `isSubmitting` to better reflect its purpose.

```diff
-  const [isSending, setIsSending] = useState(false);
+  const [isSubmitting, setIsSubmitting] = useState(false);
web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/ExecuteDelayedStakeButton.tsx (1)

27-29: Consider renaming isSending to isSubmitting for clarity.

The state variable isSending could be renamed to isSubmitting to better reflect its purpose.

-  const [isSending, setIsSending] = useState(false);
+  const [isSubmitting, setIsSubmitting] = useState(false);
subgraph/core/src/entities/ClassicRound.ts (1)

19-20: LGTM! Consider adding comments to document the new properties.

The new properties appealFeesDispersed and totalFeeDispersed enhance the functionality of the classicRound object. Consider adding comments to document these properties.

+  // Indicates whether appeal fees have been dispersed
+  classicRound.appealFeesDispersed = false;
+  // Total amount of fees that have been dispersed
+  classicRound.totalFeeDispersed = ZERO;
web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/PassPhaseButton.tsx (1)

1-2: Organize imports for better readability.

Consider grouping related imports together for better readability and maintainability.

import React, { useMemo, useState } from "react";
import styled from "styled-components";

import { usePublicClient } from "wagmi";

import { Button } from "@kleros/ui-components-library";

import {
  useReadSortitionModuleDisputesWithoutJurors,
  useReadSortitionModuleLastPhaseChange,
  useReadSortitionModuleMaxDrawingTime,
  useReadSortitionModuleMinStakingTime,
  useSimulateSortitionModulePassPhase,
  useWriteSortitionModulePassPhase,
} from "hooks/contracts/generated";
import { useSortitionModulePhase } from "hooks/useSortitionModulePhase";
import { wrapWithToast } from "utils/wrapWithToast";
import { isUndefined } from "src/utils";

import { IBaseStakeMaintenanceButton, Phases } from ".";
web/src/pages/Cases/CaseDetails/MaintenanceButtons/DistributeRewards.tsx (1)

1-2: Organize imports for better readability.

Consider grouping related imports together for better readability and maintainability.

import React, { useEffect, useMemo, useState } from "react";
import styled from "styled-components";

import { useAccount, usePublicClient } from "wagmi";

import { Button } from "@kleros/ui-components-library";

import { DEFAULT_CHAIN } from "consts/chains";
import { klerosCoreAbi, klerosCoreAddress } from "hooks/contracts/generated";
import useTransactionBatcher, { type TransactionBatcherConfig } from "hooks/useTransactionBatcher";
import { wrapWithToast } from "utils/wrapWithToast";

import useDisputeMaintenanceQuery from "queries/useDisputeMaintenanceQuery";

import { Period } from "src/graphql/graphql";
import { isUndefined } from "src/utils";

import { IBaseMaintenanceButton } from ".";
web/src/pages/Courts/CourtDetails/StakePanel/index.tsx (1)

14-15: Organize imports for better readability.

Consider grouping related imports together for better readability and maintainability.

import React, { useState } from "react";
import styled, { css } from "styled-components";

import BalanceIcon from "svgs/icons/balance.svg";
import ThreePnksIcon from "svgs/styled/three-pnks.svg";

import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";

import { landscapeStyle } from "styles/landscapeStyle";

import Popup, { PopupType } from "components/Popup/index";
import Tag from "components/Tag";

import StakeMaintenanceButtons from "../StakeMaintenanceButton";

import InputDisplay from "./InputDisplay";
import JurorBalanceDisplay from "./JurorStakeDisplay";
import { ActionType } from "./StakeWithdrawButton";
web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx (2)

1-2: Unused import: styled-components

The styled-components library is imported but not used in the file. Consider removing it if not needed.

- import styled from "styled-components";

22-24: Ensure consistent styling

The StyledButton component is defined but not used. Ensure that it is used or remove the definition if not needed.

- const StyledButton = styled(Button)`
-   width: 100%;
- `;
web/src/pages/Cases/CaseDetails/MaintenanceButtons/index.tsx (1)

1-2: Unused import: styled-components

The styled-components library is imported but not used in the file. Consider removing it if not needed.

- import styled from "styled-components";
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4066228 and 58cc149.

Files ignored due to path filters (1)
  • web/src/assets/svgs/icons/dotted-menu.svg is excluded by !**/*.svg
Files selected for processing (29)
  • contracts/README.md (2 hunks)
  • contracts/deploy/00-transaction-batcher.ts (1 hunks)
  • contracts/deployments/arbitrum/TransactionBatcher.json (1 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/TransactionBatcher.json (1 hunks)
  • contracts/src/utils/TransactionBatcher.sol (1 hunks)
  • subgraph/core/schema.graphql (2 hunks)
  • subgraph/core/src/DisputeKitClassic.ts (2 hunks)
  • subgraph/core/src/KlerosCore.ts (3 hunks)
  • subgraph/core/src/entities/ClassicRound.ts (1 hunks)
  • subgraph/core/src/entities/Round.ts (1 hunks)
  • web/src/components/DottedMenuButton.tsx (1 hunks)
  • web/src/hooks/queries/useClassicAppealQuery.ts (1 hunks)
  • web/src/hooks/queries/useDisputeDetailsQuery.ts (1 hunks)
  • web/src/hooks/queries/useDisputeMaintenanceQuery.ts (1 hunks)
  • web/src/hooks/useTransactionBatcher.tsx (1 hunks)
  • web/src/layout/Header/navbar/Debug.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/DistributeRewards.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/ExecuteRuling.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/MenuButton.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/index.tsx (1 hunks)
  • web/src/pages/Cases/CaseDetails/index.tsx (3 hunks)
  • web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/ExecuteDelayedStakeButton.tsx (1 hunks)
  • web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/PassPhaseButton.tsx (1 hunks)
  • web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/index.tsx (1 hunks)
  • web/src/pages/Courts/CourtDetails/StakePanel/index.tsx (3 hunks)
  • web/src/utils/getLocalRounds.ts (1 hunks)
Additional comments not posted (75)
web/src/utils/getLocalRounds.ts (3)

1-2: LGTM! The new generic interface enhances flexibility.

The DisputeKitDispute<T> interface is well-defined and allows for different types of localRounds.


5-8: LGTM! The JSDoc comment improves documentation.

The added JSDoc comment clarifies the function's parameters and return value, enhancing its usability.


9-11: LGTM! The function signature change improves type safety and flexibility.

The updated getLocalRounds function uses the new generic interface and flatMap to simplify the logic.

contracts/src/utils/TransactionBatcher.sol (3)

1-5: LGTM! The SPDX license identifier and pragma directive are correctly included.

The comment about the adaptation source provides useful context.


6-12: LGTM! The batchSend function is correctly implemented.

The function iterates over the targets and performs the calls, reverting if any call fails.


14-22: LGTM! The batchSendUnchecked function is correctly implemented.

The function iterates over the targets and performs the calls, intentionally ignoring the return value.

contracts/deploy/00-transaction-batcher.ts (3)

1-4: LGTM! The import statements are correctly included.

The import statements are necessary for the deployment script.


5-19: LGTM! The deployArbitration function is correctly implemented.

The function retrieves the deployer address and chain ID, logs the deployment information, and deploys the TransactionBatcher contract.


21-26: LGTM! The tags and skip function are correctly implemented.

The tags and skip function are necessary for the deployment script.

web/src/hooks/queries/useDisputeDetailsQuery.ts (1)

30-30: LGTM! But verify the usage of nbVotes in the codebase.

The addition of the nbVotes field in the GraphQL query is correct.

Ensure that all usages of the nbVotes field are correctly handled in the codebase.

Verification successful

The usage of nbVotes is correctly handled in the codebase.

The nbVotes field is used appropriately in various contexts, including logical conditions, assignments, and function arguments.

  • subgraph/core/src/KlerosCore.ts
  • subgraph/core/src/entities/Round.ts
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/index.tsx
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/DistributeRewards.tsx
  • web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx
  • web/src/hooks/queries/useVotingHistory.ts
  • web/src/hooks/queries/useDisputeMaintenanceQuery.ts
  • web/src/hooks/queries/useDisputeDetailsQuery.ts
  • contracts/deployments/devnet.viem.ts
  • contracts/deployments/arbitrumSepoliaDevnet.ts
  • contracts/deployments/testnet.viem.ts
  • contracts/scripts/keeperBot.ts
  • contracts/deployments/arbitrumSepolia.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of the `nbVotes` field in the codebase.

# Test: Search for the `nbVotes` field usage. Expect: Correct handling of the field.
rg --type javascript --type typescript -A 5 $'nbVotes'

Length of output: 88


Script:

#!/bin/bash
# Description: Verify all usages of the `nbVotes` field in the codebase.

# Test: Search for the `nbVotes` field usage. Expect: Correct handling of the field.
rg --type ts --type js -A 5 'nbVotes'

Length of output: 12136

web/src/hooks/queries/useDisputeMaintenanceQuery.ts (3)

1-8: Imports look good.

The imports are necessary and correctly used in the file.


9-34: GraphQL query definition looks good.

The query is correctly defined to fetch dispute maintenance details.


36-52: React hook definition looks good.

The hook is correctly defined to fetch dispute maintenance details.

web/src/hooks/queries/useClassicAppealQuery.ts (1)

30-31: LGTM! But verify the usage of appealFeesDispersed and totalFeeDispersed in the codebase.

The addition of the appealFeesDispersed and totalFeeDispersed fields in the GraphQL query is correct.

Ensure that all usages of the appealFeesDispersed and totalFeeDispersed fields are correctly handled in the codebase.

Verification successful

The initial attempt to verify the usage of appealFeesDispersed and totalFeeDispersed fields failed due to an unrecognized file type error with rg. We need to correct the file type and re-run the search to ensure that these fields are correctly handled in the codebase.

Let's use --type ts and --type tsx for TypeScript and TypeScript React files, respectively.


The previous attempt to verify the usage of appealFeesDispersed and totalFeeDispersed failed due to an unrecognized file type error with tsx. We need to correct the file type and re-run the search to ensure that these fields are correctly handled in the codebase.

Let's use --type typescript for TypeScript files, which should cover both .ts and .tsx files.


The previous attempts to verify the usage of appealFeesDispersed and totalFeeDispersed failed due to unrecognized file type errors. It seems rg does not recognize typescript or tsx as valid file types.

To avoid further issues, let's use rg with file extensions directly.


The previous attempts to verify the usage of appealFeesDispersed and totalFeeDispersed failed due to unrecognized file type errors. To avoid further issues, let's use rg with file extensions directly by specifying *.ts and *.tsx file extensions.


LGTM! The appealFeesDispersed and totalFeeDispersed fields are correctly utilized in the codebase.

The fields appealFeesDispersed and totalFeeDispersed are used in the following files:

  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx
  • web/src/hooks/queries/useClassicAppealQuery.ts
  • subgraph/core/src/DisputeKitClassic.ts
  • subgraph/core/src/entities/ClassicRound.ts

These usages confirm that the fields are integrated and handled in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of the `appealFeesDispersed` and `totalFeeDispersed` fields in the codebase.

# Test: Search for the `appealFeesDispersed` and `totalFeeDispersed` fields usage. Expect: Correct handling of the fields.
rg --type javascript --type typescript -A 5 $'appealFeesDispersed|totalFeeDispersed'

Length of output: 120


Script:

#!/bin/bash
# Description: Verify all usages of the `appealFeesDispersed` and `totalFeeDispersed` fields in the codebase.

# Test: Search for the `appealFeesDispersed` and `totalFeeDispersed` fields usage. Expect: Correct handling of the fields.
rg --type ts --type tsx -A 5 'appealFeesDispersed|totalFeeDispersed'

Length of output: 98


Script:

#!/bin/bash
# Description: Verify all usages of the `appealFeesDispersed` and `totalFeeDispersed` fields in the codebase.

# Test: Search for the `appealFeesDispersed` and `totalFeeDispersed` fields usage. Expect: Correct handling of the fields.
rg --type typescript -A 5 'appealFeesDispersed|totalFeeDispersed'

Length of output: 102


Script:

#!/bin/bash
# Description: Verify all usages of the `appealFeesDispersed` and `totalFeeDispersed` fields in the codebase.

# Test: Search for the `appealFeesDispersed` and `totalFeeDispersed` fields usage. Expect: Correct handling of the fields.
rg -t ts -t tsx -A 5 'appealFeesDispersed|totalFeeDispersed'

Length of output: 90


Script:

#!/bin/bash
# Description: Verify all usages of the `appealFeesDispersed` and `totalFeeDispersed` fields in the codebase.

# Test: Search for the `appealFeesDispersed` and `totalFeeDispersed` fields usage. Expect: Correct handling of the fields.
rg -g '*.ts' -g '*.tsx' -A 5 'appealFeesDispersed|totalFeeDispersed'

Length of output: 2261

web/src/layout/Header/navbar/Debug.tsx (1)

Line range hint 60-64:
LGTM! Exporting the Phase component enhances modularity.

The code changes are approved.

web/src/pages/Cases/CaseDetails/MaintenanceButtons/ExecuteRuling.tsx (1)

1-58: LGTM! The ExecuteRulingButton component is well-structured.

The code changes are approved.

Ensure the correctness of the contract interactions by verifying the hooks and utilities used.

web/src/pages/Cases/CaseDetails/MaintenanceButtons/MenuButton.tsx (1)

1-85: LGTM! The MenuButton component is well-structured and the styling is handled appropriately.

The code changes are approved.

web/src/components/DottedMenuButton.tsx (6)

1-20: LGTM!

The imports and keyframes animation are well-defined.


22-39: LGTM!

The ring function is well-defined and uses styled-components' css helper effectively.


41-57: LGTM!

The Container styled-component is well-defined and conditionally applies the ripple effect based on the displayRipple prop.


59-70: LGTM!

The ButtonContainer and StyledDottedMenu styled-components are well-defined and use theme properties for styling.


72-76: LGTM!

The IMenuButton interface is well-defined and includes an optional className prop.


78-88: LGTM!

The DottedMenuButton component is well-defined and uses the styled-components effectively. It passes the props correctly and handles the toggle function on click.

subgraph/core/src/entities/Round.ts (1)

27-28: LGTM! But verify the usage of the new properties.

The changes are approved. The new properties enhance the state management of the Round object.

However, ensure that the new properties jurorsDrawn and jurorRewardsDispersed are used correctly in the codebase.

Verification successful

Let's review the usage of jurorsDrawn and jurorRewardsDispersed in subgraph/core/src/KlerosCore.ts to ensure they are implemented correctly.


The new properties jurorsDrawn and jurorRewardsDispersed are used correctly in the codebase.

The properties are appropriately integrated and updated based on specific conditions in the core logic, ensuring accurate state management of the Round object.

  • handleDrawJurors function updates jurorsDrawn when the number of votes equals the number of drawn jurors.
  • handleTokenAndETHShift function updates jurorRewardsDispersed when the number of repartitions is greater than or equal to the number of votes.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new properties `jurorsDrawn` and `jurorRewardsDispersed`.

# Test: Search for the usage of the new properties. Expect: Occurrences of the new properties in the codebase.
rg --type ts 'jurorsDrawn|jurorRewardsDispersed'

Length of output: 994


Script:

#!/bin/bash
# Description: Review the usage of `jurorsDrawn` and `jurorRewardsDispersed` in KlerosCore.ts.

# Extract lines around the usage of `jurorsDrawn` and `jurorRewardsDispersed` for context.
rg --type ts -A 10 -B 10 'jurorsDrawn|jurorRewardsDispersed' subgraph/core/src/KlerosCore.ts

Length of output: 1379

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

Line range hint 17-40:
LGTM!

The imports and styled-components are well-defined and use theme properties for styling.


53-56: LGTM!

The changes enhance the layout by wrapping the Header and MaintenanceButtons within a HeaderContainer, improving the overall alignment and presentation of the header section.

web/src/hooks/useTransactionBatcher.tsx (2)

40-53: Ensure proper error handling for useSimulateTransactionBatcherBatchSend hook.

Ensure that the errors from the useSimulateTransactionBatcherBatchSend hook are properly handled.

  const {
    data: batchConfig,
    isLoading,
    isError,
  } = useSimulateTransactionBatcherBatchSend({
    query: {
      enabled: !isUndefined(configs) && options.enabled,
    },
    args: [
      validatedConfigs.map((config) => config?.address),
      validatedConfigs.map((config) => config?.value ?? BigInt(0)),
      validatedConfigs.map((config) => encodeFunctionData(config)),
    ],
  });

54-59: Ensure proper error handling for useWriteTransactionBatcherBatchSend hook.

Ensure that the errors from the useWriteTransactionBatcherBatchSend hook are properly handled.

  const { writeContractAsync } = useWriteTransactionBatcherBatchSend();
  const executeBatch = useCallback(
    (config: NonNullable<typeof batchConfig>) => writeContractAsync(config?.request),
    [writeContractAsync]
  );
web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx (4)

1-16: LGTM!

The import statements are appropriate and necessary for the functionality provided in the component.


33-46: Ensure proper error handling for useSimulateKlerosCorePassPeriod.

The hook useSimulateKlerosCorePassPeriod should have proper error handling to manage potential errors gracefully.

-  const {
-    data: passPeriodConfig,
-    isLoading: isLoadingConfig,
-    isError,
-  } = useSimulateKlerosCorePassPeriod({
-    query: {
-      enabled:
-        !isUndefined(id) &&
-        !isUndefined(period) &&
-        period !== Period.Execution &&
-        !(period === Period.Evidence && !isDrawn),
-    },
-    args: [BigInt(id ?? 0)],
-  });
+  const { data: passPeriodConfig, isLoading: isLoadingConfig, isError } = useSimulateKlerosCorePassPeriod({
+    query: {
+      enabled:
+        !isUndefined(id) &&
+        !isUndefined(period) &&
+        period !== Period.Execution &&
+        !(period === Period.Evidence && !isDrawn),
+    },
+    args: [BigInt(id ?? 0)],
+    onError: (error) => {
+      console.error("Error simulating pass period:", error);
+    },
+  });

50-59: LGTM!

The memoized values for isLoading and isDisabled are well-implemented.


60-69: Ensure proper error handling in handleClick.

The handleClick function should have proper error handling to manage potential errors gracefully.

-  const handleClick = () => {
-    if (!passPeriodConfig || !publicClient) return;
-    setIsSending(true);
-    wrapWithToast(async () => await passPeriod(passPeriodConfig.request), publicClient).finally(() => {
-      setIsSending(false);
-      setIsOpen(false);
-    });
-  };
+  const handleClick = async () => {
+    if (!passPeriodConfig || !publicClient) return;
+    setIsSending(true);
+    try {
+      await wrapWithToast(async () => await passPeriod(passPeriodConfig.request), publicClient);
+    } catch (error) {
+      console.error("Error passing period:", error);
+    } finally {
+      setIsSending(false);
+      setIsOpen(false);
+    }
+  };
web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/ExecuteDelayedStakeButton.tsx (5)

1-19: LGTM!

The import statements are appropriate and necessary for the functionality provided in the component.


39-47: Ensure proper error handling for useSimulateSortitionModuleExecuteDelayedStakes.

The hook useSimulateSortitionModuleExecuteDelayedStakes should have proper error handling to manage potential errors gracefully.

-  const {
-    data: executeDelayedStakeConfig,
-    isLoading: isLoadingConfig,
-    isError,
-  } = useSimulateSortitionModuleExecuteDelayedStakes({
-    query: {
-      enabled: canExecute,
-    },
-    args: [1n + (delayedStakeWriteIndex ?? 0n) - (delayedStakeReadIndex ?? 0n)],
-  });
+  const { data: executeDelayedStakeConfig, isLoading: isLoadingConfig, isError } = useSimulateSortitionModuleExecuteDelayedStakes({
+    query: {
+      enabled: canExecute,
+    },
+    args: [1n + (delayedStakeWriteIndex ?? 0n) - (delayedStakeReadIndex ?? 0n)],
+    onError: (error) => {
+      console.error("Error simulating execute delayed stakes:", error);
+    },
+  });

52-53: LGTM!

The memoized values for isLoading and isDisabled are well-implemented.


54-64: Ensure proper error handling in handleClick.

The handleClick function should have proper error handling to manage potential errors gracefully.

-  const handleClick = () => {
-    if (!executeDelayedStakeConfig || !publicClient || !executeDelayedStake) return;
-    setIsSending(true);
-    wrapWithToast(async () => await executeDelayedStake(executeDelayedStakeConfig.request), publicClient).finally(
-      () => {
-        setIsSending(false);
-        setIsOpen(false);
-      }
-    );
-  };
+  const handleClick = async () => {
+    if (!executeDelayedStakeConfig || !publicClient || !executeDelayedStake) return;
+    setIsSending(true);
+    try {
+      await wrapWithToast(async () => await executeDelayedStake(executeDelayedStakeConfig.request), publicClient);
+    } catch (error) {
+      console.error("Error executing delayed stakes:", error);
+    } finally {
+      setIsSending(false);
+      setIsOpen(false);
+    }
+  };

34-37: Consider adding a null check for phase, delayedStakeReadIndex, and delayedStakeWriteIndex.

To avoid potential runtime errors, add a null check for phase, delayedStakeReadIndex, and delayedStakeWriteIndex.

-  const canExecute = useMemo(() => {
-    if (isUndefined(phase) || isUndefined(delayedStakeReadIndex) || isUndefined(delayedStakeWriteIndex)) return false;
-    return phase === Phases.staking && delayedStakeWriteIndex >= delayedStakeReadIndex;
-  }, [phase, delayedStakeReadIndex, delayedStakeWriteIndex]);
+  const canExecute = useMemo(() => {
+    if (isUndefined(phase) || isUndefined(delayedStakeReadIndex) || isUndefined(delayedStakeWriteIndex)) return false;
+    return phase === Phases.staking && (delayedStakeWriteIndex ?? 0n) >= (delayedStakeReadIndex ?? 0n);
+  }, [phase, delayedStakeReadIndex, delayedStakeWriteIndex]);

Likely invalid or redundant comment.

subgraph/core/src/entities/ClassicRound.ts (2)

Line range hint 25-54:
LGTM!

The updateCountsAndGetCurrentRuling function is well-implemented.


Line range hint 56-75:
LGTM!

The updateChoiceFundingFromContributionEvent function is well-implemented.

web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/PassPhaseButton.tsx (1)

38-57: Ensure all dependencies are included in the useMemo hook.

The useMemo hook should include all dependencies to avoid potential stale values.

-  }, [phase, lastPhaseChange, minStakingTime, maxDrawingTime, disputeWithoutJurors]);
+  }, [phase, lastPhaseChange, minStakingTime, maxDrawingTime, disputeWithoutJurors, isUndefined]);

Likely invalid or redundant comment.

web/src/pages/Courts/CourtDetails/StakePanel/index.tsx (2)

78-82: Ensure proper styling for StyledStakeMtnceButtons.

Ensure that the StyledStakeMtnceButtons component is styled correctly and does not overlap with other elements.

const StyledStakeMtnceButtons = styled(StakeMaintenanceButtons)`
  position: absolute;
  right: 0;
  top: -4px;
  z-index: 1;  // Ensure the button appears above other elements
`;

101-101: Ensure proper integration of StyledStakeMtnceButtons.

Verify that the StyledStakeMtnceButtons component is integrated correctly and does not interfere with other elements in the StakePanel.

<Container>
  <StyledStakeMtnceButtons />
  <LeftArea>
    <TagArea>
      <Tag text="Stake" active={isActive} onClick={() => handleClick(ActionType.stake)} />
      <Tag text="Withdraw" active={!isActive} onClick={() => handleClick(ActionType.withdraw)} />
    </TagArea>
    <TextArea>
      <strong>{`${isStaking ? "Stake" : "Withdraw"} PNK`}</strong> {`${isStaking ? "to join the" : "from"}`}{" "}
      {courtName} court
    </TextArea>
    <StakeArea>
      <InputDisplay {...{ action, isSending, setIsSending, setIsPopupOpen, amount, setAmount }} />
      <JurorBalanceDisplay />
    </StakeArea>
    {isPopupOpen && (
      <Popup
        title={isStaking ? "Stake Confirmed" : "Withdraw Confirmed"}
        icon={BalanceIcon}
        popupType={PopupType.STAKE_WITHDRAW}
        isStake={isStaking}
        pnkStaked={amount}
        courtName={courtName}
        courtId={id}
        setIsOpen={setIsPopupOpen}
        setAmount={setAmount}
      />
    )}
  </LeftArea>
  <ThreePnksIconContainer>
    <ThreePnksIcon />
  </ThreePnksIconContainer>
</Container>
web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx (6)

26-30: Prop types and usage are correct

The props are correctly typed and used within the component.


33-34: State variables are correctly initialized

The state variables isSending and contractConfigs are correctly initialized.


58-79: Ensure proper handling of dependencies in useEffect

The useEffect hook is correctly implemented with proper dependencies. Ensure that the filteredContributions and other dependencies are correctly updated.


41-56: Memoized values are correctly implemented

The useMemo hooks for localRounds, feeDispersed, and filteredContributions are correctly implemented with proper dependencies.


81-104: Ensure proper error handling in main logic

The main logic is correctly implemented, but ensure proper error handling in the handleClick function. Consider adding error handling for the executeBatch function.


105-106: Ensure proper button styling

The return statement is correctly implemented, but ensure the StyledButton component is used if defined.

web/src/pages/Cases/CaseDetails/MaintenanceButtons/index.tsx (7)

21-27: Ensure consistent styling

The Container styled component is defined and used for the main container. Ensure consistent styling throughout the component.


30-47: Ensure consistent styling

The PopupContainer styled component is defined and used for the popup container. Ensure consistent styling throughout the component.


49-52: Prop types and usage are correct

The IBaseMaintenanceButton interface is correctly defined and used in child components.


54-57: State variables are correctly initialized

The state variables isOpen and displayRipple are correctly initialized.


64-97: Ensure proper handling of dependencies in useEffect

The useEffect hook is correctly implemented with proper dependencies. Ensure that the dispute data and other dependencies are correctly updated.


99-132: Ensure proper error handling in main logic

The main logic is correctly implemented, but ensure proper error handling when fetching dispute data.


101-132: Ensure proper rendering of child components

The return statement is correctly implemented, but ensure all child components are properly rendered and props are correctly passed.

subgraph/core/src/DisputeKitClassic.ts (2)

111-115: Ensure correct computation of appeal cost

The new logic correctly fetches the number of rounds and round information to compute the appeal cost. Ensure proper error handling when fetching data from the blockchain.


136-148: Ensure correct handling of reward withdrawals

The new logic correctly handles the withdrawal of rewards and updates the state. Ensure proper error handling when updating the state.

subgraph/core/schema.graphql (4)

195-195: Addition of jurorsDrawn field looks good.

This field will help in tracking whether jurors have been drawn for a round.


196-196: Addition of jurorRewardsDispersed field looks good.

This field will help in tracking whether juror rewards have been dispersed for a round.


269-269: Addition of totalFeeDispersed field looks good.

This field will help in tracking the total fees that have been dispersed for a classic round.


270-270: Addition of appealFeesDispersed field looks good.

This field will help in tracking whether appeal fees have been dispersed for a classic round.

subgraph/core/src/KlerosCore.ts (3)

27-27: Import statement update looks good.

The addition of the Round entity is necessary for the new logic related to rounds.


188-198: Changes in handleDraw function look good.

The new logic accurately tracks the state of the current round by checking the number of votes against the number of drawn jurors.


213-227: Changes in handleTokenAndETHShift function look good.

The new logic accurately tracks the state of the current round by checking the repartitions against the number of votes.

contracts/deployments/arbitrum/TransactionBatcher.json (1)

1-87: New file addition looks good.

The file contains the necessary deployment information for the TransactionBatcher contract, including the contract address, ABI, transaction hash, and other metadata.

contracts/deployments/arbitrumSepoliaDevnet/TransactionBatcher.json (7)

3-49: LGTM! ABI structure is correct.

The ABI structure for the batchSend and batchSendUnchecked functions appears to be correct.


52-66: LGTM! Transaction receipt details are correct.

The transaction receipt details appear to be correct.


70-70: LGTM! Deployment details are correct.

The deployment details appear to be correct.


73-86: LGTM! Documentation details are correct.

The documentation details appear to be correct.


51-51: Verify the transaction hash format.

Ensure that the transaction hash is correct and follows the Ethereum transaction hash format.

Verification successful

Verified the transaction hash format.

The transaction hash "0x3c4a6f233fda3dc940b9aba1e04ee5993b515e4834b73365c4cd613718db46b2" is valid and follows the Ethereum transaction hash format.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the transaction hash format.

# Test: Check if the transaction hash is a valid Ethereum transaction hash.
tx_hash="0x3c4a6f233fda3dc940b9aba1e04ee5993b515e4834b73365c4cd613718db46b2"
if [[ $tx_hash =~ ^0x[a-fA-F0-9]{64}$ ]]; then echo "Valid transaction hash"; else echo "Invalid transaction hash"; fi

Length of output: 229


69-69: Verify the solc input hash format.

Ensure that the solc input hash is correct and follows the expected format.

Verification successful

The solc input hash format is valid.

The solc input hash "036e2ca71d8ebdd78fd6317e15ba1f3c" follows the expected format and is correct.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the solc input hash format.

# Test: Check if the solc input hash is a valid hash.
solc_input_hash="036e2ca71d8ebdd78fd6317e15ba1f3c"
if [[ $solc_input_hash =~ ^[a-fA-F0-9]{32}$ ]]; then echo "Valid solc input hash"; else echo "Invalid solc input hash"; fi

Length of output: 165


2-2: Verify the contract address format.

Ensure that the contract address is correct and follows the Ethereum address format.

Verification successful

Verify the contract address usage.

The contract address "0x35f93986950804ac1F93519BF68C2a7Dd776db0E" is valid. Now, let's verify if this address is correctly referenced elsewhere in the codebase.


The contract address format and its usage are correct.

The contract address "0x35f93986950804ac1F93519BF68C2a7Dd776db0E" is valid and consistently referenced in the codebase.

  • contracts/README.md
  • contracts/deployments/arbitrumSepoliaDevnet/TransactionBatcher.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the contract address format.

# Test: Check if the address is a valid Ethereum address.
address="0x35f93986950804ac1F93519BF68C2a7Dd776db0E"
if [[ $address =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Valid address"; else echo "Invalid address"; fi

Length of output: 163


Script:

#!/bin/bash
# Search for the contract address in the codebase to ensure it is correctly referenced.
rg "0x35f93986950804ac1F93519BF68C2a7Dd776db0E"

Length of output: 434

contracts/README.md (3)

Line range hint 1-22:
LGTM! The rest of the README file is correct and complete.

The rest of the README file appears to be correct and complete.

Also applies to: 24-91, 93-290


92-92: Verify the Arbiscan link format.

Ensure that the Arbiscan link is correct and follows the expected format.

Verification successful

The Arbiscan link format is correct.

The provided link follows the expected format for an Arbiscan address on the Sepolia network.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Arbiscan link format.

# Test: Check if the link is a valid Arbiscan link.
link="https://sepolia.arbiscan.io/address/0x35f93986950804ac1F93519BF68C2a7Dd776db0E"
if [[ $link =~ ^https://sepolia\.arbiscan\.io/address/0x[a-fA-F0-9]{40}$ ]]; then echo "Valid link"; else echo "Invalid link"; fi

Length of output: 264


23-23: Verify the Arbiscan link format.

Ensure that the Arbiscan link is correct and follows the expected format.

Verification successful

The Arbiscan link format is valid.

The link provided for the TransactionBatcher contract on Arbiscan is correct and follows the expected format.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Arbiscan link format.

# Test: Check if the link is a valid Arbiscan link.
link="https://arbiscan.io/address/0xBC5ef8d9ad307154447AE148c088f083d2dEa4eF"
if [[ $link =~ ^https://arbiscan\.io/address/0x[a-fA-F0-9]{40}$ ]]; then echo "Valid link"; else echo "Invalid link"; fi

Length of output: 239

@jaybuidl jaybuidl linked an issue Aug 6, 2024 that may be closed by this pull request
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 58cc149 and 46b7260.

Files selected for processing (1)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/WithdrawAppealFees.tsx

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 46b7260 and 0b4f7da.

Files selected for processing (1)
  • subgraph/package.json (1 hunks)
Files skipped from review due to trivial changes (1)
  • subgraph/package.json

Copy link

codeclimate bot commented Aug 7, 2024

Code Climate has analyzed commit 5d9bf8e and detected 11 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2
Duplication 7
Style 2

View more on Code Climate.

Copy link

sonarqubecloud bot commented Aug 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
17.7% Duplication on New Code (required ≤ 10%)

See analysis details on SonarCloud

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

Outside diff range, codebase verification and nitpick comments (1)
web/src/components/Phase.tsx (1)

14-14: Styled component is correctly defined but lacks styles.

The StyledLabel component is defined but currently has no styles. Ensure to add styles if needed.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0b4f7da and ec0e43f.

Files selected for processing (6)
  • web/src/components/Phase.tsx (1 hunks)
  • web/src/layout/Header/navbar/Debug.tsx (3 hunks)
  • web/src/pages/Courts/StakeMaintenanceButton/ExecuteDelayedStakeButton.tsx (1 hunks)
  • web/src/pages/Courts/StakeMaintenanceButton/PassPhaseButton.tsx (1 hunks)
  • web/src/pages/Courts/StakeMaintenanceButton/index.tsx (1 hunks)
  • web/src/pages/Courts/TopSearch.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/src/layout/Header/navbar/Debug.tsx
Additional context used
Learnings (1)
web/src/pages/Courts/StakeMaintenanceButton/PassPhaseButton.tsx (1)
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#1668
File: web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/PassPhaseButton.tsx:73-82
Timestamp: 2024-08-07T10:11:08.757Z
Learning: The `wrapWithToast` function in `web/src/utils/wrapWithToast.ts` includes error handling, so additional error handling in calling functions is not necessary.
Additional comments not posted (22)
web/src/components/Phase.tsx (4)

1-7: Imports look good.

The imported modules are necessary for the component's functionality.


8-12: Enum declaration is correct.

The Phases enum is well-defined and correctly represents the different phases.


16-19: Component definition looks good.

The Phase component is well-structured and correctly uses the custom hook and utility function.


21-21: Export statement is correct.

The Phase component is correctly exported as the default export.

web/src/pages/Courts/TopSearch.tsx (4)

Line range hint 2-16:
Imports look good.

The imported modules are necessary for the component's functionality.


18-30: Styled components are well-defined.

The Container and StyledDropdownCascader components are well-defined and enhance the layout and styling of the UI elements.


31-48: Component definition looks good.

The TopSearch component is well-structured, and the modifications improve the visual structure and responsiveness of the component.


50-50: Export statement is correct.

The TopSearch component is correctly exported as the default export.

web/src/pages/Courts/StakeMaintenanceButton/index.tsx (5)

1-11: Imports look good.

The imported modules are necessary for the component's functionality.


12-38: Styled components are well-defined.

The Container and PopupContainer components are well-defined and enhance the layout and styling of the UI elements.


40-46: Interfaces are well-defined.

The IBaseStakeMaintenanceButton and IStakeMaintenanceButtons interfaces are correctly defined and provide type safety for the component props.


47-69: Component definition looks good.

The StakeMaintenanceButtons component is well-structured and correctly uses state and conditional rendering.


72-72: Export statement is correct.

The StakeMaintenanceButtons component is correctly exported as the default export.

web/src/pages/Courts/StakeMaintenanceButton/ExecuteDelayedStakeButton.tsx (4)

1-22: LGTM!

The import statements are appropriate and relevant for the functionality of the component.


23-25: LGTM!

The styled button component is simple and sets the width to 100%.


27-27: LGTM!

The type definition for IExecuteStakeDelayedButton is appropriate.


79-79: LGTM!

The default export of the ExecuteDelayedStakeButton component is appropriate.

web/src/pages/Courts/StakeMaintenanceButton/PassPhaseButton.tsx (5)

1-23: LGTM!

The import statements are appropriate and relevant for the functionality of the component.


25-27: LGTM!

The styled button component is simple and sets the width to 100%.


29-29: LGTM!

The type definition for IPassPhaseButton is appropriate.


31-85: LGTM!

The PassPhaseButton component is well-structured and follows best practices.


88-88: LGTM!

The default export of the PassPhaseButton component is appropriate.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ec0e43f and 5d9bf8e.

Files selected for processing (1)
  • web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx (1 hunks)
Additional comments not posted (1)
web/src/pages/Cases/CaseDetails/MaintenanceButtons/PassPeriodButton.tsx (1)

31-31: Approved: Improved robustness with nullish coalescing operator.

The use of the nullish coalescing operator (??) ensures that isDrawn is always a boolean, preventing potential errors from undefined values.

@jaybuidl jaybuidl changed the title Feat/arbitrator dev buttons Maintenance buttons at arbitrator-level Aug 7, 2024
@jaybuidl jaybuidl merged commit ef60216 into dev Aug 7, 2024
17 of 24 checks passed
@jaybuidl jaybuidl deleted the feat/arbitrator-dev-buttons branch August 7, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: add buttons for arbitrator-level maintenance
2 participants